• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python umfpack_solver.UmfpackSolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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



注:本文中的suitesparse.umfpack.umfpack_solver.UmfpackSolver类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sum_of_multiples.sum_of_multiples函数代码示例发布时间:2022-05-27
下一篇:
Python suite_random.suite_random函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap