|
Ublas : |
From: aychy_at_[hidden]
Date: 2005-08-08 04:54:37
Hi.
sparse_matrix maybe don`t support comlex number very well,I can`t get the real or imag part of a complex number in the sparse_matrix, how to solve it?
a simply example:
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
sparse_matrix<std::complex<double> > m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i) {
for (unsigned j = 0; j < i; ++ j)
m (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
m (i, i) = std::complex<double> (4 * i, 0);
}
}
std::cout <<(m(0,0)).real()<< std::endl;
}
Best!
Yong Chen