Boost logo

Ublas :

Subject: [ublas] Issue calculating matrix product with diagonal matrix
From: Steven Butlin (steven_at_[hidden])
Date: 2011-03-15 14:17:10


Dear all,

 

I have encountered an issue calculating matrix products when the diagonal
matrix is used. I have written a simple test case to illustrate the problem
(see code). The calculation is fairly straight forward. However, a static
assertion fails in matrix_expression.hpp at line 4815.

 

Has anyone else encountered this problem? Can anyone suggest a solution?

 

Many Thanks,

Steven

 

 

Test Case:

 

matrix<double> A(3,3);

 

A(0,0) = 4; A(0,1) = 1; A(0,2) = 1;

A(1,0) = 1; A(1,1) = 2; A(1,2) = 1;

A(2,0) = 1; A(2,1) = 1; A(2,2) = 3;

 

diagonal_matrix<double> D(3,3);

 

D(0,0) = 1; D(1,1) = 2; D(2,2) = 3;

 

cout << prod(prod(A,D),A) << endl;

 

Compiler Output:

 

1>c:\development\patmos\thirdparty\boost\boost_1_45_0\boost\numeric\ublas\ma
trix_expression.hpp(4815) : error C2027: use of undefined type
'boost::STATIC_ASSERTION_FAILURE<x>'

1> with

1> [

1> x=false

1> ]

1>
c:\development\patmos\diamond\test\unit_test\test_linear_algebra.hpp(141) :
see reference to function template instantiation
'boost::numeric::ublas::matrix_matrix_binary<E1,E2,F>
boost::numeric::ublas::prod<boost::numeric::ublas::matrix_matrix_binary<boos
t::numeric::ublas::matrix<T>,boost::numeric::ublas::banded_matrix<T,L,A>,boo
st::numeric::ublas::matrix_matrix_prod<M1,M2,TV>>,C>(const
boost::numeric::ublas::matrix_expression<E> &,const
boost::numeric::ublas::matrix_expression<C> &)' being compiled

1> with

1> [

1>
E1=boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix
<double>,boost::numeric::ublas::banded_matrix<double,boost::numeric::ublas::
row_major,boost::numeric::ublas::unbounded_array<double>>,boost::numeric::ub
las::matrix_matrix_prod<boost::numeric::ublas::matrix<double>,boost::numeric
::ublas::banded_matrix<double,boost::numeric::ublas::row_major,boost::numeri
c::ublas::unbounded_array<double>>,double>>,

1> E2=boost::numeric::ublas::matrix<double>,

1>
F=boost::numeric::ublas::matrix_matrix_prod<boost::numeric::ublas::matrix_ma
trix_binary<boost::numeric::ublas::matrix<double>,boost::numeric::ublas::ban
ded_matrix<double,boost::numeric::ublas::row_major,boost::numeric::ublas::un
bounded_array<double>>,boost::numeric::ublas::matrix_matrix_prod<boost::nume
ric::ublas::matrix<double>,boost::numeric::ublas::banded_matrix<double,boost
::numeric::ublas::row_major,boost::numeric::ublas::unbounded_array<double>>,
double>>,boost::numeric::ublas::matrix<double>,double>,

1> T=double,

1> L=boost::numeric::ublas::row_major,

1> A=boost::numeric::ublas::unbounded_array<double>,

1> M1=boost::numeric::ublas::matrix<double>,

1>
M2=boost::numeric::ublas::banded_matrix<double,boost::numeric::ublas::row_ma
jor,boost::numeric::ublas::unbounded_array<double>>,

1> TV=double,

1> C=boost::numeric::ublas::matrix<double>,

1>
E=boost::numeric::ublas::matrix_matrix_binary<boost::numeric::ublas::matrix<
double>,boost::numeric::ublas::banded_matrix<double,boost::numeric::ublas::r
ow_major,boost::numeric::ublas::unbounded_array<double>>,boost::numeric::ubl
as::matrix_matrix_prod<boost::numeric::ublas::matrix<double>,boost::numeric:
:ublas::banded_matrix<double,boost::numeric::ublas::row_major,boost::numeric
::ublas::unbounded_array<double>>,double>>

1> ]