fudge.core.math.test package¶
Submodules¶
fudge.core.math.test.testFudgeMath module¶
test fudge/core/math cmattoon, 3/24/2011
fudge.core.math.test.testXYs module¶
fudge.core.math.test.test_linearAlgebra module¶
Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests
Pathological, all correlated, legal, but NOT INVERTIBLE
Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests
Pathological, all correlated, legal, but NOT INVERTIBLE
-
class
fudge.core.math.test.test_linearAlgebra.
BasicLinearAlgebraTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.MatrixTests
Very basic matrix tests
-
class
fudge.core.math.test.test_linearAlgebra.
BoringCovarianceTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests
Boring, a diagonal matrix
-
class
fudge.core.math.test.test_linearAlgebra.
EigendecompositionTests
[source]¶ Define some tests that should be run for DERIVED classes only. This doesn’t inherit from unittest.TestCase since the tests aren’t meant to be run inside this class.
Derived classes need to inherit from both this and from Eigendecomposition_base
-
test_construct_matrix_by_pruning
()[source]¶ Try to reconstruct the matix using the PRUNED eigenvalue decomposition
-
test_construct_matrixinverse_by_pruning
(*args, **kwargs)[source]¶ Try to construct the matrix inverse using the PRUNED eigenvalue decomposition
-
test_construct_matrixinverse_from_eigendecomposition
()[source]¶ Try to construct the matrix inverse using the eigenvalue decomposition
-
-
class
fudge.core.math.test.test_linearAlgebra.
EigendecompositionTests_allShouldFail
[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.EigendecompositionTests
For some input matrices, all tests are expected to fail. They should inherit from this class instead of EigendecompositionTests
-
class
fudge.core.math.test.test_linearAlgebra.
Eigendecomposition_base
(methodName='runTest')[source]¶
-
class
fudge.core.math.test.test_linearAlgebra.
IllegalCovarianceTest
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests_allShouldFail
A bad matrix for testing:
Eigensystem for A. It is OK using numpy.linalg.eig, but not (apparently) with numpy.linalg.eigh, I checked against mathematica: >>> m = {{1., 2., 3.}, {1., 2., 1.}, {3., 2., 1.}} >>> {e, v} = Eigensystem[ m ] >>> {{5.23607, -2., 0.763932}, {{-0.647936, -0.400447, -0.647936}, {-0.707107, 1.08315*10^-16, 0.707107}, {0.465341, -0.752938, 0.465341}}}
numpy.linalg.eig gives: >>> evals: >>> [-2.14644241 0.78156156 5.36488085] >>> evecs: >>> [[-0.64135318 0.52747554 -0.55716753] >>> [-0.20230251 -0.81675359 -0.54035845] >>> [ 0.74009445 0.23384422 -0.63053714]]
However, note that this A is not a valid covariance as the off-diagonal elements are bigger than the on-diagonal ones.
-
class
fudge.core.math.test.test_linearAlgebra.
LotsOffDiagonalCovarianceTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests
Lots of off-diagonal
-
class
fudge.core.math.test.test_linearAlgebra.
MatrixCompositionTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.MatrixTests
Very basic matrix tests
-
class
fudge.core.math.test.test_linearAlgebra.
MatrixTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
assertMatrixEqual
(a, b)[source]¶ The numpy “==” operator is a universal function, so it operates on each element in the matrices. The result is another matrix whose elements are all a[i,j] == b[i,j]. You need to call the .all() function to check that all elements evaluated to “True” Or, could just use array_equal()…
-
-
class
fudge.core.math.test.test_linearAlgebra.
OffDiagonalBarelyPathologicalCovarianceTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests_allShouldFail
Pathological, all correlated, barely illegal and very much not invertible, and slightly off-diagonal
-
class
fudge.core.math.test.test_linearAlgebra.
OnDiagonalBarelyPathologicalCovarianceTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests_allShouldFail
Pathological, all correlated, barely illegal and very much not invertible
-
class
fudge.core.math.test.test_linearAlgebra.
RealCovarianceTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests
Real covariance for testing, H(n,tot) cs cov.
-
class
fudge.core.math.test.test_linearAlgebra.
SomeOffDiagonalCovarianceTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests
Some off-diagonal-ness
-
class
fudge.core.math.test.test_linearAlgebra.
ZeroSubspaceCovarianceTests
(methodName='runTest')[source]¶ Bases:
fudge.core.math.test.test_linearAlgebra.Eigendecomposition_base
,fudge.core.math.test.test_linearAlgebra.EigendecompositionTests_allShouldFail
Zeros? it still works!, but has negative eigenvalues