|
Ublas : |
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-12-05 17:43:15
Am Montag, 3. Dezember 2007 15:14 schrieb Per Abrahamsen:
> Gunter Winkler <guwi17_at_[hidden]> writes:
> > The AFAIK simplest way is to try
> >
> > http://guwi17.de/ublas/ublas_csparse.hpp
>
> Do you have a small example preferable of how to use this to solve a
> linear equation system?
// works on 32bit and 64bit systems
compressed_matrix<
double,
basic_row_major<unsigned int, int>,
0,
unbounded_array<unsigned int>,
ublas::unbounded_array<double>
> a_compressed_matrix;
// declare variable (T=double, size_type=unsigned int)
CS::cxsparse_type_traits<T, size_type>::lu_type cs_lu;
// decompose
cs_lu = CS::cs_ul_decompose( a_compressed_matrix, 1.0 );
// solve
ublas::vector<double> temp = <rhs>;
CS::cs_ul_solve( cs_lu, temp );
<solution> = temp;
// free
CS::cs_lu_free(cs_lu);
HTH
Gunter