Boost logo

Ublas :

Subject: Re: [ublas] [bindings][lapack] Initial high-level solve
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2009-03-29 07:04:10


Karl Meerbergen wrote:
> In modern linear algebra notation (after Wilkinson, eg.), a vector is a
> column vector, its transpose is a row vector. This is simple and I
> propose to keep things simple. If a routine requires a matrix with one
> row, simply use trans(v).

Good point.
So how about as_matrix(b) for a Nx1 column major order matrix and as_c_matrix(b) for a Nx1 row major order matrix?
But I can see for myself that it somehow won't work out. Even if the vector already has a vector bindings traits class, the stride of the vector might be different from 1, so that it's impossible to interpret an arbitrary vector as a Nx1 matrix. When Markus Rickert provided Nx1 matrix traits for c_array, std::valarray and std::vector (http://lists.boost.org/MailArchives/ublas/2008/10/3048.php), I asked myself whether it's possible to come up with a better solution for this problem. Now it looks to me like this is more challenging than I initially thought.

I also see a completely different problem, independent of using "column_major::as_1xN_matrix(b)" or "trans(b)": The solve template will capture it's argument by a non-const reference, but "column_major::as_1xN_matrix(b)" or "trans(b)" will return temporary proxy objects. If I remember correctly, it is not allowed to pass temporary objects to an argument captured by a non-const reference.

This is different form the "workspace" argument, which is captured by value for this reason.

Regards,
Thomas