Boost logo

Ublas :

Subject: [ublas] Test results for lapack::trtri
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2009-02-28 18:14:33


lapack::trtri seems to be compiling and working for dense, non-triangular
matrices.

   ublas::matrix<double, column_major> A(2,2);
... //(I am setting A(0,1) to be 0 assuming it is ignored.
   lapack::trtri('L', 'N', A);
   //A now has correct inverse

However: this routine is for triangular matrices, so shouldn't it work for
these? The following code fails to compile:
   ublas::triangular_matrix<double, lower, column_major> A(2,2);
... //(I am setting A(0,1) to be 0 assuming it is ignored.
   lapack::trtri('L', 'N', A);

Compile errors:
1>C:\working\libraries\boost\boost/numeric/bindings/lapack/computational/trtri.hpp(80):
error: class
"boost::numeric::bindings::traits::matrix_traits<boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>>" has no member "value_type"
1> typedef typename traits::matrix_traits< MatrixA >::value_type
value_type;
1> ^
1> detected during instantiation of "integer_t={int}
boost::numeric::bindings::lapack::trtri(char, char, MatrixA &) [with
MatrixA=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 132 of
"C:\working\etk_lib\test_suite\etk\test_ublas.cpp"
1>
1>C:\working\libraries\boost\boost/numeric/bindings/lapack/computational/trtri.hpp(56):
error: class "boost::numeric::bindings::traits::type_traits<<error-type>>"
has no member "real_type"
1> typedef typename traits::type_traits<ValueType>::real_type
real_type;
1> ^
1> detected during:
1> instantiation of class
"boost::numeric::bindings::lapack::trtri_impl<ValueType> [with
ValueType=<error-type>]" at line 82
1> instantiation of "integer_t={int}
boost::numeric::bindings::lapack::trtri(char, char, MatrixA &) [with
MatrixA=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 132 of
"C:\working\etk_lib\test_suite\etk\test_ublas.cpp"
1>
1>C:\working\libraries\boost\boost/numeric/bindings/traits/matrix_traits.hpp(147):
error: class
"boost::numeric::bindings::traits::matrix_traits<boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>>" has no member "num_columns"
1> std::ptrdiff_t matrix_size2 (M& m) { return
matrix_traits<M>::num_columns (m); }
1> ^
1> detected during:
1> instantiation of "ptrdiff_t={int}
boost::numeric::bindings::traits::matrix_size2(M &) [with
M=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 66 of
"C:\working\libraries\boost\boost/numeric/bindings/lapack/computational/trtri.hpp"
1> instantiation of "void
boost::numeric::bindings::lapack::trtri_impl<ValueType>::compute(char, char,
MatrixA &, integer_t={int} &) [with ValueType=<error-type>,
MatrixA=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 82 of
"C:\working\libraries\boost\boost/numeric/bindings/lapack/computational/trtri.hpp"
1> instantiation of "integer_t={int}
boost::numeric::bindings::lapack::trtri(char, char, MatrixA &) [with
MatrixA=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 132 of
"C:\working\etk_lib\test_suite\etk\test_ublas.cpp"
1>
1>C:\working\libraries\boost\boost/numeric/bindings/traits/matrix_traits.hpp(123):
error: class
"boost::numeric::bindings::traits::matrix_traits<boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>>" has no member
"leading_dimension"
1> return matrix_traits<M>::leading_dimension (m);
1> ^
1> detected during:
1> instantiation of "ptrdiff_t={int}
boost::numeric::bindings::traits::leading_dimension(M &) [with
M=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 67 of
"C:\working\libraries\boost\boost/numeric/bindings/lapack/computational/trtri.hpp"
1> instantiation of "void
boost::numeric::bindings::lapack::trtri_impl<ValueType>::compute(char, char,
MatrixA &, integer_t={int} &) [with ValueType=<error-type>,
MatrixA=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 82 of
"C:\working\libraries\boost\boost/numeric/bindings/lapack/computational/trtri.hpp"
1> instantiation of "integer_t={int}
boost::numeric::bindings::lapack::trtri(char, char, MatrixA &) [with
MatrixA=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 132 of
"C:\working\etk_lib\test_suite\etk\test_ublas.cpp"
1>
1>C:\working\libraries\boost\boost/numeric/bindings/lapack/computational/trtri.hpp(71):
error: no instance of function template
"boost::numeric::bindings::traits::matrix_storage" matches the argument list
1> argument types are:
(boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real>>>)
1> traits::matrix_storage(a), traits::leading_dimension(a),
1> ^
1> detected during:
1> instantiation of "void
boost::numeric::bindings::lapack::trtri_impl<ValueType>::compute(char, char,
MatrixA &, integer_t={int} &) [with ValueType=<error-type>,
MatrixA=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 82
1> instantiation of "integer_t={int}
boost::numeric::bindings::lapack::trtri(char, char, MatrixA &) [with
MatrixA=boost::numeric::ublas::triangular_matrix<double,
boost::numeric::ublas::lower, boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 132 of
"C:\working\etk_lib\test_suite\etk\test_ublas.cpp"