def test_rankone(): x1 = np.random.standard_normal(100) x2 = np.random.standard_normal(50) fm = FM.factored_matrix(np.multiply.outer(x1, x2), min_singular=1.e-2, affine_offset=0) fm.X fm.copy() U = np.random.standard_normal((50, 10)) V = np.random.standard_normal((100, 20)) nt.assert_raises(ValueError, FM.factored_matrix, X, -1) fm.linear_map(U) fm.affine_map(U) fm.adjoint_map(V)
def test_class(): for shape in [(100, 50), (50, 100)]: n, p = shape X = np.random.standard_normal((n, p)) fm = FM.factored_matrix(X, min_singular=1.e-2, affine_offset=0) fm.X fm.copy() U = np.random.standard_normal((p, 10)) V = np.random.standard_normal((n, 20)) nt.assert_raises(ValueError, FM.factored_matrix, X, -1) fm.linear_map(U) fm.affine_map(U) fm.adjoint_map(V)
def test_class(): for shape in [(100, 50), (50, 100)]: n, p = shape X = np.random.standard_normal((n,p)) fm = FM.factored_matrix(X, min_singular=1.e-2, affine_offset=0) fm.X fm.copy() U = np.random.standard_normal((p, 10)) V = np.random.standard_normal((n, 20)) nt.assert_raises(ValueError, FM.factored_matrix, X, -1) fm.linear_map(U) fm.affine_map(U) fm.adjoint_map(V)
def test_zero(): fm = FM.factored_matrix(np.zeros((100, 50))) fm.X