Any Blitz++ and TVMET experts out there?

D

dss

I'm trying to compile some code that I downloaded. The code uses
Blitz++ and tvmet to manipulate arrays. I have never worked with either
of these, and I am having trouble getting both of these to work. When I
compile the code, I get a compiler error in the tvmet files. Instead of
trying to figure out what is going on with tvmet, I decided to do
everything with blitz. Which is also not working out. I am hoping that
someone can provide some insight into what I am doing wrong.
For example, I removed the following code.

typedef tvmet::Matrix<double,3, 3> mtr_type;
typedef blitz::Array<mtr_type,2> matrix;
..
..
..
mutable matrix mat;

If I correctly understand the above code then "mat" is a 3 by 3 array.
I replaced this code with

blitz::Array<double,2> mat(3,3);

Which gave me the error message 'The text "3" is unexpected'.

Any insight into the problem would be appreciated.
 
J

John Harrison

dss said:
I'm trying to compile some code that I downloaded. The code uses
Blitz++ and tvmet to manipulate arrays. I have never worked with either
of these, and I am having trouble getting both of these to work. When I
compile the code, I get a compiler error in the tvmet files. Instead of
trying to figure out what is going on with tvmet, I decided to do
everything with blitz. Which is also not working out. I am hoping that
someone can provide some insight into what I am doing wrong.
For example, I removed the following code.

typedef tvmet::Matrix<double,3, 3> mtr_type;
typedef blitz::Array<mtr_type,2> matrix;
.
.
.
mutable matrix mat;

If I correctly understand the above code then "mat" is a 3 by 3 array.
I replaced this code with

blitz::Array<double,2> mat(3,3);

Which gave me the error message 'The text "3" is unexpected'.

Any insight into the problem would be appreciated.

I would guess that mat exists in a class, right? I'm guessing this
because of the use of the keyword mutable.

If so then you do not construct class members where you declare them,
you do so in a constructor initalisation list instead.

This is illegal

class X
{
X() {}
blitz::Array<double,2> mat(3,3);
};

This is legal

class X
{
X() : mat(3,3) {}
blitz::Array<double,2> mat;
};

HTH

john
 
D

dss

John said:
I would guess that mat exists in a class, right? I'm guessing this
because of the use of the keyword mutable.

If so then you do not construct class members where you declare them,
you do so in a constructor initalisation list instead.

This is illegal

class X
{
X() {}
blitz::Array<double,2> mat(3,3);
};

This is legal

class X
{
X() : mat(3,3) {}
blitz::Array<double,2> mat;
};

HTH

john


Yes. You are correct. I guess my understanding of
"tvmet::Matrix<double,3, 3>" must be incorrect. Thanks John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top