def test_rdmul_large(self): vec = np.random.randn(501) mat = rand_matrix(501) a = rdmul(mat, vec) b = mat @ np.diag(vec) assert isinstance(a, np.matrix) assert_allclose(a, b)
def test_rdmul_sparse(self, mat_s, l1d): a = rdmul(mat_s, l1d) b = mat_s.A @ np.diag(l1d) assert issparse(a) assert_allclose(a.A, b)
def test_rdmul_small(self, mat_d, l1d): a = rdmul(mat_d, l1d) b = mat_d @ np.diag(l1d) assert isinstance(a, np.matrix) assert_allclose(a, b)