当前位置: 首页>>代码示例>>Python>>正文


Python linalg.solve_circulant函数代码示例

本文整理汇总了Python中scipy.linalg.solve_circulant函数的典型用法代码示例。如果您正苦于以下问题:Python solve_circulant函数的具体用法?Python solve_circulant怎么用?Python solve_circulant使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了solve_circulant函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_complex

 def test_complex(self):
     # Complex b and c
     c = np.array([1+2j, -3, 4j, 5])
     b = np.arange(8).reshape(4, 2) + 0.5j
     x = solve_circulant(c, b)
     y = solve(circulant(c), b)
     assert_allclose(x, y)
开发者ID:7924102,项目名称:scipy,代码行数:7,代码来源:test_basic.py

示例2: test_basic3

 def test_basic3(self):
     # b is a 3-d matrix.
     c = np.array([1, 2, -3, -5])
     b = np.arange(24).reshape(4, 3, 2)
     x = solve_circulant(c, b)
     y = solve(circulant(c), b)
     assert_allclose(x, y)
开发者ID:7924102,项目名称:scipy,代码行数:7,代码来源:test_basic.py

示例3: test_singular

 def test_singular(self):
     # c gives a singular circulant matrix.
     c = np.array([1, 1, 0, 0])
     b = np.array([1, 2, 3, 4])
     x = solve_circulant(c, b, singular='lstsq')
     y, res, rnk, s = lstsq(circulant(c), b)
     assert_allclose(x, y)
     assert_raises(LinAlgError, solve_circulant, x, y)
开发者ID:7924102,项目名称:scipy,代码行数:8,代码来源:test_basic.py

示例4: test_random_b_and_c

 def test_random_b_and_c(self):
     # Random b and c
     np.random.seed(54321)
     c = np.random.randn(50)
     b = np.random.randn(50)
     x = solve_circulant(c, b)
     y = solve(circulant(c), b)
     assert_allclose(x, y)
开发者ID:7924102,项目名称:scipy,代码行数:8,代码来源:test_basic.py

示例5: test_axis_args

    def test_axis_args(self):
        # Test use of caxis, baxis and outaxis.

        # c has shape (2, 1, 4)
        c = np.array([[[-1, 2.5, 3, 3.5]], [[1, 6, 6, 6.5]]])

        # b has shape (3, 4)
        b = np.array([[0, 0, 1, 1], [1, 1, 0, 0], [1, -1, 0, 0]])

        x = solve_circulant(c, b, baxis=1)
        assert_equal(x.shape, (4, 2, 3))
        expected = np.empty_like(x)
        expected[:, 0, :] = solve(circulant(c[0]), b.T)
        expected[:, 1, :] = solve(circulant(c[1]), b.T)
        assert_allclose(x, expected)

        x = solve_circulant(c, b, baxis=1, outaxis=-1)
        assert_equal(x.shape, (2, 3, 4))
        assert_allclose(np.rollaxis(x, -1), expected)

        # np.swapaxes(c, 1, 2) has shape (2, 4, 1); b.T has shape (4, 3).
        x = solve_circulant(np.swapaxes(c, 1, 2), b.T, caxis=1)
        assert_equal(x.shape, (4, 2, 3))
        assert_allclose(x, expected)
开发者ID:7924102,项目名称:scipy,代码行数:24,代码来源:test_basic.py

示例6: test_basic1

 def test_basic1(self):
     c = np.array([1, 2, 3, 5])
     b = np.array([1, -1, 1, 0])
     x = solve_circulant(c, b)
     y = solve(circulant(c), b)
     assert_allclose(x, y)
开发者ID:7924102,项目名称:scipy,代码行数:6,代码来源:test_basic.py


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