Boost logo

Ublas :

Subject: Re: [ublas] [bindings][lapack] Initial high-level solve
From: Karl Meerbergen (karl.meerbergen_at_[hidden])
Date: 2009-03-29 05:04:37


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).

Karl

Thomas Klimpel wrote:
> 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
>> line).
>>
>
> 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.
>
> Regards,
> Thomas
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
>