You are here: Symbol Reference > MtxVec Namespace > Classes > TMtx Class > public > Size Method > TMtx.Size Method (integer, integer, boolean, boolean)
MtxVec VCL
ContentsIndex
PreviousUpNext
TMtx.Size Method (integer, integer, boolean, boolean)

Sets the size of matrix.

Pascal
function Size(const ARows: integer; const ACols: integer; const aComplex: boolean; const aIsDouble: boolean): TMtx; overload;

Set the calling matrix properties:

 

Calling the Size method does not preserve the contents of the matrix. Use the Resize method, if you want to preserve existing values.

The Size method performs an out-of-memory safe resize, if the matrix already has memory allocated. This prevents out of memory message for example when redefining the size of the matrix from single column to single row: 

 

A.Rows := 10000; // matrix size = 0 A.Cols := 1; // matrix size = 10000 // ... A.Cols := 10000; // matrix size = 100 000 000 (problems here) A.Rows := 1; // matrix size = 10 000
var A: TMtx; begin CreateIt(A); try A.Size(2,1,True, mvDouble); // 2x1 complex matrix A.SetZero; // A becomes: // [0,0] // [0,0] finally FreeIt(A); end; end;
Examples on GitHub
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!