Boost logo

Ublas :

From: Sourabh (sourabh_at_[hidden])
Date: 2007-03-02 07:34:18


On Fri, 2 Mar 2007, Gunter Winkler wrote:

> On Friday 02 March 2007 12:17, Sourabh wrote:
> > The following program aborts when I am trying to use assign.
> > What is the proper way of dealing with matrices of size 1e7, which are
> > sparse and lower triangular.
>
> see below.

Thanks. using compressed_matrix allowed me bigger sizes.

 
> > The question I have is, how costly is it to
> > take inverse of such matrices ?
>
> Don't do this. The inverse of a sparse matrix is usually dense, the
> computation time grows like n^3 (or even worse) and the error can be as large
> as n^2 * 1.0e-14 ... I order to solve sparse linear systems you can either
> use a direct method (provided by UMFPACK or CXSparse) or an iterative method
> (provided by my examples or the Iterative Template Library). Solver for
> triangular systems are also available.
>
> (Or wait a few days/weeks until my native ublas sparse LU decomposition is
> finished.)

Is it true even if the matrix (which I want inverse of) is lower
triangular and sparse ? Actually I have a decision to make. I have a
matrix of constant values, If I don't
take inverse of that matrix, I have to solve the set of linear equations
many
times. On the other hand, if I take inverse of the matrix, I can compute
the values (A * inv (X) + Y) once and store the matrix. (The size of X is
1e7). I am unable to decide which way will be faster or feasible in terms
of storage and run time complexity ?

Could you please help me in deciding this ?

> > I also have to do multiplication and
> > addition of such matrices.
>
> multiplication is done by sparse_prod (operation_sparse.hpp) or simply by
> prod(). Addition uses operator + () or operator += ().
>
> > The improper way, as mentioned in the program
> > below causes abortion of program.
> > The exact assertion used was :
> >
> > boost/numeric/ublas/functional.hpp at line 1406:
> > size2 == 0 || i <= ((std::numeric_limits<size_type>::max) () - j) / size2
> > Aborted (core dumped)
>
> mapped_matrix has the size limit
> (size1*size2) < std::numeric_limits<size_type>::max
>
> try compressed_matrix and have a look at the list archives at [2]
>
> mfg
> Gunter
>
> [1] http://www.bauv.unibw-muenchen.de/~winkler/ublas/examples/
> [2] http://dir.gmane.org/gmane.comp.lib.boost.ublas
>
>
>

-- 
-- Sourabh