You declared a pointer to double and allocated memory for one-dimensional array.
double *value = new double[numrows][numcols] ;
and get message that the expression must have constant value.
The compiler must know the size of the element of a two-dimensional array. That is in this statement numcols shall be a constant expression. Moreover the types of left and right sides of the expression in the statement do not coinside.
Usually the following method is used
1 2 3 4 5 6
double **value = newdouble *[numrows];
for ( int i = 0; i < numrows; i++ )
{
value[i] = newdouble[numcols];
}
If your array is going to change size, you would be better off using a list of vectors - that way you can resize the vector and insert new vectors into the list.
Also, in my limited experience, whatever is on the left of the pointer variable should be the same as on the right of new operator like this:
However, keep in mind that the rows are not contiguous in memory.
If that's an issue use new T[rows*columns];
accessing like matrix[K*columns+L] === matrix[K][L] (encapsulate it in a class)
Other possibilities:
1 - write a matrix class that swaps to disk the parts it won't be needing.
2 - write a matrix class entirely disk-based (sloooow).
3 - a matrix class that stores compressed information (harder).