5284 |
self.failUnless(isinstance(res,Data),"wrong type of result.") |
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5285 |
self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
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") |
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5287 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5288 |
|
def test_trace_array_rank2_offset0(self): |
5289 |
|
arg=numarray.array([[0.26555691640939405, -0.18910413427150452, 0.12039085017309703, -0.17574192533077326], [-0.34124380166621093, 0.37425207868597998, -0.60605432527492908, -0.78351999526440919], [-0.008718872902747421, 0.45919281265912248, -0.33985859983016309, 0.29866113913548786], [-0.41729887400737264, -0.28881644097258641, 0.55984121129488917, 0.70121385950894766]]) |
5290 |
|
res=trace(arg,0) |
5291 |
|
ref=numarray.array(1.0011642547741586) |
5292 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
5293 |
|
self.failUnlessEqual(res.shape,(),"wrong shape of result.") |
5294 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5295 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5296 |
|
def test_trace_array_rank3_offset0(self): |
5297 |
|
arg=numarray.array([[[0.98480390026626874, 0.49765498235413208], [-0.29090485844190184, -0.75557539858330203], [-0.24147713943580618, 0.83189520938773742], [-0.39332790736632894, -0.23255430958687073], [0.61469056695908431, -0.54221652099612139], [-0.30688843565214863, 0.38245185105763024]], [[0.39352505237092705, -0.89859538741148248], [-0.19611389561895298, 0.46658392439701291], [-0.58513992115908198, -0.52572413506686666], [0.36528379930027022, 0.35082214206594764], [-0.36197438572003837, -0.58168855905536532], [0.76595064870067198, -0.29898163768408659]], [[-0.21257388708161273, -0.82660354888963417], [-0.95912201085053916, -0.74140025039180379], [0.83542400169616804, 0.71398525032328397], [0.35580921803956844, 0.9910319975254831], [-0.99833758049102572, 0.49906045783260655], [0.46148100303820816, 0.057489858386365444]], [[0.14448723439540556, -0.66497743959494815], [-0.65298722004566812, -0.80946208978135714], [-0.72729541818349297, 0.75942335665704896], [-0.22887401674150798, -0.45740224056161138], [0.32594979393943646, -0.14983354513871983], [-0.88654135390033595, 0.64170560178214209]], [[0.051660095426996566, 0.072646454146782835], [0.80107524461478041, 0.75854236897011562], [-0.84218515265322691, 0.5416362111837385], [0.72274598019809133, -0.1904262266248522], [-0.70527606629361261, 0.71754633833989923], [0.9944261102138261, 0.27642826392584841]], [[-0.71311099419488766, 0.096638813026104442], [-0.5881439560482713, 0.48983822134718635], [-0.36462007898555537, 0.31258183909269088], [-0.25934166771369438, -0.46384813583935425], [-0.40956274472953136, -0.45410860721145374], [-0.63285410497195316, 0.26725460398192613]]]) |
5298 |
|
res=trace(arg,0) |
5299 |
|
ref=numarray.array([0.057109818336410045, 2.2056228588346429]) |
5300 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
5301 |
|
self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
5302 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5303 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5304 |
|
def test_trace_array_rank3_offset1(self): |
5305 |
|
arg=numarray.array([[[-0.76875725167611453, 0.075414018110247394], [-0.46910058955171152, -0.78870866656070926]], [[0.1763412665571984, -0.38625105646597069], [-0.24103707165873289, 0.90747381262632065]], [[0.092043720781569416, -0.26846050280345235], [-0.7946162528668701, 0.0066516500151119207]], [[0.25018944598669868, -0.051585233002871211], [-0.47027454711245098, -0.25743603279448135]], [[0.89008264050297203, 0.083887666317993048], [0.85233581507994938, 0.2788350650030873]], [[-0.30761996005339931, -0.4926586222583984], [0.69525691978757131, 0.88245916957253989]]]) |
5306 |
|
res=trace(arg,1) |
5307 |
|
ref=numarray.array([-1.5574659182368238, 1.083815079183519, 0.098695370796681337, -0.0072465868077826734, 1.1689177055060593, 0.57483920951914058]) |
5308 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
5309 |
|
self.failUnlessEqual(res.shape,(6,),"wrong shape of result.") |
5310 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5311 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5312 |
|
def test_trace_array_rank4_offset0(self): |
5313 |
|
arg=numarray.array([[[[-0.35914276251844779, -0.89177244154479451, 0.75156232311996729, 0.2689197071295113], [0.48550638042599714, 0.37876012371739165, 0.11909831579647689, -0.13698649685115294], [0.66469543775731199, -0.04713994250240372, 0.69016847677268345, 0.43203165345044803]], [[-0.84196908557528283, 0.31114408094237334, 0.97829773043316881, 0.71705939156379173], [-0.59254857582824449, 0.99125198550959226, -0.27824457105332501, 0.95639865727128393], [-0.88869987019695151, 0.71945513418541562, -0.63948935534342555, -0.60595079857487888]], [[0.20060003292491246, -0.51895689477941298, 0.77610596136013754, 0.89846794711535649], [-0.797787885912846, 0.1126603408303033, 0.71040396312258625, -0.58371207496516675], [-0.39629389058593234, -0.224661339329151, -0.4415492883796388, -0.2843763466047633]]], [[[-0.14648357755460073, 0.10563951301739172, 0.074504969752375638, -0.11173828803978103], [-0.54814938162159921, -0.030096820913388944, 0.01245902120734721, -0.93883615158053946], [0.23918339542047629, -0.58141478071359765, -0.47847130713180896, -0.3854827811199637]], [[0.031675817270823137, -0.28496738108976349, 0.75670930591992125, -0.78671398093094447], [0.3632307462902622, 0.086431371878165075, -0.73497382201547867, 0.41464504948755421], [-0.100681389463116, 0.10486835825917429, -0.51283334572425865, -0.10649277312087135]], [[0.64697608810822471, -0.4521370777632252, -0.5134303970348042, 0.87851641270408254], [-0.54474768357062953, 0.62303825302672777, -0.80583800146399409, 0.34594811232501099], [-0.31036396242882325, -0.56242948188853092, -0.22336487915091019, -0.39223978983887853]]], [[[-0.27938145518702884, 0.77804736964504406, -0.011111792974861645, -0.20087387832153847], [-0.31688601479435285, -0.82880241287501444, -0.5794350312586245, -0.92630428602849646], [-0.88496830540835147, -0.083138586748798371, -0.95091261792702308, 0.31621428161145904]], [[0.17190403532611431, -0.55658920241117382, 0.68690100106161078, -0.31096726230017713], [0.70230740428853178, -0.74569911664915844, -0.45156846173579446, -0.12422693360460091], [-0.98904485448914325, 0.57482038825465653, -0.46254001816981405, -0.82707533787151544]], [[0.70924494286527739, 0.050750820630569571, 0.7836413546922556, 0.32035567617899541], [0.76832143595594471, -0.36561424057317549, -0.26942425383212854, 0.8169272968127963], [0.73410520671439561, 0.53990562381492802, -0.75655688584516367, 0.20038872707677813]]]]) |
5314 |
|
res=trace(arg,0) |
5315 |
|
ref=numarray.array([[0.38177799761765274, -1.1259890020039884, 2.2919129837321441, -0.19743859762243776], [1.617058562672204, 0.099577255022381239, -0.88529976005113031, 1.0945858494491976], [1.2981192550085916, 0.59763403957169858, -0.57922175479673887, 0.5259276074063548]]) |
5316 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
5317 |
|
self.failUnlessEqual(res.shape,(3, 4),"wrong shape of result.") |
5318 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5319 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5320 |
|
def test_trace_array_rank4_offset1(self): |
5321 |
|
arg=numarray.array([[[[-0.92784167492855762, 0.60248011777483357, 0.031225045884133662, -0.34745967830316826], [0.027129935696126095, 0.48013540111896069, -0.72517396078746899, 0.95371795346554977]], [[-0.72505453089243255, 0.007597625514423223, -0.98625885351348153, 0.1682118209020349], [0.64064186297081394, 0.71427245750801327, 0.92923384113278851, -0.95941382390217966]]], [[[-0.028684917730743331, 0.090779113645879095, 0.63429381954611386, 0.10940719084580586], [-0.067228410948499295, -0.45721418427291693, -0.47873249885715663, 0.21835729813061455]], [[0.51965061080506958, 0.75785664872937386, -0.33550922445148745, 0.66896630346996044], [0.7176636344292453, 0.56712006361198353, -0.0048458303867575658, 0.17607306572513104]]], [[[-0.76702410971539137, -0.14274699317299167, 0.28278039945268163, -0.7080275942808707], [-0.20539126224132875, -0.9172867821862789, -0.49799499531251512, 0.092624073961727005]], [[-0.59138766627665462, -0.46807518914541313, -0.9104444200453814, 0.11708065088439268], [-0.4668904319703393, -0.32397199958420608, 0.059672712734865518, 0.99088767923010379]]]]) |
5322 |
|
res=trace(arg,1) |
5323 |
|
ref=numarray.array([[-0.28719981195774369, 1.3167525752828468, 0.96045888701692217, -1.3068735022053479], [0.68897871669850197, 0.65789917725786262, 0.62944798915935629, 0.2854802565709369], [-1.2339145416857307, -0.46671899275719775, 0.34245311218754715, 0.28286008494923309]]) |
5324 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
5325 |
|
self.failUnlessEqual(res.shape,(3, 4),"wrong shape of result.") |
5326 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5327 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5328 |
|
def test_trace_array_rank4_offset2(self): |
5329 |
|
arg=numarray.array([[[[0.13031826439397065, -0.1789298694401773, -0.64989661091089923], [-0.27327904713332241, -0.61679868125863613, 0.18686962619451131], [0.66553888328001665, -0.99338065217851401, 0.70085830978616381]], [[0.41407307674031446, 0.70389105425033516, -0.85751604971482887], [0.60932599055523418, -0.027942855299541769, 0.42976951506702132], [-0.45560078263789872, 0.87711330379085095, 0.35291250996606194]]], [[[0.0085795831135988543, 0.18775995060321127, 0.92382753051777255], [0.2329781632292165, 0.19209684057591137, 0.76180170447446627], [-0.22107729339810578, -0.063955483745411046, -0.4596195798551701]], [[-0.87062584076293215, -0.97712503659797512, -0.36609561443173488], [0.025990661451154473, 0.13804237670844399, -0.3575230803781464], [-0.089217826694265812, 0.33387178666740835, -0.016589404783220019]]], [[[-0.52969301393409496, 0.99628743319515278, -0.68831285828334776], [0.17295713720552652, -0.10633816939243634, -0.75799480026623534], [0.049894479253417279, 0.97106513893516566, 0.19808838402211992]], [[-0.57109506688962441, -0.21527086508290272, -0.81800681445834766], [0.53496737929008442, -0.43086860643255731, -0.93046040310632749], [0.05573925281031844, 0.63980368481088545, -0.10083869982683513]]]]) |
5330 |
|
res=trace(arg,2) |
5331 |
|
ref=numarray.array([[0.21437789292149834, 0.73904273140683463], [-0.25894315616565988, -0.74917286883770817], [-0.43794279930441138, -1.1028023731490169]]) |
5332 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
5333 |
|
self.failUnlessEqual(res.shape,(3, 2),"wrong shape of result.") |
5334 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5335 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5336 |
|
def test_trace_Symbol_rank2_offset0(self): |
5337 |
|
arg=Symbol(shape=(4, 4)) |
5338 |
|
res=trace(arg,0) |
5339 |
|
s=numarray.array([[0.53170042435493015, -0.81813085266388819, 0.49776488697815036, -0.59308638942814595], [0.16020418993822272, -0.20879594431552184, -0.40438865299637583, -0.90709844441071552], [0.64375666096961881, -0.27517391230452315, 0.8807123412925002, -0.77747601880843309], [0.81384867834518992, 0.81300711507303358, -0.33478570998135648, -0.42745393629191275]]) |
5340 |
|
sub=res.substitute({arg:s}) |
5341 |
|
ref=numarray.array(0.77616288503999575) |
5342 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
5343 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
5344 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5345 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5346 |
|
def test_trace_Symbol_rank3_offset0(self): |
5347 |
|
arg=Symbol(shape=(6, 6, 2)) |
5348 |
|
res=trace(arg,0) |
5349 |
|
s=numarray.array([[[-0.89676591931694349, 0.95604978719490608], [-0.82494255250502535, -0.77648887659173571], [0.7124204966499359, -0.47918747979862353], [0.94253036599801887, -0.49525180470205044], [0.24456142502672207, -0.30004097354106674], [0.65768225250028256, 0.00086818156620172005]], [[-0.504909745584186, 0.85097185047497104], [0.81641180829143756, -0.39468331897086184], [-0.70635046887704656, 0.49890292017932292], [-0.92440555351961806, -0.06419549869111596], [-0.39579576071153322, -0.20288275718588511], [-0.77089133943822885, -0.0011741243199028251]], [[0.31645143359889882, 0.54967022870454052], [-0.84917283992702641, -0.22946831794661371], [0.30750555249731204, -0.53374075034351387], [-0.21836207994144496, 0.23970091940304572], [-0.44234380858409805, 0.69989440592744412], [0.41425030688237774, 0.31712081171648743]], [[-0.97517653574764496, 0.67982884392918397], [-0.73930329355781388, -0.36444953847109773], [0.8181436780917517, 0.67303437888161155], [0.77329820758899226, 0.93569742730703287], [-0.060808707180728616, -0.97611897228764177], [-0.65303659315383022, -0.49167562112149721]], [[-0.16892454101192822, 0.38900177003547309], [-0.54962224419488726, 0.60406179433423168], [0.92813587095618688, -0.38698563342530523], [-0.29798525812007171, 0.35475928811273061], [0.50046711017097834, 0.53301179072038263], [0.024397390795399598, 0.80190468820066285]], [[0.10762880008184106, -0.67082393783832939], [0.50591078418917101, 0.9772511084203972], [0.79683226798124229, -0.38827988854229489], [0.64666546087911647, 0.14312023138737207], [0.19844882751956772, -0.4568789350267275], [0.66590612284776474, -0.59174059377329358]]]) |
5350 |
|
sub=res.substitute({arg:s}) |
5351 |
|
ref=numarray.array([2.1668228820795417, 0.90459434213465229]) |
5352 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
5353 |
|
self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
5354 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5355 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5356 |
|
def test_trace_Symbol_rank3_offset1(self): |
5357 |
|
arg=Symbol(shape=(6, 2, 2)) |
5358 |
|
res=trace(arg,1) |
5359 |
|
s=numarray.array([[[-0.7977094488200962, 0.063978285487136244], [-0.97789454136636134, -0.96688805661820409]], [[0.04895543747537956, -0.063328269776439239], [0.21235577548435702, 0.28138547228954769]], [[0.90551519491645149, -0.42412566434759813], [0.28969999227312093, -0.3663613951232576]], [[0.17193620470155002, 0.41896450861309353], [-0.013424723566530128, -0.74392980520702934]], [[-0.87732745391242406, 0.54830351236065589], [-0.43758121288766083, -0.55971209822943058]], [[0.20614861931150297, 0.94201858882027967], [0.58259554554668425, -0.025276305291194401]]]) |
5360 |
|
sub=res.substitute({arg:s}) |
5361 |
|
ref=numarray.array([-1.7645975054383003, 0.33034090976492725, 0.53915379979319389, -0.57199360050547932, -1.4370395521418546, 0.18087231402030857]) |
5362 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
5363 |
|
self.failUnlessEqual(res.getShape(),(6,),"wrong shape of result.") |
5364 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5365 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5366 |
|
def test_trace_Symbol_rank4_offset0(self): |
5367 |
|
arg=Symbol(shape=(3, 3, 3, 4)) |
5368 |
|
res=trace(arg,0) |
5369 |
|
s=numarray.array([[[[-0.80654952480556119, -0.69443824274047494, 0.78496167328791899, -0.42575436767465313], [0.12319287448070959, 0.75938161027494577, -0.4836414442506658, 0.43562960805621453], [0.20634708199571739, -0.70115826289934913, 0.2051734517191024, -0.3747855487381837]], [[0.38156829402705283, -0.73109343527655879, 0.4878500108749706, -0.32586491969049236], [0.089253266683069432, 0.19147413377319422, 0.88062066165505448, -0.15107823177659108], [0.74697716377640733, -0.6515229200918955, -0.3782893155439353, 0.47949490917041504]], [[0.65423612657751273, 0.79741744675367565, 0.55047425317188226, 0.90203544636176347], [-0.13377940079141148, 0.17280231055526629, 0.45003662395977972, 0.067433226867590346], [-0.22246738734039972, 0.38787020561779761, 0.35328502477232915, -0.10075668556673945]]], [[[-0.22329271744241797, -0.2707130236297024, -0.67541180823791946, 0.29445895278940659], [0.03095492342980255, 0.030262307093634977, 0.22659499566711006, 0.13568939898698895], [0.53495887340119186, -0.89494783812407808, 0.72903420908544447, -0.6940338048877337]], [[-0.67969622433272625, 0.045564774685938003, -0.085529480951626269, 0.32350565260596498], [-0.607413340326173, -0.05785501285407979, -0.72320594221116075, -0.48523666261110754], [-0.25900470283804955, 0.4959065468649948, 0.63349492718807388, -0.2017535601635978]], [[0.30350420718603899, 0.59176145201248787, -0.05893817640727006, -0.37431311327659222], [0.93988371599771248, 0.44898229362807229, -0.5009555998961428, -0.50488360148206923], [0.3810666681736814, 0.095905142522387354, -0.34696087767540829, 0.79409668966690927]]], [[[-0.90218333710423271, 0.86062329059996312, 0.1751195479385188, 0.71807543573065469], [-0.80031400477753589, 0.68485605290669604, 0.021018247021905578, 0.4533962598771164], [0.83575260591146128, 0.40206880744947626, -0.17463218432087935, -0.97329531576870409]], [[-0.64046742658297706, 0.57131672632728048, 0.26576340899352013, 0.26536529437565148], [0.5382705073633467, 0.50731197528556748, -0.71216687584177651, 0.9955562159049407], [0.32808570383408009, 0.16778611097035334, -0.10027128196717383, -0.48343905103716267]], [[0.8184542836987525, 0.52730109695941119, -0.88360001933499466, -0.47592646674336758], [0.71390985124247774, 0.051088798569194571, 0.67946117846981746, -0.45808667421780025], [-0.58858643667224553, -0.030929026706359997, -0.27948704074812269, 0.60160600529975539]]]]) |
5370 |
|
sub=res.substitute({arg:s}) |
5371 |
|
ref=numarray.array([[-0.66779146543953494, -0.12157237109512575, -0.18416782699870193, -0.57817518181205574], [0.22968938539701433, 0.75261539599006055, -0.52738620799200908, -0.50769372877269325], [-0.64124405751457769, -0.23618074274071432, 0.55918133815905358, 0.025066896397973881]]) |
5372 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
5373 |
|
self.failUnlessEqual(res.getShape(),(3, 4),"wrong shape of result.") |
5374 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5375 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5376 |
|
def test_trace_Symbol_rank4_offset1(self): |
5377 |
|
arg=Symbol(shape=(3, 2, 2, 4)) |
5378 |
|
res=trace(arg,1) |
5379 |
|
s=numarray.array([[[[0.67935028030080047, 0.87945762686854323, -0.030928776242075573, -0.12158036010546125], [0.24657234583687049, -0.79132752522266547, -0.40360303645871221, 0.54918832044309918]], [[-0.65986516747351875, 0.96638497681200985, 0.63728797931216952, -0.94035388523784835], [-0.23605266636044298, -0.96159056440728508, 0.92548159892971738, 0.38460211142921508]]], [[[0.0084721881107214791, 0.65963525484863594, 0.83038538937978146, 0.79420214695732749], [-0.60657534901222987, 0.62017585161777133, 0.038076548988372316, 0.45500630846667889]], [[0.35671818765868735, -0.78603103654019124, -0.47333087486303249, -0.689826710860731], [-0.94506875200451246, 0.86200222663885073, 0.69208520709875865, 0.38395127433652121]]], [[[-0.9763113290056924, 0.3429641288733174, -0.71779054851061197, 0.081219493894409966], [-0.2392668059090437, 0.23623854037827141, 0.60690820644969601, -0.90326490974279161]], [[-0.31549704230059428, 0.048655767557006735, -0.22849405041132687, -0.35309647594688798], [0.41606901157939413, -0.2735829973707995, -0.41739605378032718, 0.6066947777863847]]]]) |
5380 |
|
sub=res.substitute({arg:s}) |
5381 |
|
ref=numarray.array([[0.44329761394035749, -0.082132937538741846, 0.8945528226876418, 0.26302175132375383], [-0.93659656389379098, 1.5216374814874867, 1.5224705964785401, 1.1781534212938487], [-0.56024231742629826, 0.069381131502517901, -1.1351866022909392, 0.68791427168079466]]) |
5382 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
5383 |
|
self.failUnlessEqual(res.getShape(),(3, 4),"wrong shape of result.") |
5384 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5385 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5386 |
|
def test_trace_Symbol_rank4_offset2(self): |
5387 |
|
arg=Symbol(shape=(3, 2, 3, 3)) |
5388 |
|
res=trace(arg,2) |
5389 |
|
s=numarray.array([[[[-0.43379109997130949, -0.67189802508010876, -0.76838375769062317], [0.36956867556439454, 0.15750933013402357, 0.60890180315702702], [0.75504509257177355, 0.00093170425272193214, -0.60057980545979373]], [[0.029638066249704442, 0.98470665559384063, 0.38850159850271604], [-0.057921882937528535, 0.25260595789798157, -0.47461155702456748], [0.3538224192887085, -0.022692086367159137, 0.20841169768838075]]], [[[-0.8827077102270513, -0.2681753397732729, 0.45996386413852175], [0.79094787422332025, -0.77668488346273334, -0.4134155484834694], [0.39816757111729095, 0.67661052433840085, 0.50946905439722934]], [[0.014477455133028228, -0.80240877745916417, -0.42967869209737497], [0.54259276240450438, 0.39540943896966629, -0.92884898819887329], [0.56909547571069008, 0.69849658256509883, 0.35168988071735297]]], [[[0.76703210261643284, 0.56304082158407076, 0.90973794572357214], [-0.99504722326197359, 0.50876850644469274, -0.53578805027456489], [-0.83168706913026602, 0.18635945312951985, 0.15220552320592673]], [[-0.44163594145490803, 0.36619557701582539, -0.61146289808789267], [-0.19419519121700657, -0.47906398330805788, 0.3940088527490806], [0.96446396182503746, -0.50231016580819254, 0.10716862231226565]]]]) |
5390 |
|
sub=res.substitute({arg:s}) |
5391 |
|
ref=numarray.array([[-0.87686157529707964, 0.49065572183606676], [-1.1499235392925553, 0.76157677482004749], [1.4280061322670523, -0.81353130245070027]]) |
5392 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
5393 |
|
self.failUnlessEqual(res.getShape(),(3, 2),"wrong shape of result.") |
5394 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5395 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5396 |
|
def test_trace_constData_rank2_offset0(self): |
5397 |
|
arg=Data(numarray.array([[-0.29383963344234121, -0.015014018118957306, 0.99753580206723647, -0.50635236021974106], [-0.37905392076965927, 0.31528456608530631, 0.86721682590868698, 0.51278396705456841], [0.29008438489433841, 0.10101024328890973, 0.66687277847571313, 0.6654399862684186], [-0.5902980567859355, -0.57191420388096859, -0.51058587062074134, 0.93677538124606463]]),self.functionspace) |
5398 |
|
res=trace(arg,0) |
5399 |
|
ref=Data(1.6250930923647429,self.functionspace) |
5400 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5401 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
5402 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5403 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5404 |
|
def test_trace_constData_rank3_offset0(self): |
5405 |
|
arg=Data(numarray.array([[[-0.72642799948220493, 0.79232473269996073], [-0.67563422655155247, 0.20011212614972362], [-0.59028571211858649, 0.14506117798083507], [0.47240012720854407, -0.82029555113272101], [-0.58454362400865878, 0.63215213979312868], [-0.35007656466177095, -0.1470415518683037]], [[0.42763460915772211, 0.8357573230966695], [-0.29914137624741732, -0.036306874859310279], [-0.51046716828256211, -0.85831582073872537], [-0.79470878322572314, -0.48987591183092638], [-0.86974326209750896, 0.70916592312129745], [0.83868372787049505, -0.10785599577865157]], [[-0.058672803278049468, -0.14146375774695574], [0.17727056643394556, -0.48058347796639467], [-0.83011490290698431, -0.63504062113632753], [0.086833789382744442, 0.70068497275513919], [0.49044532362179361, 0.40352559278906575], [-0.88547213401229574, 0.87226874572961344]], [[-0.33114461927211525, 0.0027119570097013934], [-0.37590722158855527, 0.2213145859812935], [0.80071873391378312, -0.41643470039851649], [-0.58961378449755419, 0.93123715794003958], [0.02582176095827271, -0.53120064845162362], [-0.38118292706842039, 0.98328185978424587]], [[0.53642120847771513, -0.26939855882552544], [-0.22456707784987806, -0.22452517341877654], [0.89817688350629865, -0.63775048322698091], [-0.76799424555480655, 0.92000058433888654], [0.36620149364765475, 0.34379452633744956], [-0.59690996179249978, -0.59279936908563813]], [[-0.59055334860005648, 0.30644018478641044], [-0.25015804641416217, -0.49250326577772507], [-0.12727433609341832, -0.35398126798225626], [-0.56502814650267053, -0.96640875351734778], [-0.51485842473096888, -0.31753865090662758], [-0.63020882370649534, 0.61645627794582958]]]),self.functionspace) |
5406 |
|
res=trace(arg,0) |
5407 |
|
ref=Data(numarray.array([-2.7093053931930013, 2.0124651989276416]),self.functionspace) |
5408 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5409 |
|
self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
5410 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5411 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5412 |
|
def test_trace_constData_rank3_offset1(self): |
5413 |
|
arg=Data(numarray.array([[[0.27352469692010906, 0.47078446143689212], [0.57479782614850539, -0.0051486191501395329]], [[0.74361396403981384, 0.25515510619301329], [-0.61255554527004286, -0.46948770334026335]], [[-0.028715409681372206, 0.070901178629972694], [-0.47846874064507117, -0.91959320136358702]], [[-0.24835828088751577, 0.23671885472681842], [0.99388364258199013, -0.23721426553099789]], [[0.19787821531251604, -0.77414401933415267], [-0.6848568761717686, -0.22644337787735802]], [[-0.78546754720422962, -0.65168742945227121], [-0.26014163072111196, -0.26194458519933228]]]),self.functionspace) |
5414 |
|
res=trace(arg,1) |
5415 |
|
ref=Data(numarray.array([0.26837607776996952, 0.27412626069955048, -0.94830861104495923, -0.48557254641851366, -0.028565162564841984, -1.0474121324035619]),self.functionspace) |
5416 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5417 |
|
self.failUnlessEqual(res.getShape(),(6,),"wrong shape of result.") |
5418 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5419 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5420 |
|
def test_trace_constData_rank4_offset0(self): |
5421 |
|
arg=Data(numarray.array([[[[0.67837901384728561, 0.25230684578079843, -0.18006172651018115, -0.18742559018056171], [0.25980554035178893, -0.60710586338433759, 0.18529181621885771, 0.06454562228317684], [-0.89720749423697344, -0.809936419954433, -0.52546885113780628, -0.65826181914830206]], [[0.75126603048955443, 0.41791482287477688, -0.18708594285812397, -0.097592007674713432], [-0.30556054895669615, -0.25367425753154871, -0.65986245393338994, 0.49830950398371265], [-0.74835162221267404, -0.98775159055059558, 0.53343998083071287, 0.58249266652470078]], [[0.72661613097074818, 0.22851198720172761, -0.38897158619501715, 0.15133995066275441], [0.76231929070207505, -0.87183861352936654, -0.9162704267412165, -0.075190375042774704], [-0.99789286156015344, 0.41046263149263118, -0.72945251192102378, -0.59631547494176385]]], [[[-0.27663864530792637, -0.91812683979135334, 0.5568519562913512, -0.31904133788107036], [-0.48634727640176045, 0.87978759058913414, -0.4631455206362578, -0.35771439543824557], [-0.0088863660929114907, 0.67411887052330854, 0.43694758100285558, 0.13263535729230225]], [[-0.047911420964740215, -0.1671659731804469, -0.79106159933094444, -0.60086616171961471], [-0.40660682701782869, -0.65857886957039002, 0.97138661007671434, -0.38521124487194713], [-0.99504601002533355, 0.038715505103106729, 0.27375528366649449, 0.51179190061643776]], [[0.17226508653462647, 0.41821768543572513, 0.99025384379339765, 0.42934653741475604], [0.94505216727849306, -0.90852488045982582, 0.99963241021520122, 0.32009293199423694], [0.64969595277507719, -0.81807980261861268, 0.63135375645829073, 0.31133912070438985]]], [[[-0.81843681081377451, 0.62297813580429251, -0.64834999047301412, 0.31879083594375723], [0.5745557058624462, -0.31209122247715793, -0.91449671557843981, -0.28521064904747151], [-0.11835330152389645, 0.23564571048634719, 0.21055665107048438, -0.84463421709998987]], [[-0.16113935663618451, -0.79196713229468929, -0.51417934429324008, 0.54945395167798505], [0.76643759834273495, -0.47795914006001694, 0.43614611442999918, -0.17337837227416975], [0.50429854624245429, -0.91686495814729718, -0.73068569106157333, 0.70282293932303208]], [[0.24655393516994573, -0.36508446162486963, -0.18165603004763731, -0.60679606785622919], [0.62995050624366744, 0.50604553586174239, 0.2139378361831199, 0.033810482605382219], [-0.21127570703083398, 0.61056026945659569, -0.94937237529332541, -0.64919134337137296]]]]),self.functionspace) |
5422 |
|
res=trace(arg,0) |
5423 |
|
ref=Data(numarray.array([[0.87702152805249112, -0.2799435890245181, -1.1527793558887629, -1.3950878197564056], [0.48314921957762769, -0.75963919709298522, 1.3706162624786919, -0.28685513998338807], [-2.1035292112931412, -0.16066064539473057, -1.2010859427646372, -0.79566126190323727]]),self.functionspace) |
5424 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5425 |
|
self.failUnlessEqual(res.getShape(),(3, 4),"wrong shape of result.") |
5426 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5427 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5428 |
|
def test_trace_constData_rank4_offset1(self): |
5429 |
|
arg=Data(numarray.array([[[[-0.16696076135170923, 0.82974391265868208, -0.078680670490009375, -0.96835524907764126], [0.54969239234040534, 0.17623541766186968, 0.077019704254756016, 0.57636452671928362]], [[-0.4519311176106926, 0.57880525532235882, -0.0015113586612311991, 0.31438699743750309], [-0.46119335345094092, 0.59471868696549524, 0.64818472484469392, -0.7434166956705377]]], [[[-0.3104928944593035, 0.89709092416386893, 0.3374479306116227, -0.56706034715284614], [0.52964596335340208, 0.062265529064360114, -0.66426921214265189, 0.0099179068655548264]], [[0.0042797304397270697, -0.68728374808571213, 0.20538696492502284, -0.82057659071817879], [-0.12466108726578962, 0.052484065740935115, -0.28252863583893451, 0.42076514415105537]]], [[[-0.65642721290351291, 0.72607023613257682, -0.075581205318460798, 0.76265280933396595], [0.9863819936467153, 0.46861308614825292, 0.25011512506209099, -0.088132594048707213]], [[0.12851311890909933, -0.26566989109689865, 0.44009914867510891, -0.30062749250691967], [0.89182785391555042, -0.54420395388411191, -0.9018886462510296, 0.95827128488931823]]]]),self.functionspace) |
5430 |
|
res=trace(arg,1) |
5431 |
|
ref=Data(numarray.array([[-0.62815411480265015, 1.4244625996241773, 0.56950405435468454, -1.711771944748179], [-0.43515398172509312, 0.94957498990480405, 0.054919294772688199, -0.14629520300179077], [0.2354006410120375, 0.18186628224846491, -0.9774698515694904, 1.7209240942232842]]),self.functionspace) |
5432 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5433 |
|
self.failUnlessEqual(res.getShape(),(3, 4),"wrong shape of result.") |
5434 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5435 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5436 |
|
def test_trace_constData_rank4_offset2(self): |
5437 |
|
arg=Data(numarray.array([[[[-0.98482921887938679, -0.2021932043246204, -0.43931510971992593], [0.82500558882646424, -0.94073688978501102, -0.85123670983501043], [0.31094599072729778, 0.12059062935396159, 0.45095349007500651]], [[0.10491489308253454, -0.87224687812665835, 0.85946921554980338], [0.20110899808432126, -0.04819131401865584, -0.65225345772055876], [0.43197594848373377, -0.8665825801549325, 0.68414135494343808]]], [[[0.82421905238462712, 0.05713259985882635, 0.88279598225821787], [-0.2098145249261274, 0.022164492617607445, -0.54619059245669699], [0.0062526761224697136, -0.13250141161679396, 0.85642390101957422]], [[0.88057912670407634, -0.059756350737471209, 0.35828573888292059], [0.49077984989887513, 0.8028691375260737, -0.93700752416276556], [0.030934159674997685, -0.60451701161112292, -0.65521990807624797]]], [[[0.0070660955019832272, 0.87011155990448241, -0.32286449245280857], [-0.24887688324443102, -0.18727119138654746, -0.90048655101564057], [0.30874988433738726, -0.69579883453454605, 0.78507788657918276]], [[0.18716153278559133, 0.20495393697585418, -0.42114034048974114], [-0.72877450302661506, 0.57308411806594006, 0.70745122427680229], [0.13182579049068832, -0.83070067184375551, -0.22593153722147408]]]]),self.functionspace) |
5438 |
|
res=trace(arg,2) |
5439 |
|
ref=Data(numarray.array([[-1.4746126185893913, 0.74086493400731679], [1.7028074460218088, 1.0282283561539021], [0.60487279069461852, 0.53431411363005732]]),self.functionspace) |
5440 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5441 |
|
self.failUnlessEqual(res.getShape(),(3, 2),"wrong shape of result.") |
5442 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5443 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5444 |
|
def test_trace_expandedData_rank2_offset0(self): |
5445 |
|
msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) |
5446 |
|
arg=msk_arg*numarray.array([[0.11566446254344553, -0.4745105734645696, -0.87728089123849706, -0.30742134665898813], [0.64561603368593645, -0.16643615643478848, -0.7068536821797744, -0.033045748559738408], [0.32071043030768398, 0.22106761892996096, 0.48388048184729837, 0.74228108665057824], [0.41235289044686274, -0.80515202915608386, -0.50750243672304451, 0.19620812039387592]])+(1.-msk_arg)*numarray.array([[0.6982051620420755, -0.43997510892232849, 0.31785539449789679, 0.77071019636847571], [0.25437948245168607, 0.87309054348917914, 0.40806383784241795, 0.23697269987364522], [0.76503085553268702, 0.54594905359750445, -0.63787892882701391, -0.43923459263360387], [-0.22326896676087116, -0.68233388681771623, 0.44544487240308017, -0.13913483142044614]]) |
5447 |
|
res=trace(arg,0) |
5448 |
|
msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) |
5449 |
|
ref=msk_ref*numarray.array(0.62931690834983134)+(1.-msk_ref)*numarray.array(0.79428194528379459) |
5450 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5451 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
5452 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5453 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5454 |
|
def test_trace_expandedData_rank3_offset0(self): |
5455 |
|
msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) |
5456 |
|
arg=msk_arg*numarray.array([[[-0.66027506839281647, 0.11166612285841016], [0.42749286897655625, -0.93865817184981437], [0.15068940524255603, 0.52349452094956739], [0.27687559884096458, 0.066986941961115765], [0.93180835331970946, -0.48756585147447229], [0.65280839067465135, -0.71921262071024761]], [[0.11618442368982751, -0.4763658244658322], [-0.50020128416710752, -0.25851957859869312], [0.35878292067616147, -0.38038146181290644], [0.93041110099841817, 0.029846232912715598], [-0.45141831725121584, 0.28948945003451643], [0.32280124045787928, 0.053742832260912587]], [[-0.98592436891189683, 0.71413775868480056], [0.046660357647682282, 0.98162830306990978], [0.58933281142936988, 0.22717987654775929], [0.71293710502335106, 0.73508206251418873], [-0.61306596901927679, -0.63773297908928717], [0.66040111118536293, -0.87407302149827326]], [[-0.67220137400111146, 0.9753868329755222], [0.37836258737909279, -0.76957121571717235], [-0.50213275436171911, -0.070066516163526771], [-0.58706972621765052, 0.77480496092018991], [0.17595133543567765, -0.67397634261638495], [-0.88890284486005799, -0.69276478680832065]], [[0.93447809528654435, 0.21446672025978786], [-0.018401823547098628, -0.31000980913085052], [0.5413158316784219, -0.058395872945901983], [-0.54734531427605515, 0.28202816017233179], [-0.69286581846548523, 0.82432638767569344], [-0.87062165825132021, -0.93175755696284512]], [[-0.65710236849233516, -0.62035012520073329], [-0.50968063974239408, -0.93313959756872777], [-0.35391354855647905, 0.75699472909905396], [0.11178875277715772, 0.072002604708961249], [-0.83779828776596932, -0.90850093178213798], [-0.68468230379800277, -0.99110190358689487]]])+(1.-msk_arg)*numarray.array([[[-0.99848839209688167, -0.644631003682262], [-0.48778615498860289, 0.30351281670072061], [0.35476651624916067, 0.65677420217236393], [0.50513285317507672, 0.38249927932844585], [0.37184137033045817, -0.014062623855171763], [0.20346283701971224, -0.90065418094786609]], [[-0.44711449100012057, 0.06097628012933809], [0.80356090400302205, 0.27132926350242892], [0.98253752709557163, -0.59382185199137427], [-0.25845751522938087, -0.38353350312948487], [-0.33300811027660804, -0.93105133171802001], [-0.26330496922471625, -0.50428263033869603]], [[-0.81751144420930899, -0.30764780803870528], [-0.78647633040943976, -0.91372171625429766], [0.20200739094322584, -0.21172544950311645], [0.9090164133708083, 0.63061458792814884], [-0.95363552021907294, -0.47103249447229723], [0.84223778501992297, 0.86715821546071359]], [[0.15707485130940202, -0.2899064141846559], [-0.84537923972525575, 0.015976015150186429], [0.74386525719705388, 0.12827716540476786], [-0.48285012973111252, 0.66655440178479153], [0.35341753421674826, 0.96292028306601618], [0.90070502993119717, -0.45105023721624105]], [[0.28873136026507829, -0.080104489353869379], [0.063967147741553321, 0.33578030011784255], [0.5987855411248364, 0.71129093318111458], [-0.2770293252781042, -0.69711328956064111], [-0.66489886266023213, -0.64595981816454051], [-0.96026557406741264, -0.78155062841685208]], [[0.55660561073469239, -0.54703296386818789], [0.19275274446148116, 0.29276600726776647], [0.012541645015802017, -0.30750896443491094], [0.18531754942814893, -0.19424254722285217], [0.36728317133983568, -0.86908257258996935], [0.6986276697478373, 0.35789358454072695]]]) |
5457 |
|
res=trace(arg,0) |
5458 |
|
msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) |
5459 |
|
ref=msk_ref*numarray.array([-2.5357613896116926, 0.6883558658164648])+(1.-msk_ref)*numarray.array([-0.44204141979414113, -0.20653902152197157]) |
5460 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5461 |
|
self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
5462 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5463 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5464 |
|
def test_trace_expandedData_rank3_offset1(self): |
5465 |
|
msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) |
5466 |
|
arg=msk_arg*numarray.array([[[0.54832323387675541, -0.8708353613360531], [-0.61626047688459518, -0.49478488575159019]], [[-0.83629746484611744, 0.47083140193399564], [-0.23408945961247651, 0.039929220485188655]], [[0.75625307461269897, 0.14019030241332509], [-0.27268120332088674, -0.72257006486353137]], [[-0.55826466629659932, 0.73521559094994182], [0.91050139917670103, 0.24001369605640965]], [[0.25393441044315046, -0.90266415386637022], [0.633218691079662, -0.6608559941901635]], [[0.59063791740460214, -0.6151947887528777], [-0.11030206731241865, 0.87604601489174794]]])+(1.-msk_arg)*numarray.array([[[-0.59125906679462714, -0.70711124409167958], [0.27856680992337113, -0.086397184806098037]], [[-0.86220968392839969, 0.26537880004255987], [0.93545519643136954, -0.48749383545450575]], [[0.06022485624330054, -0.15164028816670005], [-0.99602031320916007, -0.96448449281376236]], [[-0.57562468885884877, -0.44453327158851774], [-0.021996078817393627, -0.60252338148303708]], [[-0.043233633786327053, 0.82352268170410592], [0.74140809698310162, 0.89351886922223023]], [[0.5483633681991571, 0.85381405316771697], [-0.85793760080248904, 0.12725561555427167]]]) |
5467 |
|
res=trace(arg,1) |
5468 |
|
msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) |
5469 |
|
ref=msk_ref*numarray.array([0.053538348125165225, -0.79636824436092879, 0.033683009749167603, -0.31825097024018967, -0.40692158374701304, 1.4666839322963501])+(1.-msk_ref)*numarray.array([-0.67765625160072518, -1.3497035193829054, -0.90425963657046182, -1.1781480703418858, 0.85028523543590318, 0.67561898375342877]) |
5470 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5471 |
|
self.failUnlessEqual(res.getShape(),(6,),"wrong shape of result.") |
5472 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5473 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5474 |
|
def test_trace_expandedData_rank4_offset0(self): |
5475 |
|
msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) |
5476 |
|
arg=msk_arg*numarray.array([[[[0.80505741203337466, -0.80734097237269142, 0.71509731690044021, -0.34102290030005511], [-0.27163627689262082, 0.96803797983982598, 0.39024478352616399, 0.45615965347192255], [-0.2492201152095701, -0.53890105212209205, -0.26097899477118602, 0.098974826517917558]], [[0.4109524481147584, 0.32745334361464762, 0.88135376430664136, -0.88007501076892969], [-0.2546833692939714, -0.62753769519110136, 0.2296060741039474, 0.57476321487434467], [-0.50883771898767782, 0.0015685044689357497, -0.66998456995491273, 0.34968106764759765]], [[-0.64126116758172813, -0.55568939471539136, 0.23227193794020073, 0.7330369779999284], [-0.3126458847194391, 0.94502653499662759, -0.5936869592079892, 0.25705352992342645], [-0.46308398732466771, 0.37874287044184518, -0.030587221468148629, -0.80649056741936587]]], [[[-0.55428203289059597, 0.39384118967627457, 0.21400763473662332, -0.05778739181646686], [0.89572023189653716, 0.64808964944115921, -0.76081286684220872, 0.29643887696780724], [0.92808629225161865, -0.5927287532507779, 0.080932430903517538, 0.6300942109115113]], [[-0.050786057311087207, 0.82696470921887877, -0.52069224695178296, -0.19457105492027638], [0.20464920722411661, -0.5846772435204266, 0.15252929823896588, -0.40702515404436856], [0.30048751596882983, -0.77039288688309648, -0.25964577407800782, -0.92201363813026638]], [[0.30524909950231782, -0.078384011294031719, 0.54945703430160053, -0.79337517722753814], [0.23862358165502573, -0.21132833792836037, 0.67284298273913512, 0.47737327757131043], [-0.57895539269247887, 0.30865689803953855, 0.64471920728490284, 0.56866096983603387]]], [[[0.59411993702838983, -0.55286609932973252, -0.11704951317866552, -0.1799876691786706], [0.7044831381893395, 0.41444296685797211, 0.035873800421900803, -0.3077870122658044], [-0.5537875848354139, -0.09294785912808079, 0.60281458905112695, -0.25586177426534462]], [[0.073972334874764956, -0.17863943805405702, -0.40192876955035106, 0.49779070006291537], [-0.78351344470846263, 0.066371129010451391, -0.68107079280677119, 0.27027467137931782], [-0.08733315269502917, 0.17609544147485212, -0.84985580086147139, -0.57706563708906877]], [[0.80900077345628585, 0.54299611298654993, 0.36197457335708672, 0.78822507164521771], [-0.57823417843160185, 0.24045072531447076, -0.21646907149363126, 0.39109919937326909], [0.86048045599481848, 0.5316575326401245, 0.17357533828519278, -0.035528536537402955]]]])+(1.-msk_arg)*numarray.array([[[[0.70941815199826297, -0.11292617215886147, 0.77501725501558871, 0.55963189951353853], [-0.7796391490563328, -0.73773608726012929, -0.97005387036695923, -0.89110745459054397], [0.61643890466549855, 0.36305011268742771, -0.35899006379107701, -0.89037252955545054]], [[-0.48513893441395584, -0.80463983453322796, -0.26992613069089511, 0.25377671510133326], [0.85296361003701948, -0.088353279464719492, -0.8833491655162129, -0.49061051639006448], [-0.0070639306921898015, -0.91051044523499236, 0.19421401294033869, -0.023694190336753351]], [[0.87600763033159823, -0.12842080556081559, 0.23748702101368124, -0.42712865548684986], [0.12798880486722353, -0.68743327370801688, 0.066429185783382527, 0.89836542344770587], [-0.96008406560328807, 0.69958585815823149, -0.96646148853866998, -0.19840985556590041]]], [[[-0.50676183913854866, -0.95802357084856005, 0.88072647796789671, 0.87404328671267173], [0.91057125659389504, 0.28205294652962043, -0.84518566395353356, 0.43476689284070802], [0.72919748914970839, 0.16300515512838709, 0.69548292805402645, -0.40221177456763235]], [[0.015376288615946532, -0.65336549560515977, -0.013429002513120514, 0.92410715356068551], [0.93234891088019034, -0.25180012657781981, -0.85520698120760597, 0.030845786152130295], [0.2883277702478666, 0.98831889817695329, -0.18710978196618666, 0.63191491053115234]], [[-0.35727830132105409, -0.38880115020070694, -0.41377801087774246, 0.26046673344155802], [0.46430510016515281, -0.37898634296018896, 0.80517984749417848, -0.89342861976109855], [0.39122847915190984, 0.839544668081603, 0.032449290839240641, 0.19743019769729941]]], [[[-0.40460228252750641, 0.48245356602434275, -0.39051899259424205, -0.18353327424101074], [0.97419082853471006, -0.042098069664895599, 0.89968753511941424, -0.42150619030266823], [0.7086498513346402, -0.55571035848915984, 0.5581268170564333, 0.35555965546369439]], [[0.70102153566399905, -0.00085601991690098522, -0.003295266014190501, -0.044650933649731828], [-0.69526860140456903, -0.20761407547243449, 0.93251889119089992, -0.24412708149011197], [0.079410921553375147, -0.74409430021596035, 0.10338967121074294, 0.96093957200944913]], [[-0.2191453313682481, 0.60828504356886492, 0.83999448435024604, -0.28751114677396172], [0.49008990050737888, -0.00067270376026429268, -0.37727354733847673, 0.22111819218371975], [-0.21174513129074191, 0.33959243779929893, 0.73167011601901133, -0.084743053268589774]]]]) |
5477 |
|
res=trace(arg,0) |
5478 |
|
msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) |
5479 |
|
ref=msk_ref*numarray.array([[1.5632721281785733, 0.56261984983273727, 0.55637964330574396, 0.25263111642488623], [-0.64522124810010606, 0.62381146163387013, 0.32630501027149861, 0.44023369880082308], [0.91174785675407821, -0.77763640636506404, -0.34704943056400106, -0.85856734814975177]])+(1.-msk_ref)*numarray.array([[0.5056491092459614, -0.15800662419515632, 1.6015827368527142, 1.1962279063002623], [0.64279966233123642, -0.99020891759821339, -2.2025343989130421, -0.63914347625469392], [0.69302154362262325, 1.6909614486636799, 0.18557027026174766, -0.34320067229288798]]) |
5480 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5481 |
|
self.failUnlessEqual(res.getShape(),(3, 4),"wrong shape of result.") |
5482 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5483 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5484 |
|
def test_trace_expandedData_rank4_offset1(self): |
5485 |
|
msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) |
5486 |
|
arg=msk_arg*numarray.array([[[[0.08984283572763152, 0.55774397308602075, 0.87551033839309578, 0.99597647119622823], [0.42229013451029207, -0.69334370113115673, 0.24000324515885452, 0.42734821657622946]], [[-0.81493193917641937, -0.050594548082001589, 0.0038864544826278102, 0.052096885283608341], [0.90250995205525242, 0.70852431792468717, -0.51329731427030234, -0.35733423128402686]]], [[[0.40608243871683025, -0.23521357565080536, 0.89730267936680086, 0.047309735490747906], [-0.59393261956767396, -0.29550705351553352, 0.30755167993031152, -0.39461060352402422]], [[0.53278112038096181, -0.18809691653542338, 0.31331369186508473, -0.072624780731609606], [0.22822350853600937, -0.77304798948100206, -0.92290799290383396, -0.77844654084572884]]], [[[0.52913787058447759, -0.0060496727934438166, -0.11597929750770342, 0.34450138717310375], [0.022084213363977367, 0.65407578801966126, -0.75425196792782034, -0.75722973429394558]], [[0.98740067425091804, -0.67549616735140949, 0.62950749508587323, -0.88707486447485584], [0.060245192990180829, 0.57744779530191237, 0.37664105332815967, 0.88854593410198413]]]])+(1.-msk_arg)*numarray.array([[[[0.47417067087989362, 0.67736115892005633, -0.47715348159010551, -0.22133534252199838], [-0.65637448271923016, 0.96209293069951607, -0.36528071036921772, -0.48073633550727246]], [[-0.96698553584714331, -0.32663464055897684, -0.82564205136999669, 0.97180689930200814], [0.28291320059607195, -0.88357282368832246, 0.71368496471764575, 0.16389798613013395]]], [[[-0.46081508440668251, 0.37873602667271622, 0.60832335684486516, -0.84502188519038723], [0.19274895184009821, 0.42741773658053939, 0.30785853018719433, 0.99619445060780953]], [[0.74277555386059979, -0.49774986195020943, 0.48334133283298297, 0.75890613926618067], [-0.82416568056271866, 0.36258558577355227, 0.062026544439186537, -0.11407159191585503]]], [[[-0.36297821802040353, -0.65847019250544503, 0.60479755659167767, 0.32850256319429771], [-0.31926573823318805, 0.76520370780791147, 0.23701043523043985, -0.84107360755418736]], [[-0.94264543949346069, -0.91307915369911474, -0.44258244810340419, -0.075654165697478071], [0.089419047834058185, -0.71629556686014295, 0.17553339506971932, 0.57290908432214582]]]]) |
5487 |
|
res=trace(arg,1) |
5488 |
|
msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) |
5489 |
|
ref=msk_ref*numarray.array([[0.99235278778288394, 1.2662682910107079, 0.36221302412279344, 0.63864223991220137], [0.63430594725283962, -1.0082615651318074, -0.025605313537033103, -0.73113680535498093], [0.58938306357465842, 0.57139812250846855, 0.26066175582045625, 1.2330473212750879]])+(1.-msk_ref)*numarray.array([[0.75708387147596556, -0.20621166476826613, 0.23653148312754024, -0.057437356391864425], [-1.2849807649694012, 0.74132161244626849, 0.6703499012840517, -0.95909347710624226], [-0.27355917018634535, -1.374765759365588, 0.78033095166139699, 0.90141164751644354]]) |
5490 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5491 |
|
self.failUnlessEqual(res.getShape(),(3, 4),"wrong shape of result.") |
5492 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
5493 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5494 |
|
def test_trace_expandedData_rank4_offset2(self): |
5495 |
|
msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) |
5496 |
|
arg=msk_arg*numarray.array([[[[-0.66853129559502222, 0.291820898682152, 0.28763294566928921], [0.90955604295816017, 0.15689918504537581, -0.84974098181736846], [-0.11864531145144963, 0.62639318585116577, 0.28878897761901667]], [[-0.81891488095094211, 0.087816450656737821, -0.61977148230317702], [-0.25672822143041052, 0.850129776941005, 0.88131009407039174], [0.68042928359428401, -0.22600045838684846, 0.29289573548364345]]], [[[0.86947162304463177, 0.83714818463465979, 0.48073227883036274], [0.74537740000749331, -0.724938999271586, -0.24964341400235268], [0.96015316466387812, -0.77803078685663474, -0.40930971981379272]], [[0.50513454444497397, 0.27333552102189596, -0.010414057530881538], [-0.56187171953000825, -0.44137302845768289, -0.29244303378144232], [-0.1881407405943325, 0.4373804442340905, 0.079976247887080687]]], [[[-0.03923293421052132, -0.83834889486007658, -0.25537540031705741], [0.85687986615403067, 0.62632041906338909, -0.28611872462260002], [-0.080621198164744223, 0.92763342316339847, -0.96379876567397837]], [[-0.51229650531528792, 0.61168109929691394, -0.48562540039833846], [0.49244617296496918, -0.34501205541607938, -0.43139933921747198], [0.97335832979343806, 0.90952427744807229, -0.79476366666508969]]]])+(1.-msk_arg)*numarray.array([[[[-0.9049127988617065, -0.77513691833851217, -0.37363048230956908], [-0.19332122397693419, -0.76584280953452466, -0.36465847067381119], [-0.93936927771468182, -0.9052541144775863, -0.44538405341396325]], [[-0.91309628219582017, -0.87504920853740842, -0.6919306085080319], [0.7357120775715762, -0.81739945020223725, -0.2499946214554134], [-0.069828197774766787, 0.97127065995603989, 0.64641336042534037]]], [[[0.98354181283512387, 0.26145468296473728, 0.67122148396418746], [-0.85594120625088976, -0.90242375185857582, 0.96277097499514519], [0.08105375151436145, 0.14214289843261119, -0.18712602171243975]], [[0.5561891002327306, -0.11458725485012078, 0.70506410495446925], [0.17668410374153187, 0.72063557456429894, -0.64688343152063466], [-0.50952512796965399, -0.097278116167972328, 0.41947753973499124]]], [[[0.47279413902758161, 0.81935636228453546, 0.87589001940363165], [0.9561752822027425, -0.6004911198517342, -0.70023577057274666], [0.86945177086287462, 0.53351985326887874, -0.89239035872981298]], [[-0.98966175755131802, -0.19919768852186159, -0.81359664155341171], [-0.28175871977250644, -0.059790145158654218, -0.0089004393110567737], [0.77373148023876048, -0.2581197388152523, 0.89448508702586982]]]]) |
5497 |
|
res=trace(arg,2) |
5498 |
|
msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) |
5499 |
|
ref=msk_ref*numarray.array([[-0.22284313293062974, 0.32411063147370633], [-0.26477709604074695, 0.14373776387437176], [-0.37671128082111061, -1.652072227396457]])+(1.-msk_ref)*numarray.array([[-2.1161396618101946, -1.0840823719727171], [-0.10600796073589169, 1.6963022145320208], [-1.0200873395539656, -0.15496681568410242]]) |
5500 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
5501 |
|
self.failUnlessEqual(res.getShape(),(3, 2),"wrong shape of result.") |
5502 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |