コード例 #1
0
def chebRoots(A, a=-1, b=1, ImTol=1e-6, im=False):

    D = np_cheb.chebcompanion(A)
    eigs = sp_lin.eigvals(D)
    if im == False:
        eigs = np.real(eigs[np.abs(np.imag(eigs)) < ImTol])
        eigs = eigs[eigs >= -1]
        eigs = np.sort(eigs[eigs <= 1])
    else:
        eigs = eigs[eigs.real >= -1]
        eigs = eigs[eigs.real <= 1]

    q = (b - a) / 2;
    p = (a + b) / 2
    return eigs * q + p
コード例 #2
0
ファイル: test_chebyshev.py プロジェクト: 0x60/yhack2017
 def test_linear_root(self):
     assert_(cheb.chebcompanion([1, 2])[0, 0] == -.5)
コード例 #3
0
ファイル: test_chebyshev.py プロジェクト: 0x60/yhack2017
 def test_dimensions(self):
     for i in range(1, 5):
         coef = [0]*i + [1]
         assert_(cheb.chebcompanion(coef).shape == (i, i))
コード例 #4
0
ファイル: test_chebyshev.py プロジェクト: Alanchi/numpy
 def test_linear_root(self):
     assert_(cheb.chebcompanion([1, 2])[0, 0] == -.5)
コード例 #5
0
ファイル: test_chebyshev.py プロジェクト: Alanchi/numpy
 def test_dimensions(self):
     for i in range(1, 5):
         coef = [0]*i + [1]
         assert_(cheb.chebcompanion(coef).shape == (i, i))