Change dimensions

next - skip - up - start

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
    A.ReSize(B);                  // set dims to those of B 
Use A.CleanUp() to set the dimensions of A to zero and release all the heap memory.

A.ReSize(B) sets the dimensions of A to those of a matrix B. This includes the band-width in the case of a band matrix. It is an error for A to be a band matrix and B not a band matrix (or diagonal matrix).

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

next - skip - up - start