/[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 587 by gross, Fri Mar 10 02:26:50 2006 UTC revision 588 by gross, Fri Mar 10 04:45:04 2006 UTC
# Line 6661  class Test_util_unary_no_tagged_data(Tes Line 6661  class Test_util_unary_no_tagged_data(Tes
6661        self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")        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")        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")        self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(2))<=self.RES_TOL,"eigenvectors are not orthonormal")
6664       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6665       def test_eigenvalues_and_eigenvectors_constData_dim3_case0(self):
6666          arg=Data(numarray.array([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]),self.functionspace)
6667          res=eigenvalues_and_eigenvectors(arg)
6668          ref_ev=Data(numarray.array([0.0, 0.0, 0.0]),self.functionspace)
6669          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6670          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6671          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6672          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6673          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6674          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6675          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6676          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6677          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6678       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6679       def test_eigenvalues_and_eigenvectors_constData_dim3_case5(self):
6680          arg=Data(numarray.array([[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]),self.functionspace)
6681          res=eigenvalues_and_eigenvectors(arg)
6682          ref_ev=Data(numarray.array([10.0, 10.0, 10.0]),self.functionspace)
6683          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6684          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6685          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6686          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6687          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6688          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6689          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6690          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6691          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6692       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6693       def test_eigenvalues_and_eigenvectors_constData_dim3_case10(self):
6694          arg=Data(numarray.array([[0.9, 0.0, 0.0], [0.0, 0.9, 0.0], [0.0, 0.0, 1.0]]),self.functionspace)
6695          res=eigenvalues_and_eigenvectors(arg)
6696          ref_ev=Data(numarray.array([0.9, 0.9, 1.0]),self.functionspace)
6697          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6698          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6699          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6700          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6701          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6702          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6703          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6704          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6705          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6706       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6707       def test_eigenvalues_and_eigenvectors_constData_dim3_case11(self):
6708          arg=Data(numarray.array([[0.9, 0.0, 0.0], [0.0, 0.97060899725040983, -0.045555123008643325], [0.0, -0.045555123008643339, 0.92939100274959041]]),self.functionspace)
6709          res=eigenvalues_and_eigenvectors(arg)
6710          ref_ev=Data(numarray.array([0.9, 0.9, 1.0]),self.functionspace)
6711          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6712          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6713          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6714          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6715          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6716          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6717          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6718          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6719          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6720       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6721       def test_eigenvalues_and_eigenvectors_constData_dim3_case12(self):
6722          arg=Data(numarray.array([[0.92694799760252555, 0.0, 0.044368966468320177], [0.0, 0.9, 0.0], [0.044368966468320184, 0.0, 0.97305200239747425]]),self.functionspace)
6723          res=eigenvalues_and_eigenvectors(arg)
6724          ref_ev=Data(numarray.array([0.9, 0.9, 1.0]),self.functionspace)
6725          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6726          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6727          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6728          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6729          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6730          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6731          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6732          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6733          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6734       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6735       def test_eigenvalues_and_eigenvectors_constData_dim3_case13(self):
6736          arg=Data(numarray.array([[1.0, 0.0, 0.0], [0.0, 0.9, 0.0], [0.0, 0.0, 0.9]]),self.functionspace)
6737          res=eigenvalues_and_eigenvectors(arg)
6738          ref_ev=Data(numarray.array([0.9, 0.9, 1.0]),self.functionspace)
6739          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6740          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6741          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6742          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6743          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6744          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6745          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6746          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6747          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6748       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6749       def test_eigenvalues_and_eigenvectors_constData_dim3_case14(self):
6750          arg=Data(numarray.array([[0.92379770619813639, 0.041031106298491521, -0.011396846732439278], [0.041031106298491535, 0.97074428392640366, -0.019650012730342326], [-0.011396846732439236, -0.019650012730342337, 0.90545800987545966]]),self.functionspace)
6751          res=eigenvalues_and_eigenvectors(arg)
6752          ref_ev=Data(numarray.array([0.9, 0.9, 1.0]),self.functionspace)
6753          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6754          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6755          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6756          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6757          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6758          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6759          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6760          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6761          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6762       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6763       def test_eigenvalues_and_eigenvectors_constData_dim3_case15(self):
6764          arg=Data(numarray.array([[1.0, 0.0, 0.0], [0.0, 1.1, 0.0], [0.0, 0.0, 1.1]]),self.functionspace)
6765          res=eigenvalues_and_eigenvectors(arg)
6766          ref_ev=Data(numarray.array([1.0, 1.1, 1.1]),self.functionspace)
6767          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6768          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6769          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6770          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6771          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6772          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6773          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6774          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6775          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6776       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6777       def test_eigenvalues_and_eigenvectors_constData_dim3_case17(self):
6778          arg=Data(numarray.array([[1.0269479976025255, 0.0, 0.044368966468320309], [0.0, 1.1, 0.0], [0.044368966468320295, 0.0, 1.0730520023974743]]),self.functionspace)
6779          res=eigenvalues_and_eigenvectors(arg)
6780          ref_ev=Data(numarray.array([1.0, 1.1, 1.1]),self.functionspace)
6781          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6782          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6783          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6784          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6785          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6786          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6787          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6788          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6789          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6790       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6791       def test_eigenvalues_and_eigenvectors_constData_dim3_case18(self):
6792          arg=Data(numarray.array([[1.1, 0.0, 0.0], [0.0, 1.0153410887977139, -0.036038311201720394], [0.0, -0.036038311201720373, 1.084658911202286]]),self.functionspace)
6793          res=eigenvalues_and_eigenvectors(arg)
6794          ref_ev=Data(numarray.array([1.0, 1.1, 1.1]),self.functionspace)
6795          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6796          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6797          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6798          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6799          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6800          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6801          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6802          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6803          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6804       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6805       def test_eigenvalues_and_eigenvectors_constData_dim3_case19(self):
6806          arg=Data(numarray.array([[1.035487967756175, 0.026317079185831614, -0.039960133424212368], [0.026317079185831618, 1.0892641940924184, 0.016301362071911414], [-0.039960133424212355, 0.016301362071911431, 1.0752478381514063]]),self.functionspace)
6807          res=eigenvalues_and_eigenvectors(arg)
6808          ref_ev=Data(numarray.array([1.0, 1.1, 1.1]),self.functionspace)
6809          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6810          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6811          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6812          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6813          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6814          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6815          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6816          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6817          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6818       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6819       def test_eigenvalues_and_eigenvectors_constData_dim3_case20(self):
6820          arg=Data(numarray.array([[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]]),self.functionspace)
6821          res=eigenvalues_and_eigenvectors(arg)
6822          ref_ev=Data(numarray.array([1.0, 2.0, 3.0]),self.functionspace)
6823          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6824          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6825          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6826          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6827          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6828          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6829          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6830          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6831          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6832       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6833       def test_eigenvalues_and_eigenvectors_constData_dim3_case21(self):
6834          arg=Data(numarray.array([[1.0, 0.0, 0.0], [0.0, 2.7060899725040968, -0.45555123008643206], [0.0, -0.45555123008643228, 2.2939100274959037]]),self.functionspace)
6835          res=eigenvalues_and_eigenvectors(arg)
6836          ref_ev=Data(numarray.array([1.0, 2.0, 3.0]),self.functionspace)
6837          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6838          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6839          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6840          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6841          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6842          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6843          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6844          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6845          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6846       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6847       def test_eigenvalues_and_eigenvectors_constData_dim3_case22(self):
6848          arg=Data(numarray.array([[1.5389599520505153, 0.0, 0.88737932936638753], [0.0, 2.0, 0.0], [0.88737932936638753, 0.0, 2.4610400479494858]]),self.functionspace)
6849          res=eigenvalues_and_eigenvectors(arg)
6850          ref_ev=Data(numarray.array([1.0, 2.0, 3.0]),self.functionspace)
6851          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6852          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6853          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6854          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6855          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6856          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6857          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6858          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6859          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6860       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6861       def test_eigenvalues_and_eigenvectors_constData_dim3_case23(self):
6862          arg=Data(numarray.array([[3.0, 0.0, 0.0], [0.0, 1.153410887977139, -0.36038311201720391], [0.0, -0.36038311201720391, 1.8465891120228608]]),self.functionspace)
6863          res=eigenvalues_and_eigenvectors(arg)
6864          ref_ev=Data(numarray.array([1.0, 2.0, 3.0]),self.functionspace)
6865          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6866          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6867          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6868          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6869          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6870          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6871          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6872          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6873          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6874       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6875       def test_eigenvalues_and_eigenvectors_constData_dim3_case24(self):
6876          arg=Data(numarray.array([[1.5928567395431172, 0.67348185484323142, -0.51356980156651744], [0.67348185484323153, 2.6000847801882254, -0.033486506584313548], [-0.51356980156651744, -0.033486506584313541, 1.8070584802686565]]),self.functionspace)
6877          res=eigenvalues_and_eigenvectors(arg)
6878          ref_ev=Data(numarray.array([1.0, 2.0, 3.0]),self.functionspace)
6879          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6880          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6881          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6882          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6883          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6884          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6885          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6886          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6887          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6888       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6889       def test_eigenvalues_and_eigenvectors_constData_dim3_case25(self):
6890          arg=Data(numarray.array([[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 30000.0]]),self.functionspace)
6891          res=eigenvalues_and_eigenvectors(arg)
6892          ref_ev=Data(numarray.array([1.0, 2.0, 30000.0]),self.functionspace)
6893          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6894          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6895          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6896          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6897          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6898          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6899          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6900          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6901          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6902       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6903       def test_eigenvalues_and_eigenvectors_constData_dim3_case26(self):
6904          arg=Data(numarray.array([[1.0, 0.0, 0.0], [0.0, 21183.286995177881, -13665.625800132779], [0.0, -13665.625800132779, 8818.7130048221279]]),self.functionspace)
6905          res=eigenvalues_and_eigenvectors(arg)
6906          ref_ev=Data(numarray.array([1.0, 2.0, 30000.0]),self.functionspace)
6907          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6908          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6909          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6910          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6911          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6912          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6913          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6914          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6915          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6916       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6917       def test_eigenvalues_and_eigenvectors_constData_dim3_case27(self):
6918          arg=Data(numarray.array([[8085.1298007817086, 0.0, 13310.246250831115], [0.0, 2.0, 0.0], [13310.246250831115, 0.0, 21915.870199218316]]),self.functionspace)
6919          res=eigenvalues_and_eigenvectors(arg)
6920          ref_ev=Data(numarray.array([1.0, 2.0, 30000.0]),self.functionspace)
6921          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6922          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6923          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6924          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6925          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6926          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6927          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6928          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6929          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6930       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6931       def test_eigenvalues_and_eigenvectors_constData_dim3_case28(self):
6932          arg=Data(numarray.array([[30000.0, 0.0, 0.0], [0.0, 1.153410887977139, -0.36038311201720391], [0.0, -0.36038311201720391, 1.8465891120228608]]),self.functionspace)
6933          res=eigenvalues_and_eigenvectors(arg)
6934          ref_ev=Data(numarray.array([1.0, 2.0, 30000.0]),self.functionspace)
6935          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6936          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6937          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6938          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6939          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6940          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6941          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6942          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6943          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6944       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6945       def test_eigenvalues_and_eigenvectors_constData_dim3_case29(self):
6946          arg=Data(numarray.array([[7140.1907849945546, 12308.774438213351, -3419.2256841313947], [12308.774438213351, 21223.762934183575, -5894.4478052274408], [-3419.2256841313947, -5894.4478052274408, 1639.0462808218595]]),self.functionspace)
6947          res=eigenvalues_and_eigenvectors(arg)
6948          ref_ev=Data(numarray.array([1.0, 2.0, 30000.0]),self.functionspace)
6949          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6950          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6951          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6952          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6953          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6954          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6955          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6956          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6957          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6958       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6959       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case0(self):
6960          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6961          arg=msk_arg*numarray.array([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])+(1.-msk_arg)*numarray.array([[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]])
6962          res=eigenvalues_and_eigenvectors(arg)
6963          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6964          ref_ev=msk_ref_ev*numarray.array([0.0, 0.0, 0.0])+(1.-msk_ref_ev)*numarray.array([10.0, 10.0, 10.0])
6965          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6966          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6967          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6968          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6969          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6970          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6971          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6972          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6973          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6974       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6975       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case10(self):
6976          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6977          arg=msk_arg*numarray.array([[0.9, 0.0, 0.0], [0.0, 0.9, 0.0], [0.0, 0.0, 1.0]])+(1.-msk_arg)*numarray.array([[0.9, 0.0, 0.0], [0.0, 0.97060899725040983, -0.045555123008643325], [0.0, -0.045555123008643339, 0.92939100274959041]])
6978          res=eigenvalues_and_eigenvectors(arg)
6979          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6980          ref_ev=msk_ref_ev*numarray.array([0.9, 0.9, 1.0])+(1.-msk_ref_ev)*numarray.array([0.9, 0.9, 1.0])
6981          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6982          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6983          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
6984          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
6985          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
6986          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
6987          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
6988          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
6989          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
6990       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6991       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case12(self):
6992          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
6993          arg=msk_arg*numarray.array([[0.92694799760252555, 0.0, 0.044368966468320177], [0.0, 0.9, 0.0], [0.044368966468320184, 0.0, 0.97305200239747425]])+(1.-msk_arg)*numarray.array([[1.0, 0.0, 0.0], [0.0, 0.9, 0.0], [0.0, 0.0, 0.9]])
6994          res=eigenvalues_and_eigenvectors(arg)
6995          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
6996          ref_ev=msk_ref_ev*numarray.array([0.9, 0.9, 1.0])+(1.-msk_ref_ev)*numarray.array([0.9, 0.9, 1.0])
6997          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
6998          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
6999          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7000          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7001          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7002          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7003          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7004          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7005          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7006       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7007       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case14(self):
7008          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7009          arg=msk_arg*numarray.array([[0.92379770619813639, 0.041031106298491521, -0.011396846732439278], [0.041031106298491535, 0.97074428392640366, -0.019650012730342326], [-0.011396846732439236, -0.019650012730342337, 0.90545800987545966]])+(1.-msk_arg)*numarray.array([[1.0, 0.0, 0.0], [0.0, 1.1, 0.0], [0.0, 0.0, 1.1]])
7010          res=eigenvalues_and_eigenvectors(arg)
7011          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7012          ref_ev=msk_ref_ev*numarray.array([0.9, 0.9, 1.0])+(1.-msk_ref_ev)*numarray.array([1.0, 1.1, 1.1])
7013          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7014          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
7015          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7016          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7017          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7018          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7019          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7020          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7021          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7022       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7023       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case17(self):
7024          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7025          arg=msk_arg*numarray.array([[1.0269479976025255, 0.0, 0.044368966468320309], [0.0, 1.1, 0.0], [0.044368966468320295, 0.0, 1.0730520023974743]])+(1.-msk_arg)*numarray.array([[1.1, 0.0, 0.0], [0.0, 1.0153410887977139, -0.036038311201720394], [0.0, -0.036038311201720373, 1.084658911202286]])
7026          res=eigenvalues_and_eigenvectors(arg)
7027          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7028          ref_ev=msk_ref_ev*numarray.array([1.0, 1.1, 1.1])+(1.-msk_ref_ev)*numarray.array([1.0, 1.1, 1.1])
7029          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7030          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
7031          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7032          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7033          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7034          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7035          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7036          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7037          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7038       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7039       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case19(self):
7040          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7041          arg=msk_arg*numarray.array([[1.035487967756175, 0.026317079185831614, -0.039960133424212368], [0.026317079185831618, 1.0892641940924184, 0.016301362071911414], [-0.039960133424212355, 0.016301362071911431, 1.0752478381514063]])+(1.-msk_arg)*numarray.array([[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]])
7042          res=eigenvalues_and_eigenvectors(arg)
7043          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7044          ref_ev=msk_ref_ev*numarray.array([1.0, 1.1, 1.1])+(1.-msk_ref_ev)*numarray.array([1.0, 2.0, 3.0])
7045          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7046          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
7047          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7048          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7049          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7050          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7051          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7052          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7053          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7054       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7055       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case21(self):
7056          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7057          arg=msk_arg*numarray.array([[1.0, 0.0, 0.0], [0.0, 2.7060899725040968, -0.45555123008643206], [0.0, -0.45555123008643228, 2.2939100274959037]])+(1.-msk_arg)*numarray.array([[1.5389599520505153, 0.0, 0.88737932936638753], [0.0, 2.0, 0.0], [0.88737932936638753, 0.0, 2.4610400479494858]])
7058          res=eigenvalues_and_eigenvectors(arg)
7059          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7060          ref_ev=msk_ref_ev*numarray.array([1.0, 2.0, 3.0])+(1.-msk_ref_ev)*numarray.array([1.0, 2.0, 3.0])
7061          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7062          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
7063          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7064          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7065          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7066          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7067          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7068          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7069          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7070       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7071       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case23(self):
7072          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7073          arg=msk_arg*numarray.array([[3.0, 0.0, 0.0], [0.0, 1.153410887977139, -0.36038311201720391], [0.0, -0.36038311201720391, 1.8465891120228608]])+(1.-msk_arg)*numarray.array([[1.5928567395431172, 0.67348185484323142, -0.51356980156651744], [0.67348185484323153, 2.6000847801882254, -0.033486506584313548], [-0.51356980156651744, -0.033486506584313541, 1.8070584802686565]])
7074          res=eigenvalues_and_eigenvectors(arg)
7075          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7076          ref_ev=msk_ref_ev*numarray.array([1.0, 2.0, 3.0])+(1.-msk_ref_ev)*numarray.array([1.0, 2.0, 3.0])
7077          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7078          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
7079          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7080          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7081          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7082          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7083          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7084          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7085          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7086       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7087       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case25(self):
7088          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7089          arg=msk_arg*numarray.array([[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 30000.0]])+(1.-msk_arg)*numarray.array([[1.0, 0.0, 0.0], [0.0, 21183.286995177881, -13665.625800132779], [0.0, -13665.625800132779, 8818.7130048221279]])
7090          res=eigenvalues_and_eigenvectors(arg)
7091          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7092          ref_ev=msk_ref_ev*numarray.array([1.0, 2.0, 30000.0])+(1.-msk_ref_ev)*numarray.array([1.0, 2.0, 30000.0])
7093          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7094          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
7095          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7096          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7097          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7098          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7099          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7100          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7101          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7102       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7103       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case27(self):
7104          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7105          arg=msk_arg*numarray.array([[8085.1298007817086, 0.0, 13310.246250831115], [0.0, 2.0, 0.0], [13310.246250831115, 0.0, 21915.870199218316]])+(1.-msk_arg)*numarray.array([[30000.0, 0.0, 0.0], [0.0, 1.153410887977139, -0.36038311201720391], [0.0, -0.36038311201720391, 1.8465891120228608]])
7106          res=eigenvalues_and_eigenvectors(arg)
7107          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7108          ref_ev=msk_ref_ev*numarray.array([1.0, 2.0, 30000.0])+(1.-msk_ref_ev)*numarray.array([1.0, 2.0, 30000.0])
7109          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7110          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
7111          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7112          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7113          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7114          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7115          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7116          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7117          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7118       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7119       def test_eigenvalues_and_eigenvectors_expandedData_dim3_case29(self):
7120          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7121          arg=msk_arg*numarray.array([[7140.1907849945546, 12308.774438213351, -3419.2256841313947], [12308.774438213351, 21223.762934183575, -5894.4478052274408], [-3419.2256841313947, -5894.4478052274408, 1639.0462808218595]])+(1.-msk_arg)*numarray.array([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
7122          res=eigenvalues_and_eigenvectors(arg)
7123          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7124          ref_ev=msk_ref_ev*numarray.array([1.0, 2.0, 30000.0])+(1.-msk_ref_ev)*numarray.array([0.0, 0.0, 0.0])
7125          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7126          self.failUnlessEqual(res[0].getShape(),(3,),"wrong shape of result for eigenvalues.")
7127          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7128          self.failUnlessEqual(res[1].getShape(),(3, 3),"wrong shape of result for eigenvectors.")
7129          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7130          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7131          self.failUnless(Lsup(matrixmult(arg,res[1][:,1])-res[0][1]*res[1][:,1])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 1")
7132          self.failUnless(Lsup(matrixmult(arg,res[1][:,2])-res[0][2]*res[1][:,2])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 2")
7133          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(3))<=self.RES_TOL,"eigenvectors are not orthonormal")
7134       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7135       def test_eigenvalues_and_eigenvectors_constData_dim1_case0(self):
7136          arg=Data(numarray.array([[0.0]]),self.functionspace)
7137          res=eigenvalues_and_eigenvectors(arg)
7138          ref_ev=Data(numarray.array([0.0]),self.functionspace)
7139          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7140          self.failUnlessEqual(res[0].getShape(),(1,),"wrong shape of result for eigenvalues.")
7141          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7142          self.failUnlessEqual(res[1].getShape(),(1, 1),"wrong shape of result for eigenvectors.")
7143          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7144          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7145          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(1))<=self.RES_TOL,"eigenvectors are not orthonormal")
7146       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7147       def test_eigenvalues_and_eigenvectors_constData_dim1_case1(self):
7148          arg=Data(numarray.array([[1.0]]),self.functionspace)
7149          res=eigenvalues_and_eigenvectors(arg)
7150          ref_ev=Data(numarray.array([1.0]),self.functionspace)
7151          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7152          self.failUnlessEqual(res[0].getShape(),(1,),"wrong shape of result for eigenvalues.")
7153          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7154          self.failUnlessEqual(res[1].getShape(),(1, 1),"wrong shape of result for eigenvectors.")
7155          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7156          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7157          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(1))<=self.RES_TOL,"eigenvectors are not orthonormal")
7158       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7159       def test_eigenvalues_and_eigenvectors_expandedData_dim1_case0(self):
7160          msk_arg=whereZero(self.functionspace.getX()[0],1.e-8)
7161          arg=msk_arg*numarray.array([[0.0]])+(1.-msk_arg)*numarray.array([[1.0]])
7162          res=eigenvalues_and_eigenvectors(arg)
7163          msk_ref_ev=whereZero(self.functionspace.getX()[0],1.e-8)
7164          ref_ev=msk_ref_ev*numarray.array([0.0])+(1.-msk_ref_ev)*numarray.array([1.0])
7165          self.failUnless(isinstance(res[0],Data),"wrong type of result for eigenvalues.")
7166          self.failUnlessEqual(res[0].getShape(),(1,),"wrong shape of result for eigenvalues.")
7167          self.failUnless(isinstance(res[1],Data),"wrong type of result for eigenvectors.")
7168          self.failUnlessEqual(res[1].getShape(),(1, 1),"wrong shape of result for eigenvectors.")
7169          self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues")
7170          self.failUnless(Lsup(matrixmult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0")
7171          self.failUnless(Lsup(matrixmult(transpose(res[1]),res[1])-kronecker(1))<=self.RES_TOL,"eigenvectors are not orthonormal")

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

  ViewVC Help
Powered by ViewVC 1.1.26