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

  • Home
  • SEARCH
  • 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'm using boost::asio, and I have code like this: void CServer::Start(int port) { tcp::acceptor
I have code using boost to list directory contents, iterate through each file, and
I'm new in using boost and have a problem. I need shared_mutex function in
I am using boost shared pointers in my program, and I have a class
I am using boost's threading library and have run into linking issues in Visual
I am using boost graph library for solving a network graph problem. I have
I am using Boost with Visual Studio 2008 and I have put the path
Using boost::python , I have been able to wrap a class ( Node )
I've started using boost::signals2 instead of my old signals-code. I'm having a problem with
I am using boost::tuple for my code. Suppose that I want to store an

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.