예제 #1
0
    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))
    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))
예제 #3
0
    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
        res = pu.mapdomain(dom1, dom1, dom2)
        assert_almost_equal(res, tgt)
    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
        res = pu.mapdomain(dom1, dom1, dom2)
        assert_almost_equal(res, tgt)
예제 #5
0
파일: __init__.py 프로젝트: Bankq/CS6998
def mapdomain(x, old, new):
    from numpy.polynomial.polyutils import mapdomain
    return mapdomain(x, old, new)
예제 #6
0
파일: __init__.py 프로젝트: 1950/sawbuck
def mapdomain(x, old, new) :
    from numpy.polynomial.polyutils import mapdomain
    return mapdomain(x, old, new)