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


Python polyutils.mapdomain方法代码示例

本文整理汇总了Python中numpy.polynomial.polyutils.mapdomain方法的典型用法代码示例。如果您正苦于以下问题:Python polyutils.mapdomain方法的具体用法?Python polyutils.mapdomain怎么用?Python polyutils.mapdomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy.polynomial.polyutils的用法示例。


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

示例1: test_mapdomain

# 需要导入模块: from numpy.polynomial import polyutils [as 别名]
# 或者: from numpy.polynomial.polyutils import mapdomain [as 别名]
def test_mapdomain(self):
        # test for real values
        dom1 = [0, 4]
        dom2 = [1, 3]
        tgt = dom2
        res = pu.mapdomain(dom1, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test for complex values
        dom1 = [0 - 1j, 2 + 1j]
        dom2 = [-2, 2]
        tgt = dom2
        x = dom1
        res = pu.mapdomain(x, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test for multidimensional arrays
        dom1 = [0, 4]
        dom2 = [1, 3]
        tgt = np.array([dom2, dom2])
        x = np.array([dom1, dom1])
        res = pu.mapdomain(x, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test that subtypes are preserved.
        class MyNDArray(np.ndarray):
            pass

        dom1 = [0, 4]
        dom2 = [1, 3]
        x = np.array([dom1, dom1]).view(MyNDArray)
        res = pu.mapdomain(x, dom1, dom2)
        assert_(isinstance(res, MyNDArray)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:35,代码来源:test_polyutils.py

示例2: test_mapdomain

# 需要导入模块: from numpy.polynomial import polyutils [as 别名]
# 或者: from numpy.polynomial.polyutils import mapdomain [as 别名]
def test_mapdomain(self):
        # test for real values
        dom1 = [0, 4]
        dom2 = [1, 3]
        tgt = dom2
        res = pu. mapdomain(dom1, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test for complex values
        dom1 = [0 - 1j, 2 + 1j]
        dom2 = [-2, 2]
        tgt = dom2
        x = dom1
        res = pu.mapdomain(x, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test for multidimensional arrays
        dom1 = [0, 4]
        dom2 = [1, 3]
        tgt = np.array([dom2, dom2])
        x = np.array([dom1, dom1])
        res = pu.mapdomain(x, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test that subtypes are preserved.
        dom1 = [0, 4]
        dom2 = [1, 3]
        x = np.matrix([dom1, dom1])
        res = pu.mapdomain(x, dom1, dom2)
        assert_(isinstance(res, np.matrix)) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:32,代码来源:test_polyutils.py

示例3: test_mapdomain

# 需要导入模块: from numpy.polynomial import polyutils [as 别名]
# 或者: from numpy.polynomial.polyutils import mapdomain [as 别名]
def test_mapdomain(self) :
        # test for real values
        dom1 = [0, 4]
        dom2 = [1, 3]
        tgt = dom2
        res = pu. mapdomain(dom1, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test for complex values
        dom1 = [0 - 1j, 2 + 1j]
        dom2 = [-2, 2]
        tgt = dom2
        x = dom1
        res = pu.mapdomain(x, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test for multidimensional arrays
        dom1 = [0, 4]
        dom2 = [1, 3]
        tgt = np.array([dom2, dom2])
        x = np.array([dom1, dom1])
        res = pu.mapdomain(x, dom1, dom2)
        assert_almost_equal(res, tgt)

        # test that subtypes are preserved.
        dom1 = [0, 4]
        dom2 = [1, 3]
        x = np.matrix([dom1, dom1])
        res = pu.mapdomain(x, dom1, dom2)
        assert_(isinstance(res, np.matrix)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:32,代码来源:test_polyutils.py


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