QGenericMatrix? why not QMatrix a template? is there anything like boost::numeric::ublas::matrix<AAA>?
-
@opengpu Why do you want to put VARIANT in a matrix? Do you want to do matrix based calculations? Maybe a two dimensional QVector would be enough?
-
@jsulm said in QGenericMatrix? why not QMatrix a template? is there anything like boost::numeric::ublas::matrix<AAA>?:
dimensional QVector
dimensional QVector?
yes, i just want to get the Var besed on row&column -
@jsulm said in QGenericMatrix? why not QMatrix a template? is there anything like boost::numeric::ublas::matrix<AAA>?:
dimensional QVector
dimensional QVector?
yes, i just want to get the Var besed on row&column@opengpu said in QGenericMatrix? why not QMatrix a template? is there anything like boost::numeric::ublas::matrix<AAA>?:
yes, i just want to get the Var besed on row&column
I agree with @jsulm -- you should use
QVector<QVector<T>>.QGenericMatrixand the oldQMatrixare designed to be used as transformation matrices: https://en.wikipedia.org/wiki/Transformation_matrix. They are not designed to hold row+column data. -
@jsulm said in QGenericMatrix? why not QMatrix a template? is there anything like boost::numeric::ublas::matrix<AAA>?:
QVector<QVector<VARIANT>> _2dArray;
_2dArray[iRow][iCol] = 1.0f; //this is ok
but how should i set the presice size of _2dArray?
_2dArray.resize(rowCount * colCount); //this is not correct, right? -
@jsulm said in QGenericMatrix? why not QMatrix a template? is there anything like boost::numeric::ublas::matrix<AAA>?:
QVector<QVector<VARIANT>> _2dArray;
_2dArray[iRow][iCol] = 1.0f; //this is ok
but how should i set the presice size of _2dArray?
_2dArray.resize(rowCount * colCount); //this is not correct, right?@opengpu said in QGenericMatrix? why not QMatrix a template? is there anything like boost::numeric::ublas::matrix<AAA>?:
_2dArray.resize(rowCount * colCount); //this is not correct, right?
No, it isn't
_2dArray.resize(rowCount); // And now for each row _2dArray[row].resize(colCount); -
If you need a 2d container for type
Twith fixed dimensions and having all rows with the same number of columns you should useboost::multi_array<T,2>.
QVector<QVector<T>>is fine but it's more flexible than you need and hence less efficient. I would stick with the good old boost:boost::multi_array<VARIANT,2> _2dArray(boost::extents[rowCount][colCount]);