/[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 395 by gross, Wed Dec 21 02:41:59 2005 UTC revision 400 by gross, Wed Dec 21 23:13:39 2005 UTC
# Line 225  class Test_util_unary_no_tagged_data(Tes Line 225  class Test_util_unary_no_tagged_data(Tes
225        arg=numarray.array(-15.0739210922)        arg=numarray.array(-15.0739210922)
226        res=wherePositive(arg)        res=wherePositive(arg)
227        ref=numarray.array(0.0)        ref=numarray.array(0.0)
228        if not isinstance(res,float):        if isinstance(res,numarray.NumArray):
          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")  
229           self.failUnlessEqual(res.shape,(),"wrong shape of result.")           self.failUnlessEqual(res.shape,(),"wrong shape of result.")
230          else:
231             self.failUnless(isinstance(res,float),"wrong type of result.")
232        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
233     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
234     def test_wherePositive_array_rank1(self):     def test_wherePositive_array_rank1(self):
# Line 5094  class Test_util_unary_no_tagged_data(Tes Line 5095  class Test_util_unary_no_tagged_data(Tes
5095        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
5096        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5097    
5098       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5099       def test_clip_float_rank0(self):
5100          arg=-0.660844742681
5101          res=clip(arg,-0.3,0.5)
5102          ref=-0.3
5103          self.failUnless(isinstance(res,float),"wrong type of result.")
5104          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5105       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5106       def test_clip_array_rank0(self):
5107          arg=numarray.array(-0.616432559809)
5108          res=clip(arg,-0.3,0.5)
5109          ref=numarray.array(-0.3)
5110          if isinstance(res,numarray.NumArray):
5111             self.failUnlessEqual(res.shape,(),"wrong shape of result.")
5112          else:
5113             self.failUnless(isinstance(res,float),"wrong type of result.")
5114          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5115       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5116       def test_clip_array_rank1(self):
5117          arg=numarray.array([-0.51271199503186593, -0.822484111396796])
5118          res=clip(arg,-0.3,0.5)
5119          ref=numarray.array([-0.29999999999999999, -0.29999999999999999])
5120          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
5121          self.failUnlessEqual(res.shape,(2,),"wrong shape of result.")
5122          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5123       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5124       def test_clip_array_rank2(self):
5125          arg=numarray.array([[0.30100679449598511, 0.88767064649145766, 0.33865733182911906, 0.85531213080164914, 0.99410402183813074], [0.095717025396767408, 0.79153699203511629, 0.69300596381099822, 0.52370716757069058, -0.59416147926326457], [-0.19974051297983286, -0.54785769539787643, 0.6908558361120738, 0.10853690318676268, -0.92243333197553667], [0.38961082223496413, 0.89291409313272374, 0.057863956684621076, 0.50395838385178759, -0.34645817452731187]])
5126          res=clip(arg,-0.3,0.5)
5127          ref=numarray.array([[0.30100679449598511, 0.5, 0.33865733182911906, 0.5, 0.5], [0.095717025396767408, 0.5, 0.5, 0.5, -0.29999999999999999], [-0.19974051297983286, -0.29999999999999999, 0.5, 0.10853690318676268, -0.29999999999999999], [0.38961082223496413, 0.5, 0.057863956684621076, 0.5, -0.29999999999999999]])
5128          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
5129          self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.")
5130          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5131       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5132       def test_clip_array_rank3(self):
5133          arg=numarray.array([[[0.80651421777631804, 0.42731881222688806], [-0.97337503979172202, 0.55560652110255382]], [[0.57745817086577378, -0.74819163530551558], [0.65118109098829802, 0.45705605350544798]], [[0.84734044549687937, -0.97694579653116231], [0.11346644908007897, 0.97057408781664289]], [[-0.44110401079642081, -0.90446847999697488], [0.82981000049437226, 0.62852473157503597]], [[0.55643517187873859, 0.17159295755472526], [-0.3276983994906566, 0.82111281587385077]], [[0.66037767196123465, -0.8138922973233893], [0.22428143590074856, 0.60032297288637171]]])
5134          res=clip(arg,-0.3,0.5)
5135          ref=numarray.array([[[0.5, 0.42731881222688806], [-0.29999999999999999, 0.5]], [[0.5, -0.29999999999999999], [0.5, 0.45705605350544798]], [[0.5, -0.29999999999999999], [0.11346644908007897, 0.5]], [[-0.29999999999999999, -0.29999999999999999], [0.5, 0.5]], [[0.5, 0.17159295755472526], [-0.29999999999999999, 0.5]], [[0.5, -0.29999999999999999], [0.22428143590074856, 0.5]]])
5136          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
5137          self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.")
5138          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5139       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5140       def test_clip_array_rank4(self):
5141          arg=numarray.array([[[[0.46285917453321823, -0.91689578652051007, 0.85018159714116481, -0.25906072812293113], [0.81932949407078137, -0.60307967212356628, 0.56538931825524186, -0.40508251808655071], [0.77170764992626406, 0.81299384258133656, 0.7404976524889133, 0.51860787224188187]], [[-0.62450454506954589, 0.94207725980470158, -0.12374258578480357, 0.66339457762270237], [0.35534578368047653, 0.42819081302985462, 0.063059236470800473, -0.73505630795988397], [0.24842113864491688, 0.44227807933837804, 0.36053730941174211, -0.34351746910574721]]], [[[-0.54014660449687857, -0.73963869205638022, -0.85829607205589942, 0.19478539963645392], [-0.94553140352926479, -0.29641607950976878, -0.57063497488586767, -0.48500827538538505], [-0.45756026282338103, -0.19137078199124091, -0.26560363911562557, -0.80865109063294827]], [[0.14311339149994962, 0.29424466150856587, 0.99821626133853081, -0.1461637145270076], [-0.72334486633204564, 0.033116994477579764, 0.47044975702162461, 0.40109158073490891], [-0.038219493414332506, 0.73839517283012568, 0.14208390499507262, 0.49550413385768977]]], [[[0.398910718898426, 0.03446413720460928, -0.46028688211877444, 0.70797648020636439], [0.19363454901242005, 0.92111688093404243, 0.79409098989516091, 0.71035510610026265], [0.12629228314430518, 0.88671129037390428, -0.91227198363005213, -0.94341232990645918]], [[0.57833363856424014, -0.47043185008904964, -0.63643237130510921, 0.28866935981066577], [0.39621689148915196, -0.89298541799113895, -0.76674863298496154, 0.86640350436457525], [0.33847977460676804, 0.57610754346250648, 0.22238502772765689, -0.57901129898204906]]]])
5142          res=clip(arg,-0.3,0.5)
5143          ref=numarray.array([[[[0.46285917453321823, -0.29999999999999999, 0.5, -0.25906072812293113], [0.5, -0.29999999999999999, 0.5, -0.29999999999999999], [0.5, 0.5, 0.5, 0.5]], [[-0.29999999999999999, 0.5, -0.12374258578480357, 0.5], [0.35534578368047653, 0.42819081302985462, 0.063059236470800473, -0.29999999999999999], [0.24842113864491688, 0.44227807933837804, 0.36053730941174211, -0.29999999999999999]]], [[[-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.19478539963645392], [-0.29999999999999999, -0.29641607950976878, -0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, -0.19137078199124091, -0.26560363911562557, -0.29999999999999999]], [[0.14311339149994962, 0.29424466150856587, 0.5, -0.1461637145270076], [-0.29999999999999999, 0.033116994477579764, 0.47044975702162461, 0.40109158073490891], [-0.038219493414332506, 0.5, 0.14208390499507262, 0.49550413385768977]]], [[[0.398910718898426, 0.03446413720460928, -0.29999999999999999, 0.5], [0.19363454901242005, 0.5, 0.5, 0.5], [0.12629228314430518, 0.5, -0.29999999999999999, -0.29999999999999999]], [[0.5, -0.29999999999999999, -0.29999999999999999, 0.28866935981066577], [0.39621689148915196, -0.29999999999999999, -0.29999999999999999, 0.5], [0.33847977460676804, 0.5, 0.22238502772765689, -0.29999999999999999]]]])
5144          self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.")
5145          self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.")
5146          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5147       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5148       def test_clip_Symbol_rank0(self):
5149          arg=Symbol(shape=())
5150          res=clip(arg,-0.3,0.5)
5151          s=numarray.array(-0.792931814027)
5152          sub=res.substitute({arg:s})
5153          ref=numarray.array(-0.3)
5154          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
5155          self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
5156          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5157       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5158       def test_clip_Symbol_rank1(self):
5159          arg=Symbol(shape=(2,))
5160          res=clip(arg,-0.3,0.5)
5161          s=numarray.array([-0.12048403445176348, -0.40029599458937115])
5162          sub=res.substitute({arg:s})
5163          ref=numarray.array([-0.12048403445176348, -0.29999999999999999])
5164          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
5165          self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
5166          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5167       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5168       def test_clip_Symbol_rank2(self):
5169          arg=Symbol(shape=(4, 5))
5170          res=clip(arg,-0.3,0.5)
5171          s=numarray.array([[0.59397707593157989, -0.015816232421714593, -0.71355286935163331, -0.85103204785524444, -0.91412162455901824], [-0.010694641368312885, 0.84414762841027247, -0.55243149822804294, -0.84297884285781066, 0.27021554859147567], [0.4863295784707149, 0.050773923264246568, 0.41020785802506343, -0.015448450147302895, -0.9895001255305016], [-0.80145072141626073, 0.041501336925147125, -0.9850016338870633, 0.61693811132536069, -0.48955961785655933]])
5172          sub=res.substitute({arg:s})
5173          ref=numarray.array([[0.5, -0.015816232421714593, -0.29999999999999999, -0.29999999999999999, -0.29999999999999999], [-0.010694641368312885, 0.5, -0.29999999999999999, -0.29999999999999999, 0.27021554859147567], [0.4863295784707149, 0.050773923264246568, 0.41020785802506343, -0.015448450147302895, -0.29999999999999999], [-0.29999999999999999, 0.041501336925147125, -0.29999999999999999, 0.5, -0.29999999999999999]])
5174          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
5175          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
5176          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5177       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5178       def test_clip_Symbol_rank3(self):
5179          arg=Symbol(shape=(6, 2, 2))
5180          res=clip(arg,-0.3,0.5)
5181          s=numarray.array([[[-0.67698725582695451, 0.55024011140579132], [-0.047623883112311249, 0.071564619314291367]], [[-0.7948301013947463, 0.26374348727881602], [-0.94301016179903296, -0.88704745056286716]], [[0.20486197801890671, 0.80225286382835392], [-0.69420948063995547, -0.12606948305733034]], [[0.61750342986108109, 0.93969472414748978], [-0.45326273384231608, 0.31853757719424647]], [[0.65617139058608709, -0.29299677423087145], [-0.66376148085374687, 0.018048557420640821]], [[0.4506769651529039, -0.40677305322783619], [0.12438133220532399, 0.33554725745486236]]])
5182          sub=res.substitute({arg:s})
5183          ref=numarray.array([[[-0.29999999999999999, 0.5], [-0.047623883112311249, 0.071564619314291367]], [[-0.29999999999999999, 0.26374348727881602], [-0.29999999999999999, -0.29999999999999999]], [[0.20486197801890671, 0.5], [-0.29999999999999999, -0.12606948305733034]], [[0.5, 0.5], [-0.29999999999999999, 0.31853757719424647]], [[0.5, -0.29299677423087145], [-0.29999999999999999, 0.018048557420640821]], [[0.4506769651529039, -0.29999999999999999], [0.12438133220532399, 0.33554725745486236]]])
5184          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
5185          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
5186          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5187       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5188       def test_clip_Symbol_rank4(self):
5189          arg=Symbol(shape=(3, 2, 3, 4))
5190          res=clip(arg,-0.3,0.5)
5191          s=numarray.array([[[[0.87297933466547506, -0.6759395484248385, -0.064930862035132542, -0.68208927283081366], [-0.8905913641586114, -0.51780151868370705, 0.47935494949299517, -0.43996092297267175], [-0.13947535976114955, -0.59013798318233879, 0.92191259205453591, 0.28856814133987152]], [[0.87283476362790768, 0.83458944186472883, 0.57945024810703272, -0.51607631639092055], [-0.045611193265933991, -0.13516754948427256, -0.12079102468797509, 0.95040836153785979], [0.42784337867530087, -0.74320064427902177, -0.29677529518365819, -0.72388240820397476]]], [[[-0.25053913879373635, 0.99039684792089555, 0.84365440049321294, -0.44615210082238077], [0.2098688758528251, -0.094827930093002388, -0.48904012546642628, 0.07353404666222918], [-0.405215805546145, -0.24507666906852199, 0.073037984734869887, 0.45910186159723798]], [[-0.83617803684565284, 0.72409861676776344, 0.66274368653669491, -0.8363139277203151], [-0.59303850192082574, -0.26100647735452887, -0.46126763689102002, -0.5538059778591673], [-0.13796438067897321, 0.9455220175339234, -0.14001610155093669, -0.13853682926845678]]], [[[-0.88109448055064177, 0.042200298380294932, 0.97569411639878867, 0.055014350789691413], [-0.58023129058148948, -0.81286449921011528, 0.55426564144993939, 0.87587695474553762], [-0.19635452272327258, -0.53832837997779137, -0.025941720598393392, 0.68951865195447115]], [[-0.6367350497294797, 0.82779102060680665, 0.14724409720331422, -0.29315367370960499], [0.22190760573348678, -0.80567179915913845, 0.32495113629038319, -0.91983230608442446], [-0.32241542693213776, -0.85248386776413798, 0.78949099002770429, 0.094819493332709781]]]])
5192          sub=res.substitute({arg:s})
5193          ref=numarray.array([[[[0.5, -0.29999999999999999, -0.064930862035132542, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999, 0.47935494949299517, -0.29999999999999999], [-0.13947535976114955, -0.29999999999999999, 0.5, 0.28856814133987152]], [[0.5, 0.5, 0.5, -0.29999999999999999], [-0.045611193265933991, -0.13516754948427256, -0.12079102468797509, 0.5], [0.42784337867530087, -0.29999999999999999, -0.29677529518365819, -0.29999999999999999]]], [[[-0.25053913879373635, 0.5, 0.5, -0.29999999999999999], [0.2098688758528251, -0.094827930093002388, -0.29999999999999999, 0.07353404666222918], [-0.29999999999999999, -0.24507666906852199, 0.073037984734869887, 0.45910186159723798]], [[-0.29999999999999999, 0.5, 0.5, -0.29999999999999999], [-0.29999999999999999, -0.26100647735452887, -0.29999999999999999, -0.29999999999999999], [-0.13796438067897321, 0.5, -0.14001610155093669, -0.13853682926845678]]], [[[-0.29999999999999999, 0.042200298380294932, 0.5, 0.055014350789691413], [-0.29999999999999999, -0.29999999999999999, 0.5, 0.5], [-0.19635452272327258, -0.29999999999999999, -0.025941720598393392, 0.5]], [[-0.29999999999999999, 0.5, 0.14724409720331422, -0.29315367370960499], [0.22190760573348678, -0.29999999999999999, 0.32495113629038319, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999, 0.5, 0.094819493332709781]]]])
5194          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
5195          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
5196          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5197       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5198       def test_clip_constData_rank0(self):
5199          arg=Data(0.873991409144,self.functionspace)
5200          res=clip(arg,-0.3,0.5)
5201          ref=Data(0.5,self.functionspace)
5202          self.failUnless(isinstance(res,Data),"wrong type of result.")
5203          self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
5204          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5205       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5206       def test_clip_constData_rank1(self):
5207          arg=Data(numarray.array([0.10029829613225805, 0.47403026690156014]),self.functionspace)
5208          res=clip(arg,-0.3,0.5)
5209          ref=Data(numarray.array([0.10029829613225805, 0.47403026690156014]),self.functionspace)
5210          self.failUnless(isinstance(res,Data),"wrong type of result.")
5211          self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
5212          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5213       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5214       def test_clip_constData_rank2(self):
5215          arg=Data(numarray.array([[-0.28275534784898304, -0.13729948733728325, 0.013813296255671847, 0.73460682612929729, 0.24551982471646627], [0.61067563404013048, 0.42590985220127653, 0.053795995066850733, -0.12813919742697655, -0.45354184407079257], [0.027592398296971021, -0.27728369179302592, 0.83461918535632207, 0.5996778630178683, 0.64537419802208373], [0.46265837345465788, -0.013903448047151823, 0.43282947286633333, -0.7140268312200182, 0.11491473517057038]]),self.functionspace)
5216          res=clip(arg,-0.3,0.5)
5217          ref=Data(numarray.array([[-0.28275534784898304, -0.13729948733728325, 0.013813296255671847, 0.5, 0.24551982471646627], [0.5, 0.42590985220127653, 0.053795995066850733, -0.12813919742697655, -0.29999999999999999], [0.027592398296971021, -0.27728369179302592, 0.5, 0.5, 0.5], [0.46265837345465788, -0.013903448047151823, 0.43282947286633333, -0.29999999999999999, 0.11491473517057038]]),self.functionspace)
5218          self.failUnless(isinstance(res,Data),"wrong type of result.")
5219          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
5220          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5221       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5222       def test_clip_constData_rank3(self):
5223          arg=Data(numarray.array([[[-0.44382776839546945, -0.63662456777605092], [-0.54650947561527286, -0.84571189798389201]], [[-0.84094147647363049, 0.64826856634432373], [0.622621310911184, 0.23179746677715629]], [[0.72783765690686408, -0.14342314789815735], [0.38201531418904833, -0.69055788612963065]], [[-0.0064036502394755335, 0.88418526966764577], [0.38413648569626235, -0.48827873166332258]], [[-0.36805980178883502, -0.52366150491610441], [-0.17224428981836781, -0.11145730040193791]], [[0.0032312327392447493, 0.40509583911865898], [-0.078221409096661088, 0.55983165731854423]]]),self.functionspace)
5224          res=clip(arg,-0.3,0.5)
5225          ref=Data(numarray.array([[[-0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999]], [[-0.29999999999999999, 0.5], [0.5, 0.23179746677715629]], [[0.5, -0.14342314789815735], [0.38201531418904833, -0.29999999999999999]], [[-0.0064036502394755335, 0.5], [0.38413648569626235, -0.29999999999999999]], [[-0.29999999999999999, -0.29999999999999999], [-0.17224428981836781, -0.11145730040193791]], [[0.0032312327392447493, 0.40509583911865898], [-0.078221409096661088, 0.5]]]),self.functionspace)
5226          self.failUnless(isinstance(res,Data),"wrong type of result.")
5227          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
5228          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5229       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5230       def test_clip_constData_rank4(self):
5231          arg=Data(numarray.array([[[[0.74565220604294113, 0.70707680004089535, -0.8773779384765521, 0.32828037279397537], [0.12930191501822041, 0.61037326219072852, -0.72378849864905304, -0.71546199305068181], [-0.99689819686806036, 0.27574928269813848, -0.35838582444761657, -0.5263903369979559]], [[0.34209505072502133, 0.15911882981611325, 0.35995945219157122, 0.66221816529573552], [0.43624456519819632, -0.86396951527158183, -0.39169318175569057, -0.42904934103954684], [-0.41672280174621079, 0.5747168458744496, 0.10190810106330472, -0.40269367788473454]]], [[[0.96435342278392056, -0.38598803996794429, -0.10569714455448587, 0.78395387940432859], [-0.038509327942198635, 0.33381791489369883, -0.15711165198428034, 0.62080633262478568], [-0.85531025762383317, -0.51127155377851863, -0.98887178638798634, 0.74904701210248192]], [[-0.24723563589657527, 0.40962376639148879, -0.63040816326005822, -0.7114593474303792], [0.86532397329368793, 0.93027464092180923, 0.63743386509330668, 0.095944939045965238], [0.40272444381571271, -0.11827319884920562, 0.90658957997212819, 0.75580908924882162]]], [[[0.38931728355886186, -0.87926757063573313, 0.5065858460075825, -0.094306906597873885], [0.80847359053294654, -0.41252922807094805, -0.33611596899498153, 0.26443168557169749], [-0.017360832827441719, -0.67566709940607206, -0.64725079995155332, -0.65760481990092745]], [[0.31365664160961182, 0.18146342960739825, -0.91968636759286748, 0.95202972228558935], [0.29398556423299493, -0.19710497775305269, 0.051818367197931092, -0.58880901521639895], [-0.15383079570743585, 0.058375088082090132, 0.86765927088269068, 0.54391547419416297]]]]),self.functionspace)
5232          res=clip(arg,-0.3,0.5)
5233          ref=Data(numarray.array([[[[0.5, 0.5, -0.29999999999999999, 0.32828037279397537], [0.12930191501822041, 0.5, -0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, 0.27574928269813848, -0.29999999999999999, -0.29999999999999999]], [[0.34209505072502133, 0.15911882981611325, 0.35995945219157122, 0.5], [0.43624456519819632, -0.29999999999999999, -0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, 0.5, 0.10190810106330472, -0.29999999999999999]]], [[[0.5, -0.29999999999999999, -0.10569714455448587, 0.5], [-0.038509327942198635, 0.33381791489369883, -0.15711165198428034, 0.5], [-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.5]], [[-0.24723563589657527, 0.40962376639148879, -0.29999999999999999, -0.29999999999999999], [0.5, 0.5, 0.5, 0.095944939045965238], [0.40272444381571271, -0.11827319884920562, 0.5, 0.5]]], [[[0.38931728355886186, -0.29999999999999999, 0.5, -0.094306906597873885], [0.5, -0.29999999999999999, -0.29999999999999999, 0.26443168557169749], [-0.017360832827441719, -0.29999999999999999, -0.29999999999999999, -0.29999999999999999]], [[0.31365664160961182, 0.18146342960739825, -0.29999999999999999, 0.5], [0.29398556423299493, -0.19710497775305269, 0.051818367197931092, -0.29999999999999999], [-0.15383079570743585, 0.058375088082090132, 0.5, 0.5]]]]),self.functionspace)
5234          self.failUnless(isinstance(res,Data),"wrong type of result.")
5235          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
5236          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5237       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5238       def test_clip_expandedData_rank0(self):
5239          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
5240          arg=msk_arg*(-0.842028460005)+(1.-msk_arg)*(-0.293977917573)
5241          res=clip(arg,-0.3,0.5)
5242          msk_ref=whereNegative(self.functionspace.getX()[0]-0.5)
5243          ref=msk_ref*(-0.3)+(1.-msk_ref)*(-0.293977917573)
5244          self.failUnless(isinstance(res,Data),"wrong type of result.")
5245          self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
5246          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5247       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5248       def test_clip_expandedData_rank1(self):
5249          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
5250          arg=msk_arg*numarray.array([0.68183730574045565, 0.11696629718283025])+(1.-msk_arg)*numarray.array([0.35288961662527463, -0.072592053270659651])
5251          res=clip(arg,-0.3,0.5)
5252          msk_ref=whereNegative(self.functionspace.getX()[0]-0.5)
5253          ref=msk_ref*numarray.array([0.5, 0.11696629718283025])+(1.-msk_ref)*numarray.array([0.35288961662527463, -0.072592053270659651])
5254          self.failUnless(isinstance(res,Data),"wrong type of result.")
5255          self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
5256          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5257       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5258       def test_clip_expandedData_rank2(self):
5259          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
5260          arg=msk_arg*numarray.array([[0.90716898369189836, -0.35803512117401981, 0.94018031372277644, 0.79669090472583703, -0.18693600910396135], [0.66131238434994155, -0.97051536409745509, 0.9041285176368381, -0.85346375259533169, 0.080322075200497611], [-0.88411631255225487, -0.034767111898162728, -0.57932986353520599, -0.36438560630357641, 0.46429678163635812], [0.27577795037496067, 0.63194239600641899, -0.25968796804973282, 0.57336606861296535, 0.42681293935570541]])+(1.-msk_arg)*numarray.array([[-0.39043293288066505, -0.12586769834531109, 0.86941394855912812, 0.87286911746074325, -0.31449584387107565], [0.067675865430771864, 0.1411821630632728, 0.36884686073023309, 0.44919011697492928, -0.28594899701518273], [0.54855238117480076, 0.17688408664749944, 0.25657627305599928, -0.39115693595816903, 0.79599505168892248], [-0.63955125945377644, -0.94202055254588668, -0.68308189366965677, 0.4578895128510021, -0.60069619882054903]])
5261          res=clip(arg,-0.3,0.5)
5262          msk_ref=whereNegative(self.functionspace.getX()[0]-0.5)
5263          ref=msk_ref*numarray.array([[0.5, -0.29999999999999999, 0.5, 0.5, -0.18693600910396135], [0.5, -0.29999999999999999, 0.5, -0.29999999999999999, 0.080322075200497611], [-0.29999999999999999, -0.034767111898162728, -0.29999999999999999, -0.29999999999999999, 0.46429678163635812], [0.27577795037496067, 0.5, -0.25968796804973282, 0.5, 0.42681293935570541]])+(1.-msk_ref)*numarray.array([[-0.29999999999999999, -0.12586769834531109, 0.5, 0.5, -0.29999999999999999], [0.067675865430771864, 0.1411821630632728, 0.36884686073023309, 0.44919011697492928, -0.28594899701518273], [0.5, 0.17688408664749944, 0.25657627305599928, -0.29999999999999999, 0.5], [-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.4578895128510021, -0.29999999999999999]])
5264          self.failUnless(isinstance(res,Data),"wrong type of result.")
5265          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
5266          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5267       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5268       def test_clip_expandedData_rank3(self):
5269          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
5270          arg=msk_arg*numarray.array([[[0.93020317689046128, -0.54447904233724853], [0.11461289830616783, -0.22468993486584155]], [[0.2580017724494863, 0.96989125372971774], [0.15057436976633753, -0.78151964173949384]], [[-0.71582456376904258, 0.82703131516257322], [-0.24926797106114562, -0.1238935499896896]], [[0.32428682415562093, -0.91311839613385692], [0.30146899459086263, -0.12556147633489956]], [[-0.68665518227346567, -0.22144952551343633], [-0.50981084983177216, -0.030119060352006066]], [[0.18318336820339765, -0.38259427020750825], [0.19442151433667187, -0.99958596975615577]]])+(1.-msk_arg)*numarray.array([[[-0.4343470595053156, 0.96097360321015346], [-0.46568918744082421, 0.48300612207019933]], [[0.81630000256950841, 0.38374999480003424], [0.79617490239235345, -0.097514887490353752]], [[0.039610536347541192, -0.11954981925174257], [-0.40947914780332573, -0.48354495774094963]], [[-0.078080941006748672, -0.46167291110337838], [0.26568933223987878, 0.96040591883607895]], [[0.64111624021647295, 0.67697706382199141], [0.64028160169512827, -0.98698793247338523]], [[-0.9114669507080646, 0.62094506194746613], [-0.42103142433552065, -0.63632370203732247]]])
5271          res=clip(arg,-0.3,0.5)
5272          msk_ref=whereNegative(self.functionspace.getX()[0]-0.5)
5273          ref=msk_ref*numarray.array([[[0.5, -0.29999999999999999], [0.11461289830616783, -0.22468993486584155]], [[0.2580017724494863, 0.5], [0.15057436976633753, -0.29999999999999999]], [[-0.29999999999999999, 0.5], [-0.24926797106114562, -0.1238935499896896]], [[0.32428682415562093, -0.29999999999999999], [0.30146899459086263, -0.12556147633489956]], [[-0.29999999999999999, -0.22144952551343633], [-0.29999999999999999, -0.030119060352006066]], [[0.18318336820339765, -0.29999999999999999], [0.19442151433667187, -0.29999999999999999]]])+(1.-msk_ref)*numarray.array([[[-0.29999999999999999, 0.5], [-0.29999999999999999, 0.48300612207019933]], [[0.5, 0.38374999480003424], [0.5, -0.097514887490353752]], [[0.039610536347541192, -0.11954981925174257], [-0.29999999999999999, -0.29999999999999999]], [[-0.078080941006748672, -0.29999999999999999], [0.26568933223987878, 0.5]], [[0.5, 0.5], [0.5, -0.29999999999999999]], [[-0.29999999999999999, 0.5], [-0.29999999999999999, -0.29999999999999999]]])
5274          self.failUnless(isinstance(res,Data),"wrong type of result.")
5275          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
5276          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
5277       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5278       def test_clip_expandedData_rank4(self):
5279          msk_arg=whereNegative(self.functionspace.getX()[0]-0.5)
5280          arg=msk_arg*numarray.array([[[[0.47253941060193694, 0.19296787597619924, -0.48241297799548888, -0.75064623239139383], [-0.58524626791925782, 0.17426765589991278, 0.35312486983619285, 0.083669184154522291], [-0.84069384309987161, -0.15040140084518883, -0.41665586874162486, -0.52240956580940079]], [[-0.6154323811169542, -0.57957166937646276, 0.79263239744786929, 0.75307658018532964], [-0.11379828349950394, -0.95566162645602204, 0.82201752038788811, -0.82419839021415009], [0.040955022200906965, 0.80044686051015956, -0.084301202894394134, 0.50298997540454393]]], [[[0.38713164665793709, -0.9893659106059931, -0.40195267367189746, 0.54085998487601983], [-0.36547517059197343, -0.97749720898537218, 0.55460176315663934, -0.51328259591874281], [-0.15014163110959977, 0.64227796852044805, 0.67829045256375609, -0.53275577483557157]], [[0.69428959767000853, 0.27181575416077908, -0.67540666153511464, 0.68537741704783373], [0.12635059570264229, 0.25790168831554028, 0.21053467373381252, 0.89625019365122061], [0.78533441113905633, 0.38651890253248178, 0.46866980084781207, 0.3966858407832079]]], [[[0.09213358476370237, 0.32622677154765856, -0.52054474510218407, 0.11292458645612613], [0.60076852133813197, -0.59651506026789658, -0.310660307624816, -0.83164083985032011], [-0.11239584868207197, -0.21969260297894544, 0.66253117553533181, -0.47549870903007396]], [[0.61793844593902714, 0.049088591742032062, 0.73171791413069731, 0.10324087884362898], [0.70630497078056043, -0.39548178252243704, -0.20171780102887515, 0.4486867740825855], [0.3067826397434239, -0.69920342074020692, 0.55315007879538758, 0.76955263523522177]]]])+(1.-msk_arg)*numarray.array([[[[-0.98195387674416623, -0.71647041666207634, 0.96131746394220374, -0.2970268397734761], [-0.6798614682172941, 0.68011781692825046, 0.9901614342712215, -0.51224054060555768], [-0.49126801267038034, -0.2061185705955475, -0.94879172547184121, 0.32864682447432192]], [[0.81206407375573542, -0.47431758135493918, 0.35433905577893388, 0.015673991101298634], [0.48161105139319216, 0.76475757327272964, 0.87767937074390434, -0.061736059585125069], [0.28109110620516442, -0.84666842157492495, -0.77512442918187219, 0.20772758208828335]]], [[[0.30772959794939792, -0.2885188792188953, -0.90570783131128163, -0.91845913691101799], [0.28634884391824733, -0.3690804749180665, 0.03915017349519978, -0.35281078034679925], [-0.086035338721760501, 0.67930968257225288, 0.67498622364084948, 0.93164079695122304]], [[0.68920407959864227, 0.85164957425061294, -0.61676686381412349, -0.99625404634540149], [-0.79371359058265867, -0.94393926509038906, -0.35532528723257628, 0.0015878731596392637], [0.35679339163849177, -0.49580675506446492, 0.91497928940479811, 0.14614297523964193]]], [[[-0.26376915847654825, -0.4289545189914894, 0.0096817410430425355, -0.4091406948939682], [-0.21537036900190487, 0.38987973408241117, -0.12828981462849209, -0.97396371660294467], [0.67689931380382329, -0.73005845261718227, -0.32903973852020085, -0.074856999663114099]], [[-0.40422874438770284, 0.95870358605131867, -0.048075373669192345, 0.036769265208584478], [0.25203988496541907, -0.62875034340309677, 0.41362004004453712, -0.40696408032236886], [0.81933944111362078, -0.68464153016036078, -0.43524094107963629, 0.19643875172460112]]]])
5281          res=clip(arg,-0.3,0.5)
5282          msk_ref=whereNegative(self.functionspace.getX()[0]-0.5)
5283          ref=msk_ref*numarray.array([[[[0.47253941060193694, 0.19296787597619924, -0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, 0.17426765589991278, 0.35312486983619285, 0.083669184154522291], [-0.29999999999999999, -0.15040140084518883, -0.29999999999999999, -0.29999999999999999]], [[-0.29999999999999999, -0.29999999999999999, 0.5, 0.5], [-0.11379828349950394, -0.29999999999999999, 0.5, -0.29999999999999999], [0.040955022200906965, 0.5, -0.084301202894394134, 0.5]]], [[[0.38713164665793709, -0.29999999999999999, -0.29999999999999999, 0.5], [-0.29999999999999999, -0.29999999999999999, 0.5, -0.29999999999999999], [-0.15014163110959977, 0.5, 0.5, -0.29999999999999999]], [[0.5, 0.27181575416077908, -0.29999999999999999, 0.5], [0.12635059570264229, 0.25790168831554028, 0.21053467373381252, 0.5], [0.5, 0.38651890253248178, 0.46866980084781207, 0.3966858407832079]]], [[[0.09213358476370237, 0.32622677154765856, -0.29999999999999999, 0.11292458645612613], [0.5, -0.29999999999999999, -0.29999999999999999, -0.29999999999999999], [-0.11239584868207197, -0.21969260297894544, 0.5, -0.29999999999999999]], [[0.5, 0.049088591742032062, 0.5, 0.10324087884362898], [0.5, -0.29999999999999999, -0.20171780102887515, 0.4486867740825855], [0.3067826397434239, -0.29999999999999999, 0.5, 0.5]]]])+(1.-msk_ref)*numarray.array([[[[-0.29999999999999999, -0.29999999999999999, 0.5, -0.2970268397734761], [-0.29999999999999999, 0.5, 0.5, -0.29999999999999999], [-0.29999999999999999, -0.2061185705955475, -0.29999999999999999, 0.32864682447432192]], [[0.5, -0.29999999999999999, 0.35433905577893388, 0.015673991101298634], [0.48161105139319216, 0.5, 0.5, -0.061736059585125069], [0.28109110620516442, -0.29999999999999999, -0.29999999999999999, 0.20772758208828335]]], [[[0.30772959794939792, -0.2885188792188953, -0.29999999999999999, -0.29999999999999999], [0.28634884391824733, -0.29999999999999999, 0.03915017349519978, -0.29999999999999999], [-0.086035338721760501, 0.5, 0.5, 0.5]], [[0.5, 0.5, -0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.0015878731596392637], [0.35679339163849177, -0.29999999999999999, 0.5, 0.14614297523964193]]], [[[-0.26376915847654825, -0.29999999999999999, 0.0096817410430425355, -0.29999999999999999], [-0.21537036900190487, 0.38987973408241117, -0.12828981462849209, -0.29999999999999999], [0.5, -0.29999999999999999, -0.29999999999999999, -0.074856999663114099]], [[-0.29999999999999999, 0.5, -0.048075373669192345, 0.036769265208584478], [0.25203988496541907, -0.29999999999999999, 0.41362004004453712, -0.29999999999999999], [0.5, -0.29999999999999999, -0.29999999999999999, 0.19643875172460112]]]])
5284          self.failUnless(isinstance(res,Data),"wrong type of result.")
5285          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
5286          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")

Legend:
Removed from v.395  
changed lines
  Added in v.400

  ViewVC Help
Powered by ViewVC 1.1.26