PHP Класс MathPHP\LinearAlgebra\VectorAxiomsTest

If all the Vector math is implemented properly, these tests should all work out according to the axioms. Axioms tested: - Norms - |x|₂ ≤ |x|₁ ≤ √n |x|₂ - |x|∞ ≤ |x|₂ ≤ √n |x|∞ - |x|∞ ≤ |x|₁ ≤ √n |x|∞ - Dot product - A⋅B = B⋅A - 0⋅A = A⋅0 = 0 - Cross product - A x B = -(B x A) - A x 0 = 0 - A x (B + C) = (A x B) + (A x C) - Cross product / dot product - (A x B) ⋅ A = 0 - (A x B) ⋅ B = 0 - A ⋅ (B x C) = (A x B) ⋅ C - A x (B x C) = (A ⋅ C)B - (A ⋅ B)C - Outer product - A⨂B = ABᵀ - Scalar multiplication - (c + d)A = cA + dA - c(A + B) = cA + cB - 1A = A - 0A = 0 - -1A = -A - Perpendicular / Perp dot product - A⋅A⊥ = 0 - A⊥⋅A = 0 - A⋅A⊥ = -A⊥⋅A - Projections / Perps - projᵇA + perpᵇA = A - |projᵇA|² + |perpᵇA|² = |A|² - projᵇA ⋅ perpᵇA = 0 - |projᵇA⊥ ⋅ perpᵇA| = |projᵇA| |perpᵇA|
Наследование: extends PHPUnit_Framework_TestCase
Показать файл Открыть проект

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

Метод Описание
dataProviderForAdditiveInverse ( )
dataProviderForCrossProduct ( )
dataProviderForCrossProductThreeVectors ( )
dataProviderForDotProductZero ( )
dataProviderForOuterProduct ( )
dataProviderForPerpendicularIdentity ( )
dataProviderForProjPerp ( )
dataProviderForSingleVector ( )
dataProviderForTwoVectors ( )
testAdditivityInTheScalarForScalarMultiplication ( array $A ) Axiom: (c + d)A = cA + dA Additivity in the scalar
testAdditivityInTheVectorForScalarMultiplication ( array $A, array $B ) Axiom: c(A + B) = cA + cB Additivity in the vector
testCrossProductDistributivity ( array $A, array $B, array $C ) Axiom: A x (B + C) = (A x B) + (A x C) Cross product distributivity
testCrossProductInnerProductWithEitherVectorIsZero ( array $A, array $B ) Axiom: (A x B) ⋅ A = 0 Axiom: (A x B) ⋅ B = 0 Dot product of either vector with the cross product is always zero.
testCrossProductLagrangeFormula ( array $A, array $B, array $C ) Axiom: A x (B x C) = (A ⋅ C)B - (A ⋅ B)C Lagrange's formula
testCrossProductPropertyOfZero ( array $A, array $_ ) Axiom: A x 0 = 0 Cross product property of 0
testCrossProductVolumeProperty ( array $A, array $B, array $C ) Axiom: A ⋅ (B x C) = (A x B) ⋅ C Cross product volumn property
testDotProductCommutative ( array $A, array $B ) Axiom: A⋅B = B⋅A Dot product is commutative
testDotProductZero ( array $A, array $zero ) Axiom: 0⋅A = A⋅0 = 0 Dot product of a vector and zero is zero.
testL2NormLessThanL1NormLessThanSqrtNL2Norm ( array $V ) Axiom: |x|₂ ≤ |x|₁ ≤ √n |x|₂ l²-norm is less than equal to l₁-norm which is less than equal to sqrt n * l²-norm.
testMaxNormLessThanEqualL1NormLessThanEqualSqrtNMaxNorm ( array $V ) Axiom: |x|∞ ≤ |x|₁ ≤ √n |x|∞ Max norm is less than equal to l₁-norm which is less than equal to sqrt n * max norm.
testMaxNormLessThtanEQualL2NormLessThanEqualSqrtNMaxNorm ( array $V ) Axiom: |x|∞ ≤ |x|₂ ≤ √n |x|∞ Max norm is less than equal to l₂-norm which is less than equal to sqrt n * max norm.
testOuterProductIsMatrixMultiplicationOfAAndBTranspose ( array $A, array $B ) Axiom: A⨂B = ABᵀ Outer product is the same as matrix multiplication of A and transpose of B
testPerpDotProdcutSwapOperandsChangeSign ( array $A ) Axiom: A⋅A⊥ = -A⊥⋅A Swapping operands changes the sign of the perp dot product
testPerpDotProductZero ( array $A ) Axiom: A⊥⋅A = 0 Perp dot product with itself will be zero.
testPerpendicularDotProduct ( array $A ) Axiom: A⋅A⊥ = 0 Vector dot product with a vector perpendicular to it will be zero.
testProjPerpDotProductEqualsZero ( array $A, array $B ) Axiom: projᵇA ⋅ perpᵇA = 0 Dot product of proj and perp of A on B is 0
testProjPerpPerpDotProductEqualsProductOfLengths ( array $A, array $B ) Axiom: |projᵇA⊥ ⋅ perpᵇA| = |projᵇA| |perpᵇA| Absolute value of proj and perp dot product equals product of their lengths.
testProjPerpSumEqualsA ( array $A, array $B ) Axiom: projᵇA + perpᵇA = A Sum of the proj and perp of A on B equals A
testProjPerpSumOfSquares ( array $A, array $B ) Axiom: |projᵇA|² + |perpᵇA|² = |A|² Sum of squared lengths of proj and perp equals squared length of A
testReverseCrossProduct ( array $A, array $B ) Axiom: A x B = -(B x A) Anticommutivity: Reverse order cross product results in a negative cross product
testScalarMultiplyNegativeOneIdentity ( array $A, array $R ) Axiom: -1A = -A Additive inverse
testScalarMultiplyOneIdentity ( array $A ) Axiom: 1A = A Multiplying (scaling) by 1 does not change the vector
testScalarMultiplyZeroIdentity ( array $A ) Axiom: 0A = 0 Multiplying (scaling) by 0 gives the zero vector

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

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

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

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

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

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

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

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

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

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

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

Axiom: (c + d)A = cA + dA Additivity in the scalar

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

Axiom: c(A + B) = cA + cB Additivity in the vector

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

Axiom: A x (B + C) = (A x B) + (A x C) Cross product distributivity

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

Axiom: (A x B) ⋅ A = 0 Axiom: (A x B) ⋅ B = 0 Dot product of either vector with the cross product is always zero.

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

Axiom: A x (B x C) = (A ⋅ C)B - (A ⋅ B)C Lagrange's formula

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

Axiom: A x 0 = 0 Cross product property of 0

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

Axiom: A ⋅ (B x C) = (A x B) ⋅ C Cross product volumn property

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

Axiom: A⋅B = B⋅A Dot product is commutative
public testDotProductCommutative ( array $A, array $B )
$A array
$B array

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

Axiom: 0⋅A = A⋅0 = 0 Dot product of a vector and zero is zero.
public testDotProductZero ( array $A, array $zero )
$A array
$zero array

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

Axiom: |x|₂ ≤ |x|₁ ≤ √n |x|₂ l²-norm is less than equal to l₁-norm which is less than equal to sqrt n * l²-norm.

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

Axiom: |x|∞ ≤ |x|₁ ≤ √n |x|∞ Max norm is less than equal to l₁-norm which is less than equal to sqrt n * max norm.

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

Axiom: |x|∞ ≤ |x|₂ ≤ √n |x|∞ Max norm is less than equal to l₂-norm which is less than equal to sqrt n * max norm.

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

Axiom: A⨂B = ABᵀ Outer product is the same as matrix multiplication of A and transpose of B

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

Axiom: A⋅A⊥ = -A⊥⋅A Swapping operands changes the sign of the perp dot product

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

Axiom: A⊥⋅A = 0 Perp dot product with itself will be zero.

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

Axiom: A⋅A⊥ = 0 Vector dot product with a vector perpendicular to it will be zero.

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

Axiom: projᵇA ⋅ perpᵇA = 0 Dot product of proj and perp of A on B is 0

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

Axiom: |projᵇA⊥ ⋅ perpᵇA| = |projᵇA| |perpᵇA| Absolute value of proj and perp dot product equals product of their lengths.

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

Axiom: projᵇA + perpᵇA = A Sum of the proj and perp of A on B equals A
public testProjPerpSumEqualsA ( array $A, array $B )
$A array
$B array

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

Axiom: |projᵇA|² + |perpᵇA|² = |A|² Sum of squared lengths of proj and perp equals squared length of A
public testProjPerpSumOfSquares ( array $A, array $B )
$A array
$B array

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

Axiom: A x B = -(B x A) Anticommutivity: Reverse order cross product results in a negative cross product
public testReverseCrossProduct ( array $A, array $B )
$A array
$B array

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

Axiom: -1A = -A Additive inverse

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

Axiom: 1A = A Multiplying (scaling) by 1 does not change the vector

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

Axiom: 0A = 0 Multiplying (scaling) by 0 gives the zero vector