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
파일 보기 프로젝트 열기: markrogoyski/math-php

공개 메소드들

메소드 설명
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