It's a nice solution.
Anybody correct me if I'm wrong. In Gianluigi's solution, a myclass instanciation, a first identity_matrix object is created.
Then in it's constructor, a second one is created, then a copy constructor is called.
Now if you pass initialization parameters into the constructor initialization list like
myclass::myclas() : qt(3), you will only have one constructor called for qt and no copy-constructor.

I think it doesn't matter if instanciate that one time, but if myclass is instanciated a huge number of time, the overhead can be quite desastreous ?

Am I right or wrong ?

Cheers,
David

On Tue, Feb 2, 2010 at 15:00, Gianluigi Caddeo <ggigi78@gmail.com> wrote:
hi

I solved in this manner:

    ublas::identity_matrix<double> qt;   // declaration

qt=identity_matrix<double> (3);  // initialization

thanks

gigi


On Mon, Feb 1, 2010 at 7:00 PM, Gianluigi Caddeo <ggigi78@gmail.com> wrote:
hi

I try to define a matrix in my class but
I'have every time this problem:

myclass.h:53: error: expected identifier before numeric constant
myclass.h:53: error: expected ‘,’ or ‘...’ before numeric constant

the code is like this:

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

namespace ublas = boost::numeric::ublas;

class myclass {
   
public:

    ublas::identity_matrix<double> qt(3);

};


where is the problem? please help me...


thanks you

gigi


_______________________________________________
ublas mailing list
ublas@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: david.bellot@gmail.com



--
David Bellot, PhD
david.bellot@gmail.com
http://david.bellot.free.fr