The following operations change the dimensions of a matrix. The values of the elements are lost.
A.ReSize(nrows,ncols); // for type Matrix or nricMatrix
A.ReSize(n); // for all other types, except Band
A.ReSize(n,lower,upper); // for BandMatrix
A.ReSize(n,lower); // for LowerBandMatrix
A.ReSize(n,upper); // for UpperBandMatrix
A.ReSize(n,lower); // for SymmetricBandMatrix
Use A.CleanUp() to set the dimensions of A to zero
and release all the heap memory.
Remember that ReSize destroys values. If you want to ReSize, but keep the values in the bit that is left use something like
ColumnVector V(100); ... // load values V = V.Rows(1,50); // to get first 50 values.If you want to extend a matrix or vector use something like
ColumnVector V(50);
... // load values
{ V.Release(); ColumnVector X=V; V.ReSize(100); V.Rows(1,50)=X; }
// V now length 100