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

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

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

revision 595 by gross, Wed Feb 22 04:02:54 2006 UTC revision 596 by gross, Wed Mar 15 22:41:23 2006 UTC
# Line 4834  class Test_util_overloaded_binary_with_t Line 4834  class Test_util_overloaded_binary_with_t
4834        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
4835        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
4836     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    def test_pow_overloaded_float_rank0_taggedData_rank0(self):  
       arg0=0.341812064896  
       arg1=Data(4.30670501129,self.functionspace)  
       arg1.setTaggedValue(1,3.64191179292)  
       res=arg0**arg1  
       ref=Data(0.00982109262741,self.functionspace)  
       ref.setTaggedValue(1,0.0200490957504)  
       self.failUnless(isinstance(res,Data),"wrong type of result.")  
       self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")  
       self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_pow_overloaded_float_rank0_taggedData_rank1(self):  
       arg0=2.71918984915  
       arg1=Data(numarray.array([3.6696137015868118, 0.10205613053632596]),self.functionspace)  
       arg1.setTaggedValue(1,numarray.array([2.0744420420962988, 0.15604693286805166]))  
       res=arg0**arg1  
       ref=Data(numarray.array([39.284863912783393, 1.1074833798224062]),self.functionspace)  
       ref.setTaggedValue(1,numarray.array([7.9656207691933547, 1.1689419815449242]))  
       self.failUnless(isinstance(res,Data),"wrong type of result.")  
       self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")  
       self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_pow_overloaded_float_rank0_taggedData_rank2(self):  
       arg0=4.4483395692  
       arg1=Data(numarray.array([[2.4529759744254518, 0.7580664327558474, 3.8975000203490939, 3.4541350498163998, 2.9544320655798217], [0.51290472026154688, 4.8961671628638266, 3.2135251243961367, 2.2462684812562461, 0.40911836554684933], [0.49170040047395686, 1.6842515195955219, 1.3170700476689892, 4.1425294249616993, 3.5304507633256805], [3.947444976634118, 0.11124097097693472, 3.9923991533874283, 1.7047022614872385, 2.8975607347873065]]),self.functionspace)  
       arg1.setTaggedValue(1,numarray.array([[1.367948443330212, 4.7927959789646231, 2.3429313409787804, 4.9593367032554436, 4.2265558126195799], [3.4900286322554974, 2.8595582096739616, 1.8509445481474043, 0.5564155380820085, 4.3906066414576292], [4.6766848736409896, 3.2257976245481674, 4.7778474579462165, 2.0847486832037205, 1.7898532863269634], [1.4356217054626659, 0.92982462549186062, 2.7611923306294219, 1.3646256492703579, 3.9619562449225665]]))  
       res=arg0**arg1  
       ref=Data(numarray.array([[38.905764567917963, 3.1001099299365245, 336.00942079583973, 173.36570774432349, 82.235011176537952], [2.150125347731461, 1491.7135365638999, 121.05990834187568, 28.577654722949994, 1.8415761361989709], [2.0831434757725034, 12.351746001040247, 7.1403924396906904, 484.37197478038973, 194.28124800097655], [362.01425445908728, 1.1806092113877813, 387.13717427618201, 12.734575745284882, 75.542765004391114]]),self.functionspace)  
       ref.setTaggedValue(1,numarray.array([[7.7037353055247513, 1278.4402727482807, 33.012867631466662, 1639.1994369435079, 549.09152187901964], [182.90658566677064, 71.377234712123865, 15.840848073557623, 2.294390845812015, 701.42646220920267], [1075.0222789059023, 123.29780636599452, 1250.2326681663551, 22.455864839588571, 14.460363130951452], [8.5225002163523413, 4.0059949692425398, 61.630992150805056, 7.6656241919499521, 369.9404712831535]]))  
       self.failUnless(isinstance(res,Data),"wrong type of result.")  
       self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")  
       self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_pow_overloaded_float_rank0_taggedData_rank3(self):  
       arg0=3.9897936579  
       arg1=Data(numarray.array([[[2.889727106362701, 1.3623716131192851], [2.9916597036534092, 3.4367308950490072]], [[3.3335872229779913, 1.5322214297481302], [4.7494147088593879, 3.6775797357334379]], [[4.685707621980133, 4.2506337725961352], [0.15321167564939667, 2.5577348615722117]], [[3.6361368676688279, 4.2834060370927194], [0.37638972870613419, 0.39030513216716933]], [[3.4140922088424324, 3.6871164394652509], [3.9581489155415834, 3.3148416225122186]], [[0.35997218987828361, 2.6122533672231647], [1.5937950637694218, 1.5725008654108865]]]),self.functionspace)  
       arg1.setTaggedValue(1,numarray.array([[[0.68058173710671155, 3.6604896813370336], [0.013910592130982523, 4.1640866365439138]], [[1.2628720805564884, 1.4181377509080724], [3.068393656986165, 2.3871991576613487]], [[2.6698285170199094, 1.4193369447656969], [0.46164979577366916, 2.1969148005263128]], [[1.2834781040798817, 3.0914843479670262], [3.6005580804044293, 4.3792710341621239]], [[3.7534608128402835, 2.9947985761366493], [0.53622360363926969, 2.6873369507418534]], [[1.1972181696962809, 3.2164783088599913], [3.0875364909104346, 1.0164281755144038]]]))  
       res=arg0**arg1  
       ref=Data(numarray.array([[[54.523379096101252, 6.5874573196153481], [62.782586289507627, 116.22643811597655]], [[100.76754870055993, 8.3327650318245841], [714.76427612640032, 162.19712216078111]], [[654.45235790561503, 358.44309402018331], [1.2361541272919527, 34.440692824698289]], [[153.15741747367267, 375.07206890646461], [1.6834164683828434, 1.7161452365879322]], [[112.64196040084123, 164.35171133165582], [239.13949905472657, 98.187345080054001]], [[1.6456044167800061, 37.139392797469], [9.0738550613751467, 8.8103889216644493]]]),self.functionspace)  
       ref.setTaggedValue(1,numarray.array([[[2.564459775636728, 158.40645271869869], [1.0194350853765908, 317.98722907748692]], [[5.7401537744364708, 7.1159108619175973], [69.815604851474347, 27.201219423427464]], [[40.219309519822779, 7.127728606939832], [1.8942122717654939, 20.90436147123215]], [[5.9061806413967508, 72.082338184950487], [145.79980629661623, 428.27708277753862]], [[180.15400056508486, 63.05586809159955], [2.1001185365211592, 41.205606541304057]], [[5.2416591987144212, 85.692742263889059], [71.689639962920467, 4.0815296418305298]]]))  
       self.failUnless(isinstance(res,Data),"wrong type of result.")  
       self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")  
       self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_pow_overloaded_float_rank0_taggedData_rank4(self):  
       arg0=2.00273786518  
       arg1=Data(numarray.array([[[[4.058085214998175, 1.6160604376121306, 3.392298211100885, 1.0452007249155919], [2.5273517683292699, 3.0494177512997704, 0.33690014082657282, 0.12528978101802304], [4.5197516324925351, 0.23226248241823033, 3.5664208665570021, 4.7732489962057079]], [[4.4549507097535654, 0.55109845956885817, 2.7253278884059697, 4.496324732480609], [1.586341752881361, 2.4991507441211032, 3.2436198792465789, 1.8861809587343012], [3.3856069070921238, 2.8132833163000455, 1.8557615185276446, 1.2515630764821439]]], [[[3.9029634096168433, 3.4238838330903647, 0.168526403580252, 2.6183355793979], [4.012617066171174, 3.1192068434369804, 1.5566641170696784, 4.2941982176726397], [1.4311511821530991, 3.0032853336479115, 1.5699302744706125, 3.3894002471002085]], [[2.0541298653067361, 0.041957272399514252, 3.9926465817541326, 2.9475866810662157], [3.6248456625161114, 2.5516057015658311, 0.10278482539076957, 4.5989676951872394], [1.3614783963249981, 3.4546685791640237, 1.0699048554869663, 2.0764514576328352]]], [[[2.2381377204691408, 3.8176327781348736, 0.90064790493230951, 4.6989234806143587], [2.1736357404880438, 3.1637074985297562, 3.1423445423973613, 3.5095763892793981], [2.5804729333454222, 0.89043093205556245, 0.3803504224422426, 1.8258865124301544]], [[4.8909917949317609, 4.6840264802036744, 4.5827397185651009, 2.325986597602165], [4.6542743462709959, 4.3602860031505459, 1.9718692294021449, 1.6727430742597078], [4.0944735363242009, 3.4603064237310965, 3.0807314616342185, 1.2081156932037695]]]]),self.functionspace)  
       arg1.setTaggedValue(1,numarray.array([[[[2.7870810246480366, 2.0753323950124378, 1.6206774020250057, 1.6693164535030807], [0.22495732068957769, 1.4826277903660066, 1.6654536412954513, 3.7011690087174687], [2.8688237888109613, 4.131833355592474, 0.58743394654963033, 3.1170748037096057]], [[2.2316988612632387, 4.8338802120706443, 1.1830725418117809, 2.2558696691891198], [0.1828771012820089, 1.6175444987052734, 2.0276687081781493, 2.1722295435556092], [1.7526525704637648, 2.5413810371959822, 1.2335871661409938, 3.1822782500328279]]], [[[4.8612724338078301, 0.7675517686181661, 2.175206221217064, 0.64847845944287819], [2.7137589100492434, 3.4524463464048054, 1.6167573912489441, 0.16158562025267317], [4.0907368103502781, 1.468174509078422, 3.8588398986692334, 4.8128173918988981]], [[0.15544289923049187, 3.7268756946718211, 2.9147996475422486, 3.6294512035901425], [4.29461385610918, 4.4680526078126217, 0.060265276226098695, 2.316238253151544], [3.1881249924409127, 0.73957031720346222, 0.085295929508293178, 2.3155430777698207]]], [[[1.5940476159630346, 2.2712827258710178, 0.24608800148241564, 3.9476270044554274], [0.31300686021970531, 1.1763364711836799, 0.76136985552643244, 3.8726250916336724], [2.6397833251035379, 3.9748466473005739, 3.8288284623159541, 2.0374679133608966]], [[0.47517472829931101, 4.0767363652225068, 0.52520993483385048, 1.5660106079134684], [1.6486334521439767, 0.28245826998834422, 4.2578225614767797, 4.047421985445852], [3.2269014632928079, 3.0865258235349415, 4.5301478170774354, 3.4909708031440467]]]]))  
       res=arg0**arg1  
       ref=Data(numarray.array([[[[16.750058845591397, 3.0721526379826374, 10.548699609572795, 2.0666062446181979], [5.7850914043791031, 8.3133853562698778, 1.2636220765441493, 1.0909137572305785], [23.081607888717194, 1.1750489650261489, 11.904701658561461, 27.524977675184346]], [[22.065843738793575, 1.4663058992285734, 6.6378066215549509, 22.709100960148394], [3.0093930782835683, 5.6728867856068153, 9.5137986534737795, 3.7061044164408381], [10.499791295855353, 7.055926912267954, 3.628627724725646, 2.385072570137162]]], [[[15.039308247944584, 10.782659979803462, 1.1241690550540289, 6.1624461340705841], [16.229384415515096, 8.7262567079767237, 2.9479996476896653, 19.734844610529727], [2.7019026677952165, 8.0512490841275621, 2.9752866951568713, 10.527489804478877]], [[4.1646172182532135, 1.0295686853650003, 16.005839869392002, 7.7457451954453456], [12.397692008655882, 5.8833650491927445, 1.0739953013827201, 24.387064856692479], [2.5742736313898518, 11.015680522547886, 2.1023697483406334, 4.2296830097635185]]], [[[4.7323438821950701, 14.173923521480578, 1.8692058081325049, 26.140182058429897], [4.5250245885470779, 9.0001646657529406, 8.8676158851323628, 11.443868303875972], [6.0025094057468991, 1.8559891647626132, 1.3023354347347804, 3.5541143150273866]], [[29.870400260851106, 25.871124951438134, 24.113751679060641, 5.0300654379866412], [25.342027194461846, 20.661763233119618, 3.9333563988776534, 3.1955060146113112], [17.178764738937865, 11.058897730257282, 8.4961639056616765, 2.3141783138707765]]]]),self.functionspace)  
       ref.setTaggedValue(1,numarray.array([[[[6.9286852125785368, 4.2263969519979208, 3.0820194655202178, 3.1879102631117733], [1.1691023982577264, 2.8002466491192726, 3.1793692577325836, 13.072594935061897], [7.3334176438266114, 17.6303345843294, 1.503779779154625, 8.7133450051819885]], [[4.7112286301679207, 28.708784932966971, 2.2742761723956582, 4.7909835415904132], [1.1354294192926007, 3.0753207471873583, 4.0887802238112432, 4.5206074931782005], [3.3778648551221635, 5.8417341771948292, 2.3554811322786962, 9.1169976252798239]]], [[[29.260178173166832, 1.7041668707386901, 4.529962828226199, 1.5689053267278315], [6.5846866575461958, 10.998692316424849, 3.0736400576927507, 1.1187630615338042], [17.134239987654585, 2.7722783164873048, 14.585426938009, 28.291876751816698]], [[1.1140003466430173, 13.308084833978867, 7.5713591317368989, 12.437410980682518], [19.740542235230951, 22.267547463257269, 1.042743425368402, 4.9961250421125465], [9.1540938403147862, 1.6713685966647158, 1.0610291332840969, 4.9937134459319727]]], [[[3.0255420398866604, 4.8425445904748727, 1.1863861667386619, 15.513131639293059], [1.2428262437334108, 2.2636612679395824, 1.6968658298480934, 14.725738793712299], [6.254927688836438, 15.809188519363234, 14.284563479653341, 4.1167021282117702]], [[1.3909904683391461, 16.968442210027412, 1.4401773573943464, 2.9671981822001441], [3.1424443542515723, 1.2167356249730308, 19.242519541811749, 16.626469883428879], [9.4039709445950059, 8.530423671641044, 23.248867311915969, 11.296943532689685]]]]))  
       self.failUnless(isinstance(res,Data),"wrong type of result.")  
       self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")  
       self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
4837     def test_pow_overloaded_constData_rank0_taggedData_rank0(self):     def test_pow_overloaded_constData_rank0_taggedData_rank0(self):
4838        arg0=Data(4.55643012421,self.functionspace)        arg0=Data(4.55643012421,self.functionspace)
4839        arg1=Data(1.24128234849,self.functionspace)        arg1=Data(1.24128234849,self.functionspace)

Legend:
Removed from v.595  
changed lines
  Added in v.596

  ViewVC Help
Powered by ViewVC 1.1.26