Subject: Re: [ublas] [bindings][lapack] Initial high-level solve
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2009-03-28 19:08:31
Rutger ter Borg wrote:
> Jesse Perla wrote:
>> Quite often you want to solve AX=b with b a ublas
>> vector and don't want to convert between the two types. I am not sure if
>> there is the ability for the traits to treat a vector as an Nx1 matrix.
> I have thought about this, I guess this would become feasible if stuff
> mentioned in http://lists.boost.org/MailArchives/ublas/2009/03/3367.php is
> implemented. I.e., if is_bindable_vector<T> is a true_type, we could use an
> alternative traits implementation or dispatch (or something along that
If I remember correctly, the file ublas_vector2.hpp contained a traits class to treat a ublas_vector as a Nx1 matrix with column major order, and an (undocumented) ublas::c_vector as a 1xN matrix with row major order. The (undocumented) ublas::c_vector nicely illustrates the problem of this approach.
> This would enable us to use a vector as if it is a
> matrix in a transparent way.
I would prefer to always explicitly say how a vector should be interpreted as a matrix. I think there are 4 different possibilities: "Nx1 or 1xN" matrix with "column major or row major" order.
> solve( A, b )
> solve( A, _trans(b) )
The "_trans(b)" is exactly how it could be said explicitly. How about introducing namespaces column_major and row_major, such that the 4 different possibilities could be stated as
column_major::as_1xN_matrix(b), row_major::as_1xN_matrix(b) column_major::as_Nx1_matrix(b), row_major::as_Nx1_matrix(b)?
could be an interface I could live with.