Boost logo

Ublas :

From: Georg Baum (Georg.Baum_at_[hidden])
Date: 2007-07-30 11:43:48

Am Montag 30 Juli 2007 17:32 schrieb wedekind:
> Hello all,
> I'm quite new to numerical computing, especially using boost's
> lapack-bindings. So I hope to find some generous numerical computing guru
> among you to set me on the right path :)
> The following example does not work for me. Seemingly because of wrong
> dimensions of one of the matrices involved... Could you please check this
> example and tell me what's wrong with it? I've played around with it for
> a bit and can't find any examples on the web:
> -- Begin code sample --
> #include <boost/numeric/bindings/traits/ublas_matrix.hpp>
> #include <boost/numeric/ublas/io.hpp>
> #include <boost/numeric/bindings/lapack/geqrf.hpp>
> #include <boost/numeric/bindings/lapack/ormqr.hpp>
> int main(int argc, char * argv[])
> {
> unsigned int m = 4;
> unsigned int n = 3;
> matrix<double> A(m, n);

I guess it will work with

matrix<double, boost::numeric::ublas::column_major> A(m, n);

. Lapack stores matrices in column major order, and ublas uses row major
unless you specify column major.
AFAIK some lapack bindings work with both column and row major (by using
temporary copies -> slow, or in some cases it is possible to transpose the
input and result), but some don't.
Ideally the bindings would not compile with wrong storage types, so there is
room for improvement ;-)