Boost logo

Ublas :

Subject: Re: [ublas] novice question. how to use ublas bindings
From: Luca Sbardella (luca_at_[hidden])
Date: 2009-08-22 05:29:17


And where is that function defined?
I cannot see it in driver/syev.hpp (trunk version).

2009/8/21 Karl Meerbergen <karl.meerbergen_at_[hidden]>

> Dear Luca,
>
> If you use syev('V', 'U', matrix,...)
> you do not need a symmetric_adaptor.
>
> Best,
>
> Karl
>
>
>
> Luca Sbardella wrote:
>
>> Summarising my findings:
>>
>> 1) The binding won't compile when using a /ublas::matrix/ for a symmetric
>> eigenvalue problem.
>> 2) It won't compile if I use the /ublas::symmetric/_matrix instead (/
>> leading_dimension/ method missing in the matrix_traits for a
>> symmetric_matrix).
>> 3) It does work when I use the /ublas::symmetric_adaptor/ wrapper:
>>
>> and this is a snippet of the client code
>>
>> #include <boost/numeric/bindings/lapack/driver/syev.hpp>
>> #include <boost/numeric/bindings/traits/type_traits.hpp>
>> #include <boost/numeric/bindings/traits/ublas_symmetric.hpp>
>> #include <boost/numeric/bindings/traits/ublas_vector.hpp>
>>
>> template<typename T>
>> int syevtest(int N) {
>> namespace ublas = boost::numeric::ublas;
>> namespace lapack = boost::numeric::bindings::lapack;
>> typedef ublas::matrix<T, ublas::column_major> matrix_type;
>> typedef ublas::vector<T> vector_type;
>>
>> // Set matrix
>> matrix_type a(N,N);
>> vector_type e1(N);
>>
>> randomize_upper(a);
>>
>> ublas::symmetric_adaptor<matrix_type,ublas::upper> sym(a);
>>
>> lapack::syev('V',sym,e1);
>> return 0;
>> }
>>
>>
>> int test() {
>> syevectors<float>(10);
>> syevectors<double>(10);
>> return 0;
>> }
>>
>> Thanks for help
>>
>> Luca
>>
>>
>>
>>
>>
>>
>> 2009/8/21 Thomas Klimpel <Thomas.Klimpel_at_[hidden] <mailto:
>> Thomas.Klimpel_at_[hidden]>>
>>
>>
>> Luca Sbardella wrote:
>> > I went to bindings/traits/ublas_matrix.hpp and in the struct
>> matrix_detail_traits the uplo_type is not defined.
>> >
>> > Am I missing something?
>>
>> uplo_type is used to indicate which part of a symmetric or
>> hermitian matrix is stored. It should be either upper_t or
>> lower_t. The file matrix_traits.hpp contains the following:
>>
>> // upper/lower non-unit/unit triangular type tags
>> struct upper_t {};
>> struct lower_t {};
>> struct unit_upper_t {};
>> struct unit_lower_t {};
>>
>> I have to admit that I'm not aware of any special triangular
>> matrix types, but there are special matrix types for symmetric and
>> hermitian matrix types. So it's possible that including
>> traits/ublas_symmetric.hpp and traits/ublas_hermitian.hpp will
>> solve your problem.
>>
>> Conclusion:
>> The uplo_type is only meaningful for symmetric, hermitian or
>> triangular matrix types. I believe that only symmetric and
>> hermitian matrix types are directly supported by ublas, so these
>> type tags are only used for symmetric and hermitian matrices. So
>> including traits/ublas_symmetric.hpp and
>> traits/ublas_hermitian.hpp in the "client" code (i.e. the test
>> case) and using the corresponding symmetric/hermitian matrix
>> classes or matrix class adaptors from ublas should help with this
>> problem.
>>
>> Regards,
>> Thomas
>> _______________________________________________
>> ublas mailing list
>> ublas_at_[hidden] <mailto:ublas_at_[hidden]>
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>> Sent to: luca_at_[hidden] <mailto:luca_at_[hidden]>
>>
>>
>>
>>
>> --
>> Dr Luca Sbardella
>> Director
>> Dynamic Quant Ltd
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> ublas mailing list
>> ublas_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>> Sent to: karl.meerbergen_at_[hidden]
>>
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: luca_at_[hidden]
>

-- 
Dr Luca Sbardella
Director
Dynamic Quant Ltd