Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik Johansson committed Jan 15, 2009
1 parent 21aecce commit 9a2f942
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test_slicot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import numpy as npy
import slicot

from nose.tools import *
from numpy.testing import assert_array_almost_equal

def test_sb03md():
A = npy.array([[1., 2.], [3., 4.]])
C = -npy.array([[5., 6.], [6., 8.]])

a,u,c,scale,sep,ferr,wr,wi,info = slicot.sb03md(dico='C', job='X', fact='N', trana='N', a=A, c=C)

assert_equal(info, 0)

## Test if eigenvalues of A are correct
Alambda,Aeigvec = npy.linalg.eig(A)
assert_array_almost_equal(wr, Alambda)

## Test result
assert_array_almost_equal(c, npy.array([[-0.1, -0.8],[-0.8, -0.6]]))



0 comments on commit 9a2f942

Please sign in to comment.