/[escript]/trunk/escript/py_src/test_util_unary_no_tagged_data.py
ViewVC logotype

Diff of /trunk/escript/py_src/test_util_unary_no_tagged_data.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 586 by gross, Thu Mar 9 23:47:42 2006 UTC revision 587 by gross, Fri Mar 10 02:26:50 2006 UTC
# Line 6415  class Test_util_unary_no_tagged_data(Tes Line 6415  class Test_util_unary_no_tagged_data(Tes
6415        self.failUnless(isinstance(res,Data),"wrong type of result.")        self.failUnless(isinstance(res,Data),"wrong type of result.")
6416        self.failUnlessEqual(res.getShape(),(2, 3, 2, 3),"wrong shape of result.")        self.failUnlessEqual(res.getShape(),(2, 3, 2, 3),"wrong shape of result.")
6417        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6418       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6419       def test_eigenvalues_and_eigenvectors_constData_dim2_case0(self):
6420          arg=Data(numarray.array([[0.0, 0.0], [0.0, 0.0]]),self.functionspace)
6421          res=eigenvalues_and_eigenvectors(arg)
6422          ref_ev=Data(numarray.array([0.0, 0.0]),self.functionspace)
6423          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6424          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6425          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6426          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6427          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6428          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6429          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6430          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6431       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6432       def test_eigenvalues_and_eigenvectors_constData_dim2_case3(self):
6433          arg=Data(numarray.array([[-1.0, 0.0], [0.0, -1.0]]),self.functionspace)
6434          res=eigenvalues_and_eigenvectors(arg)
6435          ref_ev=Data(numarray.array([-1.0, -1.0]),self.functionspace)
6436          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6437          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6438          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6439          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6440          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6441          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6442          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6443          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6444       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6445       def test_eigenvalues_and_eigenvectors_constData_dim2_case5(self):
6446          arg=Data(numarray.array([[-0.99999999999999967, -6.4606252205695602e-16], [-6.4606252205695602e-16, -0.99999999999999967]]),self.functionspace)
6447          res=eigenvalues_and_eigenvectors(arg)
6448          ref_ev=Data(numarray.array([-1.0, -1.0]),self.functionspace)
6449          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6450          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6451          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6452          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6453          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6454          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6455          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6456          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6457       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6458       def test_eigenvalues_and_eigenvectors_constData_dim2_case6(self):
6459          arg=Data(numarray.array([[0.0, 0.0], [0.0, 0.0001]]),self.functionspace)
6460          res=eigenvalues_and_eigenvectors(arg)
6461          ref_ev=Data(numarray.array([0.0, 0.0001]),self.functionspace)
6462          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6463          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6464          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6465          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6466          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6467          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6468          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6469          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6470       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6471       def test_eigenvalues_and_eigenvectors_constData_dim2_case7(self):
6472          arg=Data(numarray.array([[0.0001, 0.0], [0.0, 0.0]]),self.functionspace)
6473          res=eigenvalues_and_eigenvectors(arg)
6474          ref_ev=Data(numarray.array([0.0, 0.0001]),self.functionspace)
6475          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6476          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6477          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6478          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6479          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6480          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6481          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6482          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6483       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6484       def test_eigenvalues_and_eigenvectors_constData_dim2_case8(self):
6485          arg=Data(numarray.array([[6.0598371831785722e-06, 2.3859213977648625e-05], [2.3859213977648629e-05, 9.3940162816821425e-05]]),self.functionspace)
6486          res=eigenvalues_and_eigenvectors(arg)
6487          ref_ev=Data(numarray.array([0.0, 0.0001]),self.functionspace)
6488          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6489          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6490          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6491          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6492          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6493          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6494          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6495          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6496       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6497       def test_eigenvalues_and_eigenvectors_constData_dim2_case9(self):
6498          arg=Data(numarray.array([[1.0, 0.0], [0.0, 2.0]]),self.functionspace)
6499          res=eigenvalues_and_eigenvectors(arg)
6500          ref_ev=Data(numarray.array([1.0, 2.0]),self.functionspace)
6501          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6502          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6503          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6504          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6505          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6506          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6507          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6508          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6509       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6510       def test_eigenvalues_and_eigenvectors_constData_dim2_case10(self):
6511          arg=Data(numarray.array([[2.0, 0.0], [0.0, 1.0]]),self.functionspace)
6512          res=eigenvalues_and_eigenvectors(arg)
6513          ref_ev=Data(numarray.array([1.0, 2.0]),self.functionspace)
6514          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6515          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6516          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6517          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6518          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6519          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6520          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6521          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6522       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6523       def test_eigenvalues_and_eigenvectors_constData_dim2_case11(self):
6524          arg=Data(numarray.array([[1.0605983718317855, 0.23859213977648688], [0.23859213977648688, 1.9394016281682138]]),self.functionspace)
6525          res=eigenvalues_and_eigenvectors(arg)
6526          ref_ev=Data(numarray.array([1.0, 2.0]),self.functionspace)
6527          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6528          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6529          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6530          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6531          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6532          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6533          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6534          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6535       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6536       def test_eigenvalues_and_eigenvectors_constData_dim2_case12(self):
6537          arg=Data(numarray.array([[1.0, 0.0], [0.0, 1000000.0]]),self.functionspace)
6538          res=eigenvalues_and_eigenvectors(arg)
6539          ref_ev=Data(numarray.array([1.0, 1000000.0]),self.functionspace)
6540          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6541          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6542          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6543          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6544          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6545          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6546          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6547          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6548       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6549       def test_eigenvalues_and_eigenvectors_constData_dim2_case13(self):
6550          arg=Data(numarray.array([[1000000.0, 0.0], [0.0, 1.0]]),self.functionspace)
6551          res=eigenvalues_and_eigenvectors(arg)
6552          ref_ev=Data(numarray.array([1.0, 1000000.0]),self.functionspace)
6553          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6554          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6555          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6556          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6557          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6558          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6559          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6560          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6561       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6562       def test_eigenvalues_and_eigenvectors_constData_dim2_case14(self):
6563          arg=Data(numarray.array([[60599.311233413886, 238591.90118434647], [238591.90118434647, 939401.68876658613]]),self.functionspace)
6564          res=eigenvalues_and_eigenvectors(arg)
6565          ref_ev=Data(numarray.array([1.0, 1000000.0]),self.functionspace)
6566          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6567          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6568          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6569          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6570          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6571          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6572          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6573          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6574       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6575       def test_eigenvalues_and_eigenvectors_expandedData_dim2_case0(self):
6576          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6577          arg=msk_arg*numarray.array([[0.0, 0.0], [0.0, 0.0]])+(1.-msk_arg)*numarray.array([[-1.0, 0.0], [0.0, -1.0]])
6578          res=eigenvalues_and_eigenvectors(arg)
6579          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6580          ref_ev=msk_ref_ev*numarray.array([0.0, 0.0])+(1.-msk_ref_ev)*numarray.array([-1.0, -1.0])
6581          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6582          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6583          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6584          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6585          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6586          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6587          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6588          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6589       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6590       def test_eigenvalues_and_eigenvectors_expandedData_dim2_case5(self):
6591          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6592          arg=msk_arg*numarray.array([[-0.99999999999999967, -6.4606252205695602e-16], [-6.4606252205695602e-16, -0.99999999999999967]])+(1.-msk_arg)*numarray.array([[0.0, 0.0], [0.0, 0.0001]])
6593          res=eigenvalues_and_eigenvectors(arg)
6594          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6595          ref_ev=msk_ref_ev*numarray.array([-1.0, -1.0])+(1.-msk_ref_ev)*numarray.array([0.0, 0.0001])
6596          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6597          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6598          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6599          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6600          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6601          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6602          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6603          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6604       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6605       def test_eigenvalues_and_eigenvectors_expandedData_dim2_case7(self):
6606          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6607          arg=msk_arg*numarray.array([[0.0001, 0.0], [0.0, 0.0]])+(1.-msk_arg)*numarray.array([[6.0598371831785722e-06, 2.3859213977648625e-05], [2.3859213977648629e-05, 9.3940162816821425e-05]])
6608          res=eigenvalues_and_eigenvectors(arg)
6609          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6610          ref_ev=msk_ref_ev*numarray.array([0.0, 0.0001])+(1.-msk_ref_ev)*numarray.array([0.0, 0.0001])
6611          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6612          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6613          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6614          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6615          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6616          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6617          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6618          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6619       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6620       def test_eigenvalues_and_eigenvectors_expandedData_dim2_case9(self):
6621          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6622          arg=msk_arg*numarray.array([[1.0, 0.0], [0.0, 2.0]])+(1.-msk_arg)*numarray.array([[2.0, 0.0], [0.0, 1.0]])
6623          res=eigenvalues_and_eigenvectors(arg)
6624          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6625          ref_ev=msk_ref_ev*numarray.array([1.0, 2.0])+(1.-msk_ref_ev)*numarray.array([1.0, 2.0])
6626          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6627          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6628          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6629          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6630          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6631          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6632          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6633          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6634       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6635       def test_eigenvalues_and_eigenvectors_expandedData_dim2_case11(self):
6636          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6637          arg=msk_arg*numarray.array([[1.0605983718317855, 0.23859213977648688], [0.23859213977648688, 1.9394016281682138]])+(1.-msk_arg)*numarray.array([[1.0, 0.0], [0.0, 1000000.0]])
6638          res=eigenvalues_and_eigenvectors(arg)
6639          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6640          ref_ev=msk_ref_ev*numarray.array([1.0, 2.0])+(1.-msk_ref_ev)*numarray.array([1.0, 1000000.0])
6641          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6642          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6643          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6644          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6645          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6646          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6647          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6648          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6649       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6650       def test_eigenvalues_and_eigenvectors_expandedData_dim2_case13(self):
6651          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6652          arg=msk_arg*numarray.array([[1000000.0, 0.0], [0.0, 1.0]])+(1.-msk_arg)*numarray.array([[60599.311233413886, 238591.90118434647], [238591.90118434647, 939401.68876658613]])
6653          res=eigenvalues_and_eigenvectors(arg)
6654          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6655          ref_ev=msk_ref_ev*numarray.array([1.0, 1000000.0])+(1.-msk_ref_ev)*numarray.array([1.0, 1000000.0])
6656          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6657          self.failUnlessEqual(res[0].getShape(),(2,),"wrong shape of result for eigenvalues.")
6658          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6659          self.failUnlessEqual(res[1].getShape(),(2, 2),"wrong shape of result for eigenvectors.")
6660          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6661          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6662          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6663          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")

Legend:
Removed from v.586  
changed lines
  Added in v.587

  ViewVC Help
Powered by ViewVC 1.1.26