Matrix.Adopt Method

Overload List

#SignatureDescription
1procedure Adopt(AArray: PAPointer; ARows, ACols: integer; aFloatPrecision: TMtxFloatPrecision); overload;
2procedure Adopt(AArray: PAPointer; ARows, ACols: integer; aIsComplex: boolean; aIsDouble: boolean); overload;Adopts a pointer to one dimensional array.
3procedure Adopt(const Src: TMtx); overload;Adopts TMtx object.

Overload 1: procedure Adopt(AArray: PAPointer; ARows, ACols: integer; aFloatPrecision: TMtxFloatPrecision); overload;

#NameTypeDescription
1AArrayPAPointer
2ARowsinteger
3AColsinteger
4aFloatPrecisionTMtxFloatPrecision

Result: stored in self (calling object)

Overload 2: procedure Adopt(AArray: PAPointer; ARows, ACols: integer; aIsComplex: boolean; aIsDouble: boolean); overload;

Adopts a pointer to one dimensional array.

#NameTypeDescription
1AArrayPAPointer
2ARowsinteger
3AColsinteger
4aIsComplexBoolean
5aIsDoubleBoolean

Result: stored in self (calling object)

Remarks:

Addopts a pointer to AArray array. The method sets the calling matrix TMtxVec.Complex property to aFloatPrecision, Matrix.Rows to ARows, Matrix.Cols to ACols and Values1D and CValues1D to Pointer(AArray).

Notes:

  • Required to call the Matrix.Disown method, before freeing the object
  • Do not resize the matrix
  • Do not call routines relying on Lapack when cross-platform "Core edition" is used (not linking dlls), because pascal version of Lapack will assume that adopted memory is a dynamic array and will modify array Index -2.
  • TMtx.Values1D array assignment or passing array by var (internal to library) will cause memory corruption in this case.
  • To be used with great care only.
See Also: Matrix.Disown, Matrix.Disown, Matrix.Disown

Overload 3: procedure Adopt(const Src: TMtx); overload;

Adopts TMtx object.

#NameTypeDescription
1SrcTMtxsource TMtx

Result: stored in self (calling object)

Remarks:

Src object will be adopted by Matrix. When the Matrix gets out of scope, the object will be freed.