Matrix Structure |
Namespace: sqx
[SerializableAttribute] public struct Matrix : INullable, IBinarySerialize
The Matrix type exposes the following members.
| Name | Description | |
|---|---|---|
| IsSquareMatrix | [bit] Is Square Matrix
| |
| M | [int] M (Rows)
| |
| N | [int] N (Columns)
|
| Name | Description | |
|---|---|---|
| Addition | [Matrix] Addition([Matrix] B) | |
| Adjugate | [Matrix] Adjugate() | |
| AllOnesMatrix | [Matrix] AllOnesMatrix() | |
| Avg | [Vector] Avg() | |
| Cofactor | [float] Cofactor([int] i, [int] j) | |
| CofactorMatrix | [Matrix] CofactorMatrix() | |
| ColumnPermutationMatrix | [Matrix] ColumnPermutationMatrix() | |
| ColumnVector | [Vector] ColumnVector([int] m) | |
| Covariance | [Matrix] Covariance([bit] Population) | |
| DeleteColumn | [Matrix] DeleteColumn([int] j) | |
| DeleteRow | [Matrix] DeleteRow([int] i) | |
| Determinant | [float] Determinant() | |
| Diagonal | [Matrix] Diagonal() | |
| DiagonalVector | [Vector] DiagonalVector() | |
| DirectSum | [Matrix] DirectSum([Matrix] B) | |
| Exponential | [Matrix] Exponential() | |
| GetValue | [float] GetValue([int] i, [int] j) | |
| HadamardProduct | [Matrix] HadamardProduct([Matrix] B) | |
| IdentityMatrix | [Matrix] IdentityMatrix() | |
| Inverse | [Matrix] Inverse() | |
| IsValid | [bit] IsValid() | |
| KroneckerProduct | [Matrix] KroneckerProduct([Matrix] B) | |
| KroneckerSum | [Matrix] KroneckerSum([Matrix] B) | |
| LeftDivision | [Matrix] LeftDivision([Matrix] B) | |
| MaxVector | [Vector] MaxVector() | |
| MinMaxNormalize | [Matrix] MinMaxNormalize() | |
| Minor | [float] Minor([int] i, [int] j) | |
| Minus | [Matrix] Minus() | |
| MinVector | [Vector] MinVector() | |
| Norm | [float] Norm() | |
| Power | [Matrix] Power([int] p) | |
| Product | [Matrix] Product([Matrix] B) | |
| RightDivision | [Matrix] RightDivision([Matrix] B) | |
| Round | [Matrix] Round([int] r) | |
| RowVector | [Vector] RowVector([int] n) | |
| ScalarProduct | [Matrix] ScalarProduct([float] Scalar) | |
| SetValue | [Matrix] SetValue([float] Value, [int] i, [int] j) | |
| SetVector | [Matrix] SetVector([Vector] V, [int] iOrj, [bit] ColumnVector) | |
| Standardize | [Matrix] Standardize([bit] Population) | |
| StandardizeInverse | [Matrix] StandardizeInverse([Vector] Means, [Vector] StDevs) | |
| StDev | [Vector] StDev() | |
| StDevp | [Vector] StDevp() | |
| Subtraction | [Matrix] Subtraction([Matrix] B) | |
| TableString | [nvarchar](max) TableString([int] OptionType) | |
| ToString | [nvarchar](max) ToString() (Overrides ValueTypeToString.) | |
| Trace | [float] Trace() | |
| Transpose | [Matrix] Transpose() | |
| UnitMatrix | [Matrix] UnitMatrix([int] i, [int] j) | |
| Var | [Vector] Var() | |
| Varp | [Vector] Varp() | |
| ZeroMatrix | [Matrix] ZeroMatrix() |
-- NOTE: The print and ToString() method are useful to test or debug declare @A sqx.Matrix = sqx.RandomMatrix(4,4,2), @B sqx.Matrix print '*** B=A ***' select @B = @A print @B.ToString() print '*** AB ***' print @A.Product(@B).ToString() print '*** BA ***' print @B.Product(@A).ToString() print '*** e(A) * e(B) ***' print @A.Exponential().Product(@B.Exponential()).ToString() print '*** e(A + B) *** NOTE: e(A) * e(B) = e(A + B) if and only if AB = BA' print @A.Addition(@B).Exponential().ToString() print '*** e(A) * e(-B) = I *** (With small error)' print @A.Exponential().Product(@B.Minus().Exponential()).ToString() print '*** e(A) * e(-B) = I *** Round(14)' print @A.Exponential().Product(@B.Minus().Exponential()).Round(14).ToString() /* *** B=A *** 0.771093898346226,0.404162594771088,0.165998670349828,0.985047052607428; 0.109004633551931,0.306680407983568,0.802140461188806,0.445546678940554; 0.224983153969507,0.0112066529743404,0.765367340652909,0.0287435907073056; 0.00756119052300285,0.510022416948351,0.382094984586395,0.279408783316337 *** AB *** 0.683436428454136,0.939852428295362,0.95562723126576,1.21963927001865; 0.30131934752434,0.374336572021181,1.04826865116159,0.391561182853691; 0.347116808368387,0.117603717983305,0.643106162181641,0.25664269700688; 0.149502792331879,0.306256582170913,0.809568481304923,0.323738972538041 *** BA *** 0.683436428454136,0.939852428295362,0.95562723126576,1.21963927001865; 0.30131934752434,0.374336572021181,1.04826865116159,0.391561182853691; 0.347116808368387,0.117603717983305,0.643106162181641,0.25664269700688; 0.149502792331879,0.306256582170913,0.809568481304923,0.323738972538041 *** e(A) * e(B) *** 6.77850944538221,6.17284082598166,9.27702076218408,8.76243363426655; 2.47378284657182,3.86994683810226,7.62119406268057,3.70862481083082; 2.40470006112609,1.37591910752465,6.28663273989425,2.15354068712646; 1.44897501311771,2.69366101893238,5.32755388118214,3.58293936490456 *** e(A + B) *** NOTE: e(A) * e(B) = e(A + B) if and only if AB = BA 6.77850944538221,6.17284082598166,9.27702076218408,8.76243363426656; 2.47378284657182,3.86994683810226,7.62119406268057,3.70862481083082; 2.40470006112609,1.37591910752466,6.28663273989425,2.15354068712646; 1.44897501311771,2.69366101893238,5.32755388118214,3.58293936490456 *** e(A) * e(-B) = I *** (With small error) 1,3.33066907387547E-16,-1.11022302462516E-16,1.11022302462516E-15; 2.08166817117217E-17,1,3.46944695195361E-16,3.33066907387547E-16; 6.93889390390723E-18,5.55111512312578E-17,1,1.38777878078145E-16; -1.38777878078145E-17,0,2.4980018054066E-16,1 *** e(A) * e(-B) = I *** Round(14) 1,0,0,0; 0,1,0,0; 0,0,1,0; 0,0,0,1*/