Beispiel #1
0
    def do(self, a, b):
        """ 
        inner1d not defined for complex types.
        todo: implement alternative test
        """
        if csingle == a.dtype or cdouble == a.dtype:
            raise SkipTest

        x_lo = gula.chosolve(a, b, UPLO='L')
        x_up = gula.chosolve(a, b, UPLO='U')
        assert_almost_equal(x_lo, x_up)
        # inner1d not defined for complex types
        # todo: implement alternative test
        assert_almost_equal(b, gula.matrix_multiply(a,x_lo))
        assert_almost_equal(b, gula.matrix_multiply(a,x_up))
Beispiel #2
0
    def do(self, a, b):
        a_inv = gula.poinv(a)
        ident = identity(a.shape[-1])
        if 3 == len(a.shape):
            ident = ident.reshape((1,ident.shape[0], ident.shape[1]))

        assert_almost_equal(a_inv, gula.inv(a))
        assert_almost_equal(gula.matrix_multiply(a, a_inv), ident)
Beispiel #3
0
def assert_valid_eigen_no_broadcast(M, w, v, **kw):
    lhs = gula.matrix_multiply(M,v)
    rhs = w*v
    assert_almost_equal(lhs, rhs, **kw)
Beispiel #4
0
 def do(self, a, b):
     x = gula.solve(a,b)
     assert_almost_equal(b, gula.matrix_multiply(a,x))
Beispiel #5
0
 def test_column_matrix(self):
     A = np.arange(2*2).reshape((2,2))
     B = np.arange(2*1).reshape((2,1))
     res = gula.matrix_multiply(A,B)
     assert_almost_equal(res, np.dot(A,B))
Beispiel #6
0
 def do(self, a, b):
     res = gula.matrix_multiply(a,b)
     if a.ndim == 2:
         assert_almost_equal(res, np.dot(a,b))
     else:
         assert_almost_equal(res[0], np.dot(a[0],b[0]))