Boost logo

Ublas :

From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2007-04-12 05:15:48


symmetric_matrix is a symmetric matrix in packed format.

syev takes a dense matrix as argument. See the LAPACK manual.
You should use symmetric_adaptor< matrix<T,column_major>, ... >

For eigenvalue solvers in packed format, use spev(). Unfortunately,
there is no bindings to spev(). I am not intending writing a binding for
this function soon.

syev does not make a copy: all operations are done on the matrix, whose
content is destroyed on return.

I hope this is helpful,


John Woods wrote:

>Hey folks,
>I know that Fortran takes column major lower or upper triangular
>matrices (as symmetric matrices) for DSYEV and SSYEV. I had initially
>thought that it would be best to pass in a symmetric_matrix<double,
>lower, column_major, vector<double> > to avoid unnecessary copies.
>However, I notice that this type is represented in the same way as a
>symmetric_matrix<double, upper, row_major, vector<double> > (correct?).
>Clearly if I take the product of two matrices, it's not going to matter
>so much how the data is stored. But for passing into Fortran functions
>(e.g. through syev), it does matter. Or does it? Is it copied regardless
>of how I store it? What about the work array I pass in?
>A related question:
>That fourth template argument for symmetric_matrix can be
>bounded_array<T>, unbounded_array<T>, or std::vector<T>. Vector, for
>example, has a second template argument, the size. Would a symmetric
>matrix be stored as a single vector of size n(n+1)/2? Does this save
>anything, to give that template a size?
>I realize these are pretty trivial questions and that I could write code
>to test nearly all of them. Actually, I'm not looking for specific
>answers (except about syev)--I'd much prefer a general explanation on
>the design of these libraries that would enable me to answer them myself.
>Thanks for your time.
>John Woods
>ublas mailing list