Esempio n. 1
0
def test_computeRJF_part0():
    """Test computeRJF() with random 3x3 ... 10x10 matrices.
    """
    
    np.random.seed(1234)
    for d in range(3,10):
        A = np.random.random((d,d))
        J,T,_ = LinearDS.computeRJF(A)
        Ac = T.dot(A).dot(np.linalg.inv(T))
        np.testing.assert_almost_equal(np.linalg.norm(J-Ac, 'fro'), 0)
Esempio n. 2
0
def test_computeRJF_part0():
    """Test computeRJF() with random 3x3 ... 10x10 matrices.
    """

    np.random.seed(1234)
    for d in range(3,10):
        A = np.random.random((d,d))
        J,T,_ = LinearDS.computeRJF(A)
        Ac = T.dot(A).dot(np.linalg.inv(T))
        np.testing.assert_almost_equal(np.linalg.norm(J-Ac, 'fro'), 0, 2)
Esempio n. 3
0
def test_computeRJF_part1():
    """Test computeRJF() with MATLAB example.
    """ 
    
    # MATLAB test example, see 'doc jordan' in MATLAB
    A = np.asarray([[1,-3,-2],
                    [-1,1,-1],
                    [2,4,5]])
    J,T,_ = LinearDS.computeRJF(A)
    ref = np.asarray([[3,0,0],
                      [0,2,0],
                      [0,0,2]])
    np.testing.assert_almost_equal(np.linalg.norm(J-ref,'fro'), 0)
Esempio n. 4
0
def test_computeRJF_part1():
    """Test computeRJF() with MATLAB example.
    """

    # MATLAB test example, see 'doc jordan' in MATLAB
    A = np.asarray([[1,-3,-2],
                    [-1,1,-1],
                    [2,4,5]])
    J,T,_ = LinearDS.computeRJF(A)
    ref = np.asarray([[3,0,0],
                      [0,2,0],
                      [0,0,2]])
    np.testing.assert_almost_equal(np.linalg.norm(J-ref,'fro'), 0, 2)