PHP Класс MathPHP\LinearAlgebra\MatrixAxiomsTest

If all the Matrix math is implemented properly, these tests should all work out according to the axioms. Axioms tested: - Addition - r(A + B) = rA + rB - Multiplication - (AB)C = A(BC) - A(B + C) = AB + BC - r(AB) = (rA)B = A(rB) - Identity - AI = A = IA - Inverse - AA⁻¹ = I = A⁻¹A - (A⁻¹)⁻¹ = A - (AB)⁻¹ = B⁻¹A⁻¹ - Transpose - (Aᵀ)ᵀ = A - (A⁻¹)ᵀ = (Aᵀ)⁻¹ - (rA)ᵀ = rAᵀ - (AB)ᵀ = BᵀAᵀ - (A + B)ᵀ = Aᵀ + Bᵀ - Trace - tr(A) = tr(Aᵀ) - tr(AB) = tr(BA) - Determinant - det(A) = det(Aᵀ) - det(AB) = det(A)det(B) - LU Decomposition (PA = LU) - PA = LU - A = P⁻¹LU - PPᵀ = I = PᵀP - (PA)⁻¹ = (LU)⁻¹ = U⁻¹L⁻¹ - P⁻¹ = Pᵀ - System of linear equations (Ax = b) - Ax - b = 0 - x = A⁻¹b - Symmetric matrix - A = Aᵀ - A⁻¹Aᵀ = I - Kronecker product - A ⊗ (B + C) = A ⊗ B + A ⊗ C - (A + B) ⊗ C = A ⊗ C + B ⊗ C - (A ⊗ B) ⊗ C = A ⊗ (B ⊗ C) - (kA) ⊗ B = A ⊗ (kB) = k(A ⊗ B) - (A ⊗ B)⁻¹ = A⁻¹ ⊗ B⁻¹ - (A ⊗ B)ᵀ = Aᵀ ⊗ Bᵀ - det(A ⊗ B) = det(A)ᵐ det(B)ⁿ
Наследование: extends PHPUnit_Framework_TestCase
Показать файл Открыть проект

Открытые методы

Метод Описание
dataProviderForInverse ( )
dataProviderForInverseProductIsReverseProductOfInverses ( )
dataProviderForKroneckerProductDeterminant ( )
dataProviderForMatrixTimesIdentityIsOriginalMatrix ( )
dataProviderForMultiplicationIsAssociative ( )
dataProviderForMultiplicationIsDistributive ( )
dataProviderForOneSquareMatrix ( )
dataProviderForScalarMultiplicationOrder ( )
dataProviderForScalarMultiplicationOrderAddition ( )
dataProviderForSolve ( )
dataProviderForSymmetric ( )
dataProviderForThreeMatrices ( )
dataProviderForTwoSquareMatrices ( )
testDeterminantProductSameAsProductOfDeterminants ( array $A, array $B ) det(AB) = det(A)det(B) Determinant of product of matrices is the same as the product of determinants.
testDeterminantSameAsDeterminantOfTranspose ( array $A ) det(A) = det(Aᵀ) Determinant of matrix is the same as determinant of transpose.
testInverseOfInverseIsOriginalMatrix ( array $A ) Axiom: (A⁻¹)⁻¹ = A Inverse of inverse is the original matrix.
testInverseProductIsReverseProductOfInverses ( array $A, array $B ) (AB)⁻¹ = B⁻¹A⁻¹ The inverse of a product is the reverse product of the inverses.
testInverseWithLUDecompositionInverse ( array $A ) (PA)⁻¹ = (LU)⁻¹ = U⁻¹L⁻¹ Inverse of the LU decomposition equation is the inverse of the other side.
testKroneckerProductAssociativity ( array $A, array $B, array $C ) Axiom: (A ⊗ B) ⊗ C = A ⊗ (B ⊗ C) Kronecker product associative
testKroneckerProductBilinearity1 ( array $A, array $B, array $C ) Axiom: A ⊗ (B + C) = A ⊗ B + A ⊗ C Kronecker product bilinearity
testKroneckerProductBilinearity2 ( array $A, array $B, array $C ) Axiom: (A + B) ⊗ C = A ⊗ C + B ⊗ C Kronecker product bilinearity
testKroneckerProductDeterminant ( array $A, array $B ) Axiom: det(A ⊗ B) = det(A)ᵐ det(B)ⁿ Determinant of Kronecker product - where A is nxn matrix, and b is nxn matrix
testKroneckerProductInverse ( array $A, array $B ) Axiom: (A ⊗ B)⁻¹ = A⁻¹ ⊗ B⁻¹ Inverse of Kronecker product
testKroneckerProductScalarMultiplication ( array $A, array $B ) Axiom: (kA) ⊗ B = A ⊗ (kB) = k(A ⊗ B) Kronecker product scalar multiplication
testKroneckerProductTranspose ( array $A, array $B ) Axiom: (A ⊗ B)ᵀ = Aᵀ ⊗ Bᵀ Transpose of Kronecker product
testLUDecompositionAEqualsPInverseLU ( array $A ) A = P⁻¹LU
testLUDecompositionPAEqualsLU ( array $A ) PA = LU Basic LU decomposition property that permutation matrix times the matrix is the product of the lower and upper decomposition matrices.
testLUDecompositionPPTransposeEqualsIdentity ( array $A ) PPᵀ = I = PᵀP Permutation matrix of the LU decomposition times the transpose of the permutation matrix is the identity matrix.
testMatrixTimesIdentityIsOriginalMatrix ( array $A ) Axiom: AI = A = IA Matrix multiplied with the identity matrix is the original matrix.
testMatrixTimesInverseIsIdentity ( array $A, array $A⁻¹ ) Axiom: AA⁻¹ = I = A⁻¹A Matrix multiplied with its inverse is the identity matrix.
testMultiplicationIsAssociative ( array $A, array $B, array $C ) Axiom: (AB)C = A(BC) Matrix multiplication is associative
testMultiplicationIsDistributive ( array $A, array $B, array $C ) Axiom: A(B + C) = AB + AC Matrix multiplication is distributive
testPInverseEqualsPTranspose ( array $A ) P⁻¹ = Pᵀ Inverse of the permutation matrix equals the transpose of the permutation matrix
testScalarMultiplcationOrder ( array $A, array $B, integer $r ) Axiom: r(AB) = (rA)B = A(rB) Order of scalar multiplication does not matter.
testScalarMultiplicationOfTransposeOrder ( array $A ) (rA)ᵀ = rAᵀ Scalar multiplication order does not matter for transpose
testScalarMultiplicationOrderAddition ( array $A, array $B, integer $r ) Axiom: r(A + B) = rA + rB Order of scalar multiplication does not matter.
testSolveEquationForZero ( array $A, array $b, array $x, array $zeros ) Axiom: Ax - b = 0 Matrix multiplied with unknown x vector subtract solution b is 0
testSolveInverseBEqualsX ( array $A, array $b, array $x, array $zeros ) Axiom: x = A⁻¹b Matrix multiplied with unknown x vector subtract solution b is 0
testSymmetricEqualsTranspose ( array $A ) Axiom: A = Aᵀ Symmetric matrix is the same as its transpose
testSymmetricInverseTranposeEqualsIdentity ( array $A ) Axiom: A⁻¹Aᵀ = I Symmetric matrix inverse times tranpose equals identity matrix
testTraceIsSameAsTraceOfTranspose ( array $A ) tr(A) = tr(Aᵀ) Trace is the same as the trace of the transpose
testTraceOfProductIsSameRegardlessOfOrderMultiplied ( array $A, array $B ) tr(AB) = tr(BA) Trace of product does not matter the order they were multiplied
testTransposeOfInverseIsInverseOfTranspose ( array $A ) (A⁻¹)ᵀ = (Aᵀ)⁻¹ The transpose of the inverse is the inverse of the transpose.
testTransposeOfTransposeIsOriginalMatrix ( array $A ) (Aᵀ)ᵀ = A The transpose of the transpose is the original matrix.
testTransposeProductIsProductOfTranposesInReverseOrder ( array $A, array $B ) (AB)ᵀ = BᵀAᵀ Transpose of a product of matrices equals the product of their transposes in reverse order.
testTransposeSumIsSameAsSumOfTransposes ( array $A, array $B ) (A + B)ᵀ = Aᵀ + Bᵀ Transpose of sum is the same as sum of transposes

Описание методов

dataProviderForInverse() публичный Метод

dataProviderForInverseProductIsReverseProductOfInverses() публичный Метод

dataProviderForKroneckerProductDeterminant() публичный Метод

dataProviderForMatrixTimesIdentityIsOriginalMatrix() публичный Метод

dataProviderForMultiplicationIsAssociative() публичный Метод

dataProviderForMultiplicationIsDistributive() публичный Метод

dataProviderForOneSquareMatrix() публичный Метод

dataProviderForScalarMultiplicationOrder() публичный Метод

dataProviderForScalarMultiplicationOrderAddition() публичный Метод

dataProviderForSolve() публичный Метод

dataProviderForSymmetric() публичный Метод

dataProviderForThreeMatrices() публичный Метод

dataProviderForTwoSquareMatrices() публичный Метод

testDeterminantProductSameAsProductOfDeterminants() публичный Метод

det(AB) = det(A)det(B) Determinant of product of matrices is the same as the product of determinants.

testDeterminantSameAsDeterminantOfTranspose() публичный Метод

det(A) = det(Aᵀ) Determinant of matrix is the same as determinant of transpose.

testInverseOfInverseIsOriginalMatrix() публичный Метод

Axiom: (A⁻¹)⁻¹ = A Inverse of inverse is the original matrix.

testInverseProductIsReverseProductOfInverses() публичный Метод

(AB)⁻¹ = B⁻¹A⁻¹ The inverse of a product is the reverse product of the inverses.

testInverseWithLUDecompositionInverse() публичный Метод

(PA)⁻¹ = (LU)⁻¹ = U⁻¹L⁻¹ Inverse of the LU decomposition equation is the inverse of the other side.

testKroneckerProductAssociativity() публичный Метод

Axiom: (A ⊗ B) ⊗ C = A ⊗ (B ⊗ C) Kronecker product associative

testKroneckerProductBilinearity1() публичный Метод

Axiom: A ⊗ (B + C) = A ⊗ B + A ⊗ C Kronecker product bilinearity

testKroneckerProductBilinearity2() публичный Метод

Axiom: (A + B) ⊗ C = A ⊗ C + B ⊗ C Kronecker product bilinearity

testKroneckerProductDeterminant() публичный Метод

Axiom: det(A ⊗ B) = det(A)ᵐ det(B)ⁿ Determinant of Kronecker product - where A is nxn matrix, and b is nxn matrix

testKroneckerProductInverse() публичный Метод

Axiom: (A ⊗ B)⁻¹ = A⁻¹ ⊗ B⁻¹ Inverse of Kronecker product

testKroneckerProductScalarMultiplication() публичный Метод

Axiom: (kA) ⊗ B = A ⊗ (kB) = k(A ⊗ B) Kronecker product scalar multiplication

testKroneckerProductTranspose() публичный Метод

Axiom: (A ⊗ B)ᵀ = Aᵀ ⊗ Bᵀ Transpose of Kronecker product

testLUDecompositionAEqualsPInverseLU() публичный Метод

A = P⁻¹LU

testLUDecompositionPAEqualsLU() публичный Метод

PA = LU Basic LU decomposition property that permutation matrix times the matrix is the product of the lower and upper decomposition matrices.

testLUDecompositionPPTransposeEqualsIdentity() публичный Метод

PPᵀ = I = PᵀP Permutation matrix of the LU decomposition times the transpose of the permutation matrix is the identity matrix.

testMatrixTimesIdentityIsOriginalMatrix() публичный Метод

Axiom: AI = A = IA Matrix multiplied with the identity matrix is the original matrix.

testMatrixTimesInverseIsIdentity() публичный Метод

Axiom: AA⁻¹ = I = A⁻¹A Matrix multiplied with its inverse is the identity matrix.
public testMatrixTimesInverseIsIdentity ( array $A, array $A⁻¹ )
$A array
$A⁻¹ array

testMultiplicationIsAssociative() публичный Метод

Axiom: (AB)C = A(BC) Matrix multiplication is associative

testMultiplicationIsDistributive() публичный Метод

Axiom: A(B + C) = AB + AC Matrix multiplication is distributive

testPInverseEqualsPTranspose() публичный Метод

P⁻¹ = Pᵀ Inverse of the permutation matrix equals the transpose of the permutation matrix

testScalarMultiplcationOrder() публичный Метод

Axiom: r(AB) = (rA)B = A(rB) Order of scalar multiplication does not matter.

testScalarMultiplicationOfTransposeOrder() публичный Метод

(rA)ᵀ = rAᵀ Scalar multiplication order does not matter for transpose

testScalarMultiplicationOrderAddition() публичный Метод

Axiom: r(A + B) = rA + rB Order of scalar multiplication does not matter.

testSolveEquationForZero() публичный Метод

Axiom: Ax - b = 0 Matrix multiplied with unknown x vector subtract solution b is 0
public testSolveEquationForZero ( array $A, array $b, array $x, array $zeros )
$A array
$b array
$x array
$zeros array

testSolveInverseBEqualsX() публичный Метод

Axiom: x = A⁻¹b Matrix multiplied with unknown x vector subtract solution b is 0
public testSolveInverseBEqualsX ( array $A, array $b, array $x, array $zeros )
$A array
$b array
$x array
$zeros array

testSymmetricEqualsTranspose() публичный Метод

Axiom: A = Aᵀ Symmetric matrix is the same as its transpose

testSymmetricInverseTranposeEqualsIdentity() публичный Метод

Axiom: A⁻¹Aᵀ = I Symmetric matrix inverse times tranpose equals identity matrix

testTraceIsSameAsTraceOfTranspose() публичный Метод

tr(A) = tr(Aᵀ) Trace is the same as the trace of the transpose

testTraceOfProductIsSameRegardlessOfOrderMultiplied() публичный Метод

tr(AB) = tr(BA) Trace of product does not matter the order they were multiplied

testTransposeOfInverseIsInverseOfTranspose() публичный Метод

(A⁻¹)ᵀ = (Aᵀ)⁻¹ The transpose of the inverse is the inverse of the transpose.

testTransposeOfTransposeIsOriginalMatrix() публичный Метод

(Aᵀ)ᵀ = A The transpose of the transpose is the original matrix.

testTransposeProductIsProductOfTranposesInReverseOrder() публичный Метод

(AB)ᵀ = BᵀAᵀ Transpose of a product of matrices equals the product of their transposes in reverse order.

testTransposeSumIsSameAsSumOfTransposes() публичный Метод

(A + B)ᵀ = Aᵀ + Bᵀ Transpose of sum is the same as sum of transposes