|
Ublas : |
From: Shawn D. Pautz (sdpautz_at_[hidden])
Date: 2005-10-19 10:16:04
All,
Here's some more information that may be relevant to this discussion.
The code below does not compile with gcc 3.2.3 (I've suppressed the
include statements; I've tried including a lot of the ublas header files
without success). Which lines ought to work, and which lines are an
error on my part?
int main()
{
ublas::matrix<double> A(2,2);
ublas::matrix<double> B(2,2);
lu_factorize(A); // compiles
lu_factorize(B); // compiles
lu_factorize(ublas::prod(A,B)); // won't compile
lu_factorize(ublas::matrix<double>(ublas::prod(A,B))); // won't compile
lu_factorize(static_cast<ublas::matrix<double>
>(ublas::prod(A,B))); // won't compile
ublas::matrix<double> tempMatrix(ublas::prod(A,B)); // compiles
lu_factorize(tempMatrix); // compiles
}
The compiler complains about not being able to convert the result of
prod into a matrix<double> unless I make an explicit temporary. Is that
the intended usage of lu_factorize, or should I be able to nest the
operations in one line? I prefer the compact expression if I can get it
to work.
Shawn
Gunter Winkler wrote:
>On Tuesday 18 October 2005 22:51, Shawn D. Pautz wrote:
>
>
>>Does the Matrix concept require a find2 member function? My locally
>>defined matrix class does not work with lu_factorize (with pivots)
>>unless I provide that function. Alternatively, do some of the ublas
>>algorithms have stronger requirements on the matrix classes than defined
>>by the Matrix concept?
>>
>>
>
>Some matrix proxies (row and matrix_vector_range) use find2 to obtain
>iterators pointing to begin and end of the data. To be more precise: nearly
>all (const_)iterators use find to compute pointers to the data.
>
>I don't think find2 should be part of the matrix concept, because it is only
>used internally. But if you create your own matrix class - you have to
>provide this helper function.
>
>mfg
>GuWi
>
>
>
-- Shawn D. Pautz Radiation Transport Department, MS 1179 Sandia National Laboratories P.O. Box 5800 Albuquerque, NM 87185 Phone: 505-284-4291 Fax: 505-844-0092 E-Mail: sdpautz_at_[hidden]