Matrix.Resize Method

Overload List

#SignatureDescription
1function Resize(const Src: TMtx; NewRows: Integer; NewCols: Integer): TMtx;Performs resize of the calling matrix to NewRows and NewCols.
2function Resize(NewRows: Integer; NewCols: Integer): TMtx;Resizes the matrix, while preserving the values in already allocated memory.

Overload 1: function Resize(const Src: TMtx; NewRows: Integer; NewCols: Integer): TMtx;

Performs resize of the calling matrix to NewRows and NewCols.

#NameTypeDescription
1SrcTMtx
2NewRowsInteger
3NewColsInteger

Result: stored in self (calling object), returns self for chaining

Remarks:

Copies the Src matrix values to the calling matrix. The elements outside the newly created matrix size are not referenced.

Overload 2: function Resize(NewRows: Integer; NewCols: Integer): TMtx;

Resizes the matrix, while preserving the values in already allocated memory.

#NameTypeDescription
1NewRowsInteger
2NewColsInteger

Result: stored in self (calling object), returns self for chaining

Remarks:

Sets the Matrix.Rows property to NewRows, Matrix.Cols property to NewCols, while preserving the values in already allocated memory.

Examples
var  A,B: Matrix;
begin
    A.SetIt(2,2,False,[1,3,
        2,4]);
    B.Resize(A,3,2,True);
    // B becomes:
    // [1,2,0,
    //  3,4,0]);
end;
See Also: Matrix.Size