Click or drag to resize
sqx

Matrix Structure

Matrix Data Type

Namespace:  sqx
Assembly:  SQX (in SQX.dll) Version: 1.0.2.6 (1.0.2.6)
Syntax
C#
[SerializableAttribute]
public struct Matrix : INullable, IBinarySerialize

The Matrix type exposes the following members.

Properties
  NameDescription
Public propertyIsSquareMatrix
[bit] Is Square Matrix
Public propertyCode exampleM
[int] M (Rows)
Public propertyCode exampleN
[int] N (Columns)
Top
Methods
  NameDescription
Public methodCode exampleAddition
[Matrix] Addition([Matrix] B)
Public methodCode exampleAdjugate
[Matrix] Adjugate()
Public methodAllOnesMatrix
[Matrix] AllOnesMatrix()
Public methodAvg
[Vector] Avg()
Public methodCofactor
[float] Cofactor([int] i, [int] j)
Public methodCofactorMatrix
[Matrix] CofactorMatrix()
Public methodColumnPermutationMatrix
[Matrix] ColumnPermutationMatrix()
Public methodColumnVector
[Vector] ColumnVector([int] m)
Public methodCovariance
[Matrix] Covariance([bit] Population)
Public methodDeleteColumn
[Matrix] DeleteColumn([int] j)
Public methodDeleteRow
[Matrix] DeleteRow([int] i)
Public methodDeterminant
[float] Determinant()
Public methodCode exampleDiagonal
[Matrix] Diagonal()
Public methodCode exampleDiagonalVector
[Vector] DiagonalVector()
Public methodCode exampleDirectSum
[Matrix] DirectSum([Matrix] B)
Public methodExponential
[Matrix] Exponential()
Public methodGetValue
[float] GetValue([int] i, [int] j)
Public methodCode exampleHadamardProduct
[Matrix] HadamardProduct([Matrix] B)
Public methodIdentityMatrix
[Matrix] IdentityMatrix()
Public methodInverse
[Matrix] Inverse()
Public methodIsValid
[bit] IsValid()
Public methodCode exampleKroneckerProduct
[Matrix] KroneckerProduct([Matrix] B)
Public methodCode exampleKroneckerSum
[Matrix] KroneckerSum([Matrix] B)
Public methodLeftDivision
[Matrix] LeftDivision([Matrix] B)
Public methodMaxVector
[Vector] MaxVector()
Public methodMinMaxNormalize
[Matrix] MinMaxNormalize()
Public methodMinor
[float] Minor([int] i, [int] j)
Public methodCode exampleMinus
[Matrix] Minus()
Public methodMinVector
[Vector] MinVector()
Public methodNorm
[float] Norm()
Public methodCode examplePower
[Matrix] Power([int] p)
Public methodCode exampleProduct
[Matrix] Product([Matrix] B)
Public methodRightDivision
[Matrix] RightDivision([Matrix] B)
Public methodRound
[Matrix] Round([int] r)
Public methodRowVector
[Vector] RowVector([int] n)
Public methodScalarProduct
[Matrix] ScalarProduct([float] Scalar)
Public methodSetValue
[Matrix] SetValue([float] Value, [int] i, [int] j)
Public methodSetVector
[Matrix] SetVector([Vector] V, [int] iOrj, [bit] ColumnVector)
Public methodStandardize
[Matrix] Standardize([bit] Population)
Public methodStandardizeInverse
[Matrix] StandardizeInverse([Vector] Means, [Vector] StDevs)
Public methodStDev
[Vector] StDev()
Public methodStDevp
[Vector] StDevp()
Public methodCode exampleSubtraction
[Matrix] Subtraction([Matrix] B)
Public methodCode exampleTableString
[nvarchar](max) TableString([int] OptionType)
Public methodToString
[nvarchar](max) ToString()
(Overrides ValueTypeToString.)
Public methodTrace
[float] Trace()
Public methodCode exampleTranspose
[Matrix] Transpose()
Public methodUnitMatrix
[Matrix] UnitMatrix([int] i, [int] j)
Public methodVar
[Vector] Var()
Public methodVarp
[Vector] Varp()
Public methodZeroMatrix
[Matrix] ZeroMatrix()
Top
Remarks
Matrix support up to 2GB of memory, identical to varbinary(max).
NOTE: Matrix do not support NULL values inside the Matrix but the Matrix can be NULL.

Attributes

Format.UserDefined, IsByteOrdered = false, IsFixedLength = false, MaxByteSize = -1
Examples
SQL
-- 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*/
See Also