#NEWLINE# def test_vector( self ) : #NEWLINE# #INDENT# xs = [ 0 , 1 , 2 ] #NEWLINE# ys = np . array ( [ [ 0 , 1 ] , [ 1 , 0 ] , [ 2 , 1 ] ] ) #NEWLINE# P = KroghInterpolator ( xs , ys ) #NEWLINE# Pi = [ KroghInterpolator ( xs , ys [ : , i ] ) for i in xrange ( ys . shape [ 1 ] ) ] #NEWLINE# test_xs = np . linspace ( ( - 1 ) , 3 , 100 ) #NEWLINE# assert_almost_equal ( P ( test_xs ) , np . rollaxis ( np . asarray ( [ p ( test_xs ) for p in Pi ] ) , ( - 1 ) ) ) #NEWLINE# assert_almost_equal ( P . derivatives ( test_xs ) , np . transpose ( np . asarray ( [ p . derivatives ( test_xs ) for p in Pi ] ) , ( 1 , 2 , 0 ) ) )