Boost logo

Ublas :

Subject: [ublas] Problem with matrix assignment...
From: Thomas Schmelzer (thomas.schmelzer_at_[hidden])
Date: 2009-01-27 08:57:37

my goal is to compute the Cholesky decomposition of a matrix C (which
is spd) and store the results in a standard ublas matrix (row_major!).
Here's a brief code example:

typedef ublas::matrix<dbl_t> dbl_mat_t;
typedef ublas::matrix<dbl_t, ublas::column_major> dbl_mat_cm_t;
typedef ublas::symmetric_matrix<dbl_t, ublas::lower,
ublas::column_major> dbl_sym_mat_cm_t;
typedef ublas::triangular_matrix<dbl_t, ublas::upper,
ublas::column_major> dbl_mat_triang_t;

const dbl_mat_t chol(const dbl_mat_t& C)
 // create a column-major matrix C1
 dbl_sym_mat_cm_t C1(C);
 if (lapack::pptrf(C1)==0)
        dbl_mat_triang_t C2(C1);
        dbl_mat_t R(C2);
        std::cout << ublas::norm_frobenius(ublas::prod(ublas::trans(R),R)-C)
<< std::endl;
        return R;

This all works nice in the release mode, however, once I switch to
debug matrix_assign.hpp is complaining at runtime.
The error message I get is...

Check failed in file D:\Thomas\simulation\3rd party\boost-1_36\boost/numeric/ubl
as/detail/matrix_assign.hpp at line 890:
detail::expression_type_check (m, cm)
unknown location(0): fatal error in "test::MatrixComputations::testCholesky": st
d::logic_error: external logic

Can someone please comment on this. Help is very appreciated...

Thomas Schmelzer
31 Oxford Castle
New Road
Oxford, UK
Mobile: +44 (0)7789 778187
Landline: +44 (0)5602 147976