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

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

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

revision 428 by gross, Wed Dec 21 05:08:25 2005 UTC revision 429 by gross, Wed Jan 11 05:53:40 2006 UTC
# Line 1425  class Test_util_unary_with_tagged_data(T Line 1425  class Test_util_unary_with_tagged_data(T
1425        self.failUnless(isinstance(res,Data),"wrong type of result.")        self.failUnless(isinstance(res,Data),"wrong type of result.")
1426        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1427        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1428       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1429       def test_trace_taggedData_rank2_offset0(self):
1430          arg=Data(numarray.array([[-0.056722291636611466, -0.58718629093905927, 0.5130520912721297, 0.66092297449797521], [-0.063919150248518131, -0.39058783497457283, 0.4661647306320098, 0.67021135619437922], [-0.8330832444261691, -0.85322824239920525, 0.20482436629833045, -0.96129533456242999], [-0.69346857149921193, 0.45558369040100977, 0.84938565880042294, 0.43398982881393078]]),self.functionspace)
1431          arg.setTaggedValue(1,numarray.array([[0.14749416644983149, 0.60083787293366497, -0.57073677566409819, -0.46610458227440743], [0.57348959548348577, -0.69790943654012771, 0.053443762898546243, -0.57344483020596693], [-0.50199618324500483, 0.45102735241156111, -0.52714587985442107, -0.017548841179002128], [0.76466153523225411, 0.73817066103983109, -0.01022356510953859, 0.4565914866524452]]))
1432          res=trace(arg,0)
1433          ref=Data(0.19150406850107693,self.functionspace)
1434          ref.setTaggedValue(1,-0.6209696632922721)
1435          self.failUnless(isinstance(res,Data),"wrong type of result.")
1436          self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1437          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1438       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1439       def test_trace_taggedData_rank3_offset0(self):
1440          arg=Data(numarray.array([[[0.27621931670337752, 0.79097590056883305], [0.25951150897721909, 0.31817228937435349], [-0.30264453843236794, 0.50150595739076276], [-0.98358197877106046, -0.79007659361841576], [0.083365996568159462, 0.20330829941698836], [-0.19557587546996058, -0.98573294081094631]], [[-0.79867287463079251, -0.79833593063209984], [-0.50599476325253301, 0.28464853963701153], [0.26247038837571446, -0.74722310930311919], [-0.30522375733916096, -0.22922132310741117], [0.76621304427278858, -0.93443415586735745], [-0.055794160098196155, -0.56342540287272369]], [[-0.76566607687640786, 0.73746119374128516], [-0.34094386574227986, 0.13237808550409502], [0.55551190660484662, 0.099929562752655299], [0.62416721084404547, -0.74680079679520173], [-0.32298137868118437, -0.92140648111250556], [-0.46933363170955111, -0.6173242105648995]], [[-0.78927536706600288, -0.17827448265929013], [0.29041067654470787, 0.0090187849852394475], [0.38470494443244418, -0.4697278621834069], [0.97131863616471859, -0.229464269100631], [0.27251067788871963, -0.1673771147344536], [-0.6104133183668432, -0.12904004274191427]], [[-0.001577990717716915, -0.98040279977901434], [-0.7740282327068011, -0.86160004795905754], [-0.99294888809825377, 0.13804396580730138], [-0.42198087116935734, -0.66074706364513558], [-0.13571659404271919, -0.40146697280195087], [0.7288641948187673, 0.63657731594340872]], [[0.80404064506986539, 0.75601472144811699], [0.150056166800417, 0.22187959041457184], [0.10012067300234517, 0.7651851752515153], [0.8406334361842227, 0.37796088650765558], [-0.92804955176844484, -0.74147540231797371], [0.82011305402821022, 0.15532709244856013]]]),self.functionspace)
1441          arg.setTaggedValue(1,numarray.array([[[0.13068026864793758, 0.84826211242090954], [0.82294651753010584, -0.0038648240236784925], [-0.68641664387261003, 0.30189977432863979], [-0.69405145641145394, -0.3344401427328203], [0.42997704136196258, -0.68883809314630029], [0.32627296229962499, -0.05429336799479767]], [[0.45002800082828198, 0.16571548079195186], [-0.19146515787251306, -0.25944069210245391], [0.42181551373272685, 0.20993972258463467], [-0.32968166459292703, -0.34521619419565819], [-0.46239959214099868, -0.39421043463289895], [-0.188351920308371, -0.81136727582354662]], [[0.23154319984003435, -0.24954542875472541], [0.32839612369649074, -0.010181910541722683], [0.85371015583719845, 0.060824309654751829], [0.60998908541486352, -0.10041314710819926], [-0.21491424918195423, 0.016843890670983797], [-0.81948469054048334, -0.73219493129556623]], [[0.91110914128736176, -0.45029317016500681], [0.75141649423683887, 0.37493202330235631], [-0.95649911853113556, -0.5628139992624257], [0.32354191029466106, -0.7987584974525852], [0.99623080387531782, 0.18893689271418501], [0.72418591288460332, -0.55842778836728257]], [[-0.95128831559556049, -0.22009541767819618], [-0.16638224381960742, 0.7431403220769417], [0.43446696882816038, -0.37684380902355885], [-0.67103103356015725, 0.16658940700564706], [0.95093577264569817, -0.52598902537807746], [-0.62575812314747803, -0.41939051724396537]], [[-0.12219921113913323, -0.41583537753036892], [-0.015148535233316052, -0.51255475686325225], [0.19531511234994969, 0.021398629688998305], [0.16504650528291065, -0.93951736049702372], [-0.72053369468947892, -0.85570893480481525], [-0.18173169200857453, 0.058687917578594373]]]))
1442          res=trace(arg,0)
1443          ref=Data(numarray.array([1.9814515562059007, 0.69994985350447814]),self.functionspace)
1444          ref.setTaggedValue(1,numarray.array([1.8856712575444079, -0.61641387527886082]))
1445          self.failUnless(isinstance(res,Data),"wrong type of result.")
1446          self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1447          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1448       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1449       def test_trace_taggedData_rank3_offset1(self):
1450          arg=Data(numarray.array([[[0.18108653460154356, 0.89592989152069769], [0.39406006245310943, 0.36308832003165215]], [[0.080199626318692596, 0.08698141710531293], [-0.3802472233632439, -0.44580146494500328]], [[-0.37185454390545525, -0.64624032154496258], [-0.82542887049556013, 0.49792673962118883]], [[0.0061652005510264285, -0.29039438965093134], [-0.13325260707029396, 0.60381721769509866]], [[-0.2641881854161634, -0.1041123088263789], [-0.32813370622184435, -0.45119880870645801]], [[-0.19872503698560839, -0.79949975899995285], [0.37373978335533398, -0.74402368667542862]]]),self.functionspace)
1451          arg.setTaggedValue(1,numarray.array([[[-0.50480964706631526, -0.96868442725949899], [-0.20796807939835626, 0.80648029637272489]], [[0.057449307908810532, 0.3998916254657261], [-0.39257450539926908, -0.29696732329834341]], [[0.023852805137722699, -0.17201731179752922], [0.11673292308063665, 0.89769205371407712]], [[0.73063864471010453, 0.30788376908094528], [-0.8512238294696961, 0.92354339078776171]], [[-0.69374180162018262, -0.74056846939003362], [-0.98232592110935735, -0.89406649693828055]], [[-0.44480336519662456, 0.93254466857149532], [-0.76300109266753591, 0.52582923130116521]]]))
1452          res=trace(arg,1)
1453          ref=Data(numarray.array([0.5441748546331957, -0.36560183862631068, 0.12607219571573358, 0.60998241824612509, -0.71538699412262141, -0.94274872366103701]),self.functionspace)
1454          ref.setTaggedValue(1,numarray.array([0.30167064930640963, -0.23951801538953288, 0.92154485885179982, 1.6541820354978662, -1.5878082985584632, 0.081025866104540656]))
1455          self.failUnless(isinstance(res,Data),"wrong type of result.")
1456          self.failUnlessEqual(res.getShape(),(6,),"wrong shape of result.")
1457          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1458       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1459       def test_trace_taggedData_rank4_offset0(self):
1460          arg=Data(numarray.array([[[[-0.45962016926742089, 0.02865417528062264, -0.29756263033779917, -0.64078111586047348], [0.92164046954155987, -0.54003599165059346, -0.87875895286816386, -0.3473389494925978], [-0.16291776046801099, 0.3472887520663801, 0.71935937177222153, -0.85307965190501811]], [[0.61119743618802036, 0.3502655762828446, 0.94852304489440153, -0.14189427417899325], [0.54958981135014406, -0.55503130982859883, 0.34955467736809176, -0.38497957362679047], [-0.74731172737983176, -0.47753952462364269, -0.4648049237210552, -0.70213150390386359]], [[0.52644165479644611, -0.24525608263185306, 0.62476935396121691, 0.51308479655531358], [0.42821817624865099, 0.80878105218648533, 0.37614678448471972, 0.74153228074219246], [-0.97366155081882622, -0.64213371666188435, 0.39176893655801481, 0.38394330573311874]]], [[[0.94993289577142948, -0.4473345864598901, -0.72529706466837962, -0.38227114886080593], [0.98620938838075523, -0.79085026677573689, 0.11079037569398587, 0.79410827583319343], [-0.8710215341123464, 0.98928570276569316, 0.052036661356236413, -0.56869951694252019]], [[0.16791216694921607, -0.34002163051015888, 0.55394790674046313, -0.95844254164756126], [-0.68136194488326041, -0.70654623063293909, 0.60406700230877153, 0.18419598881245269], [0.59470271617573411, 0.48548947450898305, -0.62593526940970579, 0.13784228435476797]], [[-0.051894336949978692, -0.30141195030075862, -0.54243831204364912, -0.3164835827279473], [0.46113898893543026, -0.22328338897537137, -0.6262187521411291, -0.19838295564438924], [-0.63045214825138696, 0.42991135589819929, 0.94642647328742724, -0.46927884880828441]]], [[[0.43305217297293153, 0.2536927678947547, 0.10630172818818751, 0.64912963749688624], [-0.50640500723555193, -0.52039373680496936, 0.1096650192795996, 0.61739092724335665], [0.49146409570063665, -0.6172394263210772, -0.89858617462268153, 0.078998202459677591]], [[0.31989693518174467, 0.53428120315129246, -0.86380321869857379, -0.99456503074107205], [-0.18966772064485382, 0.76550347311246214, 0.30692097150168318, 0.39425500510922684], [-0.60097695899076076, -0.22485950542948485, -0.90370187909218513, 0.0069427133057222701]], [[-0.15704314633162131, 0.89746601086632749, 0.28888078395150973, -0.34187992624489594], [-0.32033494156307274, 0.025128653723394123, -0.47866647717699262, 0.35294153182773935], [-0.98451182873333698, 0.25346634893978104, -0.0048477378610420896, 0.57224910189677436]]]]),self.functionspace)
1461          arg.setTaggedValue(1,numarray.array([[[[0.86093381951293702, 0.13996950513602546, 0.24911399113865595, -0.11687764679711665], [0.38995601569710026, 0.25862337132906621, 0.20778367175756296, 0.99392603502022769], [-0.32165386535491991, 0.080429152547056404, -0.85984733996427165, -0.15610294226570454]], [[0.12829546514003765, -0.4326838477532966, -0.61985099234292229, 0.33445914047116521], [-0.51684630714752422, 0.92431298195122413, -0.017961161723491603, -0.57836466241833606], [0.26372245020051421, 0.60965511465701305, -0.65459345305739824, -0.71283949608603092]], [[-0.59051578048618047, -0.11976164669216027, 0.63811512110527224, 0.0477865454714963], [-0.32869214968335014, -0.82123152677972677, -0.63369664321299068, 0.056672898394033666], [0.2250713152368351, -0.62438720879757748, -0.83237146630406356, -0.78278097359720378]]], [[[0.89748544928773066, 0.5752572822211599, 0.69556833557413533, 0.059484354097367076], [-0.42037686438037203, 0.24414755485271677, 0.7447054096616772, -0.73338535075846512], [0.84888276034233656, -0.89716332338609628, 0.41048988271148801, 0.77275425123689656]], [[0.053278067331299361, 0.017090335800584278, -0.019834263331557578, -0.78955636184768418], [-0.19302690568577918, 0.6869966044908038, 0.34430011476446776, 0.26412124200458797], [0.034090275037528928, -0.25940999069091819, 0.70472187490894989, -0.51898070676783026]], [[-0.11532514059713761, 0.7543433470843377, -0.025429440687317673, 0.97222217024465118], [0.100498060597767, -0.1686524972193677, 0.72744816848679061, -0.48660950354642418], [-0.59357339890728733, -0.1958546411491171, -0.89429512218716023, 0.041528696515233054]]], [[[-0.90076200036976117, -0.25957462571823475, 0.79256977370563386, -0.65221636673000094], [-0.38479624425568026, -0.98351747514208587, 0.96635050065626227, 0.13207466451884509], [-0.72321532195459648, 0.49324232956389502, -0.77437271037580513, -0.6970342093120272]], [[-0.5690486476849157, -0.18328781413382722, -0.12642173000883017, 0.72892817142317545], [-0.45697982321472996, -0.27764089575719852, 0.42027522015782659, 0.69638001933025606], [0.39249120138943683, 0.81646129948630564, 0.38622156091256632, 0.88525915829596502]], [[-0.66147807133014758, 0.92568437253839231, -0.83581384523615143, -0.89941202473191884], [0.88679461317858332, 0.78806539055185687, -0.90639197675436245, -0.056691520904474046], [-0.68628218008533293, 0.5435284380104628, -0.53709806924608294, -0.32696579362174982]]]]))
1462          res=trace(arg,0)
1463          ref=Data(numarray.array([[-0.44875114864982613, 0.58609855563679125, 0.54526606035417369, -1.9411035837529307], [-0.080056416904773275, -1.2214535685601384, -0.75335842773638495, 0.18979857114759424], [-0.55272687302561385, 1.0862445755151442, 0.088576364501473659, -0.14298826565347578]]),self.functionspace)
1464          ref.setTaggedValue(1,numarray.array([[0.2527338155140888, 1.082744213475002, -0.60653411742905305, -1.8058460333767197], [1.0837237231899044, 1.7336853663717269, -0.35430819023233173, 1.2013557561203416], [-0.97384577040272391, 0.36454759986660101, -0.69222353430140471, -1.0020494426552846]]))
1465          self.failUnless(isinstance(res,Data),"wrong type of result.")
1466          self.failUnlessEqual(res.getShape(),(3, 4),"wrong shape of result.")
1467          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1468       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1469       def test_trace_taggedData_rank4_offset1(self):
1470          arg=Data(numarray.array([[[[-0.55798919316930928, -0.12634181074327833, -0.40664724647866635, 0.36708777522359504], [0.92304655197309193, -0.56406149781700354, -0.75041568029159933, -0.095537386510300415]], [[-0.3636354593950577, -0.40380370690849166, 0.49253431857420327, 0.10902624704289288], [-0.19597941217654924, -0.95163806574005538, 0.60454417490459766, 0.69513132231601227]]], [[[-0.20308414220377036, -0.53195408451393367, -0.33288857029946994, 0.44484182547390527], [-0.12726872938253497, -0.43447934510411157, -0.39760625791440996, -0.30936298377662186]], [[0.28774381158004014, 0.61012947608207702, -0.46712034177702555, 0.91092147487322106], [-0.52390628765269009, 0.92927410510820163, -0.95012155523316077, -0.7222711322568518]]], [[[-0.24187336960914019, -0.59309059125950681, 0.53524786224937859, 0.50676945999040157], [-0.57463672422686285, 0.36012557101692289, -0.078463188038392806, 0.27486082740181295]], [[0.31528739403243211, -0.6370158849670815, -0.030539643795422844, -0.97217928007222509], [-0.47368356817793988, 0.032379440525969638, 0.34563915318137517, 0.19814305077222172]]]]),self.functionspace)
1471          arg.setTaggedValue(1,numarray.array([[[[0.75497579989715802, 0.75552023104928256, 0.48432549378389722, 0.20729794017016756], [0.44405493284670539, -0.23000293723614651, -0.63748352328109958, -0.60237445266324907]], [[-0.27625459086835935, 0.023596305703124765, 0.61504158021241917, 0.2178716901929818], [0.96278475273563724, -0.96720183527676884, 0.45551629628869139, 0.47165988558270189]]], [[[0.90761996660281774, 0.16758328211165674, -0.31356109610772309, 0.087428502708541078], [0.90782881734087795, 0.72403519404879302, -0.24417912061706226, -0.46951868330094637]], [[0.033861565372617086, 0.28163848857736618, 0.92408557671169467, 0.210632525440964], [0.87073073883033691, -0.68692992446708412, 0.14252375810828632, 0.8245351604586233]]], [[[-0.45002828026838038, -0.97190522313419714, 0.12925822440936252, -0.533132911900696], [0.011444666627784983, 0.82785488430562437, -0.3958492260594686, -0.0019680796983392312]], [[-0.17959231647010943, 0.92008786112041019, 0.38078133949239845, -0.36866225074134396], [-0.036570198363608419, -0.48923887070189065, 0.34751294528039756, 0.53151271350459495]]]]))
1472          res=trace(arg,1)
1473          ref=Data(numarray.array([[-0.75396860534585852, -1.0779798764833337, 0.19789692842593132, 1.0622190975396073], [-0.72699042985646045, 0.39732002059426796, -1.2830101255326307, -0.27742930678294653], [-0.71555693778708007, -0.56071115073353717, 0.88088701543075376, 0.70491251076262329]]),self.functionspace)
1474          ref.setTaggedValue(1,numarray.array([[1.7177605526327953, -0.21168160422748628, 0.93984179007258861, 0.67895782575286945], [1.7783507054331547, -0.51934664235542738, -0.17103733799943677, 0.91196366316716437], [-0.4865984786319888, -1.4611440938360878, 0.47677116968976008, -0.001620198396101058]]))
1475          self.failUnless(isinstance(res,Data),"wrong type of result.")
1476          self.failUnlessEqual(res.getShape(),(3, 4),"wrong shape of result.")
1477          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1478       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1479       def test_trace_taggedData_rank4_offset2(self):
1480          arg=Data(numarray.array([[[[0.50772321962003253, 0.81091093905750844, 0.94907993942795321], [0.73379368710043202, 0.1970196579321819, -0.8707801741741179], [-0.98974029208093661, 0.91681549483815017, 0.16956715133806566]], [[-0.090494805445503701, -0.3653868306105883, -0.87491027134814137], [-0.60474449778279293, 0.67282700235052628, 0.27290190361213451], [-0.03248595072972571, 0.27611081782564129, 0.75418917955906206]]], [[[0.18190784316027542, 0.33954122026553279, 0.13024592156588244], [-0.79420056673733463, 0.12148228545768824, -0.85470994652055587], [0.4829422648842423, -0.57023081427027478, 0.41433754047871041]], [[-0.58422268302045, -0.48231988981968299, -0.15004624357161589], [-0.49652481012180316, -0.21011488677963097, 0.20476295735139871], [0.17434244586251535, 0.69659164351993152, 0.8316119029490372]]], [[[0.602226352906577, 0.21989094319305869, 0.82993438476018522], [-0.093921878199302311, 0.22262225202444008, 0.50725270224144503], [-0.023680938989186773, 0.25862610493500493, -0.52230124443454318]], [[0.098543228060376409, 0.9775002686847889, -0.47745678787660806], [-0.88792221187768017, 0.35446812257977789, 0.87923110313445352], [-0.87302618083614503, 0.76889289104143943, -0.095107428145788653]]]]),self.functionspace)
1481          arg.setTaggedValue(1,numarray.array([[[[0.54945295821485707, 0.68929893451274893, -0.88766836204478827], [0.53024839700414561, 0.84905632473172754, -0.98556214149230015], [0.50718726310865336, -0.83719889242899215, 0.24136937710832362]], [[0.97221946890851418, 0.37857007790244546, 0.75560780727580856], [0.3521058501426968, 0.1507254827737019, 0.83412847473120277], [0.41312223430297745, -0.83067113456000574, 0.79847746537447262]]], [[[0.71933408626310946, -0.67938598430105768, -0.25704327542401395], [0.96454768916804823, -0.57443380467803262, -0.90584183288776843], [-0.99082600970368229, 0.92986322447411585, -0.009482479572462621]], [[0.042756189979888282, 0.7239714798641308, -0.54502595603950943], [-0.98616315736428839, -0.0324661868861289, 0.9949779711240978], [-0.18729522777607888, 0.1730936272931467, -0.011733676370543566]]], [[[0.92150763074621023, 0.041752915946222213, 0.88604844559866125], [0.32871523323767282, -0.69184453250969358, 0.10222640271280437], [0.055288050478184303, 0.3547320790777162, -0.98092888964539116]], [[0.45832990498428905, -0.5973061806598583, 0.56108743526797444], [0.85757837343863441, 0.24003028775473045, -0.093170295554950711], [-0.29609418582570224, -0.5992914494698971, 0.98416254607460307]]]]))
1482          res=trace(arg,2)
1483          ref=Data(numarray.array([[0.87431002889028009, 1.3365213764640846], [0.71772766909667407, 0.037274333148956229], [0.3025473604964739, 0.35790392249436564]]),self.functionspace)
1484          ref.setTaggedValue(1,numarray.array([[1.6398786600549082, 1.9214224170566887], [0.13541780201261422, -0.0014436732767841853], [-0.75126579140887451, 1.6825227388136226]]))
1485          self.failUnless(isinstance(res,Data),"wrong type of result.")
1486          self.failUnlessEqual(res.getShape(),(3, 2),"wrong shape of result.")
1487          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")

Legend:
Removed from v.428  
changed lines
  Added in v.429

  ViewVC Help
Powered by ViewVC 1.1.26