Boost logo

Ublas :

Subject: [ublas] bounded_matrix declaration only
From: Moritz Beber (moritz.beber_at_[hidden])
Date: 2008-11-15 10:00:23


Dear members,
I'm trying to use the bounded_matrix as a member variable for a class
I'm currently designing. The declaration of it gives me troubles though
since the way I'm currently approaching it, it would require size
information for the declaration already while I naturally only have that
information available at the point of construction of an object of that
class. A default constructor where that info is not available yet is
another story also.
I suppose I could use a normal matrix but since the size of the matrix
will not change at all during the existence time of the class object I
thought a bounded_matrix would make sense.

So the code I had in mind would look somewhat like this:

myclass {
        bounded_matrix<double, M, N, column_major> m;
        ...
}

myclass::myclass(unsigned int rows, unsigned int cols)
{
        m = bounded_matrix<double, rows, cols, column_major>(rows, cols);
        ...
}

Is there a way to bypass the need to give specific size information at
the time of declaration?

Thank you for your insights,
Moritz