/[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 432 by gross, Wed Jan 11 05:53:40 2006 UTC revision 433 by gross, Tue Jan 17 23:54:38 2006 UTC
# Line 5500  class Test_util_unary_no_tagged_data(Tes Line 5500  class Test_util_unary_no_tagged_data(Tes
5500        self.failUnless(isinstance(res,Data),"wrong type of result.")        self.failUnless(isinstance(res,Data),"wrong type of result.")
5501        self.failUnlessEqual(res.getShape(),(3, 2),"wrong shape of result.")        self.failUnlessEqual(res.getShape(),(3, 2),"wrong shape of result.")
5502        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5503       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5504       def test_inverse_array_dim1(self):
5505          arg=numarray.array([[1.3914367298126584]])
5506          res=inverse(arg)
5507          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
5508          self.failUnlessEqual(res.shape,(1, 1),"wrong shape of result.")
5509          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(1))<=self.RES_TOL,"wrong result")
5510       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5511       def test_inverse_array_dim2(self):
5512          arg=numarray.array([[2.9418052544261108, 0.53874493129953072], [0.46782111529042547, 1.9101073069970917]])
5513          res=inverse(arg)
5514          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
5515          self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.")
5516          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(2))<=self.RES_TOL,"wrong result")
5517       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5518       def test_inverse_array_dim3(self):
5519          arg=numarray.array([[1.6020395384987041, -0.87670859867007334, -0.98070275415465935], [-0.8409158097058016, 2.8045205591389903, 0.88187627481882669], [-0.45001235350647861, 0.11036032836309251, 1.8806880610894336]])
5520          res=inverse(arg)
5521          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
5522          self.failUnlessEqual(res.shape,(3, 3),"wrong shape of result.")
5523          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(3))<=self.RES_TOL,"wrong result")
5524       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5525       def test_inverse_Symbol_dim1(self):
5526          arg=Symbol(shape=(1, 1))
5527          res=inverse(arg)
5528          s=numarray.array([[1.1980314049676126]])
5529          sub=res.substitute({arg:s})
5530          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
5531          self.failUnlessEqual(res.getShape(),(1, 1),"wrong shape of result.")
5532          self.failUnless(Lsup(matrixmult(sub,s)-kronecker(1))<=self.RES_TOL,"wrong result")
5533       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5534       def test_inverse_Symbol_dim2(self):
5535          arg=Symbol(shape=(2, 2))
5536          res=inverse(arg)
5537          s=numarray.array([[2.0626000623432192, -0.19378103714358597], [-0.8695363129254492, 1.0318306215625603]])
5538          sub=res.substitute({arg:s})
5539          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
5540          self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.")
5541          self.failUnless(Lsup(matrixmult(sub,s)-kronecker(2))<=self.RES_TOL,"wrong result")
5542       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5543       def test_inverse_Symbol_dim3(self):
5544          arg=Symbol(shape=(3, 3))
5545          res=inverse(arg)
5546          s=numarray.array([[2.4910151385693204, -0.74351863162413956, -0.40708461900873694], [0.51617920870611744, 2.8802512977704158, 0.47057466972995687], [-0.42822503793816469, -0.50381354993207417, 1.3317844973101152]])
5547          sub=res.substitute({arg:s})
5548          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
5549          self.failUnlessEqual(res.getShape(),(3, 3),"wrong shape of result.")
5550          self.failUnless(Lsup(matrixmult(sub,s)-kronecker(3))<=self.RES_TOL,"wrong result")
5551       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5552       def test_inverse_constData_dim1(self):
5553          arg=Data(numarray.array([[1.4764835684284772]]),self.functionspace)
5554          res=inverse(arg)
5555          self.failUnless(isinstance(res,Data),"wrong type of result.")
5556          self.failUnlessEqual(res.getShape(),(1, 1),"wrong shape of result.")
5557          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(1))<=self.RES_TOL,"wrong result")
5558       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5559       def test_inverse_constData_dim2(self):
5560          arg=Data(numarray.array([[1.571080150835487, -0.082524281281854961], [-0.9371994394566685, 2.5886052290160944]]),self.functionspace)
5561          res=inverse(arg)
5562          self.failUnless(isinstance(res,Data),"wrong type of result.")
5563          self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.")
5564          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(2))<=self.RES_TOL,"wrong result")
5565       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5566       def test_inverse_constData_dim3(self):
5567          arg=Data(numarray.array([[2.7386874118759605, 0.24320192932450824, -0.98551433885644957], [-0.47237322912611623, 2.0770157618999936, -0.70532850079694409], [-0.55077067435537064, -0.72886734893974148, 1.8532894898622749]]),self.functionspace)
5568          res=inverse(arg)
5569          self.failUnless(isinstance(res,Data),"wrong type of result.")
5570          self.failUnlessEqual(res.getShape(),(3, 3),"wrong shape of result.")
5571          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(3))<=self.RES_TOL,"wrong result")
5572       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5573       def test_inverse_expandedData_dim1(self):
5574          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
5575          arg=msk_arg*numarray.array([[2.7459817071296375]])+(1.-msk_arg)*numarray.array([[2.708920165934452]])
5576          res=inverse(arg)
5577          self.failUnless(isinstance(res,Data),"wrong type of result.")
5578          self.failUnlessEqual(res.getShape(),(1, 1),"wrong shape of result.")
5579          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(1))<=self.RES_TOL,"wrong result")
5580       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5581       def test_inverse_expandedData_dim2(self):
5582          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
5583          arg=msk_arg*numarray.array([[1.940002512105073, 0.029227206714448339], [-0.16699889152420955, 1.7415408052680506]])+(1.-msk_arg)*numarray.array([[3.6647888118613525, -0.79263077445508201], [-0.12552062258114849, 3.8289111523004937]])
5584          res=inverse(arg)
5585          self.failUnless(isinstance(res,Data),"wrong type of result.")
5586          self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.")
5587          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(2))<=self.RES_TOL,"wrong result")
5588       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5589       def test_inverse_expandedData_dim3(self):
5590          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
5591          arg=msk_arg*numarray.array([[2.2418112382624198, 0.81650662903581805, -0.094756021110331989], [-0.79442369492917742, 1.9995946283413137, 0.99436683143019566], [0.20497870840231047, 0.56858349778979589, 1.7344833021084756]])+(1.-msk_arg)*numarray.array([[2.3428233100558398, 0.5902214559572323, 0.7775760520103312], [0.30856300288555638, 2.8439402341090472, 0.60593451605418513], [0.99714433866199181, -0.38410207533093699, 3.2417070638990513]])
5592          res=inverse(arg)
5593          self.failUnless(isinstance(res,Data),"wrong type of result.")
5594          self.failUnlessEqual(res.getShape(),(3, 3),"wrong shape of result.")
5595          self.failUnless(Lsup(matrixmult(res,arg)-kronecker(3))<=self.RES_TOL,"wrong result")

Legend:
Removed from v.432  
changed lines
  Added in v.433

  ViewVC Help
Powered by ViewVC 1.1.26