def getAuxMatrix(A): ''' return D, L, U matrices for Jacobi or Gauss-Seidel D: array L, U: matrices ''' # m = A.shape[0] D = csr_matrix.diagonal(A) L = -tril(A, k=-1) U = -triu(A, k=1) return D, L, U
def test_triu(self): for A in self.cases: B = A.toarray() for k in [-3, -2, -1, 0, 1, 2, 3]: assert_equal(extract.triu(A, k=k).toarray(), np.triu(B, k=k))
def test_triu(self): for A in self.cases: B = A.toarray() for k in [-3,-2,-1,0,1,2,3]: assert_equal(extract.triu(A,k=k).toarray(), np.triu(B,k=k))