def test_dtypes(self): for dtype_op in allowed_types: for dtype_in in allowed_types: dtype_out = np.result_type(dtype_op, dtype_in) A = lo.IdentityOperator(3, dtype=dtype_op) x = np.array([1, 1, 1]).astype(dtype_in) assert_((A * x).dtype == dtype_out)
def setUp(self): self.A = lo.IdentityOperator(2) self.B = lo.linop_from_ndarray(np.arange(1, 7).reshape([2, 3])) self.C = lo.DiagonalOperator(np.arange(3)) self.D = lo.linop_from_ndarray(np.arange(6, 0, -1).reshape([3, 2]))
def test_runtime(self): A = lo.IdentityOperator(3) x = np.array([1, 1, 1]) assert_equal(A * x, x) assert_(A.T is A) assert_(A.H is A)