The size you initialize has nothing to do with the type. Therefore:
typedef boost::numeric::ublas::matrix<double> matrix_type;
matrix_type arrayM[arraySize];
The problem is array initialization. You cannot do this:
TheClass::TheClass() :
arrayM(1, 3)
{}
Instead, you should allow them to build by default, and then resize them:
TheClass::TheClass()
{
std::fill(arrayM, arrayM + arraySize, matrix_type(1, 3));
}
Since you are using boost, consider using boost::arrayit as it gives a better syntax:
typedef boost::numeric::ublas::matrix<double> matrix_type;
typedef boost::array<matrix_type, arraySize> matrix_array;
matrix_array arrayM;
TheClass::TheClass()
{
arrayM.assign(matrix_type(1, 3));
}
source
share