Boost logo

Ublas :

From: James N. Knight (nate_at_[hidden])
Date: 2006-03-24 19:02:40


Hello all. I'm trying to initialize a triangular matrix using the
following code.

     #include <boost/numeric/ublas/matrix.hpp>
     #include <boost/numeric/ublas/triangular.hpp>

     using namespace boost::numeric::ublas;

     int main(){

        scalar_matrix<double> sm(5,5,1.0);

        triangular_adaptor<scalar_matrix<double>,upper> tma(sm);

        triangular_matrix<double,upper> tm(tma);
     }

I'm compiling against the latest (3/23/06) cvs head of boost using
gcc4.0 on a linux machine. A number of compiler errors are generated.
Here are the first few (I've modified them a bit for easier reading).

.../ublas/triangular.hpp: In instantiation of
‘ublas::triangular_adaptor<ublas::scalar_matrix<double>,
ublas::basic_upper<long unsigned int> >’:
test_tria.cpp:10: instantiated from here
.../ublas/triangular.hpp:933: error: no type named ‘closure_type’ in
‘class ublas::scalar_matrix<double>’
.../ublas/triangular.hpp:965: error: no type named ‘closure_type’ in
‘class ublas::scalar_matrix<double>’
.../ublas/triangular.hpp:969: error: no type named ‘closure_type’ in
‘class ublas::scalar_matrix<double>’
.../ublas/triangular.hpp: In instantiation of
‘ublas::triangular_adaptor<ublas::scalar_matrix<double>,
ublas::basic_upper<long unsigned int> >’:
test_tria.cpp:10: instantiated from here
.../ublas/triangular.hpp:1771: error: no type named ‘closure_type’ in
‘class ublas::scalar_matrix<double>’
.../ublas/triangular.hpp: In constructor ‘ublas::triangular_adaptor<M,
TRI>::triangular_adaptor(M&) [with M = ublas::scalar_matrix<double>, TRI
= ublas::basic_upper<long unsigned int>]’:
test_tria.cpp:10: instantiated from here
.../ublas/triangular.hpp:947: error: using invalid field
‘ublas::triangular_adaptor<M, TRI>::data_’

It goes on from there. Any ideas on why this is happening? Is this an
invalid use of triangular_adaptor? I've also done it this way.

triangular_matrix<double,upper> tm(5,5);
tm.assign(scalar_matrix<double>(1.0));

This compiles, but produces an external_logic error (as expected) when I
compile and run without -DNDEBUG. It does appear to work when I compile
without debugging though.

James