本文整理汇总了Python中suitesparse.umfpack.umfpack_solver.UmfpackSolver类的典型用法代码示例。如果您正苦于以下问题:Python UmfpackSolver类的具体用法?Python UmfpackSolver怎么用?Python UmfpackSolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UmfpackSolver类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.A = LinearFillLLSparseMatrix(size=SIZE, dtype=COMPLEX128_T, itype=INT32_T)
self.C = self.A.to_csr()
self.solver = UmfpackSolver(self.C)
开发者ID:PythonOptimizers,项目名称:SuiteSparse.py,代码行数:7,代码来源:test_umfpack_get_LU_cysparse_INT32_t_COMPLEX128_t_CSRSparseMatrix.py
示例2: setUp
def setUp(self):
self.A = LinearFillLLSparseMatrix(size=SIZE, dtype=FLOAT64_T, itype=INT32_T, store_zero=True)
self.C = self.A.to_csc()
self.solver = UmfpackSolver(self.C)
开发者ID:PythonOptimizers,项目名称:SuiteSparse.py,代码行数:10,代码来源:test_umfpack_get_LU_cysparse_INT32_t_FLOAT64_t_CSCSparseMatrix.py
示例3: setUp
def setUp(self):
self.A = LinearFillLLSparseMatrix(size=SIZE, dtype=COMPLEX128_T, itype=INT32_T, store_zero=True)
self.C = self.A
self.solver = UmfpackSolver(self.C)
开发者ID:PythonOptimizers,项目名称:SuiteSparse.py,代码行数:10,代码来源:test_umfpack_get_LU_cysparse_INT32_t_COMPLEX128_t_LLSparseMatrix.py
示例4: setUp
def setUp(self):
self.A = LinearFillLLSparseMatrix(size=SIZE, dtype=FLOAT64_T, itype=INT64_T)
self.C = self.A
self.solver = UmfpackSolver(self.C)
开发者ID:PythonOptimizers,项目名称:SuiteSparse.py,代码行数:11,代码来源:test_umfpack_get_LU_cysparse_INT64_t_FLOAT64_t_LLSparseMatrix.py
示例5: CySparseUmfpackget_LUWithSymmetrySWithZero_CSRSparseMatrix_INT32_t_COMPLEX128_t_TestCase
class CySparseUmfpackget_LUWithSymmetrySWithZero_CSRSparseMatrix_INT32_t_COMPLEX128_t_TestCase(unittest.TestCase):
def setUp(self):
self.size = SIZE
self.A = LinearFillLLSparseMatrix(
size=self.size, dtype=COMPLEX128_T, itype=INT32_T, store_symmetry=True, store_zero=True
)
self.C = self.A.to_csr()
self.solver = UmfpackSolver(self.C)
def test_factorization_element_by_element(self):
"""
Verify the equality ``L * U = P * R * A * Q``
"""
(L, U, P, Q, D, do_recip, R) = self.solver.get_LU()
lhs = L * U
P_mat = PermutationLLSparseMatrix(P=P, size=SIZE, dtype=COMPLEX128_T, itype=INT32_T)
Q_mat = PermutationLLSparseMatrix(P=Q, size=SIZE, dtype=COMPLEX128_T, itype=INT32_T)
R_mat = None
if do_recip:
R_mat = LLSparseMatrix(size=SIZE, dtype=COMPLEX128_T, itype=INT32_T)
for i in xrange(SIZE):
R_mat[i, i] = R[i]
else:
R_mat = LLSparseMatrix(size=size, dtype=COMPLEX128_T, itype=INT32_T)
for i in xrange(SIZE):
R_mat[i, i] = 1 / R[i]
rhs = P_mat * R_mat * self.C * Q_mat
for i in xrange(SIZE):
for j in xrange(SIZE):
self.assertTrue(
abs(lhs[i, j] - rhs[i, j]) < EPS,
"lhs[%d, %d] =? %f + %f j , rhs[%d, %d] = %f + %f j"
% (i, j, lhs[i, j].real, lhs[i, j].imag, i, j, rhs[i, j].real, rhs[i, j].imag),
)
开发者ID:PythonOptimizers,项目名称:SuiteSparse.py,代码行数:44,代码来源:test_umfpack_get_LU_cysparse_INT32_t_COMPLEX128_t_CSRSparseMatrix.py
示例6: CySparseUmfpackget_LUNoSymmetryNoZero_CSCSparseMatrix_INT32_t_FLOAT64_t_TestCase
class CySparseUmfpackget_LUNoSymmetryNoZero_CSCSparseMatrix_INT32_t_FLOAT64_t_TestCase(unittest.TestCase):
def setUp(self):
self.A = LinearFillLLSparseMatrix(size=SIZE, dtype=FLOAT64_T, itype=INT32_T)
self.C = self.A.to_csc()
self.solver = UmfpackSolver(self.C)
def test_factorization_element_by_element(self):
"""
Verify the equality ``L * U = P * R * A * Q``
"""
(L, U, P, Q, D, do_recip, R) = self.solver.get_LU()
lhs = L * U
P_mat = PermutationLLSparseMatrix(P=P, size=SIZE, dtype=FLOAT64_T, itype=INT32_T)
Q_mat = PermutationLLSparseMatrix(P=Q, size=SIZE, dtype=FLOAT64_T, itype=INT32_T)
R_mat = None
if do_recip:
R_mat = LLSparseMatrix(size=SIZE, dtype=FLOAT64_T, itype=INT32_T)
for i in xrange(SIZE):
R_mat[i, i] = R[i]
else:
R_mat = LLSparseMatrix(size=size, dtype=FLOAT64_T, itype=INT32_T)
for i in xrange(SIZE):
R_mat[i, i] = 1/R[i]
rhs = P_mat * R_mat * self.C * Q_mat
for i in xrange(SIZE):
for j in xrange(SIZE):
self.assertTrue(lhs[i, j] - rhs[i, j] < EPS, "lhs[%d, %d] =? %f , rhs[%d, %d] = %f" % (i,j, lhs[i, j], i, j, rhs[i, j]))
开发者ID:PythonOptimizers,项目名称:SuiteSparse.py,代码行数:40,代码来源:test_umfpack_get_LU_cysparse_INT32_t_FLOAT64_t_CSCSparseMatrix.py