
Ublas : 
From: James N. Knight (nate_at_[hidden])
Date: 20060330 18:18:27
Adding the line
typedef const matrix_reference<const self_type> closure_type;
into the definition of the scalar matrix class in matrix.hpp fixes the
problem.
I'm left wondering if this was left out for a reason though. Most types
have a const_closure_type and a closure_type definition. I've added
this definition for closure type but given it the same type as
const_closure_type. I don't think it matters since you can't modify a
scalar matrix.
Maybe it was just overlooked.
Anyway, problem solved.
Nate
Manoj Rajagopalan wrote:
> I have often come across such errors in compiling my code. Often,
> including one or more other headers solves the problem.
>
> try including one or more of the following:
> expression_types.hpp
> matrix_proxy.hpp
> matrix_expression.hpp
> traits.hpp
>
> you could try other header files that you suspect contain typedefs of
> closure_type (there are so many!).
>
> This is only a hack though  the best I have come up with.
>
> cheers
> Manoj
>
>
>
> James N. Knight wrote:
>> 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
>> _______________________________________________
>> ublas mailing list
>> ublas_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
>