/[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 529 by gross, Fri Feb 3 02:07:24 2006 UTC revision 530 by gross, Wed Feb 15 07:11:00 2006 UTC
# Line 6133  class Test_util_unary_no_tagged_data(Tes Line 6133  class Test_util_unary_no_tagged_data(Tes
6133        self.failUnless(isinstance(res,Data),"wrong type of result.")        self.failUnless(isinstance(res,Data),"wrong type of result.")
6134        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
6135        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6136       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6137       def test_eigenvalues_array_dim1(self):
6138          arg=numarray.array([[0.55998648196067324]])
6139          res=eigenvalues(arg)
6140          ref=numarray.array([0.55998648196067324])
6141          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
6142          self.failUnlessEqual(res.shape,(1,),"wrong shape of result.")
6143          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6144       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6145       def test_eigenvalues_array_dim2(self):
6146          arg=numarray.array([[-0.82785169696846017, -0.13252097848511568], [-0.13252097848511568, -0.57337241477421497]])
6147          res=eigenvalues(arg)
6148          ref=numarray.array([-0.88432851132695822, -0.51689560041571692])
6149          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
6150          self.failUnlessEqual(res.shape,(2,),"wrong shape of result.")
6151          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6152       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6153       def test_eigenvalues_array_dim3(self):
6154          arg=numarray.array([[-0.23017631173237429, 0.34683253477098563, 0.40039067825733443], [0.34683253477098563, 0.053901712034509108, -0.14974270647987487], [0.40039067825733443, -0.14974270647987487, -0.81268542047574677]])
6155          res=eigenvalues(arg)
6156          ref=numarray.array([-1.0939000322647103, -0.19276192412377424, 0.29770193621487262])
6157          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
6158          self.failUnlessEqual(res.shape,(3,),"wrong shape of result.")
6159          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6160       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6161       def test_eigenvalues_Symbol_dim1(self):
6162          arg=Symbol(shape=(1, 1))
6163          res=eigenvalues(arg)
6164          s=numarray.array([[-0.88333892054593477]])
6165          sub=res.substitute({arg:s})
6166          ref=numarray.array([-0.88333892054593477])
6167          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
6168          self.failUnlessEqual(res.getShape(),(1,),"wrong shape of result.")
6169          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6170       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6171       def test_eigenvalues_Symbol_dim2(self):
6172          arg=Symbol(shape=(2, 2))
6173          res=eigenvalues(arg)
6174          s=numarray.array([[-0.19774975364468905, 0.72605762053517053], [0.72605762053517053, -0.17702492646411461]])
6175          sub=res.substitute({arg:s})
6176          ref=numarray.array([-0.91351890385851708, 0.53874422374971342])
6177          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
6178          self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
6179          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6180       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6181       def test_eigenvalues_Symbol_dim3(self):
6182          arg=Symbol(shape=(3, 3))
6183          res=eigenvalues(arg)
6184          s=numarray.array([[-0.39666022712158422, 0.043213499565241786, -0.2718619768786924], [0.043213499565241786, 0.61677493984107223, 0.57159082148513496], [-0.2718619768786924, 0.57159082148513496, 0.3652453545986567]])
6185          sub=res.substitute({arg:s})
6186          ref=numarray.array([-0.53716021759378285, 0.033257939187142031, 1.0892623457247856])
6187          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
6188          self.failUnlessEqual(res.getShape(),(3,),"wrong shape of result.")
6189          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6190       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6191       def test_eigenvalues_constData_dim1(self):
6192          arg=Data(numarray.array([[0.18644177194421618]]),self.functionspace)
6193          res=eigenvalues(arg)
6194          ref=Data(numarray.array([0.18644177194421618]),self.functionspace)
6195          self.failUnless(isinstance(res,Data),"wrong type of result.")
6196          self.failUnlessEqual(res.getShape(),(1,),"wrong shape of result.")
6197          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6198       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6199       def test_eigenvalues_constData_dim2(self):
6200          arg=Data(numarray.array([[-0.81762199211802677, 0.45850501297427182], [0.45850501297427182, -0.47124343125083223]]),self.functionspace)
6201          res=eigenvalues(arg)
6202          ref=Data(numarray.array([-1.1345565468318792, -0.15430887653697989]),self.functionspace)
6203          self.failUnless(isinstance(res,Data),"wrong type of result.")
6204          self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
6205          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6206       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6207       def test_eigenvalues_constData_dim3(self):
6208          arg=Data(numarray.array([[0.94061304998883721, 0.26537839728361134, 0.23504527017785981], [0.26537839728361134, -0.5459884098403629, 0.2630475033998162], [0.23504527017785981, 0.2630475033998162, -0.17078741356007954]]),self.functionspace)
6209          res=eigenvalues(arg)
6210          ref=Data(numarray.array([-0.69269722708749937, -0.13414705681961808, 1.0506815104955125]),self.functionspace)
6211          self.failUnless(isinstance(res,Data),"wrong type of result.")
6212          self.failUnlessEqual(res.getShape(),(3,),"wrong shape of result.")
6213          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6214       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6215       def test_eigenvalues_expandedData_dim1(self):
6216          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
6217          arg=msk_arg*numarray.array([[-0.23193456556887959]])+(1.-msk_arg)*numarray.array([[-0.96174181563514316]])
6218          res=eigenvalues(arg)
6219          msk_ref=whereNegative(self.functionspace.getX()[0]-0.5)
6220          ref=msk_ref*numarray.array([-0.23193456556887959])+(1.-msk_ref)*numarray.array([-0.96174181563514316])
6221          self.failUnless(isinstance(res,Data),"wrong type of result.")
6222          self.failUnlessEqual(res.getShape(),(1,),"wrong shape of result.")
6223          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6224       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6225       def test_eigenvalues_expandedData_dim2(self):
6226          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
6227          arg=msk_arg*numarray.array([[0.50169800187705049, -0.25726673908249542], [-0.25726673908249542, 0.31046458149750822]])+(1.-msk_arg)*numarray.array([[-0.20084507113079897, 0.043607881117532221], [0.043607881117532221, -0.26818550790921791]])
6228          res=eigenvalues(arg)
6229          msk_ref=whereNegative(self.functionspace.getX()[0]-0.5)
6230          ref=msk_ref*numarray.array([0.13162049247242708, 0.68054209090213169])+(1.-msk_ref)*numarray.array([-0.28960912676100919, -0.17942145227900769])
6231          self.failUnless(isinstance(res,Data),"wrong type of result.")
6232          self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
6233          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
6234       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6235       def test_eigenvalues_expandedData_dim3(self):
6236          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
6237          arg=msk_arg*numarray.array([[0.77521278873012034, -0.068861371980342923, -0.17496467817334527], [-0.068861371980342923, 0.51501928025302446, 0.17204057959868801], [-0.17496467817334527, 0.17204057959868801, -0.87053006022942903]])+(1.-msk_arg)*numarray.array([[-0.76245139703149523, -0.32739735199553155, -0.40491609402756901], [-0.32739735199553155, 0.031612520130607225, 0.027781414946789096], [-0.40491609402756901, 0.027781414946789096, -0.80918893919540325]])
6238          res=eigenvalues(arg)
6239          msk_ref=whereNegative(self.functionspace.getX()[0]-0.5)
6240          ref=msk_ref*numarray.array([-0.90786283754763031, 0.50806128358627256, 0.81950356271507419])+(1.-msk_ref)*numarray.array([-1.2268520410033508, -0.49329882636432321, 0.18012305127138231])
6241          self.failUnless(isinstance(res,Data),"wrong type of result.")
6242          self.failUnlessEqual(res.getShape(),(3,),"wrong shape of result.")
6243          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")

Legend:
Removed from v.529  
changed lines
  Added in v.530

  ViewVC Help
Powered by ViewVC 1.1.26