Subject: Re: [ublas] prod function usage
From: Umut Tabak (u.tabak_at_[hidden])
Date: 2011-05-20 09:33:24
On 05/20/2011 02:46 PM, Ungermann, Jörn wrote:
> If you use, e.g., push_back for the construction,
> you can wreak some havoc with its internal data structure.
Dear Jorn, Thanks for the suggestions.
The point is that I can not use any of the functions that are related to
the compressed_matrix, for instance the template header is sth like this
template < class Mat_Sparse,
class Mat_Dense, class Vector >
int lanczos( Mat_Sparse& A,
const double shift,
const double upper_bound_on_frequency,
const double rTol = 1e-6,
const int lower_iteration_limit = 40 )
And I call this from the code as
lanczos( Kss, Mss, 10, lambda, Phi_str, 500 );
where Kss and Mss are compressed_matrix<double>, I get a segfault from
the axpy_prod(Mss, q, Mq) from the template.
Defining a code, just for a test, outside of the template like,
int sz = Mss.size1();
cout << sz << endl;
for(int k=0; k!=sz;++k)
q(k) = 1.0;
axpy_prod(Mss, q, Mq);
goes through without problems, I could not understand what is going on
in the template function. Very strange, most probably there is a stupid
mistake somewhere which I can not see the reason.
Best regards and thx.
-- If I have a thousand ideas and only one turns out to be good, I am satisfied. Alfred Nobel