The unit *MATRIX* offers some of the most important operations to manage and process two-dimensional real-valued and integer matrices. The object oriented approach of the unix *MATRIX* hides all the stuff dealing with array addressing and memory management. Thus the user may fully concentrate on his/her work. The unit *MATRIX* offers solutions for the following tasks:

- creation and management of matrices
- filling of matrices
- copying matrices
- matrix arithmetics
- determination of statistical parameters about the matrix elements
- inversion of a square matrix
- sorting of matrix elements
- LU decomposition and determinant

**Tips, Tricks and Applications**

Delphi Bits | Covariance of Samples and Populations | Why does the covariance matrix calculated by CalcCovar differ from the results obtained by Microsofts Excel^{(tm)}. |

SDL TechNotes | Access Violation When Creating Matrix Objects | How to create a TMatrix instance in your program (without glueing a TMatrix component on your form). |

What's new:

- Release 10.6 [Mar-09, 2018]

- the following methods now support multi-processing to speed up calculations: TMatrix.Square, TMatrix.MeanOfLayersToMatrix, TMat4D.MinimumOfLayersToMatrix, TMat4D.MaximumOfLayersToMatrix, TMat4D.StdDevOfLayersToMatrix
- the function TMat4D.CRCofData is now provided as a second overloaded version
- the new procedure CopyArr3DLayerToArr2D copies a layer of a 3D array to a 2D array
- the procedure CopyMatrixToArray copies a TMatrix to a 2D array
- the procedure CopyArr3DLayerToMatrix copies a layer of a 3D array to a TMatrix
- the methods TMatrix.CopyFromArray and TMatrix.CopyToArray copy matrix data from and to dynamic arrays
- the methods TMat4D.CopyArrayToLayer, TMat4D.CopyLayerToArray, TMat4D.CopyTimeSlotToArray and TMat4D.CopyArrayToTimeSlot copy matrix data to and from dynamic arrays
- the function Dichotomize compares the values of a matrix to a threshold
- bug fix: TMatrix.Histogram created one bin less than required
- bug fix: TIntMatrix.ExchangeRows addressed the wrong rows (offset by 1)
- bug fix: TMat4D.CopyMat3DToTimeSlot used the default values of TMat4D instead of the source matrix if the indices were all zero
- bug fix: TMat4D.Percentile returned a (wrong) zero quantile under certain circumstances

- Release 10.5 [Oct-10, 2016]

- TMat4D.ReadBinary allows to read binary data without using memory
- the new event OnReadElement provides elementwise feedback during reading a binary file
- TMat4D.Transpose implemented
- the methods TMat4D.CountValues and TMatrix.CountValues count values falling into an interval
- the methods TMat4D.Resample and TMat4D.CRCofData now trigger the event OnPercentDone
- the methods TMat3D.Fill and TMat4D.Fill now treat the special case of zeroing the data matrix
- the speed of the method TMat4D.MeanOfLayersToMatrix has been improved considerably
- TIntMatrix.SaveBinary, TIntMatrix.LoadBinary and TIntMatrix.OnPercentDone implemented
- the new method TMat4D.SquaredSum calculates the sum of squares
- the method TMat4D.ReadLayer allows to read a specific layer of a Mat4D matrix
- the method CountMaskedZeros counts cells after applying a logical AND with a bitmask
- the method TMat4D.Copy1DArrayToPixel copies a one-dimensional array into a pixel column
- the method CholeskyDecomp decomposes a positive definite matrix into its Cholesky factor
- bug fix: TMat4D.SaveBinary created an integer overflow for very large matrices (more than 2
^{31}cells)

- Release 10.4 [Jun-02, 2015]

- the methods QNormalizeColumns and QNormalizeRows normalize all columns/rows of a matrix to zero median and paticular quantile of 1.0
- the method MultiplyTransposed performs a matrix multiplication using the transpose of the second matrix
- the method CopyFrom is now available for TMat3D, as well
- the method LoadFromFile now offers an auto-detection option
- the new method DistanceOfObjects calculates the multivariate distance of rows
- the methods MakeValidColRange, MakeValidRowRange, MakeValidLayerRange and MakeValidTSlotRange provide a means to check and correct array indices
- the methods TMat4D.ConvertLinTo3DAddr and TMat4D.Lin3DAddr linearize 3D array indices
- the method EdgeVector calculates various parameters along the edge of a matrix
- the type declaration TEdgeOp specifies edge operations
- the method EMult provides elementwise multiplication of matrices
- the method CopyFromVec now provides an overloaded version to copy either row or column vectors
- the new method Square calculates A'A (the square) of the matrix A
- TMat4D has been optimized to reduce memory requirements for arrays with a low number of time slots
- TMatrix.Percentile and TMat4D.Percentile offer now an overloaded version which is much faster for big data sets
- TMat3D.MinMax implemented
- TMatrix.MeanCenterColumns and TMatrix.MeanCenterRows now automatically adjust the size of the vector parameter "means"
- the method MeanVec calculates the column or row means of a matrix
- the method Multiply is now available in a second overloaded version working on vectors
- the new methods TMat3D.CopyLayerToMatrix and TMat3D.CopyMatrixToLayer copy data between a layer and a two-dimensional matrix
- TMatrix.Invert can now be aborted by setting AbortMathProc to TRUE

- Release 10.3 [Oct-06, 2014]

- the new methods TMatrix.ResizeAndClear and TMat4D.ResizeAndClear both resize and clear the matrix in one step
- TMat4D.Assign implemented
- TMat4D.MinimumOfLayersToMatrix and TMat4D.MaximumOfLayersToMatrix retrieves the minimum and maximum of a range of layers of a 4D matrix, respectively
- TMat4D.CopyFrom copies parts of another matrix into its own data area
- TMat4D.CopyTimeSlotToMat3D copies part of a time slot into a 3D matrix
- TMat4D.CopyMat3DToTimeSlot copies a 3D matrix into a particular time slot
- TMat3D.Clone and TMat4D.Clone implemented
- the method TMat4D.Resample allows to resample the data of the matrix
- bug fix: ReadFromXMLStream did not adjust matrix size under certain conditions
- bug fix: TMatrix.SkewKurtSample and TIntMatrix.SkewKurtSample caused an integer overflow for large matrices

- Release 10.2 [May-30, 2013]

- the new method TMat4D.Percentile calculates percentiles of a 4-dimensional matrix
- the new methods FillDiag (Matrix) and FillDiag (Mat4D) allow to set the diagonal of a matrix
- the missing method Assign has been implemented
- bug fix: TMat4D caused a memory leak

- Release 10.1 [Oct-29, 2012]

- the new method TMatrix.Norm returns various matrix norms
- new method TMat4D.FillLayer and TMat4D.Sum implemented
- new methods TMatrix.LoadBinary, TMatrix.ReadBinaryHeader and TMatrix.SaveBinary support loading and saving matrices in binary format
- the new method TMatrix.Correlate calculates the correlation coeffient of two matrices
- the methods TMat4D.StdDevOfLayersToMatrix and TMat4D.MeanOfLayersToMatrix now provide a call to the MathFeedback
- the new method MeanVar calculates mean and variance of a particular range of the matrix
- the new method SAdd adds a scalar to the matrix
- the new method CopyMatrixToLayer allows to copy the contents of a 2D matrix into a 4D layer
- bug fix: missing overloaded version of TIntMatrix.LoadFromStream implemented

- Release 10.0 [Oct-4, 2011]

- new class TMat4D allows to manage 4-dimensional hypercube matrices
- matrix classes can now be set to zero dimensions
- TMatrix.CopyFrom offers now an additional overloaded version to copy data from integer matrices (TIntMatrix).
- the methods SaveToStream and LoadFromStream now support file streams, as well
- new method TransposeAndMultiply allows to transpose and multiply in one step
- the new methods FillRandomGauss and FillRandomUniform fill the matrix of type TMatrix, TIntMatrix and TMat3D with uniformly or normally distributed random numbers

- Release 9.7 [May-31, 2010]

- new method CRCofData calculates the CRC over all matrix cells
- new methods MirrorColumns and MirrorRows allow to mirror the matrix
- new methods ExchangeRows and ExchangeColumns allow to exchange to rows or columns of a matrix
- new function FindInSortedColumn searches a sorted column by a binary search
- bug fix: depending on the data the calculation of the determinant resulted in a wrong sign (but correct absolute values) for matrices of even dimension (bug was introduced with release 9.51)
- bug fix: sorting the matrix (both rows and columns) does no longer reduce the numeric precision to 12 significant digits

- Release 9.51 [Dec-01, 2008]

- bug fix: methods Determinant and LUDecomposition now work correctly if first diagonal element is zero

- Release 9.5 [Oct-31, 2008]

- new method Find searches for particular element in matrix
- MeanCenterColumns and MeanCenterRows implemented
- bug fix: methods Quartiles and Percentile calculate now more appropriate values for very small samples

- Release 9.0 [May-28, 2007]

- the matrix inversion routine now works for matrices with very small values, too.

- Release 8.5 [Feb-18, 2006]

- bug fix: method Percentile now calculates correct values (bug emerged only for less than 100 selected elements)

- Release 8.2 [Nov-03, 2004]

- bug fix: method Transpose works now correctly

- Release 8.1 [Aug-29, 2004]

- available for
**Delphi™ 8 for .NET**

- available for
- Release 8.0 [Apr-15, 2004]

- CalcDistMat now provides event
**OnCalcDistance**if distance measure is user defined - new distance measure
**Dice coefficient**

- CalcDistMat now provides event
- Release 7.2 [Mar-23, 2003]

- MATRIX is now part of MathPack
**TMatrix**,**TIntMatrix**and**TMat3D**are now components (no longer inherited from TObject)- properties
**NrOfRows**,**NrOfCols**,**NrOfLayers**are no longer read-only and published - property
**DataID**is now published - bug fix: Resize of TMat3D works now properly

- Release 7.0 [Sep-15, 2002]

- available for
**Delphi™ 7.0** - the unit is now CLX compatible
**Percentile**function implemented

- available for
- Release 6.5 [May-28, 2002]

- available for
**C++Builder™ 6.0** - new methods to export/import matrix data to/from XML files or streams:
**LoadFromXMLFile**,**ReadFromOpenXMLFile**,**ReadFromXMLStream**,**SaveAsXMLFile**,**WriteToOpenXMLFile**,**WriteToXMLStream** - property
**DataID**implemented - bug fix: sorting routine can now handle matrices with more than 65535 rows/columns

- available for
- Release 6.0 [Aug-06, 2001]

- available for
**Delphi™ 6.0** - new method
**SkewKurtSample**of TMatrix and TIntMatrix implemented - methods
**GeometricMean**and**HarmonicMean**implemented - bug fix: SkewKurt now calculates the skewness correctly

- available for
- Release 5.5 [Jun-09, 2000]

- available for
**C++Builder™ 5.0** **LoadFromStream**and**SaveToStream**for TMatrix and TIntMatrix implemented**sparse Matrix**implemented

- available for
- Release 5.0 [Oct-07, 1999]

- MATRIX is now available for
**Delphi™ 5.0**(as part of the SDL Component Suite 5.0) **LoadFromFile**of TMatrix and TIntMatrix extended

- MATRIX is now available for
- Release 1.8 [Mar-28, 1999]

- TMatrix & TIntMatrix have now
**OnSortExchange**events - method
**Clone**implemented - method
**Resize**now does not execute if the new dimensions are equal to the old ones - method
**Trace**implemented - property
**Elem**is now default property **LU decomposition**implemented- function
**Determinant**implementedRelease 1.1 (Feb-12, 1997) :

- new class
**TIntMatrix**implemented - bug in method
**Destroy**fixed, which resulted in occasional memory allocation problems - new methods:
**Add**,**Subtract**, and**SMult**

- TMatrix & TIntMatrix have now
- Release 1.7 [Aug-12, 1998]

- MATRIX is now available for
**Delphi™ 4.0** **Mat3D**has now**Resize**method- bug fix: resize methods of TMatrix and TIntMatrix now function properly also in 16-bit mode
**CalcDistMat**(TMatrix) implemented- method
**Histogram**implemented

- MATRIX is now available for
- Release 1.6 (Feb-14, 1998):

- new method
**Quartiles** - bug fix: TMatrix and TIntMatrix are now
**classes of TObject** - new event:
**OnChange**(both TMatrix and TIntMatrix) - new method
**Change**implemented **ESDLMatrixError**replaces ELocompError- MATRIX is now available for all versions of
**Delphi™**(1.0, 2.0, 3.0), and for**C++Builder™**(1.0 and**3.0**) **TMat3D**implemented**CopyRowToVec**,**CopyColToVec**implemented**StandardizeColumns**, and**StandardizeRows**implemented- bug in resize fixed: access violation for large matrices
- create now initializes all elements to zero values
- method
**Sum**implemented - bug fixed which caused strange behavior for zero or negative array dimensions on create

- new method
- Release 1.5 (May-28, 1997)

- bug in
**Resize**fixed, which restricted 32-bit matrices to 64k - method
**Transpose**implemented - MATRIX is now available for
**all three versions of Delphi™**and for**C++Builder™**

- bug in