Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3281712
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:50:46+00:00 2026-05-17T19:50:46+00:00

I am using Boost’s uBLAS in a numerical code and have a ‘heavy’ solver

  • 0

I am using Boost’s uBLAS in a numerical code and have a ‘heavy’ solver in place:

http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?LU_Matrix_Inversion

The code works excellently, however, it is painfully slow. After some research, I found UMFPACK, which is a sparse matrix solver (among other things). My code generates large sparse matrices which I need to invert very frequently (more correctly solve, the value of the inverse matrix is irrelevant), so UMFPACk and BOOST’s Sparse_Matrix class seems to be a happy marriage.

UMFPACK asks for the sparse matrix specified by three vectors: an entry count, row indexes, and the entries. (See example).

My question boils down to, can I get these three vectors efficiently from BOOST’s Sparse Matrix class?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:50:46+00:00Added an answer on May 17, 2026 at 7:50 pm

    There is a binding for this:

    http://mathema.tician.de/software/boost-numeric-bindings

    The project seems to be two years stagnant, but it does the job well. An example use:

        #include <iostream>
        #include <boost/numeric/bindings/traits/ublas_vector.hpp>
        #include <boost/numeric/bindings/traits/ublas_sparse.hpp>
        #include <boost/numeric/bindings/umfpack/umfpack.hpp>
        #include <boost/numeric/ublas/io.hpp>
    
        namespace ublas = boost::numeric::ublas;
        namespace umf = boost::numeric::bindings::umfpack;
    
        int main() {
    
          ublas::compressed_matrix<double, ublas::column_major, 0,
           ublas::unbounded_array<int>, ublas::unbounded_array<double> > A (5,5,12); 
          ublas::vector<double> B (5), X (5);
    
          A(0,0) = 2.; A(0,1) = 3; 
          A(1,0) = 3.; A(1,2) = 4.; A(1,4) = 6;
          A(2,1) = -1.; A(2,2) = -3.; A(2,3) = 2.;
          A(3,2) = 1.;
          A(4,1) = 4.; A(4,2) = 2.; A(4,4) = 1.; 
    
          B(0) = 8.; B(1) = 45.; B(2) = -3.; B(3) = 3.; B(4) = 19.; 
    
          umf::symbolic_type<double> Symbolic;
          umf::numeric_type<double> Numeric;
    
          umf::symbolic (A, Symbolic); 
          umf::numeric (A, Symbolic, Numeric); 
          umf::solve (A, X, B, Numeric);   
    
          std::cout << X << std::endl;  // output: [5](1,2,3,4,5)
        } 
    

    NOTE:

    Though this work, I am considering moving to NETLIB

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started using Boost 1.36. These libraries would be very useful in
Since I have started using this site, I keep hearing about the Boost library.
I'm using boost::iostreams::gzip_decompressor with boost::iostreams::filterimg_streambuf to read gzip files. some of my files have
I am using boost serialization on windows, and I wanted to test my code
I'm using boost for several C++ projects. I recently made a upgrade (1.33.1 to
I'm using boost's shared pointers, and enable_shared_from_this to enable returning a shared pointer to
What might be the best way to start programming using boost lambda libraries.
So I am doing a lot of high performance network programming using Boost::Asio (or
I am experiencing a crash while using the Boost.Spirit and Boost.Thread libraries in my
When using the pImpl idiom is it preferable to use a boost:shared_ptr instead of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.