Parent Directory
|
Revision Log
|
Patch
revision 286 by jgs, Wed Nov 9 02:02:19 2005 UTC | revision 287 by gross, Thu Dec 1 06:40:51 2005 UTC | |
---|---|---|
# | Line 1 | Line 1 |
1 | # $Id$ | # $Id$ |
2 | """ | """ |
3 | Test suite for the util.py module. | Test suite for the util.py module. |
4 | ||
5 | The tests must be linked with a function space class object in the setUp method: | The tests must be linked with a function space class object in the setUp method: |
6 | ||
7 | The test are grouped as | |
8 | ||
9 | Test_util_basic: some basic tests | |
10 | ||
11 | Test_util_unary_no_tagged_data: test for unary operations with no | |
12 | Test_util_unary_tagged_data: test for unary operations | |
13 | Test_util_unary: test for unary operations | |
14 | ||
15 | Test_util_reduction_no_tagged_data: test for unary operations with no | |
16 | Test_util_reduction_tagged_data: test for unary operations | |
17 | Test_util_reduction: test for unary operations | |
18 | ||
19 | Test_util_binary_no_tagged_data: test for unary operations with no | |
20 | Test_util_binary_tagged_data: test for unary operations | |
21 | Test_util_binary: test for unary operations | |
22 | ||
23 | Test_util_overloaded_operations_no_tagged_data: test for unary operations with no | |
24 | Test_util_overloaded_operations_tagged_data: test for unary operations | |
25 | Test_util_overloaded_operations test for unary operations | |
26 | ||
27 | Test_util_no_tagged_data: all test withour tagged data | |
28 | Test_util_tagged_data: all test with tagged data only | |
29 | Test_util: all test | |
30 | ||
31 | ||
32 | to run the use: | |
33 | ||
34 | from esys.bruce import Brick | from esys.bruce import Brick |
35 | class Test_utilOnBruce(Test_util): | class Test_utilOnBruce(Test_util_no_tagged_data): |
36 | def setUp(self): | def setUp(self): |
37 | self.domain = Brick(10,10,13) | self.domain = Brick(10,10,13) |
38 | self.functionspace = ContinuousFunction(self.domain) | self.functionspace = ContinuousFunction(self.domain) |
# | Line 14 The tests must be linked with a function | Line 40 The tests must be linked with a function |
40 | suite.addTest(unittest.makeSuite(Test_utilOnBruce)) | suite.addTest(unittest.makeSuite(Test_utilOnBruce)) |
41 | unittest.TextTestRunner(verbosity=2).run(suite) | unittest.TextTestRunner(verbosity=2).run(suite) |
42 | ||
43 | For function spaces which support tagging there is the extended test case Test_util_with_tagged_Data available. | For function spaces which support tagging there is the extended test case Test_util_with_tagged_data available. |
44 | This test assumes that the functionspace has samples with tags equal to 1 and different from 1. | This test assumes that the functionspace has samples with tags equal to 1 and different from 1. |
45 | ||
46 | @remark: at this stage thsi test will not pass as it tests for functionlity that has not been implemented yet. It also does not test the full functionalitu of util.py yet. | @note: at this stage thsi test will not pass as it tests for functionlity that has not been implemented yet. It also does not test the full functionalitu of util.py yet. |
47 | ||
48 | @var __author__: name of author | @var __author__: name of author |
49 | @var __licence__: licence agreement | @var __licence__: licence agreement |
# | Line 36 import unittest | Line 62 import unittest |
62 | import numarray | import numarray |
63 | from esys.escript import * | from esys.escript import * |
64 | ||
65 | class Test_util(unittest.TestCase): | class Test_util_base(unittest.TestCase): |
66 | """ | |
67 | basic tests on util.py | |
68 | """ | |
69 | RES_TOL=1.e-7 # RES_TOLerance to compare results | RES_TOL=1.e-7 # RES_TOLerance to compare results |
70 | DIFF_TOL=1.e-7 # RES_TOLerance to derivatices | DIFF_TOL=1.e-7 # RES_TOLerance to derivatices |
71 | #========================================================= | #========================================================= |
# | Line 250 class Test_util(unittest.TestCase): | Line 279 class Test_util(unittest.TestCase): |
279 | val=unitVector(i=0,d=self.functionspace) | val=unitVector(i=0,d=self.functionspace) |
280 | self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.") | self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.") |
281 | self.failUnlessEqual(val.shape,(self.functionspace.getDim(),),"wrong shape.") | self.failUnlessEqual(val.shape,(self.functionspace.getDim(),),"wrong shape.") |
#========================================================================= | ||
# global reduction operations (these functions have no symbolic version) | ||
#========================================================================= | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_float_rank0(self): | ||
arg=0.479077251703 | ||
ref=0.479077251703 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_array_rank0(self): | ||
arg=0.352800421569 | ||
ref=0.352800421569 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_array_rank1(self): | ||
arg=numarray.array([0.58364106865247445, 0.19224319360367659]) | ||
ref=0.583641068652 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_array_rank2(self): | ||
arg=numarray.array([[0.67017748174064184, 0.27426357568545234, 0.99809374007262508, 0.0068333566694658288, -0.27942939334057559], [-0.41062296082648619, -0.036816602223561423, -0.50580074937952246, 0.93227848108675948, -0.061517050082725788], [0.36561750746233845, 0.41114839130078873, 0.52258027672142848, -0.16534372330544111, 0.20772668552253304], [0.821900382760401, -0.84255628577421948, -0.69396587198625026, -0.57918798921236458, -0.72171447032975466]]) | ||
ref=0.998093740073 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_array_rank3(self): | ||
arg=numarray.array([[[0.058641541671277109, -0.90451294682583527], [-0.24359709498927606, -0.57748558070477163]], [[0.035804882991596898, 0.62841290637910441], [-0.28533080116748288, -0.97886508166774955]], [[0.31393622401598642, -0.43905852202615403], [-0.86251727012547685, 0.028980168735740941]], [[0.64796855283921229, -0.48583038861071492], [0.18113352051559328, -0.41145930584343637]], [[0.039393878628251944, 0.8768398562091233], [-0.17607723439655953, -0.88597401556177768]], [[-0.015710131346685419, -0.1460065558640582], [0.97739538148461858, -0.96991499683153215]]]) | ||
ref=0.978865081668 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_array_rank4(self): | ||
arg=numarray.array([[[[-0.78982105495266985, -0.63220666806337955, 0.17512704833203396, 0.87905338838606228], [0.23198845220692799, 0.039972475068823288, 0.012169097173197807, 0.44188750570302382], [0.76550090905039703, 0.31693138180972436, 0.1053031163896907, -0.35110494947362092]], [[0.98438531435704557, 0.64830270240860366, 0.17255823042313656, -0.89376135594562944], [-0.24129437029981871, -0.142955980423916, 0.16557185988864043, 0.97182386578689162], [0.68369373227893937, -0.86170550438838256, 0.30120477894454822, 0.38702330237685523]]], [[[0.77139284396922037, 0.20032741426304668, 0.57845916425558697, -0.29867163908832151], [-0.068269410287581156, 0.5940891737261742, 0.076472990825278808, -0.099092183170674364], [-0.052727700907511776, 0.86303703635283835, -0.87561628108225542, 0.98706354430335175]], [[0.59243014649382819, 0.1550040875984271, -0.2755507051420949, -0.0013143184448647371], [0.49341486033505921, 0.47331310491746503, -0.79931467469262252, -0.90673470029976722], [-0.032268150780954796, 0.296035852616644, 0.51579882806939303, 0.46437108203184607]]], [[[-0.54940019219066349, 0.063961557315018069, 0.58950734587654585, -0.98334853918198539], [-0.3624096661573355, 0.41744569348555416, 0.30209950686844023, 0.51268273249278518], [0.18884359916930848, -0.71707023426140903, -0.30560603652072227, 0.50521867139895282]], [[0.48925658559264695, -0.22791551552340583, -0.0018172920946346593, -0.35038144063572618], [-0.92608233760416425, -0.58447575161042908, 0.6419293813902982, -0.9165521427783867], [0.32116313637555338, 0.64441081354246466, 0.57516697859586241, -0.30456483792192746]]]]) | ||
ref=0.987063544303 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_constData_rank0(self): | ||
arg=Data(0.196366308048,self.functionspace) | ||
ref=0.196366308048 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_constData_rank1(self): | ||
arg=Data(numarray.array([-0.013183241788205846, 0.30081447346639489]),self.functionspace) | ||
ref=0.300814473466 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_constData_rank2(self): | ||
arg=Data(numarray.array([[0.5711180583492661, 0.70931947195628298, -0.66895311699347904, 0.96005746113679025, 0.73085528334644767], [-0.63904611175106618, 0.2843691804450883, 0.44023994297671054, 0.74230048057601272, 0.32582591826440876], [0.058605148358656045, 0.17856553839104938, 0.92397360311332144, -0.96449976222010503, -0.2936728605307215], [-0.54599501106213921, 0.76941479487476183, 0.071247548913826231, 0.19101147233175308, -0.1697403800152153]]),self.functionspace) | ||
ref=0.96449976222 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_constData_rank3(self): | ||
arg=Data(numarray.array([[[0.72501574945437675, 0.097442689963523454], [0.81136110912526904, 0.30019286779005516]], [[-0.49590270028453376, 0.89873757442194169], [-0.77574675514072333, 0.00090692035026496143]], [[0.30313499990678294, -0.22304437168798286], [0.26434595235717628, 0.56043553186944139]], [[-0.82536121216538372, 0.017266274277504934], [0.15087851023611853, 0.85422443819044291]], [[-0.85528228633213454, 0.21599153787828373], [-0.8320606477196939, 0.8359530516934528]], [[-0.32478507656272382, 0.11549647741760993], [-0.87438785398253049, 0.58454806081387956]]]),self.functionspace) | ||
ref=0.898737574422 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_constData_rank4(self): | ||
arg=Data(numarray.array([[[[-0.1675633776917147, 0.33827478137880718, -0.93890402023643449, 0.65020437341791437], [0.29507018847480526, 0.98622587753446878, 0.12652012726316597, -0.31134038684685694], [-0.046095794370747178, 0.52924578464459526, -0.6479404156998898, -0.50108997075395512]], [[-0.89461015899273821, -0.079360196866752331, 0.24950542226018069, 0.6689436082056277], [0.92392213781413735, 0.3873078097702356, 0.19593123983162242, -0.24092882483013001], [-0.64621424798001881, 0.9822743623774457, 0.89791841241748926, 0.61910184653693512]]], [[[-0.93993640130694156, 0.86452728798536005, 0.094496916350070848, 0.59825417382728907], [0.55042390382543216, 0.83625046124041091, -0.59865905280251042, 0.60081510989738351], [0.96300656863917622, 0.45676715577013183, 0.96765574240961594, 0.35217159943804499]], [[-0.44344990079738578, -0.62540931368504271, 0.47046830875624712, 0.56727920796684694], [0.68754074058706793, -0.20419202844112316, -0.0095491803785341389, 0.013299778291189002], [0.17824394120278897, -0.27714200037108694, -0.2616405339148673, -0.32155257707876661]]], [[[0.47113927793594357, -0.99306136743656892, 0.30468996581271934, -0.55558797016447881], [0.83216176170936151, 0.016003159554198287, 0.50607924358488665, -0.44441953149310631], [0.81919419287951278, -0.65849894919643503, 0.91897977494732008, -0.52338741357416407]], [[0.71408966944475138, -0.49347702658095161, 0.35676281330171133, 0.87268025092466872], [0.38401738326898771, -0.66323897612738114, 0.57309433517459518, 0.72101582669934583], [-0.0289954568811297, 0.55204032281174009, 0.51120867863750807, -0.67373936301915327]]]]),self.functionspace) | ||
ref=0.993061367437 | ||
res=Lsup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_expandedData_rank0(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*0.907507663119+(1.-msk)*0.907507663119 | ||
# arg=Data(0.907507663119,self.functionspace,True) | ||
# arg.setTaggedValue(1,0.907507663119) | ||
res=Lsup(arg) | ||
ref=0.907507663119 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_expandedData_rank1(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([0.64842023599463228, 0.7950449048151853])+(1.-msk)*numarray.array([-0.53356920308809608, -0.30392740367264159]) | ||
# arg=Data(numarray.array([0.64842023599463228, 0.7950449048151853]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[-0.53356920308809608, -0.30392740367264159]) | ||
res=Lsup(arg) | ||
ref=0.795044904815 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_expandedData_rank2(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[0.72772455370935374, -0.47120637916343311, -0.82075870555018726, -0.13186541688079845, 0.14046405940683471], [0.10791450121551649, 0.043686402172190775, 0.4587164889316806, -0.16569163575870283, 0.64477762072726041], [0.62628246294878309, -0.46538827310659792, 0.58089235621217727, -0.745300901798017, -0.1072674226756638], [0.93074707226494824, 0.17195108914746116, 0.77645205158899833, -0.55814650711894975, -0.68929261213084403]])+(1.-msk)*numarray.array([[-0.25856012658041871, -0.64132706411711782, -0.90934384682634128, 0.13076992241789931, 0.23456684296051011], [0.54052140856785269, 0.78868044275368643, 0.20419986484049479, 0.64782383948156319, 0.12883249735345115], [-0.44575026820636654, -0.86972644697707824, 0.74937006939719653, 0.64390867433141019, 0.57227950445890885], [-0.59430616226417832, -0.77932115906125854, 0.60864641730739155, 0.909083762068297, -0.5444504332265574]]) | ||
# arg=Data(numarray.array([[0.72772455370935374, -0.47120637916343311, -0.82075870555018726, -0.13186541688079845, 0.14046405940683471], [0.10791450121551649, 0.043686402172190775, 0.4587164889316806, -0.16569163575870283, 0.64477762072726041], [0.62628246294878309, -0.46538827310659792, 0.58089235621217727, -0.745300901798017, -0.1072674226756638], [0.93074707226494824, 0.17195108914746116, 0.77645205158899833, -0.55814650711894975, -0.68929261213084403]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[-0.25856012658041871, -0.64132706411711782, -0.90934384682634128, 0.13076992241789931, 0.23456684296051011], [0.54052140856785269, 0.78868044275368643, 0.20419986484049479, 0.64782383948156319, 0.12883249735345115], [-0.44575026820636654, -0.86972644697707824, 0.74937006939719653, 0.64390867433141019, 0.57227950445890885], [-0.59430616226417832, -0.77932115906125854, 0.60864641730739155, 0.909083762068297, -0.5444504332265574]]) | ||
res=Lsup(arg) | ||
ref=0.930747072265 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_expandedData_rank3(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[[0.31609964814729086, -0.59322042077218184], [0.62671563648606643, -0.99924882354010092]], [[-0.81285219908299133, -0.91261945476639861], [-0.66394864058744174, -0.070011911370653657]], [[-0.4798784324091383, -0.017929635369934749], [0.87935995021589952, 0.73748462709583618]], [[-0.89673095768516986, 0.44255562883781563], [-0.33009427566326166, 0.89415170271508537]], [[-0.070411620428932897, 0.34854312339042304], [-0.54088506672687542, 0.57996368816677069]], [[0.98447862226498417, 0.31010343079927294], [0.18832525314748882, 0.46594491838516161]]])+(1.-msk)*numarray.array([[[0.036725320623094637, -0.95874317021810596], [-0.66138152872168576, -0.52870418789420959]], [[0.59182952544611012, -0.31117513196914603], [0.17957160072325573, -0.93130315483187909]], [[0.33548100103066814, -0.6503677585469938], [-0.15995741665912955, -0.79138987042982367]], [[0.12353483100690976, -0.72197260504479188], [-0.35933752275788389, -0.46752695895022667]], [[0.7611306903818762, -0.88807332904594882], [0.91131651925077373, 0.81255438802194258]], [[-0.56892641899978824, 0.0010213385566093525], [0.40194539652124472, -0.006585080723547021]]]) | ||
# arg=Data(numarray.array([[[0.31609964814729086, -0.59322042077218184], [0.62671563648606643, -0.99924882354010092]], [[-0.81285219908299133, -0.91261945476639861], [-0.66394864058744174, -0.070011911370653657]], [[-0.4798784324091383, -0.017929635369934749], [0.87935995021589952, 0.73748462709583618]], [[-0.89673095768516986, 0.44255562883781563], [-0.33009427566326166, 0.89415170271508537]], [[-0.070411620428932897, 0.34854312339042304], [-0.54088506672687542, 0.57996368816677069]], [[0.98447862226498417, 0.31010343079927294], [0.18832525314748882, 0.46594491838516161]]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[[0.036725320623094637, -0.95874317021810596], [-0.66138152872168576, -0.52870418789420959]], [[0.59182952544611012, -0.31117513196914603], [0.17957160072325573, -0.93130315483187909]], [[0.33548100103066814, -0.6503677585469938], [-0.15995741665912955, -0.79138987042982367]], [[0.12353483100690976, -0.72197260504479188], [-0.35933752275788389, -0.46752695895022667]], [[0.7611306903818762, -0.88807332904594882], [0.91131651925077373, 0.81255438802194258]], [[-0.56892641899978824, 0.0010213385566093525], [0.40194539652124472, -0.006585080723547021]]]) | ||
res=Lsup(arg) | ||
ref=0.99924882354 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_Lsup_expandedData_rank4(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[[[0.4996033665120716, -0.074132654028136846, 0.2908837888281397, 0.79804117547820219], [0.25334186456470942, -0.10892196087517791, 0.90411872189757747, -0.21372334914190327], [0.65549677694560438, 0.97979738684954532, -0.29737844854710138, 0.93659843329597914]], [[0.22668444631484608, -0.92481913749465305, -0.9980815386745403, -0.022502768980955601], [-0.21769755240946398, 0.77216348666766876, -0.19843685166706204, 0.54270333879579558], [-0.11274856721131221, -0.29600869223659299, 0.1458222910080329, -0.83739782177046851]]], [[[0.86722932032155531, 0.39888432468517876, -0.8991679849590255, -0.088621935923834272], [-0.58464076321585412, -0.09564380294323116, 0.18232602464536307, 0.7910046931530843], [0.15923450234841652, -0.39331159996226872, 0.18298541750645669, 0.99889484861795563]], [[0.36793558813747418, -0.64593764280975363, 0.048503028175158613, -0.8304805399530264], [0.072019074767407432, -0.066883567381289311, -0.55849542620276127, -0.32521841292447484], [0.83256632210175896, -0.52124955617445723, -0.0047287521832242163, 0.84184001532121422]]], [[[-0.81375499823702158, 0.12901434959756353, -0.51500727423485215, 0.52626362435118912], [-0.47602620905811044, 0.81525173294213982, 0.023145745277130203, 0.5818744103097242], [-0.26074066195347489, 0.62737248392572886, 0.24246935026650718, 0.86155298917514145]], [[0.40180649524587109, -0.13468267908829512, -0.66576279256576543, -0.97664336021962694], [-0.81183732113700424, -0.10477655696019839, -0.90212494842448732, 0.50784279020015499], [0.29352929816605089, 0.10640245030222295, -0.16640870997460122, 0.91371366707232826]]]])+(1.-msk)*numarray.array([[[[0.6465819200939884, 0.21755363919340609, 0.73973535907059662, -0.36114669719855241], [0.16087051863228452, -0.96295075570141986, 0.93283344105282717, 0.8498346294196879], [-0.62871563035312805, 0.028501977366871101, -0.76183996578150004, -0.42396762024023338]], [[0.45139869884828876, 0.9085099092003921, 0.90516675545818392, -0.2797423591331305], [-0.012176715080714828, 0.40935600076669765, -0.010156279663344314, -0.45527372677880185], [-0.56697253731600106, -0.88076957837377901, -0.43708368779823448, -0.98115855535334329]]], [[[-0.6812131434679467, -0.75007359636996074, 0.52195871968240559, 0.74207747673309732], [0.53576769134014213, -0.19432873205999046, -0.87970756195132904, -0.36970944422105911], [0.18377651984390431, -0.30093639418244189, 0.30640551056952825, -0.95779743159891284]], [[0.3069655071293016, 0.42532244942656305, 0.27182877898608804, 0.89926151593228765], [-0.94227360921249192, 0.17309985459832045, -0.067341615594060267, -0.24017528169767255], [0.72377020653147883, -0.60287365881872312, 0.17612550848074338, -0.89499327987049915]]], [[[-0.8985020338092089, -0.27805317471704494, -0.096352572725887375, 0.26107376060313836], [-0.98264038134460852, -0.40101944215897967, 0.80787105663414827, -0.91046803072373206], [-0.11056024039811629, -0.35146855329949345, 0.62639019941990948, 0.029258586953160748]], [[0.5190564210634494, 0.25178673168519605, -0.095466912631134937, -0.66223610619416462], [0.86572944270431917, -0.0070686656495086986, -0.56404011740509774, 0.5156978630437381], [0.15106963134402651, 0.12900511640038159, 0.6022471822104567, 0.48643914768022012]]]]) | ||
# arg=Data(numarray.array([[[[0.4996033665120716, -0.074132654028136846, 0.2908837888281397, 0.79804117547820219], [0.25334186456470942, -0.10892196087517791, 0.90411872189757747, -0.21372334914190327], [0.65549677694560438, 0.97979738684954532, -0.29737844854710138, 0.93659843329597914]], [[0.22668444631484608, -0.92481913749465305, -0.9980815386745403, -0.022502768980955601], [-0.21769755240946398, 0.77216348666766876, -0.19843685166706204, 0.54270333879579558], [-0.11274856721131221, -0.29600869223659299, 0.1458222910080329, -0.83739782177046851]]], [[[0.86722932032155531, 0.39888432468517876, -0.8991679849590255, -0.088621935923834272], [-0.58464076321585412, -0.09564380294323116, 0.18232602464536307, 0.7910046931530843], [0.15923450234841652, -0.39331159996226872, 0.18298541750645669, 0.99889484861795563]], [[0.36793558813747418, -0.64593764280975363, 0.048503028175158613, -0.8304805399530264], [0.072019074767407432, -0.066883567381289311, -0.55849542620276127, -0.32521841292447484], [0.83256632210175896, -0.52124955617445723, -0.0047287521832242163, 0.84184001532121422]]], [[[-0.81375499823702158, 0.12901434959756353, -0.51500727423485215, 0.52626362435118912], [-0.47602620905811044, 0.81525173294213982, 0.023145745277130203, 0.5818744103097242], [-0.26074066195347489, 0.62737248392572886, 0.24246935026650718, 0.86155298917514145]], [[0.40180649524587109, -0.13468267908829512, -0.66576279256576543, -0.97664336021962694], [-0.81183732113700424, -0.10477655696019839, -0.90212494842448732, 0.50784279020015499], [0.29352929816605089, 0.10640245030222295, -0.16640870997460122, 0.91371366707232826]]]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[[[0.6465819200939884, 0.21755363919340609, 0.73973535907059662, -0.36114669719855241], [0.16087051863228452, -0.96295075570141986, 0.93283344105282717, 0.8498346294196879], [-0.62871563035312805, 0.028501977366871101, -0.76183996578150004, -0.42396762024023338]], [[0.45139869884828876, 0.9085099092003921, 0.90516675545818392, -0.2797423591331305], [-0.012176715080714828, 0.40935600076669765, -0.010156279663344314, -0.45527372677880185], [-0.56697253731600106, -0.88076957837377901, -0.43708368779823448, -0.98115855535334329]]], [[[-0.6812131434679467, -0.75007359636996074, 0.52195871968240559, 0.74207747673309732], [0.53576769134014213, -0.19432873205999046, -0.87970756195132904, -0.36970944422105911], [0.18377651984390431, -0.30093639418244189, 0.30640551056952825, -0.95779743159891284]], [[0.3069655071293016, 0.42532244942656305, 0.27182877898608804, 0.89926151593228765], [-0.94227360921249192, 0.17309985459832045, -0.067341615594060267, -0.24017528169767255], [0.72377020653147883, -0.60287365881872312, 0.17612550848074338, -0.89499327987049915]]], [[[-0.8985020338092089, -0.27805317471704494, -0.096352572725887375, 0.26107376060313836], [-0.98264038134460852, -0.40101944215897967, 0.80787105663414827, -0.91046803072373206], [-0.11056024039811629, -0.35146855329949345, 0.62639019941990948, 0.029258586953160748]], [[0.5190564210634494, 0.25178673168519605, -0.095466912631134937, -0.66223610619416462], [0.86572944270431917, -0.0070686656495086986, -0.56404011740509774, 0.5156978630437381], [0.15106963134402651, 0.12900511640038159, 0.6022471822104567, 0.48643914768022012]]]]) | ||
res=Lsup(arg) | ||
ref=0.998894848618 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_float_rank0(self): | ||
arg=0.870743835413 | ||
ref=0.870743835413 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_array_rank0(self): | ||
arg=0.469212543992 | ||
ref=0.469212543992 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_array_rank1(self): | ||
arg=numarray.array([0.8163530200305178, 0.7844191729334391]) | ||
ref=0.816353020031 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_array_rank2(self): | ||
arg=numarray.array([[-0.52338785100595131, 0.72523140545134046, -0.23883623210726745, 0.29329903553233394, 0.77300897701720128], [0.56646202903477705, -0.67833617682539948, 0.71280801753916911, 0.108973189514324, -0.86675353843929437], [0.37080584846118247, 0.61817009100957776, -0.20780655998890807, 0.085315295987765438, -0.73527023026482174], [-0.97586476277122935, 0.14501540684207481, 0.57375473938632338, 0.08516777342367865, -0.22644451314946301]]) | ||
ref=0.773008977017 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_array_rank3(self): | ||
arg=numarray.array([[[0.16933183602716984, -0.42964457496769226], [-0.63714228263554573, -0.28513481547494179]], [[0.72479530443714335, -0.097501515360919111], [-0.28611653510816737, -0.58370472731498535]], [[-0.18432738416022554, 0.79010596522300558], [-0.65367387441910196, 0.90861652898349976]], [[0.56004415223670123, 0.20178156913861489], [0.90730594499457595, 0.91196305151516754]], [[-0.46179421349599847, -0.54555869532019163], [0.36014998847058499, -0.70585188726413306]], [[0.49988705904335418, -0.52181171665742077], [0.14475259007357621, -0.94336078709637383]]]) | ||
ref=0.911963051515 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_array_rank4(self): | ||
arg=numarray.array([[[[0.085213773984220698, -0.9837351364458633, -0.23428780807935823, -0.54350985593703971], [-0.021654619752513593, -0.58267295960777465, -0.95135334805945893, -0.82172163939108089], [0.92970460708060565, 0.12721615089598348, 0.36243089042630872, 0.50434042290503855]], [[0.20617957875725845, 0.13657289785878368, 0.7942986246389756, -0.92641374730818571], [0.30431241116181762, -0.13563881945622858, 0.37921852742514695, -0.39275408991812211], [-0.016546769015328033, 0.50932041928102878, -0.27343457607173893, -0.0076289641375255624]]], [[[0.97189015970083137, -0.71286035174080009, 0.10143028964095313, -0.41856292303563181], [-0.97563458262665792, 0.79724078659701769, -0.70932749973904685, 0.018497784992804522], [-0.86374122662275021, 0.047715471334789816, -0.95453593058418518, 0.54562170290354794]], [[0.40249406070198157, -0.54609432046574469, -0.22682900899629166, 0.98394939138178539], [0.11049172557176901, 0.42172241721325388, 0.71050000578192951, 0.35353993854713206], [0.35412886303451896, -0.98169699399727617, 0.04758881049644037, 0.96971205948237493]]], [[[0.44672925866052249, -0.51476498049696828, 0.56442823935318875, -0.39769248164928039], [-0.40340965812893304, -0.87947712857546945, 0.55927022788356706, -0.89941016574892707], [-0.43878304559423431, 0.20915357555548764, -0.76548553334601799, -0.67202522557876954]], [[-0.56749721271516318, -0.10244683680777245, 0.17727779142251943, -0.57219284260940473], [-0.17044718853145446, 0.91117482665936023, -0.30039592703806584, -0.73813808369358713], [0.63771084365736663, -0.61427668096170129, 0.34365587989446378, -0.11877233448104674]]]]) | ||
ref=0.983949391382 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_constData_rank0(self): | ||
arg=Data(0.165371505685,self.functionspace) | ||
ref=0.165371505685 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_constData_rank1(self): | ||
arg=Data(numarray.array([-0.89603386749185288, -0.68712608295212729]),self.functionspace) | ||
ref=-0.687126082952 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_constData_rank2(self): | ||
arg=Data(numarray.array([[0.60272743728014655, 0.26067131689446787, -0.48488892003697837, -0.54328378217335027, -0.96627165443113894], [0.38861396631681999, -0.14210447298121753, -0.84480805358330624, -0.25397651427390566, 0.25670041011662192], [-0.062982523786134337, -0.149708363807598, -0.63332360725934489, -0.49175302564011525, -0.97647588301352473], [0.52022334705669038, -0.69717039787412727, -0.28284586409251511, 0.99642563937215467, -0.67058148736338885]]),self.functionspace) | ||
ref=0.996425639372 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_constData_rank3(self): | ||
arg=Data(numarray.array([[[-0.98552936119306023, -0.58995212270861552], [0.51743177430155907, 0.68576837981065508]], [[-0.61618414432919089, -0.12325580790677049], [0.32387395300714172, -0.95456083598524333]], [[0.89779642579517049, 0.98676270760314266], [0.71959629907181966, -0.9949078223284622]], [[-0.81547040114414271, 0.10033634427970006], [-0.21591232734408217, -0.68608679705274822]], [[0.30423138886571999, 0.34122142527426802], [-0.4344532377066066, -0.31076903154305779]], [[-0.46111628105416602, -0.18371998359850483], [0.63606993796228117, -0.10703087143670587]]]),self.functionspace) | ||
ref=0.986762707603 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_constData_rank4(self): | ||
arg=Data(numarray.array([[[[0.89488524023952776, 0.8669396968091807, -0.45769331537553315, -0.89738195395075349], [0.39077366764066168, -0.71075932241646922, -0.51096889323130612, 0.87130290122807663], [0.17079807940685177, -0.6198922248677714, -0.41261700237404653, -0.30627765803812368]], [[-0.0659839868001868, -0.54367942190111385, 0.79254440140135607, -0.28895269724305006], [0.2554732744127961, -0.0076696085190677277, 0.6846601760873452, 0.38696598742090393], [-0.77125424651939789, 0.63909999575689591, -0.87840142433528379, 0.41711809974302594]]], [[[-0.99322035791310692, 0.27097830567855352, -0.4253855401144222, 0.15768186455727529], [-0.49181115516922302, -0.36126829134959304, 0.52357599944776667, 0.91209852597809005], [0.069076441159411361, -0.18292686281510551, -0.6497679800515983, 0.022610374934600719]], [[0.28755759348156507, -0.08281906224050295, 0.76036900801429907, 0.54802231074240826], [-0.033682724326368874, -0.7414032372095134, -0.86699767465780231, 0.40592904057808044], [0.51593363738292841, -0.72087130860034332, 0.35672334112134374, -0.090721746979026463]]], [[[-0.54866684145444511, -0.96738751715836968, -0.21201752332220436, -0.099425492405464277], [-0.76528700517307313, -0.85955622688708644, -0.10492266626403257, 0.69311319310724762], [-0.33886276086664902, -0.6846128323156393, 0.05873264876508566, 0.88498228323799433]], [[-0.28404277561384639, -0.63570388064518468, -0.67775264818658387, 0.20825454125346576], [-0.84788984114351473, 0.037932422136330635, 0.021981819447397299, -0.2709264612684219], [-0.64072476278735468, 0.46126191894728197, -0.37456096950035489, 0.85599593427453957]]]]),self.functionspace) | ||
ref=0.912098525978 | ||
res=sup(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_expandedData_rank0(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*0.842459260157+(1.-msk)*0.985691469761 | ||
# arg=Data(0.842459260157,self.functionspace,True) | ||
# arg.setTaggedValue(1,0.842459260157) | ||
res=sup(arg) | ||
ref=0.985691469761 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_expandedData_rank1(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([0.47024430020620023, -0.40410868427962021])+(1.-msk)*numarray.array([0.34568516056640197, -0.43342673126146103]) | ||
# arg=Data(numarray.array([0.47024430020620023, -0.40410868427962021]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[0.34568516056640197, -0.43342673126146103]) | ||
res=sup(arg) | ||
ref=0.470244300206 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_expandedData_rank2(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[-0.88351146515427814, 0.87526615684362929, 0.80242059303502922, -0.6048006248682789, 0.42108402102305953], [0.11385226207304888, -0.66232044805160473, 0.69874162972474063, 0.22449470583280284, -0.19986159203927545], [0.17102700533232951, -0.9790459454968905, 0.4374092200111821, -0.4343902463997138, 0.72993175063985705], [-0.42636794385375065, -0.88420160799308434, -0.073357336228458081, -0.96071213693656698, -0.28591564459422769]])+(1.-msk)*numarray.array([[-0.66507554751323883, 0.90956185314332916, 0.39373039994051529, 0.20185922272970869, 0.56272045770025914], [-0.81603670050480082, -0.98308666677421708, 0.081972418155825233, 0.98933334281872432, -0.67280110519862579], [-0.67384516784043069, 0.19168471924963759, -0.59938113619504896, 0.22266455997006829, -0.93324865777959265], [0.93134589933544842, -0.10311385886401503, -0.2331509870020978, 0.37315747180467018, 0.73551730577813057]]) | ||
# arg=Data(numarray.array([[-0.88351146515427814, 0.87526615684362929, 0.80242059303502922, -0.6048006248682789, 0.42108402102305953], [0.11385226207304888, -0.66232044805160473, 0.69874162972474063, 0.22449470583280284, -0.19986159203927545], [0.17102700533232951, -0.9790459454968905, 0.4374092200111821, -0.4343902463997138, 0.72993175063985705], [-0.42636794385375065, -0.88420160799308434, -0.073357336228458081, -0.96071213693656698, -0.28591564459422769]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[-0.66507554751323883, 0.90956185314332916, 0.39373039994051529, 0.20185922272970869, 0.56272045770025914], [-0.81603670050480082, -0.98308666677421708, 0.081972418155825233, 0.98933334281872432, -0.67280110519862579], [-0.67384516784043069, 0.19168471924963759, -0.59938113619504896, 0.22266455997006829, -0.93324865777959265], [0.93134589933544842, -0.10311385886401503, -0.2331509870020978, 0.37315747180467018, 0.73551730577813057]]) | ||
res=sup(arg) | ||
ref=0.989333342819 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_expandedData_rank3(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[[-0.69867440642271283, -0.37489565319806606], [-0.66485463581725601, 0.18238313710104448]], [[-0.78388494323459157, 0.24027472943325923], [-0.4377158808146262, -0.34262284842949864]], [[-0.8539094490313166, 0.62109328106735684], [-0.20715549218162899, -0.33320905765908693]], [[-0.25702886172082651, 0.94651536183641283], [-0.2229696935051404, 0.84771132395539794]], [[0.52244706935442076, -0.89344888833386804], [0.064322796922618108, 0.36966382541443532]], [[0.55710175300577691, -0.22780561634551688], [0.89548548132750594, -0.77561238906399077]]])+(1.-msk)*numarray.array([[[-0.86933240372621312, 0.32078825553642276], [0.36873095289245739, 0.20578150283627239]], [[-0.13143164944725427, 0.89920065296927199], [0.79295913398164197, 0.78838875458878954]], [[0.068510791358111334, 0.87754319283313054], [-0.96880448620091553, -0.012058603734139028]], [[0.44680342907934811, -0.52293412412648466], [0.51117158355443149, -0.6794979840301234]], [[0.55644022070667498, 0.082838767459920026], [-0.64861425420762142, -0.20781169747814943]], [[0.52302454039265078, -0.71078210239352546], [0.67348959224612859, 0.18668184392186915]]]) | ||
# arg=Data(numarray.array([[[-0.69867440642271283, -0.37489565319806606], [-0.66485463581725601, 0.18238313710104448]], [[-0.78388494323459157, 0.24027472943325923], [-0.4377158808146262, -0.34262284842949864]], [[-0.8539094490313166, 0.62109328106735684], [-0.20715549218162899, -0.33320905765908693]], [[-0.25702886172082651, 0.94651536183641283], [-0.2229696935051404, 0.84771132395539794]], [[0.52244706935442076, -0.89344888833386804], [0.064322796922618108, 0.36966382541443532]], [[0.55710175300577691, -0.22780561634551688], [0.89548548132750594, -0.77561238906399077]]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[[-0.86933240372621312, 0.32078825553642276], [0.36873095289245739, 0.20578150283627239]], [[-0.13143164944725427, 0.89920065296927199], [0.79295913398164197, 0.78838875458878954]], [[0.068510791358111334, 0.87754319283313054], [-0.96880448620091553, -0.012058603734139028]], [[0.44680342907934811, -0.52293412412648466], [0.51117158355443149, -0.6794979840301234]], [[0.55644022070667498, 0.082838767459920026], [-0.64861425420762142, -0.20781169747814943]], [[0.52302454039265078, -0.71078210239352546], [0.67348959224612859, 0.18668184392186915]]]) | ||
res=sup(arg) | ||
ref=0.946515361836 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_sup_expandedData_rank4(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[[[-0.97992610933200397, -0.25896245628971326, -0.70483438344031946, -0.99381143197943023], [-0.94915117581748709, -0.41900816047650036, -0.73354223723879386, 0.75059333884969881], [-0.76848095939834238, -0.75674819943701244, 0.065477641668864495, -0.42345850130975426]], [[-0.86758200423510234, -0.91179084363212071, -0.95127824910458103, 0.44686792515820439], [0.24843166983163689, -0.78829756520109728, -0.29421842880871774, 0.081312723661290498], [-0.73676127398786795, 0.91442315487631975, -0.64075473615377643, -0.68228346762450576]]], [[[-0.52913624371899504, 0.18611492696208209, 0.87647965087074042, 0.81733477764270401], [-0.45994626037000352, -0.72068350777641998, -0.67722337882139305, 0.53688427407036721], [-0.62155086776441348, -0.16407031198819877, 0.27545162813408264, 0.82180316351563087]], [[0.86221555518143278, -0.038942303505028031, 0.99073092777336114, -0.59207542384567113], [-0.42324210154238218, 0.76649013040311842, 0.86242470461616949, 0.49956796372115009], [-0.3983839684487791, 0.50100130531149967, -0.61285700166494195, -0.77581662400471862]]], [[[0.393847951204221, -0.72453857578029801, 0.97194727576353768, -0.95039782864739597], [-0.33546269250215266, 0.4831646699512071, -0.36084136685304102, -0.21835205500655297], [-0.82932637046105562, 0.70351683765540218, -0.058619290451321637, -0.2054802590132303]], [[0.94447147902776929, -0.42312399627562503, -0.11683182283655591, -0.40970199303413191], [-0.057628087834810326, -0.92418858637343759, 0.17632737701884516, -0.45930384359491305], [-0.47612419752878798, -0.96256404924809247, 0.10415265869578216, -0.63202348546194909]]]])+(1.-msk)*numarray.array([[[[-0.97434762405813102, 0.7014239623245393, 0.62448079624150288, -0.37769806924712546], [-0.85193729675303742, -0.77375392434251022, 0.36142120851055592, 0.26580596564769365], [-0.87276378893603579, 0.38973819311591718, 0.98354255063199636, -0.66795317131402343]], [[0.90231744676982428, -0.27585106370360957, -0.32108129691288001, 0.60440834831736634], [-0.045905880902579188, -0.29199624499256793, 0.025945636614535861, -0.098321374439206854], [-0.56344512008582659, -0.3766256629210043, -0.16641839175601203, -0.47355537095296341]]], [[[-0.98963277387073156, -0.84954014836916003, 0.58413699452656576, -0.90574771672091781], [-0.076165236495137068, -0.33185579541568311, 0.71508582816996036, 0.092982625872773284], [-0.59803076383019627, 0.96534061564337792, -0.86101074809006883, 0.4514321077629706]], [[0.68169942993010979, -0.46839019201575827, 0.86748862862295062, 0.077239140299438347], [-0.41039932807903745, 0.77351932859252215, -0.91858786520587499, -0.83803209999478323], [-0.66149540952220676, 0.21690925014134543, 0.49329666114093262, 0.22750525795569843]]], [[[0.49476796496001074, 0.54374663478072427, -0.64963120626875592, 0.57704965092442939], [0.74520801893525035, -0.18704889796101698, -0.73119506283113278, 0.30233417986347821], [-0.40842036405150561, -0.58450470869605797, 0.084020496164487923, -0.58538663622202569]], [[0.75611417989143481, -0.52196566347687212, 0.47144797786301607, -0.99505702762998172], [-0.0043333507755138889, -0.8740422871734248, 0.69683145050592943, -0.015830354510735223], [-0.047302931197539255, -0.033238606395723957, -0.95126827803180114, 0.88954001433619978]]]]) | ||
# arg=Data(numarray.array([[[[-0.97992610933200397, -0.25896245628971326, -0.70483438344031946, -0.99381143197943023], [-0.94915117581748709, -0.41900816047650036, -0.73354223723879386, 0.75059333884969881], [-0.76848095939834238, -0.75674819943701244, 0.065477641668864495, -0.42345850130975426]], [[-0.86758200423510234, -0.91179084363212071, -0.95127824910458103, 0.44686792515820439], [0.24843166983163689, -0.78829756520109728, -0.29421842880871774, 0.081312723661290498], [-0.73676127398786795, 0.91442315487631975, -0.64075473615377643, -0.68228346762450576]]], [[[-0.52913624371899504, 0.18611492696208209, 0.87647965087074042, 0.81733477764270401], [-0.45994626037000352, -0.72068350777641998, -0.67722337882139305, 0.53688427407036721], [-0.62155086776441348, -0.16407031198819877, 0.27545162813408264, 0.82180316351563087]], [[0.86221555518143278, -0.038942303505028031, 0.99073092777336114, -0.59207542384567113], [-0.42324210154238218, 0.76649013040311842, 0.86242470461616949, 0.49956796372115009], [-0.3983839684487791, 0.50100130531149967, -0.61285700166494195, -0.77581662400471862]]], [[[0.393847951204221, -0.72453857578029801, 0.97194727576353768, -0.95039782864739597], [-0.33546269250215266, 0.4831646699512071, -0.36084136685304102, -0.21835205500655297], [-0.82932637046105562, 0.70351683765540218, -0.058619290451321637, -0.2054802590132303]], [[0.94447147902776929, -0.42312399627562503, -0.11683182283655591, -0.40970199303413191], [-0.057628087834810326, -0.92418858637343759, 0.17632737701884516, -0.45930384359491305], [-0.47612419752878798, -0.96256404924809247, 0.10415265869578216, -0.63202348546194909]]]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[[[-0.97434762405813102, 0.7014239623245393, 0.62448079624150288, -0.37769806924712546], [-0.85193729675303742, -0.77375392434251022, 0.36142120851055592, 0.26580596564769365], [-0.87276378893603579, 0.38973819311591718, 0.98354255063199636, -0.66795317131402343]], [[0.90231744676982428, -0.27585106370360957, -0.32108129691288001, 0.60440834831736634], [-0.045905880902579188, -0.29199624499256793, 0.025945636614535861, -0.098321374439206854], [-0.56344512008582659, -0.3766256629210043, -0.16641839175601203, -0.47355537095296341]]], [[[-0.98963277387073156, -0.84954014836916003, 0.58413699452656576, -0.90574771672091781], [-0.076165236495137068, -0.33185579541568311, 0.71508582816996036, 0.092982625872773284], [-0.59803076383019627, 0.96534061564337792, -0.86101074809006883, 0.4514321077629706]], [[0.68169942993010979, -0.46839019201575827, 0.86748862862295062, 0.077239140299438347], [-0.41039932807903745, 0.77351932859252215, -0.91858786520587499, -0.83803209999478323], [-0.66149540952220676, 0.21690925014134543, 0.49329666114093262, 0.22750525795569843]]], [[[0.49476796496001074, 0.54374663478072427, -0.64963120626875592, 0.57704965092442939], [0.74520801893525035, -0.18704889796101698, -0.73119506283113278, 0.30233417986347821], [-0.40842036405150561, -0.58450470869605797, 0.084020496164487923, -0.58538663622202569]], [[0.75611417989143481, -0.52196566347687212, 0.47144797786301607, -0.99505702762998172], [-0.0043333507755138889, -0.8740422871734248, 0.69683145050592943, -0.015830354510735223], [-0.047302931197539255, -0.033238606395723957, -0.95126827803180114, 0.88954001433619978]]]]) | ||
res=sup(arg) | ||
ref=0.990730927773 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_float_rank0(self): | ||
arg=0.857535693433 | ||
ref=0.857535693433 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_array_rank0(self): | ||
arg=0.170725403135 | ||
ref=0.170725403135 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_array_rank1(self): | ||
arg=numarray.array([-0.20582799927627726, 0.0065475369467946631]) | ||
ref=-0.205827999276 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_array_rank2(self): | ||
arg=numarray.array([[-0.00088705991533410966, -0.78884753663192009, 0.51871980588812661, -0.58204851803513313, 0.14241101940826861], [0.79094574969805964, 0.79672216617995617, -0.5690477768894624, 0.51157272654417052, 0.18066938665191556], [0.32364745994353683, 0.4748425103497671, 0.66679519455306924, -0.69644515487912217, -0.37494171775165297], [-0.18679695095262239, -0.78312977298360509, 0.044885312146701661, -0.44016241609550066, -0.49756845096624081]]) | ||
ref=-0.788847536632 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_array_rank3(self): | ||
arg=numarray.array([[[-0.8081125483464171, -0.39512178653285135], [-0.88509761616456495, 0.27821695074525521]], [[-0.12065704909614361, 0.68332883926843135], [0.3403814721074454, -0.32879966956330042]], [[-0.7045229028656752, -0.1577338131736914], [-0.5966034105188045, 0.73456332700634985]], [[0.87843639147943997, 0.94490362642776882], [-0.45552277927474183, -0.9768135246661469]], [[-0.65451540143458864, -0.2796668209543185], [-0.085396852552783953, 0.83466766003117332]], [[0.43465138886082078, 0.61441480296663342], [0.92555078046558337, -0.24612584648713121]]]) | ||
ref=-0.976813524666 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_array_rank4(self): | ||
arg=numarray.array([[[[-0.05536021838962446, -0.0098764348632232046, -0.52953548051740618, 0.58523070076080819], [0.10613609818504877, 0.67324697282212087, 0.54615663777618906, -0.67572666188479613], [-0.14390410848091539, 0.54011444546397591, -0.85609073171970373, 0.077099187121419277]], [[-0.20493469025659716, 0.90647730634569368, -0.71749107354722064, -0.12332697315517271], [0.63551267588618598, -0.60802528409862266, 0.052319255834022638, -0.95394697709081688], [-0.88612629669117959, 0.32248454322667519, 0.0072741938614420132, -0.69013368898879235]]], [[[-0.10462047858216028, -0.30097012474135698, -0.050016775782701028, 0.54822125876578376], [0.84395749034726886, -0.53249513893193168, -0.88004100855031275, -0.80779542570577179], [-0.79677629667791683, 0.95096027764472169, 0.63643207567783144, 0.97757008271555401]], [[-0.65415697736192047, -0.97050764835238645, -0.84814693021942777, -0.43855897064286542], [-0.37135308255264543, 0.041120751125186095, 0.036995657114785807, -0.35706630152349828], [-0.0030591331649565401, 0.48192500000712779, 0.18102011879743984, -0.78573775232009435]]], [[[-0.31965876602783605, 0.10351748464331689, 0.067424791069963907, -0.049524027182576535], [-0.5213817364489115, 0.027521683153738818, -0.24734661576641237, 0.24321699964875232], [-0.83947613904690699, 0.77162806253216987, -0.90740945316368071, -0.3420545897410685]], [[0.91845344502663262, -0.70878381509801414, 0.90861837177726379, -0.4013061463136427], [-0.18540388033546473, 0.9254510240675875, 0.30634230347058677, -0.97817133509804033], [-0.43975591131244984, 0.30020642565479139, 0.36841633323637479, 0.3066739733421715]]]]) | ||
ref=-0.978171335098 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_constData_rank0(self): | ||
arg=Data(0.0114629834279,self.functionspace) | ||
ref=0.0114629834279 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_constData_rank1(self): | ||
arg=Data(numarray.array([-0.13734485813185704, -0.54812466656634307]),self.functionspace) | ||
ref=-0.548124666566 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_constData_rank2(self): | ||
arg=Data(numarray.array([[-0.89509582806410015, 0.10780316690435621, -0.93073500763754335, -0.38534759506991545, -0.6935160645644014], [-0.056672310128515813, 0.6285075027787359, 0.73632355512072167, -0.60238897825476267, 0.77403597203864094], [-0.5930215600641755, 0.72623233579382429, -0.32117191475695361, -0.081104170523293773, 0.62137628665436373], [0.2669734570396014, -0.65030905665614136, -0.53589374176691495, -0.48334830355881309, -0.89125004784938211]]),self.functionspace) | ||
ref=-0.930735007638 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_constData_rank3(self): | ||
arg=Data(numarray.array([[[0.94493948950092999, 0.13737629155757691], [-0.81599535906086107, -0.35832278646984816]], [[-0.53692839435234041, 0.53679590218669571], [0.038856705021854232, -0.18543838436402926]], [[0.19718168292863836, -0.55405958298613656], [0.16477861536800242, 0.17787953041277582]], [[0.51547288009005165, 0.35889372726595203], [-0.033476505587150873, -0.42142418570614026]], [[0.80507204877418204, -0.79581688922832838], [-0.85909254497735588, 0.66095083521227149]], [[0.46206420953978222, 0.53654696439305005], [0.57618105395776831, -0.22241758047110038]]]),self.functionspace) | ||
ref=-0.859092544977 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_constData_rank4(self): | ||
arg=Data(numarray.array([[[[0.50544713768476202, 0.96922321849050874, -0.81524480218696649, -0.36499730379849193], [-0.48131882706974372, 0.026812357207576465, 0.090903267401989618, -0.24742363369877829], [-0.51631372893805438, 0.30410275437953183, -0.75149566289642533, -0.19930300338453599]], [[0.82034878499482788, -0.70904661587698792, -0.27637223434426073, -0.34818734117560401], [0.11686048779802416, -0.76746266142163178, -0.75578186306174833, 0.14509316330390232], [0.1590050723141736, 0.69684384552537937, -0.58747105640080832, -0.28640840371441523]]], [[[0.14956532194045669, 0.081514192262221119, 0.32061383569406399, -0.2444346881437609], [0.79564139071785278, -0.5456680167461434, 0.24722978802719742, 0.28286130725068315], [0.10385207763921711, -0.064749181840278336, 0.21325254547672734, -0.71875644540473838]], [[0.58552496009870802, 0.35472373485671338, -0.18411162994671826, 0.71609038134967773], [-0.20966804574945064, -0.49286619989346314, 0.85116051808632553, -0.94417114370961075], [-0.40434528979823714, 0.62250343758157611, 0.64860074098639742, 0.0043146814280992096]]], [[[-0.14242849200713259, 0.42551908502898095, 0.7691157770973962, -0.37595641162856674], [0.026655444032149589, -0.82186407521644167, 0.40285091480648783, -0.53328831035315982], [-0.12887729257054481, 0.75610663428133451, 0.022049613835531723, 0.59949338706293043]], [[-0.34506254315071772, 0.019719877473602043, 0.10216765908478709, 0.022681548062032153], [0.2228614880408597, 0.26944547311401901, -0.10122095357202965, -0.51019076850180589], [-0.081439546799124463, 0.18829632566943544, 0.12366885442775377, 0.73651436499107814]]]]),self.functionspace) | ||
ref=-0.94417114371 | ||
res=inf(arg) | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_expandedData_rank0(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*0.97331285569+(1.-msk)*0.911344578019 | ||
# arg=Data(0.97331285569,self.functionspace,True) | ||
#arg.setTaggedValue(1,0.97331285569) | ||
res=inf(arg) | ||
ref=0.911344578019 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_expandedData_rank1(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([-0.025782649803792301, 0.15017595667012174])+(1.-msk)*numarray.array([-0.69996944983865683, 0.23286168827412723]) | ||
# arg=Data(numarray.array([-0.025782649803792301, 0.15017595667012174]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[-0.69996944983865683, 0.23286168827412723]) | ||
res=inf(arg) | ||
ref=-0.699969449839 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_expandedData_rank2(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[-0.11924617230337731, -0.69281409701569552, 0.8819805848672797, 0.67606672557817737, -0.15719846909292801], [-0.91958498979699277, 0.35156143886023572, -0.66768679685578647, -0.48673444352737993, -0.33274286155542288], [-0.011930486621410052, -0.035661622752792166, 0.8109198510155371, 0.2680383999767102, 0.38679270088753159], [-0.64107995512896321, 0.58836944145799008, -0.55856121453754959, 0.63346354980998365, -0.74990799644898765]])+(1.-msk)*numarray.array([[0.075603512293304975, 0.65374459813382813, -0.68190855977115938, 0.023184369691352069, -0.15500904033575869], [-0.28865053906142646, 0.94679590620919218, -0.53701383780009748, -0.5413294941411595, -0.1693286769782183], [-0.34870739946353968, -0.92230175409787241, -0.95867600429924127, -0.0012605712136730673, 0.33180267589091184], [-0.60152160703395885, 0.3397221706065463, 0.58860878406913142, 0.59589494790106934, -0.96157487116725071]]) | ||
# arg=Data(numarray.array([[-0.11924617230337731, -0.69281409701569552, 0.8819805848672797, 0.67606672557817737, -0.15719846909292801], [-0.91958498979699277, 0.35156143886023572, -0.66768679685578647, -0.48673444352737993, -0.33274286155542288], [-0.011930486621410052, -0.035661622752792166, 0.8109198510155371, 0.2680383999767102, 0.38679270088753159], [-0.64107995512896321, 0.58836944145799008, -0.55856121453754959, 0.63346354980998365, -0.74990799644898765]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[0.075603512293304975, 0.65374459813382813, -0.68190855977115938, 0.023184369691352069, -0.15500904033575869], [-0.28865053906142646, 0.94679590620919218, -0.53701383780009748, -0.5413294941411595, -0.1693286769782183], [-0.34870739946353968, -0.92230175409787241, -0.95867600429924127, -0.0012605712136730673, 0.33180267589091184], [-0.60152160703395885, 0.3397221706065463, 0.58860878406913142, 0.59589494790106934, -0.96157487116725071]]) | ||
res=inf(arg) | ||
ref=-0.961574871167 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_expandedData_rank3(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[[0.76729109013175933, 0.93446692332588199], [-0.85883010569426133, 0.94426468618035608]], [[0.93376991286356659, -0.31027020688815887], [0.68776369494826284, -0.71422083083074273]], [[0.88895851954297633, -0.0041028262794304826], [-0.56213269421968981, -0.53305350433881493]], [[0.91080353792869873, 0.87460732654624618], [-0.43411934331432445, -0.66454826732696648]], [[-0.7458989571542316, 0.0054889915153857327], [-0.43786572648758848, 0.45559010284736901]], [[0.97274627384999923, 0.28719064869132427], [-0.068944574283213989, 0.92462015394940389]]])+(1.-msk)*numarray.array([[[0.45653716082021401, -0.23702471933521396], [-0.45177153258555913, -0.41351543065221219]], [[0.24913453932538854, -0.29954039408048372], [0.47106013214852771, -0.86663080347446608]], [[-0.75781905181266151, 0.18918623668675538], [-0.66636479853389385, 0.74776214919244066]], [[-0.1199599974824086, 0.90306995612278795], [0.77248429149482201, 0.094536885699270545]], [[-0.5505821492977705, -0.42454185319972981], [-0.035064708067998662, -0.75303714911308206]], [[-0.63966405281134198, -0.5545794126646626], [-0.010523374154368881, -0.6779302443539712]]]) | ||
# arg=Data(numarray.array([[[0.76729109013175933, 0.93446692332588199], [-0.85883010569426133, 0.94426468618035608]], [[0.93376991286356659, -0.31027020688815887], [0.68776369494826284, -0.71422083083074273]], [[0.88895851954297633, -0.0041028262794304826], [-0.56213269421968981, -0.53305350433881493]], [[0.91080353792869873, 0.87460732654624618], [-0.43411934331432445, -0.66454826732696648]], [[-0.7458989571542316, 0.0054889915153857327], [-0.43786572648758848, 0.45559010284736901]], [[0.97274627384999923, 0.28719064869132427], [-0.068944574283213989, 0.92462015394940389]]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[[0.45653716082021401, -0.23702471933521396], [-0.45177153258555913, -0.41351543065221219]], [[0.24913453932538854, -0.29954039408048372], [0.47106013214852771, -0.86663080347446608]], [[-0.75781905181266151, 0.18918623668675538], [-0.66636479853389385, 0.74776214919244066]], [[-0.1199599974824086, 0.90306995612278795], [0.77248429149482201, 0.094536885699270545]], [[-0.5505821492977705, -0.42454185319972981], [-0.035064708067998662, -0.75303714911308206]], [[-0.63966405281134198, -0.5545794126646626], [-0.010523374154368881, -0.6779302443539712]]]) | ||
res=inf(arg) | ||
ref=-0.866630803474 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
def test_inf_expandedData_rank4(self): | ||
msk=whereNegative(self.functionspace.getX()[0]-0.5) | ||
arg=msk*numarray.array([[[[0.59301561766072242, 0.6053289847447505, 0.1720524601196014, 0.4833679091408507], [-0.09424534157102582, 0.91976800441974427, -0.11950945037648264, -0.10547294628619919], [0.045302052907340462, -0.26699801365763864, -0.59100789693502542, 0.8220898248447317]], [[-0.71764117646989489, -0.31097048109028447, -0.36880919201656037, -0.12380648590370025], [0.71171672214402615, -0.87716399369053821, 0.53673002158727501, -0.29732656272582969], [-0.71737153055394787, -0.18861795164190798, -0.55325559014387649, 0.50828072891961451]]], [[[0.7139879661021804, -0.54655602578694507, -0.62738810494945163, -0.71453639471562314], [0.25287437655577372, 0.47571671295036144, -0.86354401602062025, -0.45354287599804666], [0.44863440392806031, -0.64112646326775291, 0.91877609169151908, 0.98277738739744636]], [[-0.23627452345538003, 0.26824331838587279, -0.11255839194272887, 0.62327509528972769], [0.87773514238000572, 0.62819546928589953, 0.53463187163744053, -0.11780048176113112], [0.17743656841726674, -0.47418242507357755, 0.37012543459814751, 0.84217962384585232]]], [[[-0.51615332690558602, -0.32180746309362296, -0.86871747985681558, -0.89347967000489548], [0.79236651642797762, -0.82769899986382356, -0.27503369025221813, 0.70491420567015894], [-0.46319485284379014, -0.71191635366918904, -0.4935498645964489, 0.42096986386791024]], [[-0.95241673224815648, -0.99507534300684708, -0.76759978752396862, -0.1621109099401965], [0.011495974208982407, 0.90547796535927083, -0.79651097416963368, 0.44382172569512224], [-0.11210429012307821, 0.28303519643554576, -0.59783370185364437, 0.75478113456483809]]]])+(1.-msk)*numarray.array([[[[0.70392145790103089, -0.7532260844479588, -0.53422583924595046, 0.29798767877629717], [0.87516135156666075, -0.40276494310086908, -0.070320230959511232, 0.13669067815714553], [0.26690559342737163, -0.0067218741792103298, 0.79272133073277207, -0.90080452301155178]], [[-0.90606808543363915, 0.94927254364127123, -0.15130300474521019, -0.34632615506118936], [0.29908319964670294, -0.71717585217034374, -0.11325472101126977, 0.60911487311528911], [0.055579283773870003, -0.42895625110409941, 0.22788310989168781, 0.50000680777627848]]], [[[-0.56683598589959683, 0.05720680440798942, 0.27949696950971137, 0.028472427888231566], [-0.51619860801944828, 0.73067372155966415, 0.81910302859539108, 0.97736576074434089], [-0.68851989268805447, 0.93303896549540433, -0.21083269397032622, -0.93122611728597304]], [[-0.13573136829275501, -0.30858456571228721, 0.86534434039603658, 0.79114631697533278], [-0.32870753097283112, 0.68472493656951161, -0.071089197922887593, -0.032936485145198757], [0.40875380316397925, -0.27280027645573401, -0.27155299841136848, -0.81500786568603067]]], [[[0.080473457255322733, -0.54931257643900566, 0.19082193004877501, -0.52744293877995374], [0.44447571282767639, -0.0060974808128133606, -0.87810788913565485, -0.92670043304972327], [0.45760340069120065, -0.7504981866011311, -0.95431384972577082, 0.4644557658783679]], [[0.18449401878090566, -0.73315009595487135, -0.59404794479416467, 0.076556365298426687], [0.65441299213898763, -0.91649003079073932, -0.082437357750317686, 0.88150531806538579], [-0.45829076922310796, 0.91236619416957021, -0.91128142664652279, 0.9524897339484899]]]]) | ||
# arg=Data(numarray.array([[[[0.59301561766072242, 0.6053289847447505, 0.1720524601196014, 0.4833679091408507], [-0.09424534157102582, 0.91976800441974427, -0.11950945037648264, -0.10547294628619919], [0.045302052907340462, -0.26699801365763864, -0.59100789693502542, 0.8220898248447317]], [[-0.71764117646989489, -0.31097048109028447, -0.36880919201656037, -0.12380648590370025], [0.71171672214402615, -0.87716399369053821, 0.53673002158727501, -0.29732656272582969], [-0.71737153055394787, -0.18861795164190798, -0.55325559014387649, 0.50828072891961451]]], [[[0.7139879661021804, -0.54655602578694507, -0.62738810494945163, -0.71453639471562314], [0.25287437655577372, 0.47571671295036144, -0.86354401602062025, -0.45354287599804666], [0.44863440392806031, -0.64112646326775291, 0.91877609169151908, 0.98277738739744636]], [[-0.23627452345538003, 0.26824331838587279, -0.11255839194272887, 0.62327509528972769], [0.87773514238000572, 0.62819546928589953, 0.53463187163744053, -0.11780048176113112], [0.17743656841726674, -0.47418242507357755, 0.37012543459814751, 0.84217962384585232]]], [[[-0.51615332690558602, -0.32180746309362296, -0.86871747985681558, -0.89347967000489548], [0.79236651642797762, -0.82769899986382356, -0.27503369025221813, 0.70491420567015894], [-0.46319485284379014, -0.71191635366918904, -0.4935498645964489, 0.42096986386791024]], [[-0.95241673224815648, -0.99507534300684708, -0.76759978752396862, -0.1621109099401965], [0.011495974208982407, 0.90547796535927083, -0.79651097416963368, 0.44382172569512224], [-0.11210429012307821, 0.28303519643554576, -0.59783370185364437, 0.75478113456483809]]]]),self.functionspace,True) | ||
# arg.setTaggedValue(1,[[[[0.70392145790103089, -0.7532260844479588, -0.53422583924595046, 0.29798767877629717], [0.87516135156666075, -0.40276494310086908, -0.070320230959511232, 0.13669067815714553], [0.26690559342737163, -0.0067218741792103298, 0.79272133073277207, -0.90080452301155178]], [[-0.90606808543363915, 0.94927254364127123, -0.15130300474521019, -0.34632615506118936], [0.29908319964670294, -0.71717585217034374, -0.11325472101126977, 0.60911487311528911], [0.055579283773870003, -0.42895625110409941, 0.22788310989168781, 0.50000680777627848]]], [[[-0.56683598589959683, 0.05720680440798942, 0.27949696950971137, 0.028472427888231566], [-0.51619860801944828, 0.73067372155966415, 0.81910302859539108, 0.97736576074434089], [-0.68851989268805447, 0.93303896549540433, -0.21083269397032622, -0.93122611728597304]], [[-0.13573136829275501, -0.30858456571228721, 0.86534434039603658, 0.79114631697533278], [-0.32870753097283112, 0.68472493656951161, -0.071089197922887593, -0.032936485145198757], [0.40875380316397925, -0.27280027645573401, -0.27155299841136848, -0.81500786568603067]]], [[[0.080473457255322733, -0.54931257643900566, 0.19082193004877501, -0.52744293877995374], [0.44447571282767639, -0.0060974808128133606, -0.87810788913565485, -0.92670043304972327], [0.45760340069120065, -0.7504981866011311, -0.95431384972577082, 0.4644557658783679]], [[0.18449401878090566, -0.73315009595487135, -0.59404794479416467, 0.076556365298426687], [0.65441299213898763, -0.91649003079073932, -0.082437357750317686, 0.88150531806538579], [-0.45829076922310796, 0.91236619416957021, -0.91128142664652279, 0.9524897339484899]]]]) | ||
res=inf(arg) | ||
ref=-0.995075343007 | ||
self.failUnless(isinstance(res,float),"wrong type of result.") | ||
self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | ||
282 | #========================================================= | #========================================================= |
283 | # Symbols | # Symbols |
284 | #========================================================= | #========================================================= |
# | Line 10144 class Test_util(unittest.TestCase): | Line 9759 class Test_util(unittest.TestCase): |
9759 | self.failIf(s==DependendSymbol(shape=(3,2,3,4),dim=2,args=[1, -1.0]),"different dimension.") | self.failIf(s==DependendSymbol(shape=(3,2,3,4),dim=2,args=[1, -1.0]),"different dimension.") |
9760 | self.failIf(s==DependendSymbol(shape=(3,2,3,4),dim=3,args=[1, 1.0]),"different arguments not detected.") | self.failIf(s==DependendSymbol(shape=(3,2,3,4),dim=3,args=[1, 1.0]),"different arguments not detected.") |
9761 | ||
9762 | class Test_util_with_tagged_Data(Test_util): | |
9763 | class Test_util_reduction_no_tagged_data(Test_util_base): | |
9764 | """ | |
9765 | test for reduction operation Lsup,sup,inf. no tagged data are used | |
9766 | """ | |
9767 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9768 | def test_Lsup_float_rank0(self): | |
9769 | arg=0.479077251703 | |
9770 | ref=0.479077251703 | |
9771 | res=Lsup(arg) | |
9772 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9773 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9774 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9775 | def test_Lsup_array_rank0(self): | |
9776 | arg=0.352800421569 | |
9777 | ref=0.352800421569 | |
9778 | res=Lsup(arg) | |
9779 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9780 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9781 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9782 | def test_Lsup_array_rank1(self): | |
9783 | arg=numarray.array([0.58364106865247445, 0.19224319360367659]) | |
9784 | ref=0.583641068652 | |
9785 | res=Lsup(arg) | |
9786 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9787 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9788 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9789 | def test_Lsup_array_rank2(self): | |
9790 | arg=numarray.array([[0.67017748174064184, 0.27426357568545234, 0.99809374007262508, 0.0068333566694658288, -0.27942939334057559], [-0.41062296082648619, -0.036816602223561423, -0.50580074937952246, 0.93227848108675948, -0.061517050082725788], [0.36561750746233845, 0.41114839130078873, 0.52258027672142848, -0.16534372330544111, 0.20772668552253304], [0.821900382760401, -0.84255628577421948, -0.69396587198625026, -0.57918798921236458, -0.72171447032975466]]) | |
9791 | ref=0.998093740073 | |
9792 | res=Lsup(arg) | |
9793 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9794 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9795 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9796 | def test_Lsup_array_rank3(self): | |
9797 | arg=numarray.array([[[0.058641541671277109, -0.90451294682583527], [-0.24359709498927606, -0.57748558070477163]], [[0.035804882991596898, 0.62841290637910441], [-0.28533080116748288, -0.97886508166774955]], [[0.31393622401598642, -0.43905852202615403], [-0.86251727012547685, 0.028980168735740941]], [[0.64796855283921229, -0.48583038861071492], [0.18113352051559328, -0.41145930584343637]], [[0.039393878628251944, 0.8768398562091233], [-0.17607723439655953, -0.88597401556177768]], [[-0.015710131346685419, -0.1460065558640582], [0.97739538148461858, -0.96991499683153215]]]) | |
9798 | ref=0.978865081668 | |
9799 | res=Lsup(arg) | |
9800 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9801 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9802 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9803 | def test_Lsup_array_rank4(self): | |
9804 | arg=numarray.array([[[[-0.78982105495266985, -0.63220666806337955, 0.17512704833203396, 0.87905338838606228], [0.23198845220692799, 0.039972475068823288, 0.012169097173197807, 0.44188750570302382], [0.76550090905039703, 0.31693138180972436, 0.1053031163896907, -0.35110494947362092]], [[0.98438531435704557, 0.64830270240860366, 0.17255823042313656, -0.89376135594562944], [-0.24129437029981871, -0.142955980423916, 0.16557185988864043, 0.97182386578689162], [0.68369373227893937, -0.86170550438838256, 0.30120477894454822, 0.38702330237685523]]], [[[0.77139284396922037, 0.20032741426304668, 0.57845916425558697, -0.29867163908832151], [-0.068269410287581156, 0.5940891737261742, 0.076472990825278808, -0.099092183170674364], [-0.052727700907511776, 0.86303703635283835, -0.87561628108225542, 0.98706354430335175]], [[0.59243014649382819, 0.1550040875984271, -0.2755507051420949, -0.0013143184448647371], [0.49341486033505921, 0.47331310491746503, -0.79931467469262252, -0.90673470029976722], [-0.032268150780954796, 0.296035852616644, 0.51579882806939303, 0.46437108203184607]]], [[[-0.54940019219066349, 0.063961557315018069, 0.58950734587654585, -0.98334853918198539], [-0.3624096661573355, 0.41744569348555416, 0.30209950686844023, 0.51268273249278518], [0.18884359916930848, -0.71707023426140903, -0.30560603652072227, 0.50521867139895282]], [[0.48925658559264695, -0.22791551552340583, -0.0018172920946346593, -0.35038144063572618], [-0.92608233760416425, -0.58447575161042908, 0.6419293813902982, -0.9165521427783867], [0.32116313637555338, 0.64441081354246466, 0.57516697859586241, -0.30456483792192746]]]]) | |
9805 | ref=0.987063544303 | |
9806 | res=Lsup(arg) | |
9807 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9808 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9809 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9810 | def test_Lsup_constData_rank0(self): | |
9811 | arg=Data(0.196366308048,self.functionspace) | |
9812 | ref=0.196366308048 | |
9813 | res=Lsup(arg) | |
9814 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9815 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9816 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9817 | def test_Lsup_constData_rank1(self): | |
9818 | arg=Data(numarray.array([-0.013183241788205846, 0.30081447346639489]),self.functionspace) | |
9819 | ref=0.300814473466 | |
9820 | res=Lsup(arg) | |
9821 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9822 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9823 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9824 | def test_Lsup_constData_rank2(self): | |
9825 | arg=Data(numarray.array([[0.5711180583492661, 0.70931947195628298, -0.66895311699347904, 0.96005746113679025, 0.73085528334644767], [-0.63904611175106618, 0.2843691804450883, 0.44023994297671054, 0.74230048057601272, 0.32582591826440876], [0.058605148358656045, 0.17856553839104938, 0.92397360311332144, -0.96449976222010503, -0.2936728605307215], [-0.54599501106213921, 0.76941479487476183, 0.071247548913826231, 0.19101147233175308, -0.1697403800152153]]),self.functionspace) | |
9826 | ref=0.96449976222 | |
9827 | res=Lsup(arg) | |
9828 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9829 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9830 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9831 | def test_Lsup_constData_rank3(self): | |
9832 | arg=Data(numarray.array([[[0.72501574945437675, 0.097442689963523454], [0.81136110912526904, 0.30019286779005516]], [[-0.49590270028453376, 0.89873757442194169], [-0.77574675514072333, 0.00090692035026496143]], [[0.30313499990678294, -0.22304437168798286], [0.26434595235717628, 0.56043553186944139]], [[-0.82536121216538372, 0.017266274277504934], [0.15087851023611853, 0.85422443819044291]], [[-0.85528228633213454, 0.21599153787828373], [-0.8320606477196939, 0.8359530516934528]], [[-0.32478507656272382, 0.11549647741760993], [-0.87438785398253049, 0.58454806081387956]]]),self.functionspace) | |
9833 | ref=0.898737574422 | |
9834 | res=Lsup(arg) | |
9835 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9836 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9837 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9838 | def test_Lsup_constData_rank4(self): | |
9839 | arg=Data(numarray.array([[[[-0.1675633776917147, 0.33827478137880718, -0.93890402023643449, 0.65020437341791437], [0.29507018847480526, 0.98622587753446878, 0.12652012726316597, -0.31134038684685694], [-0.046095794370747178, 0.52924578464459526, -0.6479404156998898, -0.50108997075395512]], [[-0.89461015899273821, -0.079360196866752331, 0.24950542226018069, 0.6689436082056277], [0.92392213781413735, 0.3873078097702356, 0.19593123983162242, -0.24092882483013001], [-0.64621424798001881, 0.9822743623774457, 0.89791841241748926, 0.61910184653693512]]], [[[-0.93993640130694156, 0.86452728798536005, 0.094496916350070848, 0.59825417382728907], [0.55042390382543216, 0.83625046124041091, -0.59865905280251042, 0.60081510989738351], [0.96300656863917622, 0.45676715577013183, 0.96765574240961594, 0.35217159943804499]], [[-0.44344990079738578, -0.62540931368504271, 0.47046830875624712, 0.56727920796684694], [0.68754074058706793, -0.20419202844112316, -0.0095491803785341389, 0.013299778291189002], [0.17824394120278897, -0.27714200037108694, -0.2616405339148673, -0.32155257707876661]]], [[[0.47113927793594357, -0.99306136743656892, 0.30468996581271934, -0.55558797016447881], [0.83216176170936151, 0.016003159554198287, 0.50607924358488665, -0.44441953149310631], [0.81919419287951278, -0.65849894919643503, 0.91897977494732008, -0.52338741357416407]], [[0.71408966944475138, -0.49347702658095161, 0.35676281330171133, 0.87268025092466872], [0.38401738326898771, -0.66323897612738114, 0.57309433517459518, 0.72101582669934583], [-0.0289954568811297, 0.55204032281174009, 0.51120867863750807, -0.67373936301915327]]]]),self.functionspace) | |
9840 | ref=0.993061367437 | |
9841 | res=Lsup(arg) | |
9842 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9843 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9844 | ||
9845 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9846 | def test_Lsup_expandedData_rank0(self): | |
9847 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
9848 | arg=msk*0.907507663119+(1.-msk)*0.907507663119 | |
9849 | ||
9850 | # arg=Data(0.907507663119,self.functionspace,True) | |
9851 | # arg.setTaggedValue(1,0.907507663119) | |
9852 | res=Lsup(arg) | |
9853 | ref=0.907507663119 | |
9854 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9855 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9856 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9857 | def test_Lsup_expandedData_rank1(self): | |
9858 | ||
9859 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
9860 | arg=msk*numarray.array([0.64842023599463228, 0.7950449048151853])+(1.-msk)*numarray.array([-0.53356920308809608, -0.30392740367264159]) | |
9861 | ||
9862 | # arg=Data(numarray.array([0.64842023599463228, 0.7950449048151853]),self.functionspace,True) | |
9863 | # arg.setTaggedValue(1,[-0.53356920308809608, -0.30392740367264159]) | |
9864 | res=Lsup(arg) | |
9865 | ref=0.795044904815 | |
9866 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9867 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9868 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9869 | def test_Lsup_expandedData_rank2(self): | |
9870 | ||
9871 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
9872 | arg=msk*numarray.array([[0.72772455370935374, -0.47120637916343311, -0.82075870555018726, -0.13186541688079845, 0.14046405940683471], [0.10791450121551649, 0.043686402172190775, 0.4587164889316806, -0.16569163575870283, 0.64477762072726041], [0.62628246294878309, -0.46538827310659792, 0.58089235621217727, -0.745300901798017, -0.1072674226756638], [0.93074707226494824, 0.17195108914746116, 0.77645205158899833, -0.55814650711894975, -0.68929261213084403]])+(1.-msk)*numarray.array([[-0.25856012658041871, -0.64132706411711782, -0.90934384682634128, 0.13076992241789931, 0.23456684296051011], [0.54052140856785269, 0.78868044275368643, 0.20419986484049479, 0.64782383948156319, 0.12883249735345115], [-0.44575026820636654, -0.86972644697707824, 0.74937006939719653, 0.64390867433141019, 0.57227950445890885], [-0.59430616226417832, -0.77932115906125854, 0.60864641730739155, 0.909083762068297, -0.5444504332265574]]) | |
9873 | ||
9874 | # arg=Data(numarray.array([[0.72772455370935374, -0.47120637916343311, -0.82075870555018726, -0.13186541688079845, 0.14046405940683471], [0.10791450121551649, 0.043686402172190775, 0.4587164889316806, -0.16569163575870283, 0.64477762072726041], [0.62628246294878309, -0.46538827310659792, 0.58089235621217727, -0.745300901798017, -0.1072674226756638], [0.93074707226494824, 0.17195108914746116, 0.77645205158899833, -0.55814650711894975, -0.68929261213084403]]),self.functionspace,True) | |
9875 | # arg.setTaggedValue(1,[[-0.25856012658041871, -0.64132706411711782, -0.90934384682634128, 0.13076992241789931, 0.23456684296051011], [0.54052140856785269, 0.78868044275368643, 0.20419986484049479, 0.64782383948156319, 0.12883249735345115], [-0.44575026820636654, -0.86972644697707824, 0.74937006939719653, 0.64390867433141019, 0.57227950445890885], [-0.59430616226417832, -0.77932115906125854, 0.60864641730739155, 0.909083762068297, -0.5444504332265574]]) | |
9876 | res=Lsup(arg) | |
9877 | ref=0.930747072265 | |
9878 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9879 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9880 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9881 | def test_Lsup_expandedData_rank3(self): | |
9882 | ||
9883 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
9884 | arg=msk*numarray.array([[[0.31609964814729086, -0.59322042077218184], [0.62671563648606643, -0.99924882354010092]], [[-0.81285219908299133, -0.91261945476639861], [-0.66394864058744174, -0.070011911370653657]], [[-0.4798784324091383, -0.017929635369934749], [0.87935995021589952, 0.73748462709583618]], [[-0.89673095768516986, 0.44255562883781563], [-0.33009427566326166, 0.89415170271508537]], [[-0.070411620428932897, 0.34854312339042304], [-0.54088506672687542, 0.57996368816677069]], [[0.98447862226498417, 0.31010343079927294], [0.18832525314748882, 0.46594491838516161]]])+(1.-msk)*numarray.array([[[0.036725320623094637, -0.95874317021810596], [-0.66138152872168576, -0.52870418789420959]], [[0.59182952544611012, -0.31117513196914603], [0.17957160072325573, -0.93130315483187909]], [[0.33548100103066814, -0.6503677585469938], [-0.15995741665912955, -0.79138987042982367]], [[0.12353483100690976, -0.72197260504479188], [-0.35933752275788389, -0.46752695895022667]], [[0.7611306903818762, -0.88807332904594882], [0.91131651925077373, 0.81255438802194258]], [[-0.56892641899978824, 0.0010213385566093525], [0.40194539652124472, -0.006585080723547021]]]) | |
9885 | ||
9886 | # arg=Data(numarray.array([[[0.31609964814729086, -0.59322042077218184], [0.62671563648606643, -0.99924882354010092]], [[-0.81285219908299133, -0.91261945476639861], [-0.66394864058744174, -0.070011911370653657]], [[-0.4798784324091383, -0.017929635369934749], [0.87935995021589952, 0.73748462709583618]], [[-0.89673095768516986, 0.44255562883781563], [-0.33009427566326166, 0.89415170271508537]], [[-0.070411620428932897, 0.34854312339042304], [-0.54088506672687542, 0.57996368816677069]], [[0.98447862226498417, 0.31010343079927294], [0.18832525314748882, 0.46594491838516161]]]),self.functionspace,True) | |
9887 | # arg.setTaggedValue(1,[[[0.036725320623094637, -0.95874317021810596], [-0.66138152872168576, -0.52870418789420959]], [[0.59182952544611012, -0.31117513196914603], [0.17957160072325573, -0.93130315483187909]], [[0.33548100103066814, -0.6503677585469938], [-0.15995741665912955, -0.79138987042982367]], [[0.12353483100690976, -0.72197260504479188], [-0.35933752275788389, -0.46752695895022667]], [[0.7611306903818762, -0.88807332904594882], [0.91131651925077373, 0.81255438802194258]], [[-0.56892641899978824, 0.0010213385566093525], [0.40194539652124472, -0.006585080723547021]]]) | |
9888 | res=Lsup(arg) | |
9889 | ref=0.99924882354 | |
9890 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9891 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9892 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9893 | def test_Lsup_expandedData_rank4(self): | |
9894 | ||
9895 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
9896 | arg=msk*numarray.array([[[[0.4996033665120716, -0.074132654028136846, 0.2908837888281397, 0.79804117547820219], [0.25334186456470942, -0.10892196087517791, 0.90411872189757747, -0.21372334914190327], [0.65549677694560438, 0.97979738684954532, -0.29737844854710138, 0.93659843329597914]], [[0.22668444631484608, -0.92481913749465305, -0.9980815386745403, -0.022502768980955601], [-0.21769755240946398, 0.77216348666766876, -0.19843685166706204, 0.54270333879579558], [-0.11274856721131221, -0.29600869223659299, 0.1458222910080329, -0.83739782177046851]]], [[[0.86722932032155531, 0.39888432468517876, -0.8991679849590255, -0.088621935923834272], [-0.58464076321585412, -0.09564380294323116, 0.18232602464536307, 0.7910046931530843], [0.15923450234841652, -0.39331159996226872, 0.18298541750645669, 0.99889484861795563]], [[0.36793558813747418, -0.64593764280975363, 0.048503028175158613, -0.8304805399530264], [0.072019074767407432, -0.066883567381289311, -0.55849542620276127, -0.32521841292447484], [0.83256632210175896, -0.52124955617445723, -0.0047287521832242163, 0.84184001532121422]]], [[[-0.81375499823702158, 0.12901434959756353, -0.51500727423485215, 0.52626362435118912], [-0.47602620905811044, 0.81525173294213982, 0.023145745277130203, 0.5818744103097242], [-0.26074066195347489, 0.62737248392572886, 0.24246935026650718, 0.86155298917514145]], [[0.40180649524587109, -0.13468267908829512, -0.66576279256576543, -0.97664336021962694], [-0.81183732113700424, -0.10477655696019839, -0.90212494842448732, 0.50784279020015499], [0.29352929816605089, 0.10640245030222295, -0.16640870997460122, 0.91371366707232826]]]])+(1.-msk)*numarray.array([[[[0.6465819200939884, 0.21755363919340609, 0.73973535907059662, -0.36114669719855241], [0.16087051863228452, -0.96295075570141986, 0.93283344105282717, 0.8498346294196879], [-0.62871563035312805, 0.028501977366871101, -0.76183996578150004, -0.42396762024023338]], [[0.45139869884828876, 0.9085099092003921, 0.90516675545818392, -0.2797423591331305], [-0.012176715080714828, 0.40935600076669765, -0.010156279663344314, -0.45527372677880185], [-0.56697253731600106, -0.88076957837377901, -0.43708368779823448, -0.98115855535334329]]], [[[-0.6812131434679467, -0.75007359636996074, 0.52195871968240559, 0.74207747673309732], [0.53576769134014213, -0.19432873205999046, -0.87970756195132904, -0.36970944422105911], [0.18377651984390431, -0.30093639418244189, 0.30640551056952825, -0.95779743159891284]], [[0.3069655071293016, 0.42532244942656305, 0.27182877898608804, 0.89926151593228765], [-0.94227360921249192, 0.17309985459832045, -0.067341615594060267, -0.24017528169767255], [0.72377020653147883, -0.60287365881872312, 0.17612550848074338, -0.89499327987049915]]], [[[-0.8985020338092089, -0.27805317471704494, -0.096352572725887375, 0.26107376060313836], [-0.98264038134460852, -0.40101944215897967, 0.80787105663414827, -0.91046803072373206], [-0.11056024039811629, -0.35146855329949345, 0.62639019941990948, 0.029258586953160748]], [[0.5190564210634494, 0.25178673168519605, -0.095466912631134937, -0.66223610619416462], [0.86572944270431917, -0.0070686656495086986, -0.56404011740509774, 0.5156978630437381], [0.15106963134402651, 0.12900511640038159, 0.6022471822104567, 0.48643914768022012]]]]) | |
9897 | ||
9898 | # arg=Data(numarray.array([[[[0.4996033665120716, -0.074132654028136846, 0.2908837888281397, 0.79804117547820219], [0.25334186456470942, -0.10892196087517791, 0.90411872189757747, -0.21372334914190327], [0.65549677694560438, 0.97979738684954532, -0.29737844854710138, 0.93659843329597914]], [[0.22668444631484608, -0.92481913749465305, -0.9980815386745403, -0.022502768980955601], [-0.21769755240946398, 0.77216348666766876, -0.19843685166706204, 0.54270333879579558], [-0.11274856721131221, -0.29600869223659299, 0.1458222910080329, -0.83739782177046851]]], [[[0.86722932032155531, 0.39888432468517876, -0.8991679849590255, -0.088621935923834272], [-0.58464076321585412, -0.09564380294323116, 0.18232602464536307, 0.7910046931530843], [0.15923450234841652, -0.39331159996226872, 0.18298541750645669, 0.99889484861795563]], [[0.36793558813747418, -0.64593764280975363, 0.048503028175158613, -0.8304805399530264], [0.072019074767407432, -0.066883567381289311, -0.55849542620276127, -0.32521841292447484], [0.83256632210175896, -0.52124955617445723, -0.0047287521832242163, 0.84184001532121422]]], [[[-0.81375499823702158, 0.12901434959756353, -0.51500727423485215, 0.52626362435118912], [-0.47602620905811044, 0.81525173294213982, 0.023145745277130203, 0.5818744103097242], [-0.26074066195347489, 0.62737248392572886, 0.24246935026650718, 0.86155298917514145]], [[0.40180649524587109, -0.13468267908829512, -0.66576279256576543, -0.97664336021962694], [-0.81183732113700424, -0.10477655696019839, -0.90212494842448732, 0.50784279020015499], [0.29352929816605089, 0.10640245030222295, -0.16640870997460122, 0.91371366707232826]]]]),self.functionspace,True) | |
9899 | # arg.setTaggedValue(1,[[[[0.6465819200939884, 0.21755363919340609, 0.73973535907059662, -0.36114669719855241], [0.16087051863228452, -0.96295075570141986, 0.93283344105282717, 0.8498346294196879], [-0.62871563035312805, 0.028501977366871101, -0.76183996578150004, -0.42396762024023338]], [[0.45139869884828876, 0.9085099092003921, 0.90516675545818392, -0.2797423591331305], [-0.012176715080714828, 0.40935600076669765, -0.010156279663344314, -0.45527372677880185], [-0.56697253731600106, -0.88076957837377901, -0.43708368779823448, -0.98115855535334329]]], [[[-0.6812131434679467, -0.75007359636996074, 0.52195871968240559, 0.74207747673309732], [0.53576769134014213, -0.19432873205999046, -0.87970756195132904, -0.36970944422105911], [0.18377651984390431, -0.30093639418244189, 0.30640551056952825, -0.95779743159891284]], [[0.3069655071293016, 0.42532244942656305, 0.27182877898608804, 0.89926151593228765], [-0.94227360921249192, 0.17309985459832045, -0.067341615594060267, -0.24017528169767255], [0.72377020653147883, -0.60287365881872312, 0.17612550848074338, -0.89499327987049915]]], [[[-0.8985020338092089, -0.27805317471704494, -0.096352572725887375, 0.26107376060313836], [-0.98264038134460852, -0.40101944215897967, 0.80787105663414827, -0.91046803072373206], [-0.11056024039811629, -0.35146855329949345, 0.62639019941990948, 0.029258586953160748]], [[0.5190564210634494, 0.25178673168519605, -0.095466912631134937, -0.66223610619416462], [0.86572944270431917, -0.0070686656495086986, -0.56404011740509774, 0.5156978630437381], [0.15106963134402651, 0.12900511640038159, 0.6022471822104567, 0.48643914768022012]]]]) | |
9900 | res=Lsup(arg) | |
9901 | ref=0.998894848618 | |
9902 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9903 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9904 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9905 | def test_sup_float_rank0(self): | |
9906 | arg=0.870743835413 | |
9907 | ref=0.870743835413 | |
9908 | res=sup(arg) | |
9909 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9910 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9911 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9912 | def test_sup_array_rank0(self): | |
9913 | arg=0.469212543992 | |
9914 | ref=0.469212543992 | |
9915 | res=sup(arg) | |
9916 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9917 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9918 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9919 | def test_sup_array_rank1(self): | |
9920 | arg=numarray.array([0.8163530200305178, 0.7844191729334391]) | |
9921 | ref=0.816353020031 | |
9922 | res=sup(arg) | |
9923 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9924 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9925 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9926 | def test_sup_array_rank2(self): | |
9927 | arg=numarray.array([[-0.52338785100595131, 0.72523140545134046, -0.23883623210726745, 0.29329903553233394, 0.77300897701720128], [0.56646202903477705, -0.67833617682539948, 0.71280801753916911, 0.108973189514324, -0.86675353843929437], [0.37080584846118247, 0.61817009100957776, -0.20780655998890807, 0.085315295987765438, -0.73527023026482174], [-0.97586476277122935, 0.14501540684207481, 0.57375473938632338, 0.08516777342367865, -0.22644451314946301]]) | |
9928 | ref=0.773008977017 | |
9929 | res=sup(arg) | |
9930 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9931 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9932 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9933 | def test_sup_array_rank3(self): | |
9934 | arg=numarray.array([[[0.16933183602716984, -0.42964457496769226], [-0.63714228263554573, -0.28513481547494179]], [[0.72479530443714335, -0.097501515360919111], [-0.28611653510816737, -0.58370472731498535]], [[-0.18432738416022554, 0.79010596522300558], [-0.65367387441910196, 0.90861652898349976]], [[0.56004415223670123, 0.20178156913861489], [0.90730594499457595, 0.91196305151516754]], [[-0.46179421349599847, -0.54555869532019163], [0.36014998847058499, -0.70585188726413306]], [[0.49988705904335418, -0.52181171665742077], [0.14475259007357621, -0.94336078709637383]]]) | |
9935 | ref=0.911963051515 | |
9936 | res=sup(arg) | |
9937 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9938 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9939 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9940 | def test_sup_array_rank4(self): | |
9941 | arg=numarray.array([[[[0.085213773984220698, -0.9837351364458633, -0.23428780807935823, -0.54350985593703971], [-0.021654619752513593, -0.58267295960777465, -0.95135334805945893, -0.82172163939108089], [0.92970460708060565, 0.12721615089598348, 0.36243089042630872, 0.50434042290503855]], [[0.20617957875725845, 0.13657289785878368, 0.7942986246389756, -0.92641374730818571], [0.30431241116181762, -0.13563881945622858, 0.37921852742514695, -0.39275408991812211], [-0.016546769015328033, 0.50932041928102878, -0.27343457607173893, -0.0076289641375255624]]], [[[0.97189015970083137, -0.71286035174080009, 0.10143028964095313, -0.41856292303563181], [-0.97563458262665792, 0.79724078659701769, -0.70932749973904685, 0.018497784992804522], [-0.86374122662275021, 0.047715471334789816, -0.95453593058418518, 0.54562170290354794]], [[0.40249406070198157, -0.54609432046574469, -0.22682900899629166, 0.98394939138178539], [0.11049172557176901, 0.42172241721325388, 0.71050000578192951, 0.35353993854713206], [0.35412886303451896, -0.98169699399727617, 0.04758881049644037, 0.96971205948237493]]], [[[0.44672925866052249, -0.51476498049696828, 0.56442823935318875, -0.39769248164928039], [-0.40340965812893304, -0.87947712857546945, 0.55927022788356706, -0.89941016574892707], [-0.43878304559423431, 0.20915357555548764, -0.76548553334601799, -0.67202522557876954]], [[-0.56749721271516318, -0.10244683680777245, 0.17727779142251943, -0.57219284260940473], [-0.17044718853145446, 0.91117482665936023, -0.30039592703806584, -0.73813808369358713], [0.63771084365736663, -0.61427668096170129, 0.34365587989446378, -0.11877233448104674]]]]) | |
9942 | ref=0.983949391382 | |
9943 | res=sup(arg) | |
9944 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9945 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9946 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9947 | def test_sup_constData_rank0(self): | |
9948 | arg=Data(0.165371505685,self.functionspace) | |
9949 | ref=0.165371505685 | |
9950 | res=sup(arg) | |
9951 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9952 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9953 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9954 | def test_sup_constData_rank1(self): | |
9955 | arg=Data(numarray.array([-0.89603386749185288, -0.68712608295212729]),self.functionspace) | |
9956 | ref=-0.687126082952 | |
9957 | res=sup(arg) | |
9958 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9959 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9960 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9961 | def test_sup_constData_rank2(self): | |
9962 | arg=Data(numarray.array([[0.60272743728014655, 0.26067131689446787, -0.48488892003697837, -0.54328378217335027, -0.96627165443113894], [0.38861396631681999, -0.14210447298121753, -0.84480805358330624, -0.25397651427390566, 0.25670041011662192], [-0.062982523786134337, -0.149708363807598, -0.63332360725934489, -0.49175302564011525, -0.97647588301352473], [0.52022334705669038, -0.69717039787412727, -0.28284586409251511, 0.99642563937215467, -0.67058148736338885]]),self.functionspace) | |
9963 | ref=0.996425639372 | |
9964 | res=sup(arg) | |
9965 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9966 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9967 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9968 | def test_sup_constData_rank3(self): | |
9969 | arg=Data(numarray.array([[[-0.98552936119306023, -0.58995212270861552], [0.51743177430155907, 0.68576837981065508]], [[-0.61618414432919089, -0.12325580790677049], [0.32387395300714172, -0.95456083598524333]], [[0.89779642579517049, 0.98676270760314266], [0.71959629907181966, -0.9949078223284622]], [[-0.81547040114414271, 0.10033634427970006], [-0.21591232734408217, -0.68608679705274822]], [[0.30423138886571999, 0.34122142527426802], [-0.4344532377066066, -0.31076903154305779]], [[-0.46111628105416602, -0.18371998359850483], [0.63606993796228117, -0.10703087143670587]]]),self.functionspace) | |
9970 | ref=0.986762707603 | |
9971 | res=sup(arg) | |
9972 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9973 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9974 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9975 | def test_sup_constData_rank4(self): | |
9976 | arg=Data(numarray.array([[[[0.89488524023952776, 0.8669396968091807, -0.45769331537553315, -0.89738195395075349], [0.39077366764066168, -0.71075932241646922, -0.51096889323130612, 0.87130290122807663], [0.17079807940685177, -0.6198922248677714, -0.41261700237404653, -0.30627765803812368]], [[-0.0659839868001868, -0.54367942190111385, 0.79254440140135607, -0.28895269724305006], [0.2554732744127961, -0.0076696085190677277, 0.6846601760873452, 0.38696598742090393], [-0.77125424651939789, 0.63909999575689591, -0.87840142433528379, 0.41711809974302594]]], [[[-0.99322035791310692, 0.27097830567855352, -0.4253855401144222, 0.15768186455727529], [-0.49181115516922302, -0.36126829134959304, 0.52357599944776667, 0.91209852597809005], [0.069076441159411361, -0.18292686281510551, -0.6497679800515983, 0.022610374934600719]], [[0.28755759348156507, -0.08281906224050295, 0.76036900801429907, 0.54802231074240826], [-0.033682724326368874, -0.7414032372095134, -0.86699767465780231, 0.40592904057808044], [0.51593363738292841, -0.72087130860034332, 0.35672334112134374, -0.090721746979026463]]], [[[-0.54866684145444511, -0.96738751715836968, -0.21201752332220436, -0.099425492405464277], [-0.76528700517307313, -0.85955622688708644, -0.10492266626403257, 0.69311319310724762], [-0.33886276086664902, -0.6846128323156393, 0.05873264876508566, 0.88498228323799433]], [[-0.28404277561384639, -0.63570388064518468, -0.67775264818658387, 0.20825454125346576], [-0.84788984114351473, 0.037932422136330635, 0.021981819447397299, -0.2709264612684219], [-0.64072476278735468, 0.46126191894728197, -0.37456096950035489, 0.85599593427453957]]]]),self.functionspace) | |
9977 | ref=0.912098525978 | |
9978 | res=sup(arg) | |
9979 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9980 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9981 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9982 | def test_sup_expandedData_rank0(self): | |
9983 | ||
9984 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
9985 | arg=msk*0.842459260157+(1.-msk)*0.985691469761 | |
9986 | ||
9987 | # arg=Data(0.842459260157,self.functionspace,True) | |
9988 | # arg.setTaggedValue(1,0.842459260157) | |
9989 | res=sup(arg) | |
9990 | ref=0.985691469761 | |
9991 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
9992 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
9993 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
9994 | def test_sup_expandedData_rank1(self): | |
9995 | ||
9996 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
9997 | arg=msk*numarray.array([0.47024430020620023, -0.40410868427962021])+(1.-msk)*numarray.array([0.34568516056640197, -0.43342673126146103]) | |
9998 | ||
9999 | # arg=Data(numarray.array([0.47024430020620023, -0.40410868427962021]),self.functionspace,True) | |
10000 | # arg.setTaggedValue(1,[0.34568516056640197, -0.43342673126146103]) | |
10001 | res=sup(arg) | |
10002 | ref=0.470244300206 | |
10003 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10004 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10005 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10006 | def test_sup_expandedData_rank2(self): | |
10007 | ||
10008 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
10009 | arg=msk*numarray.array([[-0.88351146515427814, 0.87526615684362929, 0.80242059303502922, -0.6048006248682789, 0.42108402102305953], [0.11385226207304888, -0.66232044805160473, 0.69874162972474063, 0.22449470583280284, -0.19986159203927545], [0.17102700533232951, -0.9790459454968905, 0.4374092200111821, -0.4343902463997138, 0.72993175063985705], [-0.42636794385375065, -0.88420160799308434, -0.073357336228458081, -0.96071213693656698, -0.28591564459422769]])+(1.-msk)*numarray.array([[-0.66507554751323883, 0.90956185314332916, 0.39373039994051529, 0.20185922272970869, 0.56272045770025914], [-0.81603670050480082, -0.98308666677421708, 0.081972418155825233, 0.98933334281872432, -0.67280110519862579], [-0.67384516784043069, 0.19168471924963759, -0.59938113619504896, 0.22266455997006829, -0.93324865777959265], [0.93134589933544842, -0.10311385886401503, -0.2331509870020978, 0.37315747180467018, 0.73551730577813057]]) | |
10010 | ||
10011 | # arg=Data(numarray.array([[-0.88351146515427814, 0.87526615684362929, 0.80242059303502922, -0.6048006248682789, 0.42108402102305953], [0.11385226207304888, -0.66232044805160473, 0.69874162972474063, 0.22449470583280284, -0.19986159203927545], [0.17102700533232951, -0.9790459454968905, 0.4374092200111821, -0.4343902463997138, 0.72993175063985705], [-0.42636794385375065, -0.88420160799308434, -0.073357336228458081, -0.96071213693656698, -0.28591564459422769]]),self.functionspace,True) | |
10012 | # arg.setTaggedValue(1,[[-0.66507554751323883, 0.90956185314332916, 0.39373039994051529, 0.20185922272970869, 0.56272045770025914], [-0.81603670050480082, -0.98308666677421708, 0.081972418155825233, 0.98933334281872432, -0.67280110519862579], [-0.67384516784043069, 0.19168471924963759, -0.59938113619504896, 0.22266455997006829, -0.93324865777959265], [0.93134589933544842, -0.10311385886401503, -0.2331509870020978, 0.37315747180467018, 0.73551730577813057]]) | |
10013 | res=sup(arg) | |
10014 | ref=0.989333342819 | |
10015 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10016 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10017 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10018 | def test_sup_expandedData_rank3(self): | |
10019 | ||
10020 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
10021 | arg=msk*numarray.array([[[-0.69867440642271283, -0.37489565319806606], [-0.66485463581725601, 0.18238313710104448]], [[-0.78388494323459157, 0.24027472943325923], [-0.4377158808146262, -0.34262284842949864]], [[-0.8539094490313166, 0.62109328106735684], [-0.20715549218162899, -0.33320905765908693]], [[-0.25702886172082651, 0.94651536183641283], [-0.2229696935051404, 0.84771132395539794]], [[0.52244706935442076, -0.89344888833386804], [0.064322796922618108, 0.36966382541443532]], [[0.55710175300577691, -0.22780561634551688], [0.89548548132750594, -0.77561238906399077]]])+(1.-msk)*numarray.array([[[-0.86933240372621312, 0.32078825553642276], [0.36873095289245739, 0.20578150283627239]], [[-0.13143164944725427, 0.89920065296927199], [0.79295913398164197, 0.78838875458878954]], [[0.068510791358111334, 0.87754319283313054], [-0.96880448620091553, -0.012058603734139028]], [[0.44680342907934811, -0.52293412412648466], [0.51117158355443149, -0.6794979840301234]], [[0.55644022070667498, 0.082838767459920026], [-0.64861425420762142, -0.20781169747814943]], [[0.52302454039265078, -0.71078210239352546], [0.67348959224612859, 0.18668184392186915]]]) | |
10022 | ||
10023 | # arg=Data(numarray.array([[[-0.69867440642271283, -0.37489565319806606], [-0.66485463581725601, 0.18238313710104448]], [[-0.78388494323459157, 0.24027472943325923], [-0.4377158808146262, -0.34262284842949864]], [[-0.8539094490313166, 0.62109328106735684], [-0.20715549218162899, -0.33320905765908693]], [[-0.25702886172082651, 0.94651536183641283], [-0.2229696935051404, 0.84771132395539794]], [[0.52244706935442076, -0.89344888833386804], [0.064322796922618108, 0.36966382541443532]], [[0.55710175300577691, -0.22780561634551688], [0.89548548132750594, -0.77561238906399077]]]),self.functionspace,True) | |
10024 | # arg.setTaggedValue(1,[[[-0.86933240372621312, 0.32078825553642276], [0.36873095289245739, 0.20578150283627239]], [[-0.13143164944725427, 0.89920065296927199], [0.79295913398164197, 0.78838875458878954]], [[0.068510791358111334, 0.87754319283313054], [-0.96880448620091553, -0.012058603734139028]], [[0.44680342907934811, -0.52293412412648466], [0.51117158355443149, -0.6794979840301234]], [[0.55644022070667498, 0.082838767459920026], [-0.64861425420762142, -0.20781169747814943]], [[0.52302454039265078, -0.71078210239352546], [0.67348959224612859, 0.18668184392186915]]]) | |
10025 | res=sup(arg) | |
10026 | ref=0.946515361836 | |
10027 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10028 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10029 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10030 | def test_sup_expandedData_rank4(self): | |
10031 | ||
10032 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
10033 | arg=msk*numarray.array([[[[-0.97992610933200397, -0.25896245628971326, -0.70483438344031946, -0.99381143197943023], [-0.94915117581748709, -0.41900816047650036, -0.73354223723879386, 0.75059333884969881], [-0.76848095939834238, -0.75674819943701244, 0.065477641668864495, -0.42345850130975426]], [[-0.86758200423510234, -0.91179084363212071, -0.95127824910458103, 0.44686792515820439], [0.24843166983163689, -0.78829756520109728, -0.29421842880871774, 0.081312723661290498], [-0.73676127398786795, 0.91442315487631975, -0.64075473615377643, -0.68228346762450576]]], [[[-0.52913624371899504, 0.18611492696208209, 0.87647965087074042, 0.81733477764270401], [-0.45994626037000352, -0.72068350777641998, -0.67722337882139305, 0.53688427407036721], [-0.62155086776441348, -0.16407031198819877, 0.27545162813408264, 0.82180316351563087]], [[0.86221555518143278, -0.038942303505028031, 0.99073092777336114, -0.59207542384567113], [-0.42324210154238218, 0.76649013040311842, 0.86242470461616949, 0.49956796372115009], [-0.3983839684487791, 0.50100130531149967, -0.61285700166494195, -0.77581662400471862]]], [[[0.393847951204221, -0.72453857578029801, 0.97194727576353768, -0.95039782864739597], [-0.33546269250215266, 0.4831646699512071, -0.36084136685304102, -0.21835205500655297], [-0.82932637046105562, 0.70351683765540218, -0.058619290451321637, -0.2054802590132303]], [[0.94447147902776929, -0.42312399627562503, -0.11683182283655591, -0.40970199303413191], [-0.057628087834810326, -0.92418858637343759, 0.17632737701884516, -0.45930384359491305], [-0.47612419752878798, -0.96256404924809247, 0.10415265869578216, -0.63202348546194909]]]])+(1.-msk)*numarray.array([[[[-0.97434762405813102, 0.7014239623245393, 0.62448079624150288, -0.37769806924712546], [-0.85193729675303742, -0.77375392434251022, 0.36142120851055592, 0.26580596564769365], [-0.87276378893603579, 0.38973819311591718, 0.98354255063199636, -0.66795317131402343]], [[0.90231744676982428, -0.27585106370360957, -0.32108129691288001, 0.60440834831736634], [-0.045905880902579188, -0.29199624499256793, 0.025945636614535861, -0.098321374439206854], [-0.56344512008582659, -0.3766256629210043, -0.16641839175601203, -0.47355537095296341]]], [[[-0.98963277387073156, -0.84954014836916003, 0.58413699452656576, -0.90574771672091781], [-0.076165236495137068, -0.33185579541568311, 0.71508582816996036, 0.092982625872773284], [-0.59803076383019627, 0.96534061564337792, -0.86101074809006883, 0.4514321077629706]], [[0.68169942993010979, -0.46839019201575827, 0.86748862862295062, 0.077239140299438347], [-0.41039932807903745, 0.77351932859252215, -0.91858786520587499, -0.83803209999478323], [-0.66149540952220676, 0.21690925014134543, 0.49329666114093262, 0.22750525795569843]]], [[[0.49476796496001074, 0.54374663478072427, -0.64963120626875592, 0.57704965092442939], [0.74520801893525035, -0.18704889796101698, -0.73119506283113278, 0.30233417986347821], [-0.40842036405150561, -0.58450470869605797, 0.084020496164487923, -0.58538663622202569]], [[0.75611417989143481, -0.52196566347687212, 0.47144797786301607, -0.99505702762998172], [-0.0043333507755138889, -0.8740422871734248, 0.69683145050592943, -0.015830354510735223], [-0.047302931197539255, -0.033238606395723957, -0.95126827803180114, 0.88954001433619978]]]]) | |
10034 | ||
10035 | # arg=Data(numarray.array([[[[-0.97992610933200397, -0.25896245628971326, -0.70483438344031946, -0.99381143197943023], [-0.94915117581748709, -0.41900816047650036, -0.73354223723879386, 0.75059333884969881], [-0.76848095939834238, -0.75674819943701244, 0.065477641668864495, -0.42345850130975426]], [[-0.86758200423510234, -0.91179084363212071, -0.95127824910458103, 0.44686792515820439], [0.24843166983163689, -0.78829756520109728, -0.29421842880871774, 0.081312723661290498], [-0.73676127398786795, 0.91442315487631975, -0.64075473615377643, -0.68228346762450576]]], [[[-0.52913624371899504, 0.18611492696208209, 0.87647965087074042, 0.81733477764270401], [-0.45994626037000352, -0.72068350777641998, -0.67722337882139305, 0.53688427407036721], [-0.62155086776441348, -0.16407031198819877, 0.27545162813408264, 0.82180316351563087]], [[0.86221555518143278, -0.038942303505028031, 0.99073092777336114, -0.59207542384567113], [-0.42324210154238218, 0.76649013040311842, 0.86242470461616949, 0.49956796372115009], [-0.3983839684487791, 0.50100130531149967, -0.61285700166494195, -0.77581662400471862]]], [[[0.393847951204221, -0.72453857578029801, 0.97194727576353768, -0.95039782864739597], [-0.33546269250215266, 0.4831646699512071, -0.36084136685304102, -0.21835205500655297], [-0.82932637046105562, 0.70351683765540218, -0.058619290451321637, -0.2054802590132303]], [[0.94447147902776929, -0.42312399627562503, -0.11683182283655591, -0.40970199303413191], [-0.057628087834810326, -0.92418858637343759, 0.17632737701884516, -0.45930384359491305], [-0.47612419752878798, -0.96256404924809247, 0.10415265869578216, -0.63202348546194909]]]]),self.functionspace,True) | |
10036 | # arg.setTaggedValue(1,[[[[-0.97434762405813102, 0.7014239623245393, 0.62448079624150288, -0.37769806924712546], [-0.85193729675303742, -0.77375392434251022, 0.36142120851055592, 0.26580596564769365], [-0.87276378893603579, 0.38973819311591718, 0.98354255063199636, -0.66795317131402343]], [[0.90231744676982428, -0.27585106370360957, -0.32108129691288001, 0.60440834831736634], [-0.045905880902579188, -0.29199624499256793, 0.025945636614535861, -0.098321374439206854], [-0.56344512008582659, -0.3766256629210043, -0.16641839175601203, -0.47355537095296341]]], [[[-0.98963277387073156, -0.84954014836916003, 0.58413699452656576, -0.90574771672091781], [-0.076165236495137068, -0.33185579541568311, 0.71508582816996036, 0.092982625872773284], [-0.59803076383019627, 0.96534061564337792, -0.86101074809006883, 0.4514321077629706]], [[0.68169942993010979, -0.46839019201575827, 0.86748862862295062, 0.077239140299438347], [-0.41039932807903745, 0.77351932859252215, -0.91858786520587499, -0.83803209999478323], [-0.66149540952220676, 0.21690925014134543, 0.49329666114093262, 0.22750525795569843]]], [[[0.49476796496001074, 0.54374663478072427, -0.64963120626875592, 0.57704965092442939], [0.74520801893525035, -0.18704889796101698, -0.73119506283113278, 0.30233417986347821], [-0.40842036405150561, -0.58450470869605797, 0.084020496164487923, -0.58538663622202569]], [[0.75611417989143481, -0.52196566347687212, 0.47144797786301607, -0.99505702762998172], [-0.0043333507755138889, -0.8740422871734248, 0.69683145050592943, -0.015830354510735223], [-0.047302931197539255, -0.033238606395723957, -0.95126827803180114, 0.88954001433619978]]]]) | |
10037 | res=sup(arg) | |
10038 | ref=0.990730927773 | |
10039 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10040 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10041 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10042 | def test_inf_float_rank0(self): | |
10043 | arg=0.857535693433 | |
10044 | ref=0.857535693433 | |
10045 | res=inf(arg) | |
10046 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10047 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10048 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10049 | def test_inf_array_rank0(self): | |
10050 | arg=0.170725403135 | |
10051 | ref=0.170725403135 | |
10052 | res=inf(arg) | |
10053 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10054 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10055 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10056 | def test_inf_array_rank1(self): | |
10057 | arg=numarray.array([-0.20582799927627726, 0.0065475369467946631]) | |
10058 | ref=-0.205827999276 | |
10059 | res=inf(arg) | |
10060 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10061 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10062 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10063 | def test_inf_array_rank2(self): | |
10064 | arg=numarray.array([[-0.00088705991533410966, -0.78884753663192009, 0.51871980588812661, -0.58204851803513313, 0.14241101940826861], [0.79094574969805964, 0.79672216617995617, -0.5690477768894624, 0.51157272654417052, 0.18066938665191556], [0.32364745994353683, 0.4748425103497671, 0.66679519455306924, -0.69644515487912217, -0.37494171775165297], [-0.18679695095262239, -0.78312977298360509, 0.044885312146701661, -0.44016241609550066, -0.49756845096624081]]) | |
10065 | ref=-0.788847536632 | |
10066 | res=inf(arg) | |
10067 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10068 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10069 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10070 | def test_inf_array_rank3(self): | |
10071 | arg=numarray.array([[[-0.8081125483464171, -0.39512178653285135], [-0.88509761616456495, 0.27821695074525521]], [[-0.12065704909614361, 0.68332883926843135], [0.3403814721074454, -0.32879966956330042]], [[-0.7045229028656752, -0.1577338131736914], [-0.5966034105188045, 0.73456332700634985]], [[0.87843639147943997, 0.94490362642776882], [-0.45552277927474183, -0.9768135246661469]], [[-0.65451540143458864, -0.2796668209543185], [-0.085396852552783953, 0.83466766003117332]], [[0.43465138886082078, 0.61441480296663342], [0.92555078046558337, -0.24612584648713121]]]) | |
10072 | ref=-0.976813524666 | |
10073 | res=inf(arg) | |
10074 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10075 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10076 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10077 | def test_inf_array_rank4(self): | |
10078 | arg=numarray.array([[[[-0.05536021838962446, -0.0098764348632232046, -0.52953548051740618, 0.58523070076080819], [0.10613609818504877, 0.67324697282212087, 0.54615663777618906, -0.67572666188479613], [-0.14390410848091539, 0.54011444546397591, -0.85609073171970373, 0.077099187121419277]], [[-0.20493469025659716, 0.90647730634569368, -0.71749107354722064, -0.12332697315517271], [0.63551267588618598, -0.60802528409862266, 0.052319255834022638, -0.95394697709081688], [-0.88612629669117959, 0.32248454322667519, 0.0072741938614420132, -0.69013368898879235]]], [[[-0.10462047858216028, -0.30097012474135698, -0.050016775782701028, 0.54822125876578376], [0.84395749034726886, -0.53249513893193168, -0.88004100855031275, -0.80779542570577179], [-0.79677629667791683, 0.95096027764472169, 0.63643207567783144, 0.97757008271555401]], [[-0.65415697736192047, -0.97050764835238645, -0.84814693021942777, -0.43855897064286542], [-0.37135308255264543, 0.041120751125186095, 0.036995657114785807, -0.35706630152349828], [-0.0030591331649565401, 0.48192500000712779, 0.18102011879743984, -0.78573775232009435]]], [[[-0.31965876602783605, 0.10351748464331689, 0.067424791069963907, -0.049524027182576535], [-0.5213817364489115, 0.027521683153738818, -0.24734661576641237, 0.24321699964875232], [-0.83947613904690699, 0.77162806253216987, -0.90740945316368071, -0.3420545897410685]], [[0.91845344502663262, -0.70878381509801414, 0.90861837177726379, -0.4013061463136427], [-0.18540388033546473, 0.9254510240675875, 0.30634230347058677, -0.97817133509804033], [-0.43975591131244984, 0.30020642565479139, 0.36841633323637479, 0.3066739733421715]]]]) | |
10079 | ref=-0.978171335098 | |
10080 | res=inf(arg) | |
10081 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10082 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10083 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10084 | def test_inf_constData_rank0(self): | |
10085 | arg=Data(0.0114629834279,self.functionspace) | |
10086 | ref=0.0114629834279 | |
10087 | res=inf(arg) | |
10088 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10089 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10090 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10091 | def test_inf_constData_rank1(self): | |
10092 | arg=Data(numarray.array([-0.13734485813185704, -0.54812466656634307]),self.functionspace) | |
10093 | ref=-0.548124666566 | |
10094 | res=inf(arg) | |
10095 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10096 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10097 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10098 | def test_inf_constData_rank2(self): | |
10099 | arg=Data(numarray.array([[-0.89509582806410015, 0.10780316690435621, -0.93073500763754335, -0.38534759506991545, -0.6935160645644014], [-0.056672310128515813, 0.6285075027787359, 0.73632355512072167, -0.60238897825476267, 0.77403597203864094], [-0.5930215600641755, 0.72623233579382429, -0.32117191475695361, -0.081104170523293773, 0.62137628665436373], [0.2669734570396014, -0.65030905665614136, -0.53589374176691495, -0.48334830355881309, -0.89125004784938211]]),self.functionspace) | |
10100 | ref=-0.930735007638 | |
10101 | res=inf(arg) | |
10102 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10103 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10104 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10105 | def test_inf_constData_rank3(self): | |
10106 | arg=Data(numarray.array([[[0.94493948950092999, 0.13737629155757691], [-0.81599535906086107, -0.35832278646984816]], [[-0.53692839435234041, 0.53679590218669571], [0.038856705021854232, -0.18543838436402926]], [[0.19718168292863836, -0.55405958298613656], [0.16477861536800242, 0.17787953041277582]], [[0.51547288009005165, 0.35889372726595203], [-0.033476505587150873, -0.42142418570614026]], [[0.80507204877418204, -0.79581688922832838], [-0.85909254497735588, 0.66095083521227149]], [[0.46206420953978222, 0.53654696439305005], [0.57618105395776831, -0.22241758047110038]]]),self.functionspace) | |
10107 | ref=-0.859092544977 | |
10108 | res=inf(arg) | |
10109 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10110 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10111 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10112 | def test_inf_constData_rank4(self): | |
10113 | arg=Data(numarray.array([[[[0.50544713768476202, 0.96922321849050874, -0.81524480218696649, -0.36499730379849193], [-0.48131882706974372, 0.026812357207576465, 0.090903267401989618, -0.24742363369877829], [-0.51631372893805438, 0.30410275437953183, -0.75149566289642533, -0.19930300338453599]], [[0.82034878499482788, -0.70904661587698792, -0.27637223434426073, -0.34818734117560401], [0.11686048779802416, -0.76746266142163178, -0.75578186306174833, 0.14509316330390232], [0.1590050723141736, 0.69684384552537937, -0.58747105640080832, -0.28640840371441523]]], [[[0.14956532194045669, 0.081514192262221119, 0.32061383569406399, -0.2444346881437609], [0.79564139071785278, -0.5456680167461434, 0.24722978802719742, 0.28286130725068315], [0.10385207763921711, -0.064749181840278336, 0.21325254547672734, -0.71875644540473838]], [[0.58552496009870802, 0.35472373485671338, -0.18411162994671826, 0.71609038134967773], [-0.20966804574945064, -0.49286619989346314, 0.85116051808632553, -0.94417114370961075], [-0.40434528979823714, 0.62250343758157611, 0.64860074098639742, 0.0043146814280992096]]], [[[-0.14242849200713259, 0.42551908502898095, 0.7691157770973962, -0.37595641162856674], [0.026655444032149589, -0.82186407521644167, 0.40285091480648783, -0.53328831035315982], [-0.12887729257054481, 0.75610663428133451, 0.022049613835531723, 0.59949338706293043]], [[-0.34506254315071772, 0.019719877473602043, 0.10216765908478709, 0.022681548062032153], [0.2228614880408597, 0.26944547311401901, -0.10122095357202965, -0.51019076850180589], [-0.081439546799124463, 0.18829632566943544, 0.12366885442775377, 0.73651436499107814]]]]),self.functionspace) | |
10114 | ref=-0.94417114371 | |
10115 | res=inf(arg) | |
10116 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10117 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10118 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10119 | def test_inf_expandedData_rank0(self): | |
10120 | ||
10121 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
10122 | arg=msk*0.97331285569+(1.-msk)*0.911344578019 | |
10123 | ||
10124 | # arg=Data(0.97331285569,self.functionspace,True) | |
10125 | #arg.setTaggedValue(1,0.97331285569) | |
10126 | res=inf(arg) | |
10127 | ref=0.911344578019 | |
10128 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10129 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10130 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10131 | def test_inf_expandedData_rank1(self): | |
10132 | ||
10133 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
10134 | arg=msk*numarray.array([-0.025782649803792301, 0.15017595667012174])+(1.-msk)*numarray.array([-0.69996944983865683, 0.23286168827412723]) | |
10135 | ||
10136 | # arg=Data(numarray.array([-0.025782649803792301, 0.15017595667012174]),self.functionspace,True) | |
10137 | # arg.setTaggedValue(1,[-0.69996944983865683, 0.23286168827412723]) | |
10138 | res=inf(arg) | |
10139 | ref=-0.699969449839 | |
10140 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10141 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10142 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10143 | def test_inf_expandedData_rank2(self): | |
10144 | ||
10145 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
10146 | arg=msk*numarray.array([[-0.11924617230337731, -0.69281409701569552, 0.8819805848672797, 0.67606672557817737, -0.15719846909292801], [-0.91958498979699277, 0.35156143886023572, -0.66768679685578647, -0.48673444352737993, -0.33274286155542288], [-0.011930486621410052, -0.035661622752792166, 0.8109198510155371, 0.2680383999767102, 0.38679270088753159], [-0.64107995512896321, 0.58836944145799008, -0.55856121453754959, 0.63346354980998365, -0.74990799644898765]])+(1.-msk)*numarray.array([[0.075603512293304975, 0.65374459813382813, -0.68190855977115938, 0.023184369691352069, -0.15500904033575869], [-0.28865053906142646, 0.94679590620919218, -0.53701383780009748, -0.5413294941411595, -0.1693286769782183], [-0.34870739946353968, -0.92230175409787241, -0.95867600429924127, -0.0012605712136730673, 0.33180267589091184], [-0.60152160703395885, 0.3397221706065463, 0.58860878406913142, 0.59589494790106934, -0.96157487116725071]]) | |
10147 | ||
10148 | # arg=Data(numarray.array([[-0.11924617230337731, -0.69281409701569552, 0.8819805848672797, 0.67606672557817737, -0.15719846909292801], [-0.91958498979699277, 0.35156143886023572, -0.66768679685578647, -0.48673444352737993, -0.33274286155542288], [-0.011930486621410052, -0.035661622752792166, 0.8109198510155371, 0.2680383999767102, 0.38679270088753159], [-0.64107995512896321, 0.58836944145799008, -0.55856121453754959, 0.63346354980998365, -0.74990799644898765]]),self.functionspace,True) | |
10149 | # arg.setTaggedValue(1,[[0.075603512293304975, 0.65374459813382813, -0.68190855977115938, 0.023184369691352069, -0.15500904033575869], [-0.28865053906142646, 0.94679590620919218, -0.53701383780009748, -0.5413294941411595, -0.1693286769782183], [-0.34870739946353968, -0.92230175409787241, -0.95867600429924127, -0.0012605712136730673, 0.33180267589091184], [-0.60152160703395885, 0.3397221706065463, 0.58860878406913142, 0.59589494790106934, -0.96157487116725071]]) | |
10150 | res=inf(arg) | |
10151 | ref=-0.961574871167 | |
10152 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10153 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10154 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10155 | def test_inf_expandedData_rank3(self): | |
10156 | ||
10157 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
10158 | arg=msk*numarray.array([[[0.76729109013175933, 0.93446692332588199], [-0.85883010569426133, 0.94426468618035608]], [[0.93376991286356659, -0.31027020688815887], [0.68776369494826284, -0.71422083083074273]], [[0.88895851954297633, -0.0041028262794304826], [-0.56213269421968981, -0.53305350433881493]], [[0.91080353792869873, 0.87460732654624618], [-0.43411934331432445, -0.66454826732696648]], [[-0.7458989571542316, 0.0054889915153857327], [-0.43786572648758848, 0.45559010284736901]], [[0.97274627384999923, 0.28719064869132427], [-0.068944574283213989, 0.92462015394940389]]])+(1.-msk)*numarray.array([[[0.45653716082021401, -0.23702471933521396], [-0.45177153258555913, -0.41351543065221219]], [[0.24913453932538854, -0.29954039408048372], [0.47106013214852771, -0.86663080347446608]], [[-0.75781905181266151, 0.18918623668675538], [-0.66636479853389385, 0.74776214919244066]], [[-0.1199599974824086, 0.90306995612278795], [0.77248429149482201, 0.094536885699270545]], [[-0.5505821492977705, -0.42454185319972981], [-0.035064708067998662, -0.75303714911308206]], [[-0.63966405281134198, -0.5545794126646626], [-0.010523374154368881, -0.6779302443539712]]]) | |
10159 | ||
10160 | # arg=Data(numarray.array([[[0.76729109013175933, 0.93446692332588199], [-0.85883010569426133, 0.94426468618035608]], [[0.93376991286356659, -0.31027020688815887], [0.68776369494826284, -0.71422083083074273]], [[0.88895851954297633, -0.0041028262794304826], [-0.56213269421968981, -0.53305350433881493]], [[0.91080353792869873, 0.87460732654624618], [-0.43411934331432445, -0.66454826732696648]], [[-0.7458989571542316, 0.0054889915153857327], [-0.43786572648758848, 0.45559010284736901]], [[0.97274627384999923, 0.28719064869132427], [-0.068944574283213989, 0.92462015394940389]]]),self.functionspace,True) | |
10161 | # arg.setTaggedValue(1,[[[0.45653716082021401, -0.23702471933521396], [-0.45177153258555913, -0.41351543065221219]], [[0.24913453932538854, -0.29954039408048372], [0.47106013214852771, -0.86663080347446608]], [[-0.75781905181266151, 0.18918623668675538], [-0.66636479853389385, 0.74776214919244066]], [[-0.1199599974824086, 0.90306995612278795], [0.77248429149482201, 0.094536885699270545]], [[-0.5505821492977705, -0.42454185319972981], [-0.035064708067998662, -0.75303714911308206]], [[-0.63966405281134198, -0.5545794126646626], [-0.010523374154368881, -0.6779302443539712]]]) | |
10162 | res=inf(arg) | |
10163 | ref=-0.866630803474 | |
10164 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10165 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10166 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10167 | def test_inf_expandedData_rank4(self): | |
10168 | ||
10169 | msk=whereNegative(self.functionspace.getX()[0]-0.5) | |
10170 | arg=msk*numarray.array([[[[0.59301561766072242, 0.6053289847447505, 0.1720524601196014, 0.4833679091408507], [-0.09424534157102582, 0.91976800441974427, -0.11950945037648264, -0.10547294628619919], [0.045302052907340462, -0.26699801365763864, -0.59100789693502542, 0.8220898248447317]], [[-0.71764117646989489, -0.31097048109028447, -0.36880919201656037, -0.12380648590370025], [0.71171672214402615, -0.87716399369053821, 0.53673002158727501, -0.29732656272582969], [-0.71737153055394787, -0.18861795164190798, -0.55325559014387649, 0.50828072891961451]]], [[[0.7139879661021804, -0.54655602578694507, -0.62738810494945163, -0.71453639471562314], [0.25287437655577372, 0.47571671295036144, -0.86354401602062025, -0.45354287599804666], [0.44863440392806031, -0.64112646326775291, 0.91877609169151908, 0.98277738739744636]], [[-0.23627452345538003, 0.26824331838587279, -0.11255839194272887, 0.62327509528972769], [0.87773514238000572, 0.62819546928589953, 0.53463187163744053, -0.11780048176113112], [0.17743656841726674, -0.47418242507357755, 0.37012543459814751, 0.84217962384585232]]], [[[-0.51615332690558602, -0.32180746309362296, -0.86871747985681558, -0.89347967000489548], [0.79236651642797762, -0.82769899986382356, -0.27503369025221813, 0.70491420567015894], [-0.46319485284379014, -0.71191635366918904, -0.4935498645964489, 0.42096986386791024]], [[-0.95241673224815648, -0.99507534300684708, -0.76759978752396862, -0.1621109099401965], [0.011495974208982407, 0.90547796535927083, -0.79651097416963368, 0.44382172569512224], [-0.11210429012307821, 0.28303519643554576, -0.59783370185364437, 0.75478113456483809]]]])+(1.-msk)*numarray.array([[[[0.70392145790103089, -0.7532260844479588, -0.53422583924595046, 0.29798767877629717], [0.87516135156666075, -0.40276494310086908, -0.070320230959511232, 0.13669067815714553], [0.26690559342737163, -0.0067218741792103298, 0.79272133073277207, -0.90080452301155178]], [[-0.90606808543363915, 0.94927254364127123, -0.15130300474521019, -0.34632615506118936], [0.29908319964670294, -0.71717585217034374, -0.11325472101126977, 0.60911487311528911], [0.055579283773870003, -0.42895625110409941, 0.22788310989168781, 0.50000680777627848]]], [[[-0.56683598589959683, 0.05720680440798942, 0.27949696950971137, 0.028472427888231566], [-0.51619860801944828, 0.73067372155966415, 0.81910302859539108, 0.97736576074434089], [-0.68851989268805447, 0.93303896549540433, -0.21083269397032622, -0.93122611728597304]], [[-0.13573136829275501, -0.30858456571228721, 0.86534434039603658, 0.79114631697533278], [-0.32870753097283112, 0.68472493656951161, -0.071089197922887593, -0.032936485145198757], [0.40875380316397925, -0.27280027645573401, -0.27155299841136848, -0.81500786568603067]]], [[[0.080473457255322733, -0.54931257643900566, 0.19082193004877501, -0.52744293877995374], [0.44447571282767639, -0.0060974808128133606, -0.87810788913565485, -0.92670043304972327], [0.45760340069120065, -0.7504981866011311, -0.95431384972577082, 0.4644557658783679]], [[0.18449401878090566, -0.73315009595487135, -0.59404794479416467, 0.076556365298426687], [0.65441299213898763, -0.91649003079073932, -0.082437357750317686, 0.88150531806538579], [-0.45829076922310796, 0.91236619416957021, -0.91128142664652279, 0.9524897339484899]]]]) | |
10171 | ||
10172 | # arg=Data(numarray.array([[[[0.59301561766072242, 0.6053289847447505, 0.1720524601196014, 0.4833679091408507], [-0.09424534157102582, 0.91976800441974427, -0.11950945037648264, -0.10547294628619919], [0.045302052907340462, -0.26699801365763864, -0.59100789693502542, 0.8220898248447317]], [[-0.71764117646989489, -0.31097048109028447, -0.36880919201656037, -0.12380648590370025], [0.71171672214402615, -0.87716399369053821, 0.53673002158727501, -0.29732656272582969], [-0.71737153055394787, -0.18861795164190798, -0.55325559014387649, 0.50828072891961451]]], [[[0.7139879661021804, -0.54655602578694507, -0.62738810494945163, -0.71453639471562314], [0.25287437655577372, 0.47571671295036144, -0.86354401602062025, -0.45354287599804666], [0.44863440392806031, -0.64112646326775291, 0.91877609169151908, 0.98277738739744636]], [[-0.23627452345538003, 0.26824331838587279, -0.11255839194272887, 0.62327509528972769], [0.87773514238000572, 0.62819546928589953, 0.53463187163744053, -0.11780048176113112], [0.17743656841726674, -0.47418242507357755, 0.37012543459814751, 0.84217962384585232]]], [[[-0.51615332690558602, -0.32180746309362296, -0.86871747985681558, -0.89347967000489548], [0.79236651642797762, -0.82769899986382356, -0.27503369025221813, 0.70491420567015894], [-0.46319485284379014, -0.71191635366918904, -0.4935498645964489, 0.42096986386791024]], [[-0.95241673224815648, -0.99507534300684708, -0.76759978752396862, -0.1621109099401965], [0.011495974208982407, 0.90547796535927083, -0.79651097416963368, 0.44382172569512224], [-0.11210429012307821, 0.28303519643554576, -0.59783370185364437, 0.75478113456483809]]]]),self.functionspace,True) | |
10173 | # arg.setTaggedValue(1,[[[[0.70392145790103089, -0.7532260844479588, -0.53422583924595046, 0.29798767877629717], [0.87516135156666075, -0.40276494310086908, -0.070320230959511232, 0.13669067815714553], [0.26690559342737163, -0.0067218741792103298, 0.79272133073277207, -0.90080452301155178]], [[-0.90606808543363915, 0.94927254364127123, -0.15130300474521019, -0.34632615506118936], [0.29908319964670294, -0.71717585217034374, -0.11325472101126977, 0.60911487311528911], [0.055579283773870003, -0.42895625110409941, 0.22788310989168781, 0.50000680777627848]]], [[[-0.56683598589959683, 0.05720680440798942, 0.27949696950971137, 0.028472427888231566], [-0.51619860801944828, 0.73067372155966415, 0.81910302859539108, 0.97736576074434089], [-0.68851989268805447, 0.93303896549540433, -0.21083269397032622, -0.93122611728597304]], [[-0.13573136829275501, -0.30858456571228721, 0.86534434039603658, 0.79114631697533278], [-0.32870753097283112, 0.68472493656951161, -0.071089197922887593, -0.032936485145198757], [0.40875380316397925, -0.27280027645573401, -0.27155299841136848, -0.81500786568603067]]], [[[0.080473457255322733, -0.54931257643900566, 0.19082193004877501, -0.52744293877995374], [0.44447571282767639, -0.0060974808128133606, -0.87810788913565485, -0.92670043304972327], [0.45760340069120065, -0.7504981866011311, -0.95431384972577082, 0.4644557658783679]], [[0.18449401878090566, -0.73315009595487135, -0.59404794479416467, 0.076556365298426687], [0.65441299213898763, -0.91649003079073932, -0.082437357750317686, 0.88150531806538579], [-0.45829076922310796, 0.91236619416957021, -0.91128142664652279, 0.9524897339484899]]]]) | |
10174 | res=inf(arg) | |
10175 | ref=-0.995075343007 | |
10176 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10177 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | |
10178 | ||
10179 | ||
10180 | class Test_util_reduction_with_tagged_data(Test_util_base): | |
10181 | """ | |
10182 | test for reduction operation Lsup,sup,inf with tagged data only | |
10183 | """ | |
10184 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
10185 | def test_Lsup_taggedData_rank0(self): | def test_Lsup_taggedData_rank0(self): |
10186 | arg=Data(0.860813503322,self.functionspace) | arg=Data(0.860813503322,self.functionspace) |
10187 | arg.setTaggedValue(1,0.860813503322) | arg.setTaggedValue(1,0.086081350332) |
10188 | res=Lsup(arg) | res=Lsup(arg) |
10189 | ref=0.860813503322 | ref=0.860813503322 |
10190 | self.failUnless(isinstance(res,float),"wrong type of result.") | self.failUnless(isinstance(res,float),"wrong type of result.") |
# | Line 10265 class Test_util_with_tagged_Data(Test_ut | Line 10301 class Test_util_with_tagged_Data(Test_ut |
10301 | ref=0.997207317201 | ref=0.997207317201 |
10302 | self.failUnless(isinstance(res,float),"wrong type of result.") | self.failUnless(isinstance(res,float),"wrong type of result.") |
10303 | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") | self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result") |
10304 | ||
10305 | ||
10306 | class Test_util_reduction(Test_util_reduction_no_tagged_data,Test_util_reduction_with_tagged_data): | |
10307 | """ | |
10308 | test for reduction operation Lsup,sup,inf for all data types | |
10309 | """ | |
10310 | pass | |
10311 | ||
10312 | class Test_util_unary_no_tagged_data(Test_util_base): | |
10313 | """ | |
10314 | test for unary operations. No tagged data are tested. | |
10315 | """ | |
10316 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10317 | def test_log10_float_rank0(self): | |
10318 | arg=52.2519689858 | |
10319 | res=log10(arg) | |
10320 | ref=1.7181026604 | |
10321 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10322 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10323 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10324 | def test_log10_array_rank0(self): | |
10325 | arg=numarray.array(45.1686859861) | |
10326 | res=log10(arg) | |
10327 | ref=numarray.array(1.65483745657) | |
10328 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10329 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
10330 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10331 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10332 | def test_log10_array_rank1(self): | |
10333 | arg=numarray.array([13.954560287699826, 23.475641658812407]) | |
10334 | res=log10(arg) | |
10335 | ref=numarray.array([1.1447161562933539, 1.3706174716547848]) | |
10336 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10337 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
10338 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10339 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10340 | def test_log10_array_rank2(self): | |
10341 | arg=numarray.array([[25.915081952650038, 58.337204652970946, 15.450038105653986, 38.930671788011558, 87.005181288770302], [3.6208586171272144, 84.49833125689257, 69.261223337588021, 54.98351177434435, 58.379918137373565], [99.26000663643724, 45.338259591938282, 53.685949933590322, 95.061307572866596, 47.187722694142664], [5.6737763969659527, 44.873622862711144, 97.056192800604094, 55.273029732289778, 85.494701869969745]]) | |
10342 | res=log10(arg) | |
10343 | ref=numarray.array([[1.4135525865703951, 1.7659456151718125, 1.1889295548970895, 1.5902918979721861, 1.9395451162751614], [0.55881156734663273, 1.9268481322268585, 1.8404901580778943, 1.7402324746037254, 1.7662634816675511], [1.9967742998978548, 1.6564648447687793, 1.7298606420366613, 1.9780037837413516, 1.6738290185543834], [0.75387221628934742, 1.6519911336241999, 1.9870232513506001, 1.7425132706239763, 1.9319392022143682]]) | |
10344 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10345 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
10346 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10347 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10348 | def test_log10_array_rank3(self): | |
10349 | arg=numarray.array([[[61.549373713195962, 41.673709308293191], [18.017632188926811, 13.171469559653669]], [[50.290930361991521, 14.626533261319382], [15.969153538380304, 56.425345549785291]], [[90.382517465043676, 98.988183466908609], [33.988560486114899, 61.488838120931966]], [[27.205433883156655, 77.280843084053075], [42.537512400205529, 20.752110100745131]], [[2.7510631963546697, 37.227526331006125], [17.709630263115471, 77.944115343628809]], [[15.848941645935733, 77.546800032084079], [44.6765341255255, 59.885570390022544]]]) | |
10350 | res=log10(arg) | |
10351 | ref=numarray.array([[[1.7892236381887503, 1.6198621580149473], [1.2556977170065395, 1.1196342325201316]], [[1.7014896699685444, 1.1651414030979794], [1.203281896517113, 1.7514742273848101]], [[1.9560844337638301, 1.9955833545833324], [1.5313327713445872, 1.7887962867926523]], [[1.434655656599509, 1.8880718513054029], [1.6287720887060415, 1.3170622629043851]], [[0.43950056694834205, 1.5708641794769067], [1.2482094942016551, 1.8917833322219468]], [[1.2000002663849119, 1.8895638813619857], [1.6500794744582843, 1.7773221904207173]]]) | |
10352 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10353 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
10354 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10355 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10356 | def test_log10_array_rank4(self): | |
10357 | arg=numarray.array([[[[49.041458121649541, 12.453861805081642, 22.352539133207308, 35.856582214340698], [47.729104473308858, 67.27333693612141, 48.837394467178136, 9.6698413270700367], [64.583260503019162, 46.411663014624139, 85.71255093334365, 36.363958914509439]], [[80.036726405255635, 40.387280979035751, 15.276817994504155, 59.062184549366151], [59.167871518749848, 21.930421722965473, 0.23764880334288624, 24.921348290633865], [35.111521136514753, 93.225181218111516, 48.850751790389111, 51.591988234960553]]], [[[47.509673966789677, 54.481428169403792, 36.464944550283505, 90.799221097408463], [46.169280587237125, 47.324905848019064, 87.626395482722373, 98.929522440449787], [61.773097039759605, 82.412988902042329, 4.5402354395996527, 41.873043607198412]], [[36.545836359312922, 49.472492642337876, 54.796411622124296, 9.1573852487394394], [94.483164799633187, 59.013891170601127, 81.50036423642824, 4.9151253236939265], [53.788789868327207, 58.332866884869581, 96.756911476142037, 37.843173549368686]]], [[[80.58432601195986, 21.263772240505372, 63.6235430125706, 35.501558596702829], [5.6711036927454339, 74.217470766535399, 40.89063067086159, 30.690400010085241], [35.999004111325121, 20.274838444258663, 70.564641379269005, 99.740954368148309]], [[31.256278345889452, 17.526864558417355, 12.375337394164927, 31.216749887776125], [31.235942054585749, 4.4714795388662898, 16.839093071461757, 98.544202438777774], [7.1017853296580133, 80.078083678719835, 33.756128516966982, 25.658869355266614]]]]) | |
10358 | res=log10(arg) | |
10359 | ref=numarray.array([[[[1.6905633743319768, 1.0953040422410532, 1.3493268638843343, 1.5545688910211573], [1.6787832859072254, 1.8278429703764396, 1.6887524857660539, 0.98541934778069684], [1.8101199667066123, 1.6666271302620568, 1.9330444205462154, 1.5606711584094208]], [[1.9032893171804688, 1.6062446158451591, 1.1840329045447144, 1.771309506296336], [1.7720859464227217, 1.3410469832596377, -0.62406436821075306, 1.3965715347504626], [1.5454496448138082, 1.969533236248409, 1.6888712516966586, 1.7125822648927624]]], [[[1.6767820501011672, 1.7362484835956555, 1.5618755574979692, 1.9580821230304646], [1.6643531073987192, 1.6750897586162579, 1.9426349473298661, 1.9953259126255949], [1.7907993755575464, 1.9159956651428329, 0.65707837432577154, 1.6219345294073721]], [[1.5628379052561994, 1.6943637925865513, 1.738752119365097, 0.96177148522339684], [1.9753544319382004, 1.7709542514498018, 1.9111595496665708, 0.69153459575815146], [1.7306917737033041, 1.7659133212214235, 1.98568199703713, 1.5779875494313049]]], [[[1.9062505779281724, 1.3276403118294007, 1.8036178500584357, 1.5502474199590055], [0.75366758817392854, 1.8705061500821059, 1.6116238088855386, 1.4870025489414542], [1.5562904864634381, 1.3069574023136983, 1.8485871387211481, 1.998873519435157]], [[1.4949372657476212, 1.2437042305963351, 1.0925570481249276, 1.4943876847840263], [1.4946546085032237, 0.65045124779595043, 1.2263186973378477, 1.9936310789157055], [0.85136754045869678, 1.9035136716426462, 1.5283526316700879, 1.4092375155000518]]]]) | |
10360 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10361 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
10362 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10363 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10364 | def test_log10_constData_rank0(self): | |
10365 | arg=Data(32.7103924665,self.functionspace) | |
10366 | res=log10(arg) | |
10367 | ref=Data(1.51468575492,self.functionspace) | |
10368 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10369 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10370 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10371 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10372 | def test_log10_constData_rank1(self): | |
10373 | arg=Data(numarray.array([38.13113991980368, 3.9574358995083889]),self.functionspace) | |
10374 | res=log10(arg) | |
10375 | ref=Data(numarray.array([1.5812797885802696, 0.59741388911487381]),self.functionspace) | |
10376 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10377 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10378 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10379 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10380 | def test_log10_constData_rank2(self): | |
10381 | arg=Data(numarray.array([[94.835349573618515, 17.653263208696131, 62.502954853493407, 19.234729096475913, 43.672005218091151], [15.048159867737148, 98.672070942815608, 52.576472580061754, 49.935023943546007, 26.60036022461162], [6.721528672936774, 75.440376910024227, 63.249503917897741, 63.687804000958671, 32.436637160710369], [68.994703422400121, 20.092325091226218, 54.808697863191284, 46.361425111883918, 79.716043096984109]]),self.functionspace) | |
10382 | res=log10(arg) | |
10383 | ref=Data(numarray.array([[1.9769702493968937, 1.2468249965531741, 1.7959005492838003, 1.28408607404631, 1.6402031331890035], [1.1774833963984679, 1.9941942433294959, 1.7207914453990389, 1.6984052624540111, 1.4248875179281264], [0.82746805560156844, 1.8776038495269229, 1.8010571235780615, 1.804056274373053, 1.5110358227817056], [1.8388157521471691, 1.3030301963730122, 1.7388494842917164, 1.6661567773501147, 1.9015457332824068]]),self.functionspace) | |
10384 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10385 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10386 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10387 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10388 | def test_log10_constData_rank3(self): | |
10389 | arg=Data(numarray.array([[[60.505360366376287, 95.665159725837654], [45.535060469642595, 8.7120300613775825]], [[85.791369386166309, 55.438032107346338], [38.874954040860693, 0.032497264299415379]], [[56.341710995337245, 51.491208922462491], [88.530577620189433, 12.245118647390212]], [[2.7511376879554934, 34.207282964733224], [30.122953960922267, 38.812210597586919]], [[86.660286634007576, 99.90443738735307], [17.396122538609294, 56.668511719223552]], [[36.718231261528388, 50.782102049171812], [88.979825368021281, 69.352170891166125]]]),self.functionspace) | |
10390 | res=log10(arg) | |
10391 | ref=Data(numarray.array([[[1.7817938519155039, 1.9807538009560601], [1.658345917646564, 0.9401193653092289]], [[1.9334436000107917, 1.7438078056569788], [1.5896698885992053, -1.4881531974726712]], [[1.7508300315839129, 1.7117330884128066], [1.9470932977951618, 1.0879629975176723]], [[0.43951232634857773, 1.5341185801691359], [1.4788975580341073, 1.5889683792252702]], [[1.9378201211553368, 1.999584778416601], [1.2404524581824454, 1.7533418069486038]], [[1.5648817528162677, 1.7057106738803878], [1.9492915490656653, 1.8410600600927651]]]),self.functionspace) | |
10392 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10393 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10394 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10395 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10396 | def test_log10_constData_rank4(self): | |
10397 | arg=Data(numarray.array([[[[7.1178859886623451, 14.637867086244679, 36.35859711294826, 37.7723554870581], [44.508345724124766, 25.973407994350175, 49.071421558624728, 42.354776612571754], [91.85968925895304, 94.407818198616539, 43.315126893833394, 75.615056315689174]], [[6.2918566984022908, 13.126791472139409, 5.4081624176919272, 67.758267396244534], [6.3749374576688131, 28.038450788587877, 57.310863148910528, 40.510465526946518], [93.706477842024938, 56.835264912992365, 40.743079267474769, 55.242148230373495]]], [[[83.448958312190257, 44.295439593214205, 2.2473909991848409, 76.158191501497342], [89.137647290369543, 55.865574608149423, 34.00060537625113, 37.86772086689443], [12.457637095864028, 82.46283305226747, 8.2656512835811657, 64.122937473337672]], [[54.25835998622415, 31.151251379554999, 71.605899030813731, 23.688427104278972], [93.960338747791468, 24.330099432103534, 39.06736609968543, 33.657862341058689], [4.584970065153624, 11.444794976152613, 92.427741892222471, 86.464234082604506]]], [[[73.237800540520212, 40.200704386760357, 61.394401252086411, 10.275754214437864], [77.622206392059113, 6.1972834106359214, 63.472374671706035, 80.460731554212771], [75.404584514400938, 93.73627374151657, 66.710853225948313, 60.813357606195645]], [[45.25139607197994, 74.577688908930867, 95.208049640850376, 14.393702972960131], [65.862630893385798, 71.877942440445722, 27.710516935466455, 70.580992209569118], [67.600547228807855, 78.088363930903228, 38.219137036754042, 28.047017615696081]]]]),self.functionspace) | |
10398 | res=log10(arg) | |
10399 | ref=Data(numarray.array([[[[0.85235102737513713, 1.1654777993891423, 1.5606071177331162, 1.5771740683100366], [1.6484414528258733, 1.4145289375397965, 1.6908286393162306, 1.6269023955286619], [1.9631249719620456, 1.9750079610345306, 1.636639591024321, 1.8786082799426707]], [[0.79877882269221356, 1.1181585862396579, 0.73304972584189554, 1.8309622923953988], [0.80447592841225835, 1.4477540138397433, 1.7582369493404233, 1.6075672339172933], [1.9717696143008383, 1.7546178886111818, 1.6100538488746503, 1.7422705588721348]]], [[[1.9214209197798999, 1.6463590160322708, 0.35167863717923287, 1.8817166224792843], [1.9500611670813865, 1.7471442700825282, 1.5314866496665132, 1.5782691671562759], [1.0954356752650989, 1.9162582511278587, 0.91727707904742606, 1.8070134091786803]], [[1.7344666626342538, 1.4934754974259916, 1.8549488017910998, 1.3745362248168791], [1.9729445738360003, 1.386143883806513, 1.5918141323168808, 1.527086529852433], [0.66133650454670789, 1.0586080170609664, 1.9658023428913385, 1.9368364987628319]]], [[[1.8647352932012256, 1.6042336627512135, 1.788128768271634, 1.0118137078374039], [1.8899859832929091, 0.79220135751176601, 1.8025847467388194, 1.9055839768869141], [1.8773977512912479, 1.9719076852022974, 1.8241964952763503, 1.7839989821922779]], [[1.6556319823700489, 1.872608920864252, 1.9786736686240998, 1.1581725363856989], [1.8186390746853227, 1.8565956366123635, 1.442644627555113, 1.8486877592678144], [1.8299502115849742, 1.8925863237992646, 1.5822808767428842, 1.4478866872710365]]]]),self.functionspace) | |
10400 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10401 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10402 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10403 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10404 | def test_log10_expandedData_rank0(self): | |
10405 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10406 | arg=msk_arg*(96.1097445547)+(1.-msk_arg)*(15.7194730216) | |
10407 | res=log10(arg) | |
10408 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10409 | ref=msk_ref*(1.98276742296)+(1.-msk_ref)*(1.19643798269) | |
10410 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10411 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10412 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10413 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10414 | def test_log10_expandedData_rank1(self): | |
10415 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10416 | arg=msk_arg*numarray.array([67.188570100204331, 83.852182235203458])+(1.-msk_arg)*numarray.array([12.970539131997421, 55.494059090853888]) | |
10417 | res=log10(arg) | |
10418 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10419 | ref=msk_ref*numarray.array([1.8272953985804494, 1.9235143695106758])+(1.-msk_ref)*numarray.array([1.112958028295743, 1.7442464922729273]) | |
10420 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10421 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10422 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10423 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10424 | def test_log10_expandedData_rank2(self): | |
10425 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10426 | arg=msk_arg*numarray.array([[45.930333300115343, 70.753859497865847, 22.04664793382257, 79.15163171404815, 75.405024274312993], [93.445968445291669, 30.36616470571791, 6.5043375890994559, 31.426752793912506, 21.34925350080275], [55.608242339925667, 60.535785665483225, 34.569731451078027, 21.386089927826287, 3.9072078681127631], [19.365485690555648, 32.043862755374363, 58.335981689330417, 80.08022377912441, 29.309322772405462]])+(1.-msk_arg)*numarray.array([[25.745723389769719, 64.392268446036255, 85.501520058738976, 45.362572337757612, 97.503453294299518], [2.8517470840863286, 14.034055548650054, 33.880935693055591, 29.696281993337909, 92.433531843558612], [37.125936326201604, 37.497435106305446, 91.813274646371681, 77.728476618025766, 45.331358346905688], [71.362205298919307, 94.671089912047734, 25.688825508752888, 56.379550500341139, 4.1755783242915809]]) | |
10427 | res=log10(arg) | |
10428 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10429 | ref=msk_ref*numarray.array([[1.6620995969501617, 1.849750134838158, 1.3433425668419521, 1.898459872288744, 1.8774002840914414], [1.9705605692811208, 1.4823899433069487, 0.81320307398795078, 1.4972995093490966, 1.3293826940612745], [1.7451391681548531, 1.7820121832883282, 1.5386960058146677, 1.3301313886858133, 0.59186651682317182], [1.2870283936579181, 1.5057448629748622, 1.7659365106572738, 1.9035252780814409, 1.4670057836514949]])+(1.-msk_ref)*numarray.array([[1.410705098912199, 1.8088337249250597, 1.9319738357486911, 1.6566976737600356, 1.9890199974431519], [0.45511100615307598, 1.1471831911912613, 1.5299553957767158, 1.47270207858137, 1.9658295475498999], [1.5696774154882256, 1.5740015622004013, 1.9629054773764056, 1.8905801561543689, 1.6563987328183856], [1.853468262533325, 1.9762173770124165, 1.4097442488078882, 1.7511216090311554, 0.62071663446741465]]) | |
10430 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10431 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10432 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10433 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10434 | def test_log10_expandedData_rank3(self): | |
10435 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10436 | arg=msk_arg*numarray.array([[[22.388258065770664, 51.715962865840815], [65.432613978623507, 8.3209401983813631]], [[88.431488726297857, 89.785784570369586], [3.2671698372353806, 14.647277245749521]], [[68.153001107883583, 19.918374467307398], [62.741803756290338, 32.019573139182008]], [[67.165624226669038, 2.8759095839159929], [73.719522685630153, 94.724688180711894]], [[48.844734513795146, 28.150257589983699], [42.654320101950383, 50.476435941718051]], [[37.462663753206783, 82.654691621504796], [52.152313992909285, 3.1027027366472075]]])+(1.-msk_arg)*numarray.array([[[1.8076283580543755, 4.753292603600527], [6.7876691754431446, 88.85524686992207]], [[20.447379893795944, 10.467051425047025], [48.020952347676165, 29.139882960928777]], [[32.353404155614214, 49.731545888765915], [50.076198518791642, 12.61911728105847]], [[50.812406051522565, 24.959142420006426], [32.119283687346766, 27.446174244224839]], [[78.480705204997335, 51.479031400667225], [80.539043834605735, 72.176036709299979]], [[65.812691581415578, 73.827132926837777], [61.203847954462837, 57.906796690274135]]]) | |
10437 | res=log10(arg) | |
10438 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10439 | ref=msk_ref*numarray.array([[[1.3500203043046504, 1.7136246149415175], [1.8157942703490402, 0.92017240079787166]], [[1.9466069363367877, 1.953207581975233], [0.51417171098507863, 1.1657569020250118]], [[1.8334849846886128, 1.2992538928886661], [1.7975570000190917, 1.5054155379351397]], [[1.8271470553686036, 0.45877522808649995], [1.86758251461448, 1.9764631843179037]], [[1.6888177534210882, 1.4494823732334281], [1.6299630238135752, 1.7030886824981748]], [[1.573598654304283, 1.9172675099038647], [1.7172735827923957, 0.49174016874627252]]])+(1.-msk_ref)*numarray.array([[[0.25710914591980127, 0.6769945494552323], [0.83172066706037573, 1.9486830778292807]], [[1.3106376658608263, 1.0198243578793709], [1.6814307686997538, 1.4644878031125961]], [[1.5099199829403827, 1.6966319593433428], [1.6996313524512594, 1.1010289766693471]], [[1.7059697599596824, 1.397229659189178], [1.5067658512361108, 1.4384818161662032]], [[1.8947628968344679, 1.711630366878371], [1.9060064693262986, 1.8583930306392809]], [[1.8183096527670626, 1.8682160029445969], [1.7867787275843738, 1.7627295411341]]]) | |
10440 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10441 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10442 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10443 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10444 | def test_log10_expandedData_rank4(self): | |
10445 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10446 | arg=msk_arg*numarray.array([[[[51.471579704080902, 1.402847457439917, 48.558207798874633, 89.648969258612524], [86.525832839744794, 67.293178311636296, 36.293476074354814, 28.027447132690767], [10.633474820618499, 52.422445043400536, 16.892564122675008, 91.588281668647483]], [[69.006862669320284, 50.632932996111499, 20.819307520773513, 31.458894256989172], [34.054758838486975, 67.499730360187598, 74.656828581187256, 25.901320636052535], [69.566935512371245, 69.265794475105736, 49.758452930544813, 28.779752034461762]]], [[[72.22373251870431, 78.006053500246296, 31.060760583589399, 13.641516246702956], [19.276675259486392, 50.172392044390563, 63.569136215761631, 41.789254015859484], [77.72177399967164, 17.666602305012276, 46.52250820815128, 99.530462341866837]], [[77.258789628594741, 13.343315652586506, 70.821037532780295, 52.515534097664812], [78.878814482604369, 32.375661085180987, 46.503085042716158, 45.997964823991765], [12.861656668310804, 1.89832465373334, 25.450959358908168, 91.571383479978465]]], [[[1.2791555124757796, 61.193118582110273, 75.060163212570316, 55.342467763428438], [71.762210006922828, 84.536864679041486, 73.714524745683775, 11.850589611465555], [75.639151162482378, 64.29578756080727, 33.11720623917023, 37.534286641607828]], [[45.364350792710475, 93.649088149678789, 32.500785342140865, 3.4368793436320275], [19.133668646879922, 58.565788824469315, 98.054154704002983, 23.793410565976142], [77.647872455877192, 54.998750332692239, 19.370566893444124, 63.765617721508789]]]])+(1.-msk_arg)*numarray.array([[[[63.565214992977019, 60.995683199558883, 10.071281252885441, 99.995081907465718], [41.291004315699134, 3.2589259834977984, 64.44648163924586, 36.675923847946201], [53.577021195107271, 66.247159776521869, 11.509715616484302, 32.399165283870758]], [[25.855485901204684, 43.242105604769712, 13.014136372280724, 59.917489517777284], [72.87071809369273, 47.58552363917326, 25.297863133765659, 42.034501839579164], [94.309551997346077, 68.920541976900637, 1.692465072456105, 75.023262610656431]]], [[[63.471572962233353, 64.798741064964048, 43.72068323448616, 8.6997778638889542], [94.546430747727896, 88.016904759109764, 14.58256144742673, 74.45351675626388], [52.003630381495853, 38.537771628548576, 69.220538944397731, 25.695279099495448]], [[83.306032767743361, 47.257525060077683, 79.090659443546016, 86.984706241324432], [32.514084780833812, 41.274617166342345, 81.606897997605458, 40.058066677423589], [16.582991113576046, 26.477777900260783, 70.754349706548751, 36.162958070109205]]], [[[70.623876696227569, 88.724541508204311, 35.433617134818753, 24.504940423114135], [79.892676517300728, 54.161986455126332, 21.400020573937091, 45.043365143126863], [65.200095846905569, 45.852516046794086, 13.178288768375849, 66.486188034920545]], [[36.310614216780785, 59.353182927411325, 93.107604989020089, 34.366396717715467], [45.413466526703367, 0.13231504642780872, 85.586369506934446, 56.883390161446918], [34.343943871748365, 91.343033836337057, 8.5221756532344575, 80.981820970431841]]]]) | |
10447 | res=log10(arg) | |
10448 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10449 | ref=msk_ref*numarray.array([[[[1.7115674973008292, 0.14701044936490915, 1.6862626492899628, 1.9525453006146518], [1.9371457882142409, 1.8279710408692522, 1.5598285655445743, 1.4475835420458216], [1.0266752070276506, 1.7195172730793549, 1.227695576143472, 1.9618399110892391]], [[1.8388922830736614, 1.7044330853392986, 1.318466280174116, 1.4977434536169738], [1.5321778091382223, 1.8293020379670764, 1.8730695371715311, 1.4133219081093693], [1.8424028727067936, 1.8405188199206457, 1.6968668689863722, 1.4590870477476021]]], [[[1.8586799289868094, 1.8921283065333185, 1.4922120860741765, 1.1348626445857921], [1.2850321311761868, 1.700464807165174, 1.8032463102305676, 1.6210646185787188], [1.890542704813432, 1.2471530326945834, 1.6676631211809771, 1.9979560214717456]], [[1.8879479000068351, 1.1252637599178532, 1.8501622849109463, 1.7202877867394817], [1.8969603747078481, 1.5102186451268347, 1.6674817652036087, 1.6627386167845508], [1.1092969122559071, 0.27837048800046127, 1.4057041574557758, 1.9617597756499436]]], [[[0.10692334674954952, 1.7867025866905135, 1.8754095044181454, 1.743058520763453], [1.8558958048831982, 1.9270461365869012, 1.867553069886098, 1.0737399586698149], [1.8787466464617588, 1.8081825203732931, 1.5200536926633199, 1.5744281662911923]], [[1.6567147000879612, 1.9715035530567897, 1.5118938553061785, 0.53616428590079812], [1.2817982486650861, 1.7676439971874796, 1.9914660001128803, 1.3764566986081392], [1.8901295606012043, 1.7403528216800304, 1.2871423308426, 1.8045865712170828]]]])+(1.-msk_ref)*numarray.array([[[[1.8032195202182379, 1.7852991001099465, 1.0030847243432686, 1.9999786404702637], [1.6158554462910679, 0.51307449691082996, 1.8091992126689456, 1.5643810623111436], [1.7289785637983148, 1.8211672634416693, 1.0610645931591225, 1.5105338214017157]], [[1.4125527038651586, 1.635906833067311, 1.1144153532983052, 1.7775536085729702], [1.8625530492364937, 1.6774748527239138, 1.4030838386300655, 1.6236059048612139], [1.974555681811033, 1.838348683991484, 0.22851971487795045, 1.8751959468180956]]], [[[1.8025792611996256, 1.8115665683111739, 1.6406869401634994, 0.93950816368541279], [1.9756451383018918, 1.9445660919061505, 1.1638338151190002, 1.871885216148214], [1.7160336628581898, 1.5858865988143969, 1.8402349763459562, 1.4098533393090875]], [[1.9206764528218314, 1.6744709733078493, 1.8981251966246733, 1.9394429011373768], [1.5120715338251509, 1.6156830537503111, 1.9117268699754428, 1.6026899851076344], [1.2196628680091728, 1.422881534916125, 1.8497531437791539, 1.5582639478260578]]], [[[1.8489515532379794, 1.948043763770869, 1.5494154882493205, 1.3892536509847744], [1.9025069708797608, 1.7336945842346827, 1.3304141908792402, 1.653630828745982], [1.8142482341636932, 1.6613631715274912, 1.1198590197647234, 1.8227314335250477]], [[1.5600335953381868, 1.7734440137833716, 1.9689851554161102, 1.5361339991826606], [1.6571846539810831, -0.87839076647757686, 1.9324046044051812, 1.7549854717676672], [1.5358501657051966, 1.9606754320191659, 0.93055048133642204, 1.9083875381587312]]]]) | |
10450 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10451 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10452 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10453 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10454 | def test_log10_Symbol_rank0(self): | |
10455 | arg=Symbol(shape=()) | |
10456 | res=log10(arg) | |
10457 | s=numarray.array(3.30130672789) | |
10458 | sub=res.substitute({arg:s}) | |
10459 | ref=numarray.array(0.518685876964) | |
10460 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10461 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10462 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10463 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10464 | def test_log10_Symbol_rank1(self): | |
10465 | arg=Symbol(shape=(2,)) | |
10466 | res=log10(arg) | |
10467 | s=numarray.array([80.781942827080286, 19.173714117161172]) | |
10468 | sub=res.substitute({arg:s}) | |
10469 | ref=numarray.array([1.9073142938566714, 1.2827062476902695]) | |
10470 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10471 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10472 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10473 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10474 | def test_log10_Symbol_rank2(self): | |
10475 | arg=Symbol(shape=(4, 5)) | |
10476 | res=log10(arg) | |
10477 | s=numarray.array([[12.87178302719602, 68.894041539222059, 67.550533437690731, 65.121963561659555, 17.165986405555117], [70.260037949797564, 84.846330525471089, 33.94378182270269, 71.878916358185535, 48.565558946072912], [22.693372717603474, 21.936741520835913, 90.32217067645739, 70.411674261453342, 6.3690942522773053], [18.813716565135767, 44.357013040228409, 20.907360810094122, 4.6004533917390633, 16.782614506943588]]) | |
10478 | sub=res.substitute({arg:s}) | |
10479 | ref=numarray.array([[1.1096387104814578, 1.8381816625674801, 1.829628782938076, 1.8137274869538904, 1.2346687642535261], [1.8467083800330524, 1.9286330644851621, 1.5307602272931806, 1.8566015210912505, 1.6863283914409721], [1.3558990460740996, 1.3411721180145617, 1.9557943662672153, 1.8476446711733261, 0.80407767578801104], [1.2744745969481517, 1.6469622934775219, 1.3202992141685685, 0.66280063512227227, 1.224859619036704]]) | |
10480 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10481 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10482 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10483 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10484 | def test_log10_Symbol_rank3(self): | |
10485 | arg=Symbol(shape=(6, 2, 2)) | |
10486 | res=log10(arg) | |
10487 | s=numarray.array([[[97.677455398657074, 5.2995923723645664], [59.480459383312862, 31.287029167765699]], [[71.178947786444226, 80.741319028685012], [4.6937684226740757, 82.77854206239293]], [[37.685161012781009, 98.687319373999358], [35.10949192866029, 91.569084058538095]], [[5.0027662267064468, 91.014241654301969], [58.955781232044089, 42.084452128968486]], [[42.095754738844363, 65.010819895554334], [1.5796236582104439, 21.735792752471603]], [[2.7216077761134634, 94.934790022180749], [48.226002781175161, 39.974953444592217]]]) | |
10488 | sub=res.substitute({arg:s}) | |
10489 | ref=numarray.array([[[1.9897943372521787, 0.72424246634779432], [1.7743743140339689, 1.4953643270547985]], [[1.852351563691448, 1.9070958399739759], [0.67152165892347482, 1.9179177731177302]], [[1.5761703751687193, 1.9942613524700676], [1.5454245448120962, 1.9617488700750414]], [[0.69921020929486732, 1.9591093548259275], [1.7705263986434625, 1.6241216777418199]], [[1.6242383004328855, 1.8129856432563642], [0.19855362959306125, 1.3371754844967376]], [[0.4348255371262037, 1.9774253941539486], [1.683281266856163, 1.6017879666329446]]]) | |
10490 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10491 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10492 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10493 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10494 | def test_log10_Symbol_rank4(self): | |
10495 | arg=Symbol(shape=(3, 2, 3, 4)) | |
10496 | res=log10(arg) | |
10497 | s=numarray.array([[[[16.045040740457228, 44.206338348310695, 93.40651696252057, 41.363358895057978], [63.003183559801194, 42.521563748415652, 8.6993137819993134, 74.382838127848629], [45.459960205898135, 80.856347298703682, 44.432638407790726, 19.227764687502933]], [[83.760984274338924, 85.653170708807224, 70.695307663592047, 93.459124905553011], [12.593602001874332, 15.823926028904745, 56.197268657756482, 72.264399830277114], [79.814475892193883, 72.335551687072851, 38.67162462451919, 72.957787867770691]]], [[[63.261177157590048, 19.106157472979373, 12.579604590358606, 57.238626886098317], [37.258243564126879, 80.6564043172623, 17.791453176791894, 72.593744868798936], [51.784094386303515, 71.1225086541086, 52.470521860231401, 37.515182918884939]], [[60.054478935403843, 64.171538197777366, 59.343629062665904, 78.932915989720726], [71.684640978389197, 17.296300300660835, 66.710626043564787, 29.599576157916399], [82.750620535499948, 68.051253095052544, 47.140766487889351, 64.511627295078895]]], [[[63.303786699612154, 6.3288524584968009, 7.8921294047783288, 16.867328761433935], [26.792013647404634, 56.632884251794707, 15.19584760573529, 47.669107257961393], [14.796650879616557, 93.976599541985081, 83.095541055174948, 69.492537636920886]], [[13.729968603614751, 0.47465429532443348, 96.901076881373811, 53.206407481750915], [38.296922736957285, 64.554310808840825, 44.872698720823387, 44.966755775657276], [39.450963126141424, 45.816408715888691, 24.156240302619725, 88.251967910885227]]]]) | |
10498 | sub=res.substitute({arg:s}) | |
10499 | ref=numarray.array([[[[1.2053408241634207, 1.6454845433840053, 1.9703771779659067, 1.6166157982280229], [1.7993624949698093, 1.6286092275074269, 0.93948499601574675, 1.8714727451408386], [1.6576290512225109, 1.9077141181026729, 1.6477021023906282, 1.2839287985229535]], [[1.923041772090109, 1.9327434443108824, 1.8493905888543518, 1.970621710237741], [1.1001499640874481, 1.1993142440892028, 1.7497152081724321, 1.8589244001304135], [1.9020816661621307, 1.8593517980783829, 1.5873924174995711, 1.8630716574011561]]], [[[1.8011372689627134, 1.2811733528802767, 1.0996669903203637, 1.7576892067973247], [1.5712223774419329, 1.9066388571461961, 1.2502114219955252, 1.8608992007827503], [1.7141963855944065, 1.85200706679542, 1.7199153836168972, 1.574207068351656]], [[1.7785454031526147, 1.807342449495341, 1.7733741013623185, 1.8972581470832404], [1.855426114484128, 1.237953216953114, 1.8241950162932645, 1.4712854923563716], [1.9177712591744391, 1.8328361267069659, 1.673396639680764, 1.8096379970383623]]], [[[1.8014296893784714, 0.80132497129351055, 0.89719419762936958, 1.22704630985494], [1.428005355754228, 1.7530686803399524, 1.1817249295049448, 1.6782370185817173], [1.1701634269423968, 1.9730197264193245, 1.9195777199683672, 1.8419381709626483]], [[1.1376695441346099, -0.32362258467939325, 1.9863286034804823, 1.7259639361747965], [1.5831638786148206, 1.8099252488949431, 1.6519821895312212, 1.6528915555787334], [1.5960576102136967, 1.6610210443470965, 1.3830293412534942, 1.9457243984033095]]]]) | |
10500 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10501 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10502 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10503 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10504 | def test_wherePositive_float_rank0(self): | |
10505 | arg=-70.4202098913 | |
10506 | res=wherePositive(arg) | |
10507 | ref=0.0 | |
10508 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10509 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10510 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10511 | def test_wherePositive_array_rank0(self): | |
10512 | arg=numarray.array(-15.0739210922) | |
10513 | res=wherePositive(arg) | |
10514 | ref=numarray.array(0.0) | |
10515 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10516 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
10517 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10518 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10519 | def test_wherePositive_array_rank1(self): | |
10520 | arg=numarray.array([28.906077447952242, -23.10248488222922]) | |
10521 | res=wherePositive(arg) | |
10522 | ref=numarray.array([1.0, 0.0]) | |
10523 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10524 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
10525 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10526 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10527 | def test_wherePositive_array_rank2(self): | |
10528 | arg=numarray.array([[67.494612236577638, 80.909854174047979, 47.70625909870725, -71.777921046997903, -98.760598538077588], [-91.46372992135052, -96.471924292992298, 2.2231997478348262, -86.769574545358523, 27.58841468272739], [41.637665565063259, 43.273086569741736, -91.492851720531291, -1.0475761142533457, 2.0960045464434245], [66.692822223370541, -81.550480374891549, -16.03214690197197, 40.933392894460582, -55.932865200691054]]) | |
10529 | res=wherePositive(arg) | |
10530 | ref=numarray.array([[1.0, 1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 1.0, 0.0]]) | |
10531 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10532 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
10533 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10534 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10535 | def test_wherePositive_array_rank3(self): | |
10536 | arg=numarray.array([[[-78.74335358357429, 61.656365045394921], [-42.157193730553708, -38.883346265013287]], [[-88.068489379591128, 78.654807861894938], [65.794256223486343, 0.30259701842065567]], [[-34.476517576931769, -70.04973714943732], [-40.160695156882142, -18.154859425407395]], [[84.416246128010471, -50.99152387283268], [62.940159515920811, -0.11087897257154111]], [[24.387079920060856, 48.804666891859824], [-84.793512049461796, -45.707677832173552]], [[-56.719649784696678, 41.392713601723557], [-61.888885999508261, -26.917437791111837]]]) | |
10537 | res=wherePositive(arg) | |
10538 | ref=numarray.array([[[0.0, 1.0], [0.0, 0.0]], [[0.0, 1.0], [1.0, 1.0]], [[0.0, 0.0], [0.0, 0.0]], [[1.0, 0.0], [1.0, 0.0]], [[1.0, 1.0], [0.0, 0.0]], [[0.0, 1.0], [0.0, 0.0]]]) | |
10539 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10540 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
10541 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10542 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10543 | def test_wherePositive_array_rank4(self): | |
10544 | arg=numarray.array([[[[72.100249984910391, -57.956175146094189, -98.913296387113945, -94.28075564808627], [-20.338451587905567, 2.4621360465247619, -80.82947875967011, 14.027370399640887], [-48.035910797270517, 64.795111774229667, -82.329489801042541, 86.211936552870952]], [[37.185934763312503, 49.50849631983408, 52.839672777504035, 56.377399244546268], [-7.234268113362134, 63.462611511320603, -52.156035067909997, -43.754752300758845], [-14.612026578032641, 53.353096426791865, -30.372778094043994, 97.860579226476858]]], [[[-82.319953411897728, -2.3001105395993733, -12.470606338277989, -63.185118541205121], [-94.960301922301298, -5.6565221271575297, 84.191028153250841, -70.636345764666828], [-49.130664317092567, -63.768657233437096, -36.120318903149595, 9.5139407723962393]], [[-92.191650374208336, 20.072457509379518, 81.652491381337285, -23.646733247590561], [81.342975568236085, 8.3577532005437547, 90.97695735629847, -73.840918529210441], [55.181621714112651, 38.330720467911931, -44.40476584033042, -83.817032958509117]]], [[[51.616654622513693, -14.450479331389161, -5.8020122717656477, -12.213830658544154], [-51.343817002573424, 18.583775895090156, 30.9554845465818, -87.095470001919878], [18.943349747730863, -70.349447902193702, -88.554802232088136, -28.827441779916782]], [[93.287427705419901, -70.256526015900903, -42.22715235102428, -19.855219969615817], [83.720263265665665, 37.151450334636081, -9.298456402444728, -68.274978717591296], [-18.390940148111184, -34.890690302498555, -23.885346500749165, -41.804510053113894]]]]) | |
10545 | res=wherePositive(arg) | |
10546 | ref=numarray.array([[[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 1.0], [0.0, 1.0, 0.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 0.0, 0.0], [0.0, 1.0, 0.0, 1.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]], [[0.0, 1.0, 1.0, 0.0], [1.0, 1.0, 1.0, 0.0], [1.0, 1.0, 0.0, 0.0]]], [[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0]], [[1.0, 0.0, 0.0, 0.0], [1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]]]) | |
10547 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10548 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
10549 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10550 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10551 | def test_wherePositive_constData_rank0(self): | |
10552 | arg=Data(-37.6753904615,self.functionspace) | |
10553 | res=wherePositive(arg) | |
10554 | ref=Data(0.0,self.functionspace) | |
10555 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10556 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10557 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10558 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10559 | def test_wherePositive_constData_rank1(self): | |
10560 | arg=Data(numarray.array([5.9258449909595186, -10.188430268215654]),self.functionspace) | |
10561 | res=wherePositive(arg) | |
10562 | ref=Data(numarray.array([1.0, 0.0]),self.functionspace) | |
10563 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10564 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10565 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10566 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10567 | def test_wherePositive_constData_rank2(self): | |
10568 | arg=Data(numarray.array([[-83.114314035576911, -97.085921526582439, -2.9217465777721827, -1.1787890915813506, -20.648618676160794], [71.555185206951847, -36.727722158005328, -65.518358513104715, -10.283766355353151, -88.62623357705364], [-87.443527444393794, 60.959525199376515, -36.134372946418772, 29.770497973959067, -0.56000819620498987], [-49.731344859570029, 75.300101947703638, -19.333618937761287, -76.395441717604839, -82.674517477413232]]),self.functionspace) | |
10569 | res=wherePositive(arg) | |
10570 | ref=Data(numarray.array([[0.0, 0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 1.0, 0.0], [0.0, 1.0, 0.0, 0.0, 0.0]]),self.functionspace) | |
10571 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10572 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10573 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10574 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10575 | def test_wherePositive_constData_rank3(self): | |
10576 | arg=Data(numarray.array([[[-40.29961143870586, -64.342711281295834], [-64.836836776535421, -41.307920796211107]], [[-61.487633921118331, -7.3019368673698182], [-81.595580375270529, -80.989974279719092]], [[13.759821229996419, -43.651255501857598], [50.571853247937838, 14.873409423642684]], [[32.599560708951344, 55.599891743152568], [-1.8584615650637915, 23.421438487813944]], [[47.743729631487469, -36.78569238955729], [-28.252743553505184, 22.915574068362659]], [[-0.67504474651151725, 28.5961011553226], [77.940744385806681, -89.35268267418266]]]),self.functionspace) | |
10577 | res=wherePositive(arg) | |
10578 | ref=Data(numarray.array([[[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[1.0, 0.0], [1.0, 1.0]], [[1.0, 1.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]], [[0.0, 1.0], [1.0, 0.0]]]),self.functionspace) | |
10579 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10580 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10581 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10582 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10583 | def test_wherePositive_constData_rank4(self): | |
10584 | arg=Data(numarray.array([[[[71.612692363554316, -80.902829681816598, -6.0794925791431496, 41.078313564593316], [84.057541602542102, -97.902796065627044, 76.245927278333113, -96.120505502491469], [-99.105019921573785, -34.847444130381049, 88.667555631999448, -61.769631633660339]], [[40.254500143735328, 70.315581126398541, 10.456067243123286, -17.984811825653452], [-27.229768774609923, 75.270523605621804, 51.732035936211417, 14.053481511556541], [-29.429004067130975, 13.931520718869521, -30.222269455495066, 53.099744636438828]]], [[[66.658594737374756, 26.443778675942383, 9.5217968199842886, 68.676346716535676], [-4.3009384691851125, -50.115873372077658, 40.775834478113808, 82.265077077049256], [-7.2654412117834681, 81.465859170947255, -40.570736265673958, 56.150931410619563]], [[15.146701299125894, -64.769075114245851, 77.291597540960367, -14.009811712530947], [32.952062015880443, 80.976651596673207, -12.913148087348574, 91.160708451911319], [11.314142446960517, 82.128551417863406, 9.3083839762397673, 84.293128609776659]]], [[[-18.320762412080938, -27.151169441911918, 68.650437109092991, 99.874147618429021], [68.713441258274884, 57.829825185320146, 97.052922881235219, -75.918331274766771], [35.001416215619628, -31.489897641770497, -92.684784085487038, -60.095802530301491]], [[92.145606292141849, -48.839544388877989, -81.576565094059148, -25.403820705830697], [-35.642188462105295, 93.371365566245657, 86.533657118913908, -64.737341204155797], [80.204843593716333, -55.196561402571298, -91.04571841996929, -36.30116120361]]]]),self.functionspace) | |
10585 | res=wherePositive(arg) | |
10586 | ref=Data(numarray.array([[[[1.0, 0.0, 0.0, 1.0], [1.0, 0.0, 1.0, 0.0], [0.0, 0.0, 1.0, 0.0]], [[1.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 1.0], [0.0, 1.0, 0.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [0.0, 1.0, 0.0, 1.0]], [[1.0, 0.0, 1.0, 0.0], [1.0, 1.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[0.0, 0.0, 1.0, 1.0], [1.0, 1.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0]], [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0]]]]),self.functionspace) | |
10587 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10588 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10589 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10590 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10591 | def test_wherePositive_expandedData_rank0(self): | |
10592 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10593 | arg=msk_arg*(60.0229181114)+(1.-msk_arg)*(-96.3764768528) | |
10594 | res=wherePositive(arg) | |
10595 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10596 | ref=msk_ref*(1.0)+(1.-msk_ref)*(0.0) | |
10597 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10598 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10599 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10600 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10601 | def test_wherePositive_expandedData_rank1(self): | |
10602 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10603 | arg=msk_arg*numarray.array([-22.419211375644196, 61.516723654676611])+(1.-msk_arg)*numarray.array([-47.697327344809139, -28.757233801998126]) | |
10604 | res=wherePositive(arg) | |
10605 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10606 | ref=msk_ref*numarray.array([0.0, 1.0])+(1.-msk_ref)*numarray.array([0.0, 0.0]) | |
10607 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10608 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10609 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10610 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10611 | def test_wherePositive_expandedData_rank2(self): | |
10612 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10613 | arg=msk_arg*numarray.array([[75.742071937578856, 0.92373368970095271, -52.139002610910602, -90.166031609404286, 5.5135768493946244], [-85.866582176624462, -5.8971094180698174, -44.235765048437599, 66.234147934377376, 17.435204749442562], [33.989217424407883, -90.944874166814358, 95.204126153994281, -48.494625981425976, -47.866621860789692], [-51.66387411792315, 23.408933865995692, -38.274649597022268, 94.35801540027137, -22.729990325215482]])+(1.-msk_arg)*numarray.array([[-77.74312490692175, 73.695397504354787, -25.165673520548154, 28.581554535703447, 16.809417381385657], [14.13939656000484, -30.054842741776127, 80.5114214445926, -91.608466400819012, 74.642682764121503], [24.373158682098676, 88.149830810457473, -87.043665488082226, -41.342480458547229, 47.83512981806436], [-23.988019538589128, -97.754385926732397, 64.136066737433026, 93.308550605904486, 50.264032149431102]]) | |
10614 | res=wherePositive(arg) | |
10615 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10616 | ref=msk_ref*numarray.array([[1.0, 1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0, 0.0], [0.0, 1.0, 0.0, 1.0, 0.0]])+(1.-msk_ref)*numarray.array([[0.0, 1.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0, 1.0]]) | |
10617 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10618 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10619 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10620 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10621 | def test_wherePositive_expandedData_rank3(self): | |
10622 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10623 | arg=msk_arg*numarray.array([[[-77.3470085491482, 23.703501363968414], [-78.457555629030821, -30.460470615708402]], [[40.586688169139535, 85.979119968548844], [14.391931326799096, 98.012599760182638]], [[-25.877266251828445, 92.469507013732766], [28.446352130979278, -29.047890229715236]], [[85.045265454383923, -79.743098568103363], [-67.998286974132469, 51.27842688771014]], [[-26.856044632583959, -46.616707014967403], [-13.323366086721251, 5.0944903333334395]], [[86.74261544510577, -64.927377055330226], [-96.292217645844659, 73.280353362666261]]])+(1.-msk_arg)*numarray.array([[[-73.854272948424978, -62.224959421353731], [69.003679176662558, 55.120389456685018]], [[-66.302549803605586, 41.107120553488897], [35.942390589413179, -49.629959161552975]], [[87.070085680653023, -7.4957980304887002], [62.24913427711212, 70.671000810016523]], [[-62.720150429412101, -67.208518801718355], [1.0758801572739856, -7.2411545422204995]], [[-46.322912286667474, -95.449711884536555], [-41.530447460581279, 23.396402682152996]], [[61.760793037463145, 26.046559417690631], [20.210361159406972, -6.0045794744297183]]]) | |
10624 | res=wherePositive(arg) | |
10625 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10626 | ref=msk_ref*numarray.array([[[0.0, 1.0], [0.0, 0.0]], [[1.0, 1.0], [1.0, 1.0]], [[0.0, 1.0], [1.0, 0.0]], [[1.0, 0.0], [0.0, 1.0]], [[0.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]]])+(1.-msk_ref)*numarray.array([[[0.0, 0.0], [1.0, 1.0]], [[0.0, 1.0], [1.0, 0.0]], [[1.0, 0.0], [1.0, 1.0]], [[0.0, 0.0], [1.0, 0.0]], [[0.0, 0.0], [0.0, 1.0]], [[1.0, 1.0], [1.0, 0.0]]]) | |
10627 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10628 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10629 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10630 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10631 | def test_wherePositive_expandedData_rank4(self): | |
10632 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10633 | arg=msk_arg*numarray.array([[[[43.80370896979781, -1.8783559803067504, 68.652439234878358, -54.13722802579484], [-16.330009797654171, -4.9840146257985225, -82.461337583892941, 20.478464419172909], [2.5283355218952437, -38.317141099135156, 74.439904322815721, -32.370032619039009]], [[75.661807530547463, 14.806511977463515, 92.913122066573948, -57.392835755828209], [-24.746344559568371, 58.577607900172268, 19.638932598152707, -56.683628155430846], [-23.63916211487431, -31.732325498364517, 2.9992635782867012, -51.737397326020073]]], [[[14.055418901807641, 49.78668125052377, 68.35230222025416, 1.1913826311549229], [-92.159227348973076, 77.751907937221432, 44.535941263032896, -69.410161289906654], [27.701588449716269, 33.203546994102169, -52.284409227888084, 6.1028377961118991]], [[-5.3335556081772069, -9.4816270741597748, 21.074022334438197, -82.638909781192709], [-38.201386351163571, -60.608459482874963, -10.140896441708108, -51.937205523614985], [67.836075729072832, 27.271013305993591, 37.943674493436077, 47.122338195390938]]], [[[94.80320858794326, 78.422597672517611, -47.362034814216145, -67.005672757399992], [13.984708106797612, -80.851401714264526, -66.341143846358705, 23.096516376649774], [19.354469887332982, -32.204625876582298, -90.448693280849412, -83.438145584116057]], [[-20.430907359037946, 34.265521783285777, 36.932356914307803, 94.749144039157954], [-23.740364230369423, -24.861180581515924, -23.653628334874384, -76.457114676244316], [-49.29499131919097, 97.199643030562271, 86.725540680528979, -20.724580882040343]]]])+(1.-msk_arg)*numarray.array([[[[-1.6865270561507373, -48.38266559451008, -21.021725580733076, -13.790499838190257], [50.521044913720118, -11.838528039107359, 48.1628346881065, -89.550279456158279], [74.235807932697497, -13.100435601018347, 2.3652821326138422, 30.026883928678501]], [[-69.738936297086411, 88.100714549880394, -31.068488721700788, -75.688640201758659], [74.214023515172073, 24.090808172915288, 60.52301851018504, -87.853385795062763], [-87.508927874364957, -1.5837298917809335, -28.713029983952225, -57.250723533626036]]], [[[-65.075934563641624, 11.614682951153725, 45.215631592128346, -74.364837387252123], [50.728658050670447, -58.927486265154741, 52.743491813692458, -35.976343344650601], [79.119298474238235, 97.80256840023921, -59.11443388001851, 54.649824887730659]], [[-99.518412000665691, -42.977729536858433, 20.676967689422, -90.750676595060924], [38.4658987940185, -16.645573644802568, -78.554599571785232, -59.494115705700779], [9.3463745210543578, 1.8679075108029082, -47.098256469256448, 83.374869892965677]]], [[[-69.480204147992879, 22.097990324074402, 64.676628015428008, -57.273925044302757], [-22.854234700698981, -91.099345045115427, 13.492331841283175, 64.248512967461465], [35.277064985517995, -94.753538497730474, 4.898846453131128, 75.023190487572577]], [[-90.672626500706244, -96.193464484471392, -13.003806772626731, -36.673991242489045], [-91.46754262338321, -48.493735714203744, -52.961005505255308, -75.058035570591386], [-39.614658185133521, 43.427235596994592, -79.256978699402055, -23.592401540492915]]]]) | |
10634 | res=wherePositive(arg) | |
10635 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10636 | ref=msk_ref*numarray.array([[[[1.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 1.0, 0.0]], [[1.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 0.0]]], [[[1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 0.0], [1.0, 1.0, 0.0, 1.0]], [[0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 0.0, 0.0], [1.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 0.0]], [[0.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0]]]])+(1.-msk_ref)*numarray.array([[[[0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 1.0, 0.0], [1.0, 0.0, 1.0, 1.0]], [[0.0, 1.0, 0.0, 0.0], [1.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 1.0, 1.0, 0.0], [1.0, 0.0, 1.0, 0.0], [1.0, 1.0, 0.0, 1.0]], [[0.0, 0.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0], [1.0, 1.0, 0.0, 1.0]]], [[[0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0]]]]) | |
10637 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10638 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10639 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10640 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10641 | def test_wherePositive_Symbol_rank0(self): | |
10642 | arg=Symbol(shape=()) | |
10643 | res=wherePositive(arg) | |
10644 | s=numarray.array(-9.43501528753) | |
10645 | sub=res.substitute({arg:s}) | |
10646 | ref=numarray.array(0.0) | |
10647 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10648 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10649 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10650 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10651 | def test_wherePositive_Symbol_rank1(self): | |
10652 | arg=Symbol(shape=(2,)) | |
10653 | res=wherePositive(arg) | |
10654 | s=numarray.array([-86.076223420613644, 24.887439437676818]) | |
10655 | sub=res.substitute({arg:s}) | |
10656 | ref=numarray.array([0.0, 1.0]) | |
10657 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10658 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10659 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10660 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10661 | def test_wherePositive_Symbol_rank2(self): | |
10662 | arg=Symbol(shape=(4, 5)) | |
10663 | res=wherePositive(arg) | |
10664 | s=numarray.array([[-72.861467415908407, 87.445413020151335, 44.122959128487878, 37.815712663148446, 16.51575833789849], [5.5678430369583225, -31.657700395046518, -23.000608981075231, 13.175691780223559, -47.172371090875245], [46.838381836265143, -0.64336779291720347, 79.712475185814469, -69.138421706470496, -28.642558818567949], [91.568480320945753, -14.976400873356837, -16.802832112916647, 7.6223808092700409, 43.400561726126483]]) | |
10665 | sub=res.substitute({arg:s}) | |
10666 | ref=numarray.array([[0.0, 1.0, 1.0, 1.0, 1.0], [1.0, 0.0, 0.0, 1.0, 0.0], [1.0, 0.0, 1.0, 0.0, 0.0], [1.0, 0.0, 0.0, 1.0, 1.0]]) | |
10667 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10668 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10669 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10670 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10671 | def test_wherePositive_Symbol_rank3(self): | |
10672 | arg=Symbol(shape=(6, 2, 2)) | |
10673 | res=wherePositive(arg) | |
10674 | s=numarray.array([[[14.254888779256163, -93.079183322703372], [-63.28205537162679, -5.1053738037226708]], [[88.548065869410834, 92.437854070248505], [67.463905803574136, -69.119627703399033]], [[-5.1587834929179337, 14.438150309231744], [-60.082589289020348, -2.8764823549122411]], [[86.474191437976202, -23.913731018025047], [-14.33516255203034, -76.872920311355045]], [[31.232916890504555, -98.898455060843588], [-63.462721420014013, -59.602078269458957]], [[54.664891148938096, -5.6099126717595595], [34.202150896807495, 28.911805516544462]]]) | |
10675 | sub=res.substitute({arg:s}) | |
10676 | ref=numarray.array([[[1.0, 0.0], [0.0, 0.0]], [[1.0, 1.0], [1.0, 0.0]], [[0.0, 1.0], [0.0, 0.0]], [[1.0, 0.0], [0.0, 0.0]], [[1.0, 0.0], [0.0, 0.0]], [[1.0, 0.0], [1.0, 1.0]]]) | |
10677 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10678 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10679 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10680 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10681 | def test_wherePositive_Symbol_rank4(self): | |
10682 | arg=Symbol(shape=(3, 2, 3, 4)) | |
10683 | res=wherePositive(arg) | |
10684 | s=numarray.array([[[[-37.88958007709131, -69.422440876170157, 98.309997394312262, -99.832160786266513], [-98.549853800366634, -59.212851099858788, 70.467934907158082, 87.428704353937917], [8.80467342401829, -67.471677482415785, 23.942091174941325, 15.803088287257538]], [[-63.172322626194635, 82.538771957419357, 45.164380438773549, -94.022903002494402], [4.0962211030344662, -48.787187296107028, 45.525825517642005, 45.711734183529074], [48.265143872942929, -87.162363496761159, 16.011575553754028, -96.721599021387377]]], [[[9.4948883762552327, -18.446841364017814, 20.351663614867761, 55.318055980592845], [90.016295105535704, 18.315786000578143, 54.95564104759859, 75.816166573502358], [-71.162333511732001, -95.953386780228797, 84.570733819306724, -10.941053704889384]], [[-8.4083264964211111, 56.989366045336567, 9.1939134657073538, 22.066859941476011], [1.0651237550664661, 84.74053823059441, -90.753568574100399, 73.121172281878046], [-99.18615441543605, -28.331557285152641, -44.476057352835177, 46.421436565938251]]], [[[73.673411450959293, 72.485098252566615, -72.54930137464963, 82.784929340261613], [-12.436989146984473, 33.551428499615753, 53.425622240674727, 55.24125898657536], [-46.807406690716967, -99.733941429080986, 41.082918915124822, 43.402758860058839]], [[-30.615849276223585, 90.588710503833624, 36.934609404692054, -87.474764164742183], [-96.421287284725565, -5.6209672311981791, 89.578789522633173, 56.454146153177106], [-23.865121727890298, -53.925804298204838, -1.8102203614056123, -37.919849585870246]]]]) | |
10685 | sub=res.substitute({arg:s}) | |
10686 | ref=numarray.array([[[[0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0]], [[0.0, 1.0, 1.0, 0.0], [1.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0]]], [[[1.0, 0.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 0.0]], [[0.0, 1.0, 1.0, 1.0], [1.0, 1.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0]]], [[[1.0, 1.0, 0.0, 1.0], [0.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0]], [[0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0]]]]) | |
10687 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10688 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10689 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10690 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10691 | def test_whereNegative_float_rank0(self): | |
10692 | arg=60.8682840238 | |
10693 | res=whereNegative(arg) | |
10694 | ref=0.0 | |
10695 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10696 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10697 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10698 | def test_whereNegative_array_rank0(self): | |
10699 | arg=numarray.array(12.3306392667) | |
10700 | res=whereNegative(arg) | |
10701 | ref=numarray.array(0.0) | |
10702 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10703 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
10704 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10705 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10706 | def test_whereNegative_array_rank1(self): | |
10707 | arg=numarray.array([-96.137063268028797, -76.658277780494259]) | |
10708 | res=whereNegative(arg) | |
10709 | ref=numarray.array([1.0, 1.0]) | |
10710 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10711 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
10712 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10713 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10714 | def test_whereNegative_array_rank2(self): | |
10715 | arg=numarray.array([[34.527255357681298, 46.742030193793738, -10.068808745305603, 33.451041357426902, 52.37433370591711], [-1.1274024836940555, 2.5419221930968519, 32.984481014462432, 76.341642878243078, 36.384014089381708], [-98.496974526985866, -65.01368641484936, 50.789914135856463, -16.286375703249959, 45.813382104794698], [18.983852245009942, -39.656344508041677, -87.540891441344542, 22.257065860125209, -56.083642049697957]]) | |
10716 | res=whereNegative(arg) | |
10717 | ref=numarray.array([[0.0, 0.0, 1.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 0.0, 1.0, 0.0], [0.0, 1.0, 1.0, 0.0, 1.0]]) | |
10718 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10719 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
10720 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10721 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10722 | def test_whereNegative_array_rank3(self): | |
10723 | arg=numarray.array([[[27.452945477282029, 10.079247782917776], [73.463914059433876, 89.31763644890097]], [[-39.00630564129397, -56.727418650360839], [99.956113750577458, -63.201931425083899]], [[23.800879753842111, -71.802714984390661], [20.122988022110079, 50.095040283423629]], [[17.391754513203111, -87.274468281986955], [-69.061025469838569, -95.107053552460357]], [[-38.397282711106314, -73.428763082157076], [-24.751594707412835, 93.224119395489396]], [[-71.420548157545795, -10.204520855028434], [8.2682413993733377, 69.215290928341716]]]) | |
10724 | res=whereNegative(arg) | |
10725 | ref=numarray.array([[[0.0, 0.0], [0.0, 0.0]], [[1.0, 1.0], [0.0, 1.0]], [[0.0, 1.0], [0.0, 0.0]], [[0.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 0.0]], [[1.0, 1.0], [0.0, 0.0]]]) | |
10726 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10727 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
10728 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10729 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10730 | def test_whereNegative_array_rank4(self): | |
10731 | arg=numarray.array([[[[52.851635463931416, -42.757919744122042, -43.221594386333393, -71.627489318948307], [63.051185031362394, 88.122130054764369, 3.0294368603839104, -80.279495847366533], [22.202897744980945, -9.5679057475316398, 0.6747259697796153, -32.77109355448286]], [[7.4103317420963606, 56.685726337130205, -5.6243186818793873, 30.690249505075911], [-40.26391967567595, 56.69805771317823, 38.011050108017827, -67.152404819687916], [11.988018990285681, 15.418047294689202, -35.853437208267195, 9.7603269619072535]]], [[[62.818258893227807, -68.93898305799496, -59.052468240174804, -26.916691703402719], [-93.556184474191454, 54.562368122195096, -69.599681490131715, -79.832141645610747], [-68.174504363157169, 15.388412833294524, 92.958241545241805, 48.717089383312725]], [[80.362433523267072, 85.459156338229405, 48.410142376841151, 92.900690384172805], [-13.477883213840627, -48.877024108923784, -42.918741473403841, 30.897642075312746], [6.738002126296621, 12.415597112960256, 39.201682409893436, -18.884889673699519]]], [[[-62.408880043825611, -72.590378070784652, -82.098861995291813, -34.475953721594863], [85.281229062252805, -53.982038453937164, 31.566642378708877, 10.785407426910879], [67.392800607262615, -44.131930493424655, -79.616463869751612, 69.356492589536515]], [[20.091109964478719, -76.324154832707023, 76.477460746877824, -45.456803948000314], [77.912305288034929, -24.195046812358953, -28.192001907231074, 87.18708113620994], [31.883641084515517, 58.423371148498177, 68.91426566250999, -4.6562642110223038]]]]) | |
10732 | res=whereNegative(arg) | |
10733 | ref=numarray.array([[[[0.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 1.0]], [[0.0, 0.0, 1.0, 0.0], [1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 1.0, 0.0]]], [[[0.0, 1.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0], [1.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0]], [[0.0, 1.0, 0.0, 1.0], [0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]]]) | |
10734 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10735 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
10736 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10737 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10738 | def test_whereNegative_constData_rank0(self): | |
10739 | arg=Data(71.0461471154,self.functionspace) | |
10740 | res=whereNegative(arg) | |
10741 | ref=Data(0.0,self.functionspace) | |
10742 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10743 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10744 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10745 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10746 | def test_whereNegative_constData_rank1(self): | |
10747 | arg=Data(numarray.array([-80.731119617568183, 91.086434642832756]),self.functionspace) | |
10748 | res=whereNegative(arg) | |
10749 | ref=Data(numarray.array([1.0, 0.0]),self.functionspace) | |
10750 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10751 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10752 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10753 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10754 | def test_whereNegative_constData_rank2(self): | |
10755 | arg=Data(numarray.array([[-30.078161181135357, -83.774816691205274, 31.234430645356866, -88.643364099015969, -27.327692899224587], [39.87080777988453, -90.362613632345415, -88.178393380316351, 0.78766148538969105, 17.467833815617212], [-41.019873514226759, 85.969686883649359, -71.810931481288037, -64.605161148773874, 73.291192617723908], [59.382800564915414, 72.112470346114435, 64.321292886976977, 83.840884620483592, -18.887748452642555]]),self.functionspace) | |
10756 | res=whereNegative(arg) | |
10757 | ref=Data(numarray.array([[1.0, 1.0, 0.0, 1.0, 1.0], [0.0, 1.0, 1.0, 0.0, 0.0], [1.0, 0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 1.0]]),self.functionspace) | |
10758 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10759 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10760 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10761 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10762 | def test_whereNegative_constData_rank3(self): | |
10763 | arg=Data(numarray.array([[[52.467962714577851, -10.755811269205751], [-49.824884301105229, -87.898834770673545]], [[-84.887027502945656, 39.276449348108372], [-0.28784075758221661, -43.719102909037424]], [[5.0483861425380212, 77.163995546260338], [-82.618948195844013, 1.7083645155553171]], [[-85.252812042880379, 47.920337911790767], [-89.706782276303997, -9.5992153716397723]], [[-53.487541003352291, -37.042887199510169], [-39.924749090729648, -97.861135144144257]], [[14.313959182168418, -64.680421169049538], [-18.772463792577526, -22.16535015919969]]]),self.functionspace) | |
10764 | res=whereNegative(arg) | |
10765 | ref=Data(numarray.array([[[0.0, 1.0], [1.0, 1.0]], [[1.0, 0.0], [1.0, 1.0]], [[0.0, 0.0], [1.0, 0.0]], [[1.0, 0.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[0.0, 1.0], [1.0, 1.0]]]),self.functionspace) | |
10766 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10767 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10768 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10769 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10770 | def test_whereNegative_constData_rank4(self): | |
10771 | arg=Data(numarray.array([[[[-56.738900482413811, -11.202980729285244, -71.631743919679849, -14.501263562534177], [43.190705972099948, 28.379497298551968, -13.569119185364585, 65.358348068303656], [-91.736472018303189, 45.571509175250782, 20.814396687393597, 53.332854517832743]], [[32.567368220643601, 3.4928426287876135, 58.278182327340858, -96.270406402097166], [30.357738302076029, -34.075847316972101, 88.565145570585258, 68.632732598053138], [-43.333644849377052, 98.698365574236476, 99.086221332142486, 79.256177564404851]]], [[[83.658967348768414, 73.87622641143912, 26.664285223308923, -24.236702163040988], [33.966505242244011, -47.630267479564296, -41.486678856495061, -68.553303600684572], [-75.108951411161826, 42.384054423970923, -48.286880035511935, -66.006863305952038]], [[-1.946984825710345, 12.753883934941655, 99.463784625818676, -86.199776629612472], [43.644149588437671, -18.088721159515316, 82.264706299718881, -66.686685578089453], [-1.6489398255121301, 17.662742039769299, -39.062788718667996, 43.366643090778211]]], [[[7.0838003526987166, 84.164965010157346, 94.39131652727707, 42.082953004169639], [-55.773938700136782, 52.435811047719028, 53.070615567554626, -64.791867065020568], [-11.109776598239193, 76.314724953648579, -47.359305606426716, 52.614937206019448]], [[18.800439656297712, 93.558627961377653, 13.541712656625251, 4.6114826390651018], [63.601298072608671, 48.408056729632989, 49.122562180543326, -0.17795085269705169], [35.457986798476099, -74.518767618135072, 11.99706514332901, 40.603347309608296]]]]),self.functionspace) | |
10772 | res=whereNegative(arg) | |
10773 | ref=Data(numarray.array([[[[1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0]], [[1.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 1.0], [1.0, 0.0, 1.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 1.0], [1.0, 0.0, 1.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0]]]]),self.functionspace) | |
10774 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10775 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10776 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10777 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10778 | def test_whereNegative_expandedData_rank0(self): | |
10779 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10780 | arg=msk_arg*(-30.5711237435)+(1.-msk_arg)*(69.0316558372) | |
10781 | res=whereNegative(arg) | |
10782 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10783 | ref=msk_ref*(1.0)+(1.-msk_ref)*(0.0) | |
10784 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10785 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10786 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10787 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10788 | def test_whereNegative_expandedData_rank1(self): | |
10789 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10790 | arg=msk_arg*numarray.array([-71.631541638025368, -34.933285862461716])+(1.-msk_arg)*numarray.array([94.532432395056986, -8.4861064431438251]) | |
10791 | res=whereNegative(arg) | |
10792 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10793 | ref=msk_ref*numarray.array([1.0, 1.0])+(1.-msk_ref)*numarray.array([0.0, 1.0]) | |
10794 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10795 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10796 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10797 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10798 | def test_whereNegative_expandedData_rank2(self): | |
10799 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10800 | arg=msk_arg*numarray.array([[-81.246161725962281, -0.80928674630524711, 64.245598914154385, 25.019488668613903, -20.02114893086133], [-16.925215481515338, -19.119399037651519, -33.929581396089105, 49.036506368260234, -19.653199853598636], [-71.356363589257569, 60.190772929399429, -80.879381891956257, -25.014458239978964, 53.593957929715629], [-99.037250890485964, 2.1499053353822575, 24.458899543815619, 17.352712366156538, 87.281727012725412]])+(1.-msk_arg)*numarray.array([[24.876343327252769, -97.810881158075432, -98.976581314248165, -58.828345137646295, -47.996308815032116], [88.870044806649133, 83.497827171390071, -49.848159713628817, -79.747992284629902, -86.622423551338159], [-44.407345444816215, -19.420350667571313, 30.593026030666437, -92.522432388627806, -27.411015715113336], [-70.620933054656803, 95.630924114745426, -6.4891593001671595, 30.067888220202349, 54.633003267596763]]) | |
10801 | res=whereNegative(arg) | |
10802 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10803 | ref=msk_ref*numarray.array([[1.0, 1.0, 0.0, 0.0, 1.0], [1.0, 1.0, 1.0, 0.0, 1.0], [1.0, 0.0, 1.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0, 0.0]])+(1.-msk_ref)*numarray.array([[0.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0, 1.0], [1.0, 1.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0, 0.0]]) | |
10804 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10805 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10806 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10807 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10808 | def test_whereNegative_expandedData_rank3(self): | |
10809 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10810 | arg=msk_arg*numarray.array([[[-13.226116878406287, -82.199364713243199], [10.802887584692229, -65.686743331979756]], [[-53.361630863787582, 99.378467998876744], [-3.7915436947351395, -26.517844578338142]], [[93.096723454132416, -93.695818457215509], [31.554012577630004, 39.96605767563608]], [[-42.995245201378005, -29.890999774133903], [18.30723099164662, 88.621280116942501]], [[1.7197935367676394, 25.587678904490673], [48.238578489671426, -98.542525990226594]], [[-37.454079112118485, 7.2826272286010294], [76.911623094137013, 88.86281750539041]]])+(1.-msk_arg)*numarray.array([[[-76.308681189268725, 78.036351430824794], [29.442414274483752, 32.970131475820949]], [[-11.522188039672287, -29.450015896780172], [-71.490304555395142, 86.623804825605646]], [[29.9575694239212, 48.244193165489548], [12.890596118737662, -44.72251029422889]], [[87.880930152139086, 77.877282206925827], [52.458002105709056, -26.128933933435519]], [[-10.037415450512867, 62.849269823732953], [-13.341389821511029, -66.474146337225662]], [[-66.827808490764482, 55.123032168800961], [11.770865332062257, -65.792755427561076]]]) | |
10811 | res=whereNegative(arg) | |
10812 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10813 | ref=msk_ref*numarray.array([[[1.0, 1.0], [0.0, 1.0]], [[1.0, 0.0], [1.0, 1.0]], [[0.0, 1.0], [0.0, 0.0]], [[1.0, 1.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 0.0]]])+(1.-msk_ref)*numarray.array([[[1.0, 0.0], [0.0, 0.0]], [[1.0, 1.0], [1.0, 0.0]], [[0.0, 0.0], [0.0, 1.0]], [[0.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [1.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]]]) | |
10814 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10815 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10816 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10817 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10818 | def test_whereNegative_expandedData_rank4(self): | |
10819 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10820 | arg=msk_arg*numarray.array([[[[22.736350434258242, 83.810869845847236, 19.347903964541985, -80.166931850749208], [45.452393364563619, 50.301718349604471, 67.66905146372207, -16.354259444700304], [47.685594996358162, -15.412627032981447, -33.973100957852424, -28.421171446812849]], [[28.765923294757869, 81.948159836174653, -61.002964447142837, -60.377845446919643], [-11.088814072045068, 77.109491110526534, -28.820136591829765, 54.89579817587898], [88.727197576669454, -61.758232727685126, 31.11303916232518, 22.425386560120742]]], [[[-37.668698306499728, -93.367508938543509, -96.69001608717312, 46.73287429891991], [-17.086614002398235, 77.117506515236443, -89.609359206118882, -51.116796499884963], [-11.331078933065797, 82.655593610768733, -51.263800662903833, -45.417082762140161]], [[-38.448402748623288, 40.952337637478053, 8.3792678972500312, -28.811191611059755], [-46.223465500265526, -44.801884964741333, 87.075157001648392, 72.791216981596563], [-0.90078100649908777, -60.044301966082593, -24.235637315239387, 86.769389985854133]]], [[[-85.232530260963387, 8.41880287115751, -80.819791741701195, 1.6073205456352753], [43.848963529258867, -84.768973989806852, 45.149836932049368, -54.480107023795263], [-90.354256577100813, -28.667837787830337, -74.038580399961162, -44.842435509105826]], [[-13.569853286180006, -39.870360955262484, -43.80119994880998, 98.821718640347399], [-74.739576772222932, -10.481845098843181, -19.428165239121967, -64.409567816025458], [-84.960799515544096, 44.601968055026731, -53.945696380018205, -62.508824901005354]]]])+(1.-msk_arg)*numarray.array([[[[98.331226651596097, -45.908896808474253, -76.328427133254692, 9.0732880852006019], [77.537791077921838, 81.188001463478429, -77.573617910825661, -70.53070043922385], [-60.093184821750675, -51.652608941265157, 17.555344559057744, 71.905673472708713]], [[60.587001914144139, -22.25480650550962, -15.669252605643379, 81.086498408593513], [20.771698800848753, 88.031012565600975, -57.68613427820555, 33.563864544408631], [71.357793416800945, 48.697344496300332, -56.302119150659721, 85.465915125881565]]], [[[71.34331579003441, -76.222881134514139, 70.657517114902021, -51.209553238176994], [-51.01048305469795, -54.010632435840478, 40.057721463180229, 90.017288091933807], [23.78119243806394, -65.128478845325958, -69.24071358054411, -35.156183078888859]], [[24.931984536066182, 29.218423454675872, 37.291762771095193, -44.301474105023033], [-27.534021386697475, 22.357601126944559, -32.007180009349128, -78.646515703268264], [70.214506130886946, 57.390883214823788, -94.288983066193083, 68.156267247037135]]], [[[86.210144621283746, 47.931898737102983, 64.611807566463199, 97.889272082903091], [-31.445648061764658, 80.771569964243128, -36.261273157065155, 95.317389789191196], [-53.571317526281348, -14.421189259125327, 59.637908000860364, -61.238575115717154]], [[-25.60102669901228, 53.006556636924671, -69.520681581420575, -2.0132709991870286], [22.968036096731808, 5.7145633292572597, 73.063684440985469, -57.182218254882436], [77.157618409964044, -31.84995932925176, -83.282695391829435, 77.690533538106138]]]]) | |
10821 | res=whereNegative(arg) | |
10822 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10823 | ref=msk_ref*numarray.array([[[[0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 1.0, 1.0]], [[0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0], [0.0, 1.0, 0.0, 0.0]]], [[[1.0, 1.0, 1.0, 0.0], [1.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0]], [[1.0, 0.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0], [1.0, 1.0, 1.0, 0.0]]], [[[1.0, 0.0, 1.0, 0.0], [0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 0.0], [1.0, 1.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0]]]])+(1.-msk_ref)*numarray.array([[[[0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 1.0], [1.0, 1.0, 0.0, 0.0]], [[0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 1.0, 0.0]]], [[[0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0], [0.0, 1.0, 1.0, 1.0]], [[0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 1.0, 0.0], [1.0, 1.0, 0.0, 1.0]], [[1.0, 0.0, 1.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 1.0, 0.0]]]]) | |
10824 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10825 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10826 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10827 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10828 | def test_whereNegative_Symbol_rank0(self): | |
10829 | arg=Symbol(shape=()) | |
10830 | res=whereNegative(arg) | |
10831 | s=numarray.array(40.4011650623) | |
10832 | sub=res.substitute({arg:s}) | |
10833 | ref=numarray.array(0.0) | |
10834 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10835 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10836 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10837 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10838 | def test_whereNegative_Symbol_rank1(self): | |
10839 | arg=Symbol(shape=(2,)) | |
10840 | res=whereNegative(arg) | |
10841 | s=numarray.array([-71.655665065686279, 91.138272113877008]) | |
10842 | sub=res.substitute({arg:s}) | |
10843 | ref=numarray.array([1.0, 0.0]) | |
10844 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10845 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10846 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10847 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10848 | def test_whereNegative_Symbol_rank2(self): | |
10849 | arg=Symbol(shape=(4, 5)) | |
10850 | res=whereNegative(arg) | |
10851 | s=numarray.array([[12.471311999599237, -79.466700443191797, -29.647474934713685, 78.725723129788037, -25.193667637213736], [-27.383589504006082, -92.789488552284837, -67.82758123957224, 48.122220899847264, 19.750545844613285], [74.799702244704122, -4.7296754832835575, -63.235693854345975, -75.80063354282521, 35.997583859070147], [-41.225516291769672, 38.466173287652197, -75.068915147413065, 11.383660545905457, 72.671825561656561]]) | |
10852 | sub=res.substitute({arg:s}) | |
10853 | ref=numarray.array([[0.0, 1.0, 1.0, 0.0, 1.0], [1.0, 1.0, 1.0, 0.0, 0.0], [0.0, 1.0, 1.0, 1.0, 0.0], [1.0, 0.0, 1.0, 0.0, 0.0]]) | |
10854 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10855 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10856 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10857 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10858 | def test_whereNegative_Symbol_rank3(self): | |
10859 | arg=Symbol(shape=(6, 2, 2)) | |
10860 | res=whereNegative(arg) | |
10861 | s=numarray.array([[[86.049934039938336, -76.916545040373748], [47.912904518542064, -19.385016225256763]], [[-43.143194458809234, 22.762350582447041], [17.476826380519455, -26.433656105535647]], [[-36.204785428645977, -16.285117464727605], [-50.409162834264045, -25.095216353145005]], [[-39.400776326287087, -33.445516576117896], [37.980139505297558, -92.882287108795424]], [[-46.373275962943225, -12.838605874855318], [84.062884747590715, 98.762981126760053]], [[85.475866506225884, -56.869083412891563], [-2.8563954657025761, -33.463794722879598]]]) | |
10862 | sub=res.substitute({arg:s}) | |
10863 | ref=numarray.array([[[0.0, 1.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [0.0, 1.0]], [[1.0, 1.0], [0.0, 0.0]], [[0.0, 1.0], [1.0, 1.0]]]) | |
10864 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10865 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10866 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10867 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10868 | def test_whereNegative_Symbol_rank4(self): | |
10869 | arg=Symbol(shape=(3, 2, 3, 4)) | |
10870 | res=whereNegative(arg) | |
10871 | s=numarray.array([[[[-39.14990061925532, 51.949859965073983, 55.37633633636824, -82.35728979416686], [-62.823259140676726, -60.987847514454629, -87.165694611302087, -9.4983692954954506], [-59.034970257539342, -12.349309123798236, -74.849079914303317, -41.408354712867457]], [[29.9307981548464, -81.526499155207048, 46.012868740458487, 11.900092247618034], [53.654390339989675, -56.414112602954262, 32.405102833786714, 46.210686310237207], [-72.147580142442223, -22.977139544545636, 89.142946567216995, -88.831906311919909]]], [[[-1.3198711955164697, 21.369948454299475, 59.766310276379983, -53.755025619966347], [98.576470432795276, -72.025064379707928, 58.324331062695535, 49.676210952580192], [-29.552848681947296, 13.576893933997908, -54.333930944304967, -13.498886110363202]], [[9.3704956801669397, -2.2513137797195668, -52.882998377311516, -93.606100392506164], [-88.881588707277956, 83.417801198755512, 57.914520898503298, -97.689248571026454], [-74.800685017601623, -35.991007287628051, 81.330326943014711, 22.556206038634812]]], [[[9.2780054495407569, 93.824584816474839, 51.875991914097796, -42.220631714359456], [85.338622377384127, -27.149448703310824, -73.347709655591103, -23.42518563583134], [45.940803116571885, -32.381912906643123, -95.049577516480682, 63.411283490611311]], [[-30.01425279958174, 25.196938582282158, -10.252771505748854, 52.029675553268618], [-0.53388159534763702, 77.25070415513926, 49.336454387777877, -46.275901599419569], [4.3984065300076907, 91.391927269984365, 42.161201561377652, -85.358967464268986]]]]) | |
10872 | sub=res.substitute({arg:s}) | |
10873 | ref=numarray.array([[[[1.0, 0.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[0.0, 1.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [1.0, 1.0, 0.0, 1.0]]], [[[1.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0], [1.0, 0.0, 1.0, 1.0]], [[0.0, 1.0, 1.0, 1.0], [1.0, 0.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 0.0]], [[1.0, 0.0, 1.0, 0.0], [1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0]]]]) | |
10874 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
10875 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10876 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10877 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10878 | def test_whereNonNegative_float_rank0(self): | |
10879 | arg=58.4734070432 | |
10880 | res=whereNonNegative(arg) | |
10881 | ref=1.0 | |
10882 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
10883 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10884 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10885 | def test_whereNonNegative_array_rank0(self): | |
10886 | arg=numarray.array(-77.2396345376) | |
10887 | res=whereNonNegative(arg) | |
10888 | ref=numarray.array(0.0) | |
10889 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10890 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
10891 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10892 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10893 | def test_whereNonNegative_array_rank1(self): | |
10894 | arg=numarray.array([-96.481185201309529, 55.69393817245151]) | |
10895 | res=whereNonNegative(arg) | |
10896 | ref=numarray.array([0.0, 1.0]) | |
10897 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10898 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
10899 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10900 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10901 | def test_whereNonNegative_array_rank2(self): | |
10902 | arg=numarray.array([[33.751666255076515, -97.928265537757909, 14.362676388994842, 74.281280811324933, -52.516825657717888], [-20.461289856454684, -45.157730149915643, 31.896091176433487, 4.1317379123191529, -55.246764488338762], [19.700429048464358, 16.679444563048492, -38.30023330559407, -77.041761864300582, -28.043364036650644], [5.0773359198315973, 91.9368391294513, 20.710543350370259, -28.942481048294326, -16.348545481686472]]) | |
10903 | res=whereNonNegative(arg) | |
10904 | ref=numarray.array([[1.0, 0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 1.0, 0.0], [1.0, 1.0, 0.0, 0.0, 0.0], [1.0, 1.0, 1.0, 0.0, 0.0]]) | |
10905 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10906 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
10907 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10908 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10909 | def test_whereNonNegative_array_rank3(self): | |
10910 | arg=numarray.array([[[19.729007031849989, 28.339725664851557], [-47.773566720641256, -21.927219410096143]], [[46.094165089019498, -0.63223312390847752], [5.1418015828473358, -3.2223067899969919]], [[-93.553953569350369, 88.717633043793484], [-78.87519362229618, 32.971725631423112]], [[-90.65660301934227, 6.6283631097893192], [90.193523289250635, -40.957164498019537]], [[83.152161885821187, -70.542346994808355], [30.571013881082479, -0.80033587662163086]], [[53.966121161234639, -32.727914208209413], [5.7429993927969889, -30.72691997703258]]]) | |
10911 | res=whereNonNegative(arg) | |
10912 | ref=numarray.array([[[1.0, 1.0], [0.0, 0.0]], [[1.0, 0.0], [1.0, 0.0]], [[0.0, 1.0], [0.0, 1.0]], [[0.0, 1.0], [1.0, 0.0]], [[1.0, 0.0], [1.0, 0.0]], [[1.0, 0.0], [1.0, 0.0]]]) | |
10913 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10914 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
10915 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10916 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10917 | def test_whereNonNegative_array_rank4(self): | |
10918 | arg=numarray.array([[[[67.819303150305586, 58.094451445762473, -56.716860642067182, -31.264742194049617], [-65.095373210856522, -76.708282393809441, 32.654968187506199, 85.420496372460292], [-6.1214503461968235, -12.93519491683017, -71.316345077104828, 50.676771270018918]], [[-90.117656138807604, -30.507925648793119, 29.786316442392916, -13.581636478986141], [-56.535310447507214, 68.422294613888425, -76.869431303022864, -92.136715817023898], [-69.545808694217229, -65.561773987757903, 80.884826568492457, -16.59346797909906]]], [[[28.446041688660898, -93.575372847332545, 51.967032569599922, 16.338681282927169], [-54.098652915975663, -64.462591681548645, 27.942122982761418, 66.929439755872039], [44.711579155976636, -20.254353511943918, 5.2271920927414754, -32.665593100317622]], [[-28.264723368846106, 51.707175859789402, -70.695873526038469, 10.846862489367922], [-78.389576448699813, -61.161653853188945, 15.927215052827066, -96.297305121328208], [-89.498120859989911, -83.699171123343334, -49.945976969918114, 52.515091562529761]]], [[[98.432201063954437, 5.3470028633255424, -87.883945686853139, -82.398714780883893], [88.61112112218737, 65.282106288691892, -90.450701516842031, 11.372598817788031], [-1.2170253549431749, -11.147053059704916, -51.10796851690624, -21.568184900408241]], [[-58.41155791852222, 63.556679823020005, -33.777540011731944, -19.968219145362582], [62.331887732495801, 96.26963346060586, -47.912958914398573, 20.836893897762778], [83.530900729436809, 36.16042965799457, -99.099072331349603, -82.111303540526407]]]]) | |
10919 | res=whereNonNegative(arg) | |
10920 | ref=numarray.array([[[[1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 0.0, 1.0]], [[0.0, 0.0, 1.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0]]], [[[1.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0]], [[0.0, 1.0, 0.0, 1.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]], [[[1.0, 1.0, 0.0, 0.0], [1.0, 1.0, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 1.0, 0.0, 0.0], [1.0, 1.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0]]]]) | |
10921 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
10922 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
10923 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10924 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10925 | def test_whereNonNegative_constData_rank0(self): | |
10926 | arg=Data(-5.63597616175,self.functionspace) | |
10927 | res=whereNonNegative(arg) | |
10928 | ref=Data(0.0,self.functionspace) | |
10929 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10930 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10931 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10932 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10933 | def test_whereNonNegative_constData_rank1(self): | |
10934 | arg=Data(numarray.array([52.597537475659237, 65.281264541702825]),self.functionspace) | |
10935 | res=whereNonNegative(arg) | |
10936 | ref=Data(numarray.array([1.0, 1.0]),self.functionspace) | |
10937 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10938 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10939 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10940 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10941 | def test_whereNonNegative_constData_rank2(self): | |
10942 | arg=Data(numarray.array([[23.937746997604961, 12.178098197245674, 19.416176574130617, -13.724111061677206, 73.879619373893036], [-64.162137997220782, 40.478876735342112, -58.917478343894622, -70.727192689590737, -44.735513365105881], [-84.885212174941756, -95.547022727178614, 29.595829863194666, 86.446737656525102, -84.567583366252606], [82.021223674901137, -37.06970380424206, 29.766667765490439, 36.637380378689386, 94.715161252546096]]),self.functionspace) | |
10943 | res=whereNonNegative(arg) | |
10944 | ref=Data(numarray.array([[1.0, 1.0, 1.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.0, 1.0, 0.0], [1.0, 0.0, 1.0, 1.0, 1.0]]),self.functionspace) | |
10945 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10946 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10947 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10948 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10949 | def test_whereNonNegative_constData_rank3(self): | |
10950 | arg=Data(numarray.array([[[-84.874906350810292, -44.379505192158206], [28.596504409608315, 60.352404739121454]], [[17.592457984129254, 67.664065046718292], [46.795367470916034, 36.556332282490359]], [[6.2010626169601011, -33.585920455893998], [-47.715736291142342, -42.963154840594278]], [[-45.34095850737463, -26.483708610893302], [-39.974262905912994, 19.88771053468794]], [[88.691725161686577, -75.208046572141768], [-85.689747680137458, 8.2377492978098985]], [[83.787631396620867, -49.123477152480156], [36.050783089982389, 54.394056720653481]]]),self.functionspace) | |
10951 | res=whereNonNegative(arg) | |
10952 | ref=Data(numarray.array([[[0.0, 0.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [1.0, 1.0]]]),self.functionspace) | |
10953 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10954 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
10955 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10956 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10957 | def test_whereNonNegative_constData_rank4(self): | |
10958 | arg=Data(numarray.array([[[[-84.52613988075008, -64.947347041847252, 9.4101305201296839, 35.435694420253526], [-7.120286056474697, -6.0689912937658619, 61.501160707208356, -4.1907953448503577], [54.669009036752612, -98.597999209648663, 79.057818995264938, 34.756927524520307]], [[-70.577681199984156, -52.492379254166764, 35.141902397747174, -16.226709548482205], [36.635918130607024, 42.223918562099385, -29.109256279694733, 54.62766676733915], [15.534773817682535, 87.38605319097698, 1.625572546046854, 27.706127877563389]]], [[[-25.7664484244482, 47.928621558570313, 7.3034707294236796, 78.015951593044775], [-43.166701835432143, -38.442261925682033, 30.893468557397057, 76.670511167039166], [92.706771429777774, -55.126224012943425, 67.321551454448951, 21.740500733205522]], [[-61.907644030699458, -38.306720971672583, 0.028473852938077471, -77.315845643856392], [-66.248821618301704, -68.743432146090242, -30.342588891529431, 74.988392905265613], [67.96408525986044, -30.961390473072626, -88.014243699266714, -7.3404633115983273]]], [[[82.80863756339042, -84.617444504028242, 28.915306301329991, -73.0670924857328], [-24.942282815492604, -25.503886997001899, -47.670576507576847, 67.418759772866565], [-5.4429473873534846, -9.2842979893077171, 81.764457533224487, 72.156672638590123]], [[-90.515361748774609, 49.995483389181857, 64.396138141130649, -33.448204883697159], [63.15104838581496, 45.549340467023313, -10.674194426909494, 33.4040207366196], [-29.719350476337425, 1.7739287529206678, 46.246160005609397, 56.425625128320206]]]]),self.functionspace) | |
10959 | res=whereNonNegative(arg) | |
10960 | ref=Data(numarray.array([[[[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 0.0], [1.0, 0.0, 1.0, 1.0]], [[0.0, 0.0, 1.0, 0.0], [1.0, 1.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[0.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 1.0]], [[0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 0.0]]], [[[1.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0]], [[0.0, 1.0, 1.0, 0.0], [1.0, 1.0, 0.0, 1.0], [0.0, 1.0, 1.0, 1.0]]]]),self.functionspace) | |
10961 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10962 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
10963 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10964 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10965 | def test_whereNonNegative_expandedData_rank0(self): | |
10966 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10967 | arg=msk_arg*(56.6120440687)+(1.-msk_arg)*(96.3965404442) | |
10968 | res=whereNonNegative(arg) | |
10969 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10970 | ref=msk_ref*(1.0)+(1.-msk_ref)*(1.0) | |
10971 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10972 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
10973 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10974 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10975 | def test_whereNonNegative_expandedData_rank1(self): | |
10976 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10977 | arg=msk_arg*numarray.array([25.636357534486805, 67.685837005139604])+(1.-msk_arg)*numarray.array([-24.15576704470746, -84.048449027253042]) | |
10978 | res=whereNonNegative(arg) | |
10979 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10980 | ref=msk_ref*numarray.array([1.0, 1.0])+(1.-msk_ref)*numarray.array([0.0, 0.0]) | |
10981 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10982 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
10983 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10984 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10985 | def test_whereNonNegative_expandedData_rank2(self): | |
10986 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10987 | arg=msk_arg*numarray.array([[-78.072975305635964, -30.667161396580141, 61.34202507179748, -11.419584402032768, 39.71596012189525], [-25.684737576238177, 53.340398852687258, -3.7920141589733873, -35.952675355382183, -72.00887455038], [-66.687289808523516, -55.038138946819949, 87.076259533901833, -62.254642616503332, -29.28679422910929], [-72.59303136759938, 93.821103037696304, -1.9135138142220853, 29.766163398776797, 39.407165859633977]])+(1.-msk_arg)*numarray.array([[83.571115792006481, 21.888287744499536, -29.168589548635609, 34.101960445545103, 25.366974991818296], [37.116659623741299, -20.551392540396819, 9.4877933474515999, -61.562905177089135, 92.89134307705973], [-52.907637411387178, 55.499587467889029, 48.295777148962998, -48.29039188616369, -41.329781691943211], [-89.407168408621132, 48.502208126113885, 40.222625009294035, -62.616466083297404, -70.677377752043967]]) | |
10988 | res=whereNonNegative(arg) | |
10989 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
10990 | ref=msk_ref*numarray.array([[0.0, 0.0, 1.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0, 0.0], [0.0, 1.0, 0.0, 1.0, 1.0]])+(1.-msk_ref)*numarray.array([[1.0, 1.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0, 1.0], [0.0, 1.0, 1.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0, 0.0]]) | |
10991 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
10992 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
10993 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
10994 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
10995 | def test_whereNonNegative_expandedData_rank3(self): | |
10996 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
10997 | arg=msk_arg*numarray.array([[[40.268335457118411, -86.265565082439849], [-77.060652900660841, -35.613541831532686]], [[-11.130159180791651, -50.801802035975065], [77.616966406185526, -70.955846219724322]], [[-59.237474200638005, 30.293686762130278], [8.9399890546122833, 18.022819538905438]], [[-16.735446376444173, 81.491526325502974], [-59.435886845211414, -23.576205091650152]], [[-19.93446385501656, 28.158357589195418], [-81.904756903369673, 37.850741195421818]], [[-23.170136003419174, -88.117336264200148], [-39.721430862707805, -37.158697868374823]]])+(1.-msk_arg)*numarray.array([[[-89.484033408544164, 3.6290659328079471], [55.5035691803443, 35.04365064842699]], [[-39.575786434207672, 24.075061751850129], [-51.028410946050862, -72.168381468693894]], [[8.7978652953924126, 33.743730472745966], [48.813391295251847, 57.556748922574599]], [[-50.67819357472851, 98.297612205036046], [65.754745719803822, 94.701073496612821]], [[-7.8627589244033089, -77.587700068588745], [-78.102433124642317, 80.568138398059347]], [[20.626187739191067, 72.868306997375896], [-92.253636917468327, -92.26606957875822]]]) | |
10998 | res=whereNonNegative(arg) | |
10999 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11000 | ref=msk_ref*numarray.array([[[1.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [1.0, 0.0]], [[0.0, 1.0], [1.0, 1.0]], [[0.0, 1.0], [0.0, 0.0]], [[0.0, 1.0], [0.0, 1.0]], [[0.0, 0.0], [0.0, 0.0]]])+(1.-msk_ref)*numarray.array([[[0.0, 1.0], [1.0, 1.0]], [[0.0, 1.0], [0.0, 0.0]], [[1.0, 1.0], [1.0, 1.0]], [[0.0, 1.0], [1.0, 1.0]], [[0.0, 0.0], [0.0, 1.0]], [[1.0, 1.0], [0.0, 0.0]]]) | |
11001 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11002 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11003 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11004 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11005 | def test_whereNonNegative_expandedData_rank4(self): | |
11006 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11007 | arg=msk_arg*numarray.array([[[[50.118052228953417, -88.730765495976627, -84.378037931711788, -23.415595349324121], [-67.440289645809926, 93.404419793514279, -59.787425377620963, -32.374614750659873], [72.996508166755063, 28.673559835094807, -41.279856362022961, -98.826373041981256]], [[34.161465745827087, 60.408826978493238, -55.569419121217997, 98.526543458136359], [89.581255428071103, -7.9093712080281477, 19.046497284788245, 46.656250120588084], [-89.213555622028167, -60.048706949978836, -96.023118800400738, -38.560321211470217]]], [[[30.610073607783136, -83.484858651904204, -17.939350518275972, -19.569367705996626], [-74.45115543876399, 6.2068488889173636, -6.9764471417878156, -9.6106071030669113], [-34.169979148291318, 39.422153163908035, -82.520572748630272, -97.826881500667696]], [[-43.805063575145113, 52.820087341249064, -11.425891732077531, 91.225666306308483], [-65.7372703434865, -62.123010875670246, -34.999218025158257, 82.649036492923187], [26.621421005843573, -24.208721371623469, 36.104693970302208, -26.311040499741821]]], [[[-73.614891770734744, -85.837005758293458, -53.722074500413754, 80.21071183957946], [46.723144872292266, -6.4559074348415066, 76.314206389016562, 49.12876304442392], [-24.203320133532188, 92.593031809694111, 95.529348278263171, 79.699349442454661]], [[47.068575118893051, 38.079994995473555, 49.966665821438681, 26.424916515149306], [-87.637253126554185, -12.958087998221799, -84.146782819641402, -1.3189534835551484], [-78.523734070290715, 46.584675916144505, 12.785152169211571, -39.544671827810497]]]])+(1.-msk_arg)*numarray.array([[[[-44.483784104558957, -28.006494802891964, 92.253214471020186, -15.814708339708289], [-34.727972062008462, 18.489845474296487, -8.684561294250372, -39.459862391993617], [3.2532135157034503, 97.032451670690847, -5.0819510089139328, 78.319214911261668]], [[-98.398026812312395, 59.505846535267978, 10.784341452949846, -14.250704963278665], [16.595393811048226, 4.8049629604389565, -76.61905163551242, -96.404190597114223], [11.885589053645433, -73.332964281192645, 53.445417740070354, 93.807480385985798]]], [[[66.632634303970747, 28.645399611787298, -83.987062053435622, -62.89109800936339], [-24.23393761880088, 48.42862684926024, 40.07211030469216, -81.012080582820943], [50.754863806056903, -68.507318003236549, -25.055399867857432, 62.59244861144785]], [[-11.047268692459596, -90.177853490375483, -11.20089156470867, 35.53859445005051], [59.047803703205204, 23.854271835098714, -89.220352115110501, -54.108930266124823], [-70.781715085187784, 30.727426768606961, 19.981466099151106, -26.098236640973766]]], [[[71.538263486211775, -85.096322580377006, 79.221899163626887, -59.858169598469793], [47.338661263600414, 93.057272248217714, 75.394754283706391, 58.169107710198773], [73.772225431452796, -59.557034519677707, -26.119548712323578, 31.027715412640816]], [[61.119765212242982, 42.526393080611683, 69.940051844556393, -54.370980511290881], [-75.41802697240314, -87.096596680306959, 90.532406636535342, -46.482642233552987], [-46.532222608169491, 73.733664853166999, -93.120651954554361, 42.436012745957726]]]]) | |
11008 | res=whereNonNegative(arg) | |
11009 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11010 | ref=msk_ref*numarray.array([[[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [1.0, 1.0, 0.0, 0.0]], [[1.0, 1.0, 0.0, 1.0], [1.0, 0.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0]]], [[[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0]], [[0.0, 1.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 1.0, 0.0]]], [[[0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0]]]])+(1.-msk_ref)*numarray.array([[[[0.0, 0.0, 1.0, 0.0], [0.0, 1.0, 0.0, 0.0], [1.0, 1.0, 0.0, 1.0]], [[0.0, 1.0, 1.0, 0.0], [1.0, 1.0, 0.0, 0.0], [1.0, 0.0, 1.0, 1.0]]], [[[1.0, 1.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0], [1.0, 0.0, 0.0, 1.0]], [[0.0, 0.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0]]], [[[1.0, 0.0, 1.0, 0.0], [1.0, 1.0, 1.0, 1.0], [1.0, 0.0, 0.0, 1.0]], [[1.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 1.0, 0.0, 1.0]]]]) | |
11011 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11012 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11013 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11014 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11015 | def test_whereNonNegative_Symbol_rank0(self): | |
11016 | arg=Symbol(shape=()) | |
11017 | res=whereNonNegative(arg) | |
11018 | s=numarray.array(-58.8398548815) | |
11019 | sub=res.substitute({arg:s}) | |
11020 | ref=numarray.array(0.0) | |
11021 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11022 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11023 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11024 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11025 | def test_whereNonNegative_Symbol_rank1(self): | |
11026 | arg=Symbol(shape=(2,)) | |
11027 | res=whereNonNegative(arg) | |
11028 | s=numarray.array([-82.978162754997925, 8.8047326469017122]) | |
11029 | sub=res.substitute({arg:s}) | |
11030 | ref=numarray.array([0.0, 1.0]) | |
11031 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11032 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11033 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11034 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11035 | def test_whereNonNegative_Symbol_rank2(self): | |
11036 | arg=Symbol(shape=(4, 5)) | |
11037 | res=whereNonNegative(arg) | |
11038 | s=numarray.array([[-57.114751898774863, 15.310009304133203, 43.273189593545482, 77.426458486062614, 98.035318487754211], [-76.31417820596009, 96.405957727411931, -36.79040107424283, 69.588907574896353, -90.819051620846139], [-21.384010858090917, -49.316099962453343, -55.596563560663206, -56.091061695460368, -54.243683421440721], [-3.1770490856211921, -77.802197055188955, -91.262528798034097, 16.294977226431428, -61.953476904394321]]) | |
11039 | sub=res.substitute({arg:s}) | |
11040 | ref=numarray.array([[0.0, 1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0, 0.0]]) | |
11041 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11042 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11043 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11044 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11045 | def test_whereNonNegative_Symbol_rank3(self): | |
11046 | arg=Symbol(shape=(6, 2, 2)) | |
11047 | res=whereNonNegative(arg) | |
11048 | s=numarray.array([[[-52.302419178666696, -36.011072121710995], [70.344129482626641, -94.887462805836108]], [[39.457090101441935, 62.182034936241706], [33.071419719406265, 19.65467224682935]], [[96.444658364252234, 41.810028968759298], [17.391731498730124, -61.25543188161371]], [[-63.301909068860418, -81.883202505287912], [-9.9686422778212318, -46.09994160257731]], [[0.79602140898114726, 50.995175121403491], [39.42271713433064, -42.96711417231338]], [[80.077410450464015, -98.147299040950202], [64.444746581110735, 51.710239923438252]]]) | |
11049 | sub=res.substitute({arg:s}) | |
11050 | ref=numarray.array([[[0.0, 0.0], [1.0, 0.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[1.0, 1.0], [1.0, 0.0]], [[1.0, 0.0], [1.0, 1.0]]]) | |
11051 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11052 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11053 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11054 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11055 | def test_whereNonNegative_Symbol_rank4(self): | |
11056 | arg=Symbol(shape=(3, 2, 3, 4)) | |
11057 | res=whereNonNegative(arg) | |
11058 | s=numarray.array([[[[-2.5976588468490576, 40.976618480274965, 70.916330592715354, -49.191553192076313], [-45.926997545504577, 24.639940210475771, 97.36697304102708, 17.590694675821311], [7.7336847115890208, 85.237419267281496, -44.228298807540178, 78.087061579851849]], [[-12.198656257367603, 47.317574884270329, -62.408862701830678, -80.308596525604585], [80.773698810403005, -9.4412453002422581, 23.683937597676618, 85.85784825956523], [59.265035657131932, -69.325519327240812, 8.7058140434875781, -2.6024028142058313]]], [[[86.063542738983188, -51.362725843818154, 34.405542453001004, -41.972672290063898], [55.999438377020596, 34.884322235694952, 43.380175207740791, 72.776691509642774], [34.801699371894642, -29.764898058856332, -21.123661199537452, 70.371152717243234]], [[3.6278240748509347, 70.0196680461124, 13.553508050734834, 63.606237837653055], [-96.718689436297979, 4.8092184150583961, 77.949143466573901, 4.2865181135117325], [86.218370330935954, 2.1563115590517583, 79.16881170243272, 30.950434657002916]]], [[[-21.513843712936279, 58.255206877882586, 72.514067267547603, -55.492241103847896], [50.528843425732504, 32.768659523585143, -96.564483321783712, 8.5964884268373822], [-64.457464623327951, 28.321553816132479, -80.813838907921777, -47.985766337452375]], [[72.299179846553841, 23.493342362064666, -62.700406034359645, 98.803246182773449], [58.424956553971555, 44.217263909841364, -90.54565580877221, -17.345594535777977], [-75.243832297268185, -78.534529191352576, -4.4135475705371761, -10.331784394585156]]]]) | |
11059 | sub=res.substitute({arg:s}) | |
11060 | ref=numarray.array([[[[0.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 1.0], [1.0, 1.0, 0.0, 1.0]], [[0.0, 1.0, 0.0, 0.0], [1.0, 0.0, 1.0, 1.0], [1.0, 0.0, 1.0, 0.0]]], [[[1.0, 0.0, 1.0, 0.0], [1.0, 1.0, 1.0, 1.0], [1.0, 0.0, 0.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[0.0, 1.0, 1.0, 0.0], [1.0, 1.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0]], [[1.0, 1.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]]]) | |
11061 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11062 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11063 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11064 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11065 | def test_whereNonPositive_float_rank0(self): | |
11066 | arg=-45.8140100626 | |
11067 | res=whereNonPositive(arg) | |
11068 | ref=1.0 | |
11069 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
11070 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11071 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11072 | def test_whereNonPositive_array_rank0(self): | |
11073 | arg=numarray.array(-63.8959249588) | |
11074 | res=whereNonPositive(arg) | |
11075 | ref=numarray.array(1.0) | |
11076 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11077 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
11078 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11079 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11080 | def test_whereNonPositive_array_rank1(self): | |
11081 | arg=numarray.array([54.415838481100479, -35.5624835416114]) | |
11082 | res=whereNonPositive(arg) | |
11083 | ref=numarray.array([0.0, 1.0]) | |
11084 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11085 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
11086 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11087 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11088 | def test_whereNonPositive_array_rank2(self): | |
11089 | arg=numarray.array([[-19.977776356765318, 5.9786051244587952, -56.499280299922752, -34.772432329184056, -42.376287015366223], [-84.487175491423102, -47.807388262784926, -2.1549567968020398, 65.070219308351994, -81.156967947597551], [39.362869981047908, 82.897480274445286, -25.251661283915567, -14.554050325024775, 99.441792996707022], [-87.49041530809086, -32.750499747633071, 40.491174827110797, 68.288080492730728, 21.562840881641691]]) | |
11090 | res=whereNonPositive(arg) | |
11091 | ref=numarray.array([[1.0, 0.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0, 0.0], [1.0, 1.0, 0.0, 0.0, 0.0]]) | |
11092 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11093 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
11094 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11095 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11096 | def test_whereNonPositive_array_rank3(self): | |
11097 | arg=numarray.array([[[-80.816933807988647, 18.410516218736745], [-84.025394562335066, 73.817364376601347]], [[61.338668393303806, -19.309105906918774], [60.531656152601499, -62.629597501263888]], [[98.405881825725487, -87.157404259910081], [-77.87716088817686, 54.080880261791691]], [[44.017293267806849, 81.605183414497702], [25.005545230944733, 43.880992994339664]], [[-9.0200660048142396, -52.950279136546015], [33.391394798474323, 77.366312324785582]], [[-12.930426357736494, 26.724479555287701], [76.853844695874045, -73.905941842749797]]]) | |
11098 | res=whereNonPositive(arg) | |
11099 | ref=numarray.array([[[1.0, 0.0], [1.0, 0.0]], [[0.0, 1.0], [0.0, 1.0]], [[0.0, 1.0], [1.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[1.0, 1.0], [0.0, 0.0]], [[1.0, 0.0], [0.0, 1.0]]]) | |
11100 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11101 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
11102 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11103 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11104 | def test_whereNonPositive_array_rank4(self): | |
11105 | arg=numarray.array([[[[84.854900822533551, -70.314859921760501, 91.167657851483199, 58.634317483028553], [-45.674981783852253, -91.344582047164224, -45.296293433418299, -11.820391409783412], [7.5520922261311085, 33.939791936902679, -30.78101779452625, 92.217815104797097]], [[16.487093948363324, 46.549440093303588, -35.737509999956288, -79.69614030357792], [28.449486617318911, -62.884436564134603, 40.844828284827628, 10.366425813044785], [79.665416005370531, 39.56742434170576, -27.721667918864227, -81.954150375477553]]], [[[47.951911230948269, -25.788610534552575, -16.885257596759516, 82.068516597608067], [-0.51652980482228372, -66.573004416820339, -72.185890143047729, -63.647624985740258], [93.906834018256092, -58.422363414411606, -39.708973666342608, -7.1654247643074314]], [[-82.284191996980809, 63.235007339504534, -78.292387412733092, -52.126182522828877], [16.684565256071693, 57.832220397954075, -38.766429611788354, -62.311953863196749], [-60.30897110518432, -42.386777033904146, -60.890434946023241, 78.663607764550704]]], [[[-47.287040896177388, -20.906728008055325, 48.334998443867818, 18.78306004141406], [-74.950637186434733, 84.51043393945514, 14.145744299214428, 76.234540063777558], [18.666731132635476, 83.354101505920454, 48.433353335770846, -50.240885823292778]], [[-72.060114740388656, -55.762235089994427, -35.520941042497213, 49.448425790974369], [-0.16498976632010454, 3.6711888832083588, 0.44840601553353565, -4.6970780448722991], [-94.786520432934168, 18.525824825003696, 61.101943285402172, -87.622236927860868]]]]) | |
11106 | res=whereNonPositive(arg) | |
11107 | ref=numarray.array([[[[0.0, 1.0, 0.0, 0.0], [1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 0.0]], [[0.0, 0.0, 1.0, 1.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 1.0]]], [[[0.0, 1.0, 1.0, 0.0], [1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0]], [[1.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [1.0, 1.0, 1.0, 0.0]]], [[[1.0, 1.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]], [[1.0, 1.0, 1.0, 0.0], [1.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 1.0]]]]) | |
11108 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11109 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
11110 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11111 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11112 | def test_whereNonPositive_constData_rank0(self): | |
11113 | arg=Data(76.8341760885,self.functionspace) | |
11114 | res=whereNonPositive(arg) | |
11115 | ref=Data(0.0,self.functionspace) | |
11116 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11117 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11118 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11119 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11120 | def test_whereNonPositive_constData_rank1(self): | |
11121 | arg=Data(numarray.array([5.110430775637127, -8.5929188047610552]),self.functionspace) | |
11122 | res=whereNonPositive(arg) | |
11123 | ref=Data(numarray.array([0.0, 1.0]),self.functionspace) | |
11124 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11125 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11126 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11127 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11128 | def test_whereNonPositive_constData_rank2(self): | |
11129 | arg=Data(numarray.array([[73.186196525129645, 63.106873510282924, -37.93591985539193, -4.9728512739999076, 19.376979391439363], [4.5452345913447658, 46.103234583667671, 18.062219251009836, 99.310495136151133, 51.526446572677145], [-94.648587297912812, -79.599690191233478, 95.310895065698446, -91.742395450846828, -95.503130322854204], [54.132238583769265, -6.2958941894595881, 80.387872082718758, -56.594075571445003, -0.087162886623445957]]),self.functionspace) | |
11130 | res=whereNonPositive(arg) | |
11131 | ref=Data(numarray.array([[0.0, 0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 0.0, 1.0, 1.0], [0.0, 1.0, 0.0, 1.0, 1.0]]),self.functionspace) | |
11132 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11133 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11134 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11135 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11136 | def test_whereNonPositive_constData_rank3(self): | |
11137 | arg=Data(numarray.array([[[35.640522044117716, 35.479584214315452], [-83.66008428402651, -12.353315661361748]], [[-46.695985576916875, 56.815876089929901], [14.328557434943392, 54.490435657692615]], [[38.157071729732564, -63.060450376793042], [-56.69840568574287, 45.584077281388033]], [[96.777622099398059, -5.1796500781218384], [89.674102699704235, 41.472615569686411]], [[59.694746638725746, -37.205367017231382], [-29.955192328084593, 55.672175132947785]], [[35.375171131639576, -93.866403218358215], [23.27567992190464, -49.139452886576862]]]),self.functionspace) | |
11138 | res=whereNonPositive(arg) | |
11139 | ref=Data(numarray.array([[[0.0, 0.0], [1.0, 1.0]], [[1.0, 0.0], [0.0, 0.0]], [[0.0, 1.0], [1.0, 0.0]], [[0.0, 1.0], [0.0, 0.0]], [[0.0, 1.0], [1.0, 0.0]], [[0.0, 1.0], [0.0, 1.0]]]),self.functionspace) | |
11140 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11141 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11142 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11143 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11144 | def test_whereNonPositive_constData_rank4(self): | |
11145 | arg=Data(numarray.array([[[[78.120351293960368, 45.517827635106755, 13.754081165958112, 53.648332704104661], [-95.730532610383534, 64.863790698266143, -56.063132630021649, 66.592428370803646], [63.399839434838213, -73.022434587860104, -67.904116954138885, -50.280183675978037]], [[-29.930362494006559, 32.052615321911333, 72.250187735124626, 33.654605438190998], [-65.127089193367851, -32.722417502163452, 38.596924965290668, -81.264280989691599], [-26.325082622716451, 92.723726612008733, -6.9104901305947948, -56.732407303629607]]], [[[81.299873121289409, -0.60752785487785843, 81.02975074643345, 5.6594823714348053], [17.236459205051176, 2.9463513679599771, 96.07565713416264, -70.792732773851498], [87.611958793760635, 99.359964258540117, 10.130252954092242, -67.297975693155252]], [[-71.553505655481999, -90.989697336378043, -57.310147425889625, -4.7051290563562276], [45.896460083362314, 79.487272101784242, 33.393465498093576, 90.509868144157366], [-68.059017250831175, 98.172331068427752, 76.21324396944388, -18.114975003809363]]], [[[30.18165573581669, -95.406985301029422, -41.697668617320851, -88.452149593062245], [-26.45265307152971, 7.5605523928963692, 87.21992505390017, -83.416286385195633], [-25.719143977748814, 57.849131833666064, 16.280200193493343, -48.38523212914918]], [[22.977807767062089, -16.18840952303114, 99.764245118344576, -31.703462585340404], [-11.504718586929556, -24.746181326375378, 30.058139117771191, 93.910717466047032], [-79.520098835545866, 30.192855384126148, 99.121945637672439, -59.524886303278301]]]]),self.functionspace) | |
11146 | res=whereNonPositive(arg) | |
11147 | ref=Data(numarray.array([[[[0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 1.0, 0.0], [0.0, 1.0, 1.0, 1.0]], [[1.0, 0.0, 0.0, 0.0], [1.0, 1.0, 0.0, 1.0], [1.0, 0.0, 1.0, 1.0]]], [[[0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 1.0]]], [[[0.0, 1.0, 1.0, 1.0], [1.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 1.0]], [[0.0, 1.0, 0.0, 1.0], [1.0, 1.0, 0.0, 0.0], [1.0, 0.0, 0.0, 1.0]]]]),self.functionspace) | |
11148 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11149 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11150 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11151 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11152 | def test_whereNonPositive_expandedData_rank0(self): | |
11153 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11154 | arg=msk_arg*(-21.294938937)+(1.-msk_arg)*(-72.0328127018) | |
11155 | res=whereNonPositive(arg) | |
11156 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11157 | ref=msk_ref*(1.0)+(1.-msk_ref)*(1.0) | |
11158 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11159 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11160 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11161 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11162 | def test_whereNonPositive_expandedData_rank1(self): | |
11163 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11164 | arg=msk_arg*numarray.array([14.001065620474165, 51.060850237675112])+(1.-msk_arg)*numarray.array([-6.4845892236093334, 73.407748235087723]) | |
11165 | res=whereNonPositive(arg) | |
11166 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11167 | ref=msk_ref*numarray.array([0.0, 0.0])+(1.-msk_ref)*numarray.array([1.0, 0.0]) | |
11168 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11169 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11170 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11171 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11172 | def test_whereNonPositive_expandedData_rank2(self): | |
11173 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11174 | arg=msk_arg*numarray.array([[-64.52120230042874, -31.827528475750682, 10.004997743630327, 91.575189079620088, 50.375139386687209], [41.720379535781916, 63.159827023202382, 49.57432401463214, 9.3070620932102202, 60.232643522299185], [25.240200875891901, -96.938260964323163, 62.0452615917537, -42.644345796361179, -82.263178482606222], [-75.954278388926681, 14.813887736649605, 8.7669517953596028, -76.802613030476522, 4.3723418171869923]])+(1.-msk_arg)*numarray.array([[3.6464123199156973, -30.094451732015187, -38.084149034576512, 16.553157123976646, 49.784666124112704], [-66.53566180083385, -1.0279761734758068, 36.193921499854014, 27.465955037373504, 8.41610652840032], [45.914465105438126, 47.11191355094499, -78.536609881550731, -28.478652266113855, -36.443325125458003], [86.47075792022045, -8.4827911972243299, 36.645811902720908, 45.3318814313877, -93.9890221530123]]) | |
11175 | res=whereNonPositive(arg) | |
11176 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11177 | ref=msk_ref*numarray.array([[1.0, 1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 1.0, 1.0], [1.0, 0.0, 0.0, 1.0, 0.0]])+(1.-msk_ref)*numarray.array([[0.0, 1.0, 1.0, 0.0, 0.0], [1.0, 1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.0, 1.0, 1.0], [0.0, 1.0, 0.0, 0.0, 1.0]]) | |
11178 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11179 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11180 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11181 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11182 | def test_whereNonPositive_expandedData_rank3(self): | |
11183 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11184 | arg=msk_arg*numarray.array([[[3.4932152236425225, -36.146311025025412], [-79.511782256523205, 43.209384016358598]], [[-12.911756606412169, 84.296575347249728], [-18.796706505874795, -65.624653714469986]], [[20.077128133134423, 82.197624733378518], [-10.896782554696998, 8.3500680112954484]], [[-55.918585807034724, -71.322632870917687], [-79.500335685116255, -66.109585462512442]], [[5.3425876719804819, 59.506331837634548], [4.3592655512523493, -44.497382825601115]], [[-8.9240915992721028, 56.420248561123145], [10.275532725278708, -14.724999384740372]]])+(1.-msk_arg)*numarray.array([[[-50.654219085401195, -20.564018798701042], [-6.8157495083358981, -8.7152789021806001]], [[67.612800754357124, 20.241913145493101], [68.465229152050711, 32.266053812298566]], [[-0.88016538230590413, 41.688901064752685], [27.230966724318776, 32.520603018797004]], [[26.061980470503499, -54.87980460183941], [7.6346427424732042, 20.663565250317689]], [[-96.61073536198441, -73.190601459898843], [-61.479505152207395, -99.707856346427221]], [[-9.3807883210439371, -9.3488757322235188], [-6.7769146729327758, -73.95899955952676]]]) | |
11185 | res=whereNonPositive(arg) | |
11186 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11187 | ref=msk_ref*numarray.array([[[0.0, 1.0], [1.0, 0.0]], [[1.0, 0.0], [1.0, 1.0]], [[0.0, 0.0], [1.0, 0.0]], [[1.0, 1.0], [1.0, 1.0]], [[0.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]]])+(1.-msk_ref)*numarray.array([[[1.0, 1.0], [1.0, 1.0]], [[0.0, 0.0], [0.0, 0.0]], [[1.0, 0.0], [0.0, 0.0]], [[0.0, 1.0], [0.0, 0.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]]]) | |
11188 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11189 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11190 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11191 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11192 | def test_whereNonPositive_expandedData_rank4(self): | |
11193 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11194 | arg=msk_arg*numarray.array([[[[-58.89835447211469, -6.0893328346566733, -1.0023693518593575, -61.539230319459627], [60.870457135837682, -83.305095813845867, -38.116740546736374, -64.075745680293039], [79.081243725668998, -3.1565899739248522, -69.359266580736985, -25.939574951041493]], [[44.840056891487734, 9.4190204246416016, 33.086497185256661, 45.011451755319172], [94.214589826739939, -5.702363967501924, -19.973298938018431, 76.184762328377644], [7.5290921100338721, 48.192190457350875, 80.630439347990887, -10.677496472704931]]], [[[11.221137534077187, 7.1347297082242846, 25.87988065153138, -3.7157692974099064], [-76.043759143725808, 69.02633203511769, -98.860304021235777, 53.531068740423734], [-34.89611427266945, 27.156902812036535, 72.743609137679357, 95.314597465726479]], [[78.038851407351615, 56.72377621086261, -20.725276919441342, -58.75384173399285], [-26.213835341147828, -86.937961787952219, -45.889334819778796, 31.050065322925832], [75.255475636162998, -54.929307087299996, -42.283656056524642, 68.6586886677525]]], [[[-28.16883583872432, -40.372922117108565, -30.135564687244994, 50.246251468410065], [-7.2498686947860165, 94.45851868271248, -53.581025727792642, -32.424001887898868], [85.576621269199592, 58.609425585253945, 78.085399899893304, 98.996509927055513]], [[-75.317618268425264, 11.26227410259915, -51.177413277829785, -34.929151547420361], [4.3965337305110097, 90.923268663940149, -89.483861691460845, -5.4115854061605972], [-49.940568614308049, -28.969569648394568, -95.982720688496244, 87.745557466302273]]]])+(1.-msk_arg)*numarray.array([[[[-74.771460648328443, 13.793031178508002, -41.976214738752859, -25.36331645721701], [24.01507156186311, 60.776951586528895, 8.3096968814290619, -60.613551059743067], [1.4391448885635327, -92.057454358544248, 13.907184752443811, -52.254719033883632]], [[-46.910170661904637, -33.334225663168681, -9.3791104242402952, -15.404344393378281], [69.025944878882456, -51.909070828632785, 31.053379001160948, 62.760215014236422], [-74.91014748820912, 22.358213500298248, -91.88145013095253, 35.630042926552306]]], [[[-29.279785927448572, -98.509512781683981, -3.2141945191207668, -7.8787884397738992], [61.929082763373486, -13.285831454240963, -22.609607789839885, -95.781398772215994], [11.65303310062788, -55.087961160687016, -7.340663618342063, -51.681435909557429]], [[10.223206694434708, 52.870731191118949, 94.343773117331011, 54.502331701573127], [-74.304124617034418, 37.5127280034894, 87.414312181666446, 5.5216671015867007], [-48.162344739211704, 40.109818025385323, 88.765369352144177, -3.2256322380404612]]], [[[-21.040797096187333, 38.819012415945906, -40.815118132374636, 57.1068994645087], [44.584730270097026, 63.853583439836456, 64.648203529995698, 19.794733417566988], [90.528792123051915, -65.456358000132781, 10.691310766549861, 90.084242627365683]], [[-64.643286624216984, 36.640703954145948, 82.940348145540838, -74.20215167286193], [80.641128632128385, 7.801376809332325, 8.1922136533463004, 85.312711221718672], [60.727877225987015, -96.319606263671147, 42.598308142226301, 27.966063247606769]]]]) | |
11195 | res=whereNonPositive(arg) | |
11196 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11197 | ref=msk_ref*numarray.array([[[[1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]], [[[0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 1.0, 1.0], [1.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 0.0]]], [[[1.0, 1.0, 1.0, 0.0], [1.0, 0.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0]], [[1.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [1.0, 1.0, 1.0, 0.0]]]])+(1.-msk_ref)*numarray.array([[[[1.0, 0.0, 1.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 0.0, 0.0], [1.0, 0.0, 1.0, 0.0]]], [[[1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0]], [[0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 1.0]]], [[[1.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0]], [[1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0]]]]) | |
11198 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11199 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11200 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11201 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11202 | def test_whereNonPositive_Symbol_rank0(self): | |
11203 | arg=Symbol(shape=()) | |
11204 | res=whereNonPositive(arg) | |
11205 | s=numarray.array(77.8916591537) | |
11206 | sub=res.substitute({arg:s}) | |
11207 | ref=numarray.array(0.0) | |
11208 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11209 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11210 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11211 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11212 | def test_whereNonPositive_Symbol_rank1(self): | |
11213 | arg=Symbol(shape=(2,)) | |
11214 | res=whereNonPositive(arg) | |
11215 | s=numarray.array([-33.289158126131952, -1.5128195409398302]) | |
11216 | sub=res.substitute({arg:s}) | |
11217 | ref=numarray.array([1.0, 1.0]) | |
11218 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11219 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11220 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11221 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11222 | def test_whereNonPositive_Symbol_rank2(self): | |
11223 | arg=Symbol(shape=(4, 5)) | |
11224 | res=whereNonPositive(arg) | |
11225 | s=numarray.array([[-89.675580644561265, 22.559086207037524, -61.828686826382075, 27.1544684361686, 45.542621022409065], [85.192461460403905, -53.369255198350189, -14.522490839063138, -52.745550126279504, 86.892055736152827], [59.381482694454775, -2.2128498063082986, -18.474083777512277, -32.66119377883534, -4.6884479061867381], [7.5046013827574569, -64.478468078572845, -62.300090670346989, -43.459905594571559, -37.619402963077995]]) | |
11226 | sub=res.substitute({arg:s}) | |
11227 | ref=numarray.array([[1.0, 0.0, 1.0, 0.0, 0.0], [0.0, 1.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0, 1.0]]) | |
11228 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11229 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11230 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11231 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11232 | def test_whereNonPositive_Symbol_rank3(self): | |
11233 | arg=Symbol(shape=(6, 2, 2)) | |
11234 | res=whereNonPositive(arg) | |
11235 | s=numarray.array([[[-95.918264910372713, 6.3129536060116038], [-76.185186646280044, 44.955820732431221]], [[-32.087973595564208, -0.31281142062647405], [98.251703861862637, 23.468120114051857]], [[-17.876631318058784, -80.339284229220681], [66.433104146541297, -2.5691119117624766]], [[-92.336473044409061, -66.47349632093993], [6.9081826899842298, -92.412591379337769]], [[69.747227993397672, -68.361187717592585], [28.906283769426977, -3.0855057313569034]], [[0.16094458858653127, -37.744731595476111], [29.326676077792968, -67.220325889081693]]]) | |
11236 | sub=res.substitute({arg:s}) | |
11237 | ref=numarray.array([[[1.0, 0.0], [1.0, 0.0]], [[1.0, 1.0], [0.0, 0.0]], [[1.0, 1.0], [0.0, 1.0]], [[1.0, 1.0], [0.0, 1.0]], [[0.0, 1.0], [0.0, 1.0]], [[0.0, 1.0], [0.0, 1.0]]]) | |
11238 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11239 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11240 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11241 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11242 | def test_whereNonPositive_Symbol_rank4(self): | |
11243 | arg=Symbol(shape=(3, 2, 3, 4)) | |
11244 | res=whereNonPositive(arg) | |
11245 | s=numarray.array([[[[55.498714331062388, 54.252976216091497, -98.652221242885446, -23.046325158660252], [66.57207224733591, -81.489676342610181, -32.086709889394712, -53.285321024541574], [5.2473282469308771, 13.640749356133469, -12.21713455758298, -1.1074900781016055]], [[83.821686808343998, 99.553411628762717, -33.166274509524158, -53.92140858957346], [5.6843137169410483, 91.822981464459502, -59.926027075594135, 98.170404451167997], [-19.520109690127313, -16.751066330247028, -19.60635328442504, -73.443643477418306]]], [[[-88.557271430733664, 69.650033834683228, 55.310025898430098, -1.3968640891514497], [85.622930077343767, -28.885517945359183, -38.007545637866905, 48.884082461569591], [32.287613684538513, -67.874193842556593, -46.816154148980679, 15.033159367432276]], [[15.626339801085123, -36.615019684003272, -3.5738338209469305, -82.126638691597861], [75.620428324563647, 14.684051809096403, 32.959487070219126, -47.924394139408747], [86.232984866683438, 94.002057931789693, -5.031840183352827, -99.515668678010044]]], [[[38.57106713689825, 71.66686186356219, -72.000417104598526, -63.413495181487974], [69.578042969052859, 24.326236647615815, -61.668240010633532, -56.60420332916172], [-96.104048028550366, -63.518533753250914, -81.310814350545613, 85.074793962081429]], [[-71.475740787666183, -47.442708107298046, 76.896488259930521, 7.503896955381876], [1.72079358206976, 80.217658032495223, -76.894583651034452, 84.60341852944893], [-14.477740266380309, 9.795225312137859, 39.751992668400902, -45.915851163810764]]]]) | |
11246 | sub=res.substitute({arg:s}) | |
11247 | ref=numarray.array([[[[0.0, 0.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0]], [[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 0.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 0.0, 0.0, 1.0], [0.0, 1.0, 1.0, 0.0], [0.0, 1.0, 1.0, 0.0]], [[0.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0]]], [[[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [1.0, 1.0, 1.0, 0.0]], [[1.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [1.0, 0.0, 0.0, 1.0]]]]) | |
11248 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11249 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11250 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11251 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11252 | def test_whereZero_float_rank0(self): | |
11253 | arg=36.9194219022 | |
11254 | res=whereZero(arg) | |
11255 | ref=0.0 | |
11256 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
11257 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11258 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11259 | def test_whereZero_array_rank0(self): | |
11260 | arg=numarray.array(-93.2286970236) | |
11261 | res=whereZero(arg) | |
11262 | ref=numarray.array(0.0) | |
11263 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11264 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
11265 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11266 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11267 | def test_whereZero_array_rank1(self): | |
11268 | arg=numarray.array([-5.4758135185183079, -12.393482705182549]) | |
11269 | res=whereZero(arg) | |
11270 | ref=numarray.array([0.0, 0.0]) | |
11271 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11272 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
11273 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11274 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11275 | def test_whereZero_array_rank2(self): | |
11276 | arg=numarray.array([[-22.216037501798056, 4.9281618608239484, 24.076323373045312, -1.5837381383595073, 89.085883212985664], [-31.966408477169978, 59.125907926918728, 22.148581815123777, -3.4787216423014513, 70.486779662550191], [-38.434264024343953, -28.545406042409468, -86.569085677953652, 29.872458065808701, 82.968130635374706], [-0.12806513945584186, 5.2584442959378919, 88.481457835654652, 52.526216268675853, -47.867118858740824]]) | |
11277 | res=whereZero(arg) | |
11278 | ref=numarray.array([[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0]]) | |
11279 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11280 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
11281 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11282 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11283 | def test_whereZero_array_rank3(self): | |
11284 | arg=numarray.array([[[83.566843166821798, 83.428361682287743], [-27.142097287854597, -7.7449066894637042]], [[95.740285720896139, 58.956113534039076], [50.123535284541219, 51.623550969006601]], [[95.393321001956423, 88.750537248542344], [-29.708780869260522, -90.320511258990138]], [[75.205523953075215, -81.374513795204507], [-70.55439045053609, 27.401171040594903]], [[23.344274043598048, -52.331497199756583], [77.956546937871479, 25.315698227587191]], [[-73.700561398579438, -10.261392160687222], [-0.82001847170529629, -69.219536679954956]]]) | |
11285 | res=whereZero(arg) | |
11286 | ref=numarray.array([[[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]) | |
11287 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11288 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
11289 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11290 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11291 | def test_whereZero_array_rank4(self): | |
11292 | arg=numarray.array([[[[25.646485297551976, 11.073836310281109, 54.114761331724992, -12.154046230984548], [55.324874795537227, 28.95659934737148, 94.639492916569793, 34.007912394649708], [63.557437176693213, 74.008668533501378, 64.891082638452303, 75.02732907327038]], [[0.10812203896047379, -56.42920257387194, 25.284865245539166, 56.659069500901381], [-24.816276674907726, 54.234226668365494, 30.712957393064244, 99.206875660084734], [-70.610950252661524, -95.570055459069891, -15.080615988435554, -34.468629003757911]]], [[[56.891765767496025, -18.388156109946863, -69.598390029982539, -49.746422132267121], [-55.031142846420522, -76.066644780947399, -77.183345994632262, 57.117746506564544], [-90.739836243999989, -64.407621405298698, 47.917245532062736, 40.184055666825515]], [[-50.242499172011243, -8.87012437468087, 43.485752684298006, 1.9802518704210286], [52.738617953516098, 67.416303731706478, -93.317491063936075, -10.148998504978351], [41.786805141066679, -0.75710798140093516, -0.44487284484937106, 52.422098163397976]]], [[[-56.523619961520424, -56.87408626775543, 86.257157391371067, -59.666478835501756], [-27.523677831571518, 26.978800410887743, 41.981358630995317, 60.966684046224884], [-88.336158365149743, 25.253390160451673, 24.947726326096927, -69.88210288786064]], [[28.934555939829323, 28.843750360082907, 52.298137157289517, 98.435696242381738], [-45.858063671063661, -24.386879374695596, -4.7125807697196933, 18.897314951135954], [-68.600970437531487, 46.967350537404627, 24.491641179009946, -14.113138296837874]]]]) | |
11293 | res=whereZero(arg) | |
11294 | ref=numarray.array([[[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]]]) | |
11295 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11296 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
11297 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11298 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11299 | def test_whereZero_constData_rank0(self): | |
11300 | arg=Data(28.1448958043,self.functionspace) | |
11301 | res=whereZero(arg) | |
11302 | ref=Data(0.0,self.functionspace) | |
11303 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11304 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11305 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11306 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11307 | def test_whereZero_constData_rank1(self): | |
11308 | arg=Data(numarray.array([-82.424192879607403, -37.742931006156489]),self.functionspace) | |
11309 | res=whereZero(arg) | |
11310 | ref=Data(numarray.array([0.0, 0.0]),self.functionspace) | |
11311 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11312 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11313 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11314 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11315 | def test_whereZero_constData_rank2(self): | |
11316 | arg=Data(numarray.array([[88.228357156618614, -67.868123140983812, 1.512038393501669, -2.4090303677805451, -77.431662457170702], [-28.559471393034855, -15.937848887398616, -10.531725851274871, -1.7510038488192521, -44.964870198048246], [-39.261122217051955, 63.804285642486178, -92.35899221299897, 83.265740587577596, 25.680465013643357], [54.5460930839632, 60.917809009044504, -50.068271855067373, -27.753796832679427, 24.173974108605705]]),self.functionspace) | |
11317 | res=whereZero(arg) | |
11318 | ref=Data(numarray.array([[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0]]),self.functionspace) | |
11319 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11320 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11321 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11322 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11323 | def test_whereZero_constData_rank3(self): | |
11324 | arg=Data(numarray.array([[[5.8006491078266436, 35.129891450052469], [72.468149481480708, 30.423431420167645]], [[-97.49296225256478, -95.545777693389056], [-19.272840387210778, -52.712492439965295]], [[-8.4318486054725099, -48.14775009081422], [15.485176866163101, 20.812291283387779]], [[59.148678501666808, 44.49011017020382], [68.060455906204766, -28.366297330479597]], [[-53.89552234182662, -56.019523425289734], [-12.787919401488608, -25.640418311378554]], [[-80.946202928069681, 98.68988212964004], [-86.271543759781096, 58.957148643203482]]]),self.functionspace) | |
11325 | res=whereZero(arg) | |
11326 | ref=Data(numarray.array([[[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]),self.functionspace) | |
11327 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11328 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11329 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11330 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11331 | def test_whereZero_constData_rank4(self): | |
11332 | arg=Data(numarray.array([[[[-65.177620457916689, 67.29262327490423, -7.3415276413508082, -5.2405941808933392], [-48.758858112961768, 22.839891911492273, 79.281591854134689, -31.661211799895611], [-29.378697622508909, 97.445171039982398, -3.9519401978111972, 76.511678962031851]], [[-62.423828480664746, 56.125375059826581, -75.453141434267295, -58.099034647323307], [-97.405453924636291, 50.587164071913492, -62.207039945193785, 6.9380229297484561], [-97.178170849233254, 95.128123507156232, 73.270487977455275, 43.015502805504582]]], [[[-18.640235019885793, -64.312133051653603, 94.354412363014035, 22.993281228643994], [-91.306876358518196, 43.015613220689886, 33.570404531422213, 82.971175030422302], [31.335392435326156, -34.121087575670714, 78.788049923464627, -5.6671192929215692]], [[85.897768300402873, -12.59829275357778, 43.814744997102991, 6.6323709267625048], [-43.13141600459609, -90.169076035549622, -61.538645551752701, -65.336406452922034], [25.4847655361812, 79.757518347506931, 4.4404225559480039, -90.310854126467547]]], [[[-89.942170042909737, 48.83614806552265, 27.339850059944709, 40.364684920253126], [82.979560873661626, -14.475961583560661, -62.784944309919325, -98.935571321987737], [-88.87373557335512, -85.243755112678102, -26.797719666615038, -78.779936332270836]], [[-97.025077640729592, 60.965387643532466, -96.879335350883025, -44.074960019423479], [84.871574286123774, 63.119314763292721, -64.659489888329944, 84.502657554937542], [65.086432289042222, -21.632326349787093, -4.2254524282816277, 84.264250212943978]]]]),self.functionspace) | |
11333 | res=whereZero(arg) | |
11334 | ref=Data(numarray.array([[[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]]]),self.functionspace) | |
11335 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11336 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11337 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11338 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11339 | def test_whereZero_expandedData_rank0(self): | |
11340 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11341 | arg=msk_arg*(32.6280408645)+(1.-msk_arg)*(95.9857415093) | |
11342 | res=whereZero(arg) | |
11343 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11344 | ref=msk_ref*(0.0)+(1.-msk_ref)*(0.0) | |
11345 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11346 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11347 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11348 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11349 | def test_whereZero_expandedData_rank1(self): | |
11350 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11351 | arg=msk_arg*numarray.array([78.912256081910982, 95.107329887542988])+(1.-msk_arg)*numarray.array([-93.129096936828716, -31.119112819271606]) | |
11352 | res=whereZero(arg) | |
11353 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11354 | ref=msk_ref*numarray.array([0.0, 0.0])+(1.-msk_ref)*numarray.array([0.0, 0.0]) | |
11355 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11356 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11357 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11358 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11359 | def test_whereZero_expandedData_rank2(self): | |
11360 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11361 | arg=msk_arg*numarray.array([[-4.5674063676684113, -89.281893625146708, 23.19996829396085, 18.836280966336673, 48.069098115838699], [-22.012453235487612, 49.277998375509071, 36.357927774507999, -81.584591164471846, -86.383640243979073], [-11.398848874052291, 53.725683521115826, 57.996950911680813, -19.278919654298136, -7.6330215452677663], [23.212683532644604, 47.218488529598716, 94.087207901705796, -19.986642121880791, -60.768388103484973]])+(1.-msk_arg)*numarray.array([[-91.766428267475405, -80.743485192118527, 49.721965309529139, -8.4541150165939598, 11.588341364396655], [-66.832555155876435, -41.812843111232766, -42.848862832974092, 38.718794135330427, 97.120556706875561], [-1.7661898089937438, 9.3172028698214291, 64.632791057438652, 8.7177199255444151, 97.409280590459673], [-40.687002837505325, -44.151855951781215, 81.104463998584123, 68.501916362320713, 15.603376060294408]]) | |
11362 | res=whereZero(arg) | |
11363 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11364 | ref=msk_ref*numarray.array([[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0]])+(1.-msk_ref)*numarray.array([[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0]]) | |
11365 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11366 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11367 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11368 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11369 | def test_whereZero_expandedData_rank3(self): | |
11370 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11371 | arg=msk_arg*numarray.array([[[-21.084709880958158, 60.058563461115341], [23.462135905224613, 4.1925110299263935]], [[-73.752445728764471, 98.917050977312613], [91.380933382588495, 96.936759674063694]], [[-42.119594542112758, -36.557259071778894], [-41.337250253991378, -23.488672516050045]], [[79.635013224815708, 34.63320785977092], [52.590069604255888, 21.512417656206551]], [[54.361795611776955, -45.247793152599435], [-90.021841110057906, 80.87660694310236]], [[68.838235188657535, 53.277307015666736], [69.927085977405824, -86.715842974659438]]])+(1.-msk_arg)*numarray.array([[[35.824777853004889, -98.41139283617531], [46.481491612419063, 73.744423180097272]], [[-62.535302751139653, 90.281500522248365], [75.01937602982872, -28.925552206472531]], [[-13.317676532324427, -65.881247444860747], [88.671022199931372, 73.998882504024408]], [[0.15025950906122887, -94.853839866383098], [46.402552203453979, -47.706832151504287]], [[-89.242628256571521, -34.33096936505919], [81.905543323362821, -16.972568236626273]], [[96.777671705474376, -54.187557400745568], [31.04774327078735, -10.538455973188675]]]) | |
11372 | res=whereZero(arg) | |
11373 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11374 | ref=msk_ref*numarray.array([[[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]])+(1.-msk_ref)*numarray.array([[[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]) | |
11375 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11376 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11377 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11378 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11379 | def test_whereZero_expandedData_rank4(self): | |
11380 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11381 | arg=msk_arg*numarray.array([[[[-32.662481234741009, 40.260928889330899, 75.847123834183577, 78.64906987881929], [-63.275395114512165, -31.782530467351066, -33.223085447198656, -41.760129832198146], [-74.215302896565618, 96.846057240589488, -42.720460482944176, -81.859139209222548]], [[-80.806077534597605, -71.830510003086573, -52.675707514171592, 59.066414162745303], [-70.588014101153917, 51.148551968394855, -74.276699989547552, 73.901372979374713], [70.366974039594226, -9.8398879113183852, 36.910219459152358, 70.56418458925782]]], [[[-86.98957296102455, -81.086417993215889, -46.036348376772821, 1.9830002078387707], [-81.396274030320797, -7.4045882449412943, 6.3580886221511008, 79.040288934545032], [-14.153401419846759, 67.679531820133519, 51.592855364211687, 90.708140577398439]], [[-94.306912199804941, 98.63226780530934, -8.9357196058543309, 4.7943903912119907], [-74.373684606723373, 91.169643203671882, 16.841492324960569, 93.632465846065628], [-99.088266439789805, 45.694749451260208, -90.330018599691812, -60.130076035705656]]], [[[-7.2101696440878698, -34.214635113611934, -41.058199491627747, 16.37206535285118], [12.97372741143397, 61.291284156806938, 92.690533886945445, -90.198572175888316], [43.854839856732838, 69.937218292009533, -9.1804659284850771, -94.216640840953787]], [[68.181402600087836, 0.30694213217643096, -28.922839864406868, -23.615203338489295], [-25.458367043581916, -53.828155760722353, -87.161998896681524, 25.519257343379692], [79.178020952386134, -30.669991922330126, 69.968344114998871, -2.5714051990672857]]]])+(1.-msk_arg)*numarray.array([[[[85.208773947656681, 88.332585876380023, -44.90871447056162, -43.006236243527241], [-2.047920558204595, 89.27443100854407, -5.5594319239118448, -51.774859847771722], [-60.342290733130845, 30.737338461190973, -11.740568632642152, 92.593235560303924]], [[-16.237930188618634, 85.904441626286911, 73.575939167565167, 61.372847005304777], [-25.293050011864722, 86.444597934853704, 65.144765734125684, 24.221545914400892], [-45.788018695054447, 20.030203845344701, -38.808816142235322, 95.412752620189195]]], [[[95.355286693057337, -20.930533826082325, -53.087896571538536, 58.552873058160117], [-9.8932393167384873, -63.401775116131475, -78.43041141947036, 8.9216142837929198], [56.310803454533783, -77.378150114889451, 54.241934023962244, -24.239451277709605]], [[-81.577621003821022, -20.575488788882396, -74.748333868053194, -77.650260041846195], [-36.715889937928893, 46.713294962560639, -32.726652799822858, -86.511792039144225], [-36.63521378668375, -6.6216634903382214, -38.109037159628009, 37.802959591625665]]], [[[-89.164784930058289, -16.893154586268452, -34.0483761542868, 45.087030820992595], [56.096068746482814, -47.841426397183099, 62.786778552668522, -53.641715554093629], [68.655982343210781, -29.962711809331694, -37.999496293427541, 65.862456745659273]], [[-73.176583009461709, 49.80677997366908, 12.506512460993363, 35.473350491292592], [16.781388716717373, -8.5505718161589215, 26.19539860058407, 46.761865879346487], [41.621990096276903, -38.514318974070669, -74.226339225637702, 41.167568383147398]]]]) | |
11382 | res=whereZero(arg) | |
11383 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11384 | ref=msk_ref*numarray.array([[[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]]])+(1.-msk_ref)*numarray.array([[[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]]]) | |
11385 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11386 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11387 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11388 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11389 | def test_whereZero_Symbol_rank0(self): | |
11390 | arg=Symbol(shape=()) | |
11391 | res=whereZero(arg) | |
11392 | s=numarray.array(81.6444913441) | |
11393 | sub=res.substitute({arg:s}) | |
11394 | ref=numarray.array(0.0) | |
11395 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11396 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11397 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11398 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11399 | def test_whereZero_Symbol_rank1(self): | |
11400 | arg=Symbol(shape=(2,)) | |
11401 | res=whereZero(arg) | |
11402 | s=numarray.array([-0.42577857552119269, -97.824884344164786]) | |
11403 | sub=res.substitute({arg:s}) | |
11404 | ref=numarray.array([0.0, 0.0]) | |
11405 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11406 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11407 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11408 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11409 | def test_whereZero_Symbol_rank2(self): | |
11410 | arg=Symbol(shape=(4, 5)) | |
11411 | res=whereZero(arg) | |
11412 | s=numarray.array([[39.799478427096147, 38.492638423570327, -72.762325210310081, -69.098205396529181, 38.188266474849456], [13.030277476589887, 74.277784962164588, -75.455425329956682, -0.98991194199366817, 40.241690530095951], [32.255154097894831, -99.716448230113969, -21.681673392271421, 93.069064225310001, 11.128753427692573], [7.0711563192171809, -17.15976661897767, -74.584589854898439, 51.041755486974239, -5.6722415070331778]]) | |
11413 | sub=res.substitute({arg:s}) | |
11414 | ref=numarray.array([[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0]]) | |
11415 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11416 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11417 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11418 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11419 | def test_whereZero_Symbol_rank3(self): | |
11420 | arg=Symbol(shape=(6, 2, 2)) | |
11421 | res=whereZero(arg) | |
11422 | s=numarray.array([[[-6.9578233775275038, 49.132223141003095], [-48.145023755700088, 21.587944379016761]], [[86.651677318588611, -0.57273995292416657], [-24.596335688728061, -84.06959838105297]], [[39.239654475555739, 46.913346038704105], [67.021307498603164, -3.8507829652879622]], [[-80.47774249090331, -64.49244373998269], [-13.414465155552463, -28.648148016214364]], [[-39.709711031302874, -5.31689974420064], [-57.377517901382276, 94.506624151769302]], [[11.115875644871551, 72.592213743917142], [-32.851536402053583, 78.518378718942529]]]) | |
11423 | sub=res.substitute({arg:s}) | |
11424 | ref=numarray.array([[[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0]]]) | |
11425 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11426 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11427 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11428 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11429 | def test_whereZero_Symbol_rank4(self): | |
11430 | arg=Symbol(shape=(3, 2, 3, 4)) | |
11431 | res=whereZero(arg) | |
11432 | s=numarray.array([[[[-39.290159719357185, 6.4490380987615623, -32.475323811147817, 60.226470912331308], [-67.755482790982938, -39.36427904339579, 21.997707246133388, -57.33676285078031], [25.320831197285258, -76.349205569527896, -36.414788962722014, 32.291459935518731]], [[-65.904294197582345, -89.034718909868275, 23.261623493802404, -23.180947290729321], [-46.259617026665943, 99.549706170539366, 10.306727586246595, 87.039923782401161], [66.016848823361642, 28.256642649753928, 70.164371345513473, 67.371978520546691]]], [[[95.146996060217106, -97.305855490492306, -29.256335422763627, -24.209100707496575], [45.641162744683385, 63.645930271424191, -90.807337430480288, 24.138834899377557], [73.589873856883969, -56.963982942159276, -56.566510827885196, 19.815127048510604]], [[-6.0501958637814397, -64.804389079293671, -97.436129865062156, -75.007677448589078], [97.657879332162167, 76.181023957804541, 10.091188897304022, -50.857694189930648], [-21.917722344901122, -73.808061753514863, -65.869251863183962, 4.5616827304170613]]], [[[70.035781937760731, -51.832467945539221, 79.042746419994728, 38.668501922355972], [34.119830624253126, 24.299671216764267, -42.277730257287182, 92.671939181987852], [-72.79102447157895, 30.740060638932874, -74.191520466794174, -52.954497069438666]], [[24.430118839801438, -6.8193204451386151, 61.796792049679993, 64.743591095050022], [43.828951570456724, -52.733202497353915, 18.689222089808339, 53.094849161936565], [77.126411810233293, 46.773335174712628, 24.535808124902417, -51.550372123195707]]]]) | |
11433 | sub=res.substitute({arg:s}) | |
11434 | ref=numarray.array([[[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]], [[[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]]]) | |
11435 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11436 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11437 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11438 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11439 | def test_whereNonZero_float_rank0(self): | |
11440 | arg=-56.0152542247 | |
11441 | res=whereNonZero(arg) | |
11442 | ref=1.0 | |
11443 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
11444 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11445 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11446 | def test_whereNonZero_array_rank0(self): | |
11447 | arg=numarray.array(71.1859507003) | |
11448 | res=whereNonZero(arg) | |
11449 | ref=numarray.array(1.0) | |
11450 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11451 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
11452 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11453 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11454 | def test_whereNonZero_array_rank1(self): | |
11455 | arg=numarray.array([-17.3035326538253, -86.593915731827906]) | |
11456 | res=whereNonZero(arg) | |
11457 | ref=numarray.array([1.0, 1.0]) | |
11458 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11459 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
11460 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11461 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11462 | def test_whereNonZero_array_rank2(self): | |
11463 | arg=numarray.array([[41.61768486731961, 69.290611719671801, 48.401728321290705, -54.590972112334143, 11.564399558126269], [-1.8042524010560896, -92.702095284465159, 45.136484559735237, -72.362244352134866, 24.194710407260914], [-43.108695050778387, 47.647489079294672, -61.701429681233932, -36.067537829718567, 99.180966430966492], [51.707301922404213, 7.5838051866514746, -43.604821883975163, 74.85674310120524, 91.181953108853094]]) | |
11464 | res=whereNonZero(arg) | |
11465 | ref=numarray.array([[1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0]]) | |
11466 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11467 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
11468 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11469 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11470 | def test_whereNonZero_array_rank3(self): | |
11471 | arg=numarray.array([[[21.449928615271091, -17.253570875796783], [23.691826817893485, 72.615672710486564]], [[-56.101868173239325, -50.789146263740115], [44.254260393918344, -77.113348468531143]], [[31.628186192244158, -29.567091682631514], [-25.637642791911858, 90.000932154214325]], [[-98.909566050888145, -15.524708628153604], [40.294638716411356, 19.662663209587222]], [[-8.9424053143323476, 44.033554341712147], [-28.592658918978913, 57.701429147236496]], [[5.8373347600123964, -15.938309186009377], [47.118492474253401, -17.104874895088756]]]) | |
11472 | res=whereNonZero(arg) | |
11473 | ref=numarray.array([[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]]]) | |
11474 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11475 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
11476 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11477 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11478 | def test_whereNonZero_array_rank4(self): | |
11479 | arg=numarray.array([[[[36.811388311146146, -37.819440076221554, -70.946877208868955, -53.423749294710589], [-27.959990449110549, -13.19600531838357, 30.051887488086265, -62.951332747963093], [44.237322250517849, -49.199225003263706, 80.483871168859963, -89.985441118504284]], [[44.560573770678758, -54.599849870638707, -88.477359629839185, 28.797401260182085], [-77.152989636288908, 20.342246911351296, 75.740577688308235, -19.451449067952353], [55.586372931716994, 46.066327045425965, -61.412715276495746, -0.57311906305483262]]], [[[69.342920685200568, 20.761986693929686, 65.355240394684017, -43.975994488286531], [-45.602468581331699, -60.702312875128705, -52.741215221192064, -50.152173529149891], [63.871292914570887, 50.308104012520829, 13.646656015678801, -2.2486349800344954]], [[9.7609011134064332, 3.3174725979807818, 96.220499171807035, -20.264739672411267], [-26.826050737340353, 12.940873209136299, 54.903850018848289, -44.753514431245911], [-31.296365135620107, -53.852944671155981, 37.681503437560878, 50.394193944723071]]], [[[93.559245006066305, 21.615439772198215, -46.999800142512726, -99.515382399330576], [-26.590613229769033, 65.009853745193624, -38.710017866404975, -34.390372809473206], [71.657928675928162, 85.018672069146191, 72.768640349535559, 66.342192378120103]], [[39.999657304603545, -96.748350051606195, 84.903024547152626, -24.425754771404911], [14.239472718681043, 21.23525425634169, 85.086308297188765, 58.613396024449628], [58.879250368865002, 22.553655766939201, -40.509432689823655, 90.333538469165688]]]]) | |
11480 | res=whereNonZero(arg) | |
11481 | ref=numarray.array([[[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]]]) | |
11482 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11483 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
11484 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11485 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11486 | def test_whereNonZero_constData_rank0(self): | |
11487 | arg=Data(81.267839677,self.functionspace) | |
11488 | res=whereNonZero(arg) | |
11489 | ref=Data(1.0,self.functionspace) | |
11490 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11491 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11492 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11493 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11494 | def test_whereNonZero_constData_rank1(self): | |
11495 | arg=Data(numarray.array([4.3097880462597686, 38.2746982582035]),self.functionspace) | |
11496 | res=whereNonZero(arg) | |
11497 | ref=Data(numarray.array([1.0, 1.0]),self.functionspace) | |
11498 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11499 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11500 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11501 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11502 | def test_whereNonZero_constData_rank2(self): | |
11503 | arg=Data(numarray.array([[-57.872158775060825, 3.0665803612860714, 23.678752611770307, 27.706914354716304, -78.399825738474846], [83.27658948992422, -86.630812378705045, -94.818125169373133, 80.207597472222801, -59.996764104241066], [-48.920076163552359, -5.2793956419858716, -50.805323597125707, -2.4177320821246724, 14.787663281902354], [-91.456661324218942, -75.915552368352166, 9.029031640098097, -64.522060166953736, 45.606353207854369]]),self.functionspace) | |
11504 | res=whereNonZero(arg) | |
11505 | ref=Data(numarray.array([[1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0]]),self.functionspace) | |
11506 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11507 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11508 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11509 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11510 | def test_whereNonZero_constData_rank3(self): | |
11511 | arg=Data(numarray.array([[[-65.737279660632169, -69.58794855021317], [49.173019648663285, -75.324917930399081]], [[36.734465319459133, 39.356936322031572], [72.229844336186147, 27.313887429173732]], [[-46.346862025625811, -28.232476346878286], [67.290787988042212, 28.839469197769318]], [[22.138154835183599, -73.891269486450966], [44.435903802312509, 35.208760455185853]], [[17.707928227345704, -82.502312692751232], [-50.185359824329211, -75.512768380834984]], [[-11.011396097469046, 3.7914246847852837], [88.484294237998171, 27.817718891298298]]]),self.functionspace) | |
11512 | res=whereNonZero(arg) | |
11513 | ref=Data(numarray.array([[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]]]),self.functionspace) | |
11514 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11515 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11516 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11517 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11518 | def test_whereNonZero_constData_rank4(self): | |
11519 | arg=Data(numarray.array([[[[-90.837005944640453, 58.32908469863068, -21.397220189906932, -59.882605473903048], [-60.155669460320048, 94.264197917567316, 5.2271187077156895, 7.6994454870920919], [45.007283205913836, -12.641863450474105, 14.162620707917583, 19.00968469844095]], [[80.350439667173504, 62.976498386779269, -92.277088804255243, -22.02365795339658], [-77.586036199115824, 18.456470236740913, 47.615072286184358, 54.538747153369343], [91.74150400219861, 86.412378355903371, 88.617980688509135, -46.604677919468649]]], [[[-53.574380602108441, -25.238541870158244, -73.591218463895842, -37.649627917290609], [-67.751440748047912, 75.941689285252011, -89.393524054767482, 67.428736009005092], [96.911150988908844, 12.958697435254351, -66.109426273033193, -88.3308257725689]], [[62.378724670258009, -4.8176444206246885, 81.947676307785855, -48.326765737807989], [2.7384341578773075, -51.578329102849452, -8.1888405371007593, 40.041650279869941], [1.097138779089164, -94.669191888914668, -51.813633997289308, -54.599754268322151]]], [[[83.590503053969371, -74.086642770815402, -72.770948998639255, -97.314802633614931], [-86.027885055613837, 33.553797401705197, 31.053141327356713, 67.511970696929382], [52.366010839111311, -33.722724485456567, -85.983722002837638, -86.789587160415778]], [[-70.157132541078397, -77.562471328811228, 14.699980308694634, -18.99732113106478], [12.774619589743438, -87.237747438149697, -81.789726467975441, 70.99819494952979], [-49.82446845622561, 29.476931575070466, 31.2380468420277, -80.56982756990962]]]]),self.functionspace) | |
11520 | res=whereNonZero(arg) | |
11521 | ref=Data(numarray.array([[[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]]]),self.functionspace) | |
11522 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11523 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11524 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11525 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11526 | def test_whereNonZero_expandedData_rank0(self): | |
11527 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11528 | arg=msk_arg*(55.457381569)+(1.-msk_arg)*(-23.468996897) | |
11529 | res=whereNonZero(arg) | |
11530 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11531 | ref=msk_ref*(1.0)+(1.-msk_ref)*(1.0) | |
11532 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11533 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11534 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11535 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11536 | def test_whereNonZero_expandedData_rank1(self): | |
11537 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11538 | arg=msk_arg*numarray.array([75.794421272424358, 53.341174509357501])+(1.-msk_arg)*numarray.array([62.218317595110733, 28.772022216936335]) | |
11539 | res=whereNonZero(arg) | |
11540 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11541 | ref=msk_ref*numarray.array([1.0, 1.0])+(1.-msk_ref)*numarray.array([1.0, 1.0]) | |
11542 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11543 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11544 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11545 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11546 | def test_whereNonZero_expandedData_rank2(self): | |
11547 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11548 | arg=msk_arg*numarray.array([[25.693195010945445, 53.470932335076157, -68.183323445425884, -90.253837566532937, 97.906247975957115], [58.50459295308795, -44.270817918326053, 44.734053038122738, 46.132305677124208, 15.093865803964562], [42.388010237041698, -7.0981379825856266, -2.7347840708205098, -29.594785545579597, -95.196484793137472], [38.36601032797401, -31.853113575844233, 22.743621849911833, -4.9889383642481846, -51.432166195627829]])+(1.-msk_arg)*numarray.array([[-21.251861279170669, 23.87089448722665, 54.546286256972479, -50.596083351973761, 71.290931136958989], [-85.431548064496582, 20.522672789852606, -90.730704002438671, -46.757529093371275, 16.785961991598612], [22.174454395058632, 69.692756669654159, 87.615316871643131, -78.004806291849491, 3.6808126640922865], [-57.786804759801669, -87.557537170166015, 64.774622761137721, 90.823752701099721, -47.516231901181612]]) | |
11549 | res=whereNonZero(arg) | |
11550 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11551 | ref=msk_ref*numarray.array([[1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0]])+(1.-msk_ref)*numarray.array([[1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0]]) | |
11552 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11553 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11554 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11555 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11556 | def test_whereNonZero_expandedData_rank3(self): | |
11557 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11558 | arg=msk_arg*numarray.array([[[86.149242248728058, -35.02751878546529], [40.087555658614548, -77.393517988885691]], [[26.117710543523316, 71.702690330409268], [98.666028493959146, 11.651670052091717]], [[-89.606381835492499, 52.900856899025115], [-28.078601574503764, -95.119493866321875]], [[98.666959366780844, 23.275898081831897], [4.3281069846126172, -80.865475942459497]], [[-14.7551225313251, 97.396689501269265], [23.671398524796032, 21.397118290457513]], [[23.732489190132, -59.259215202504677], [-83.242145340201688, -75.536810160429368]]])+(1.-msk_arg)*numarray.array([[[-9.7478095088222148, 11.661323310074323], [4.8146279047090559, -52.254294186764461]], [[-25.036812644543332, 73.198082013951563], [-9.0171269289220106, -47.016186545303171]], [[-28.848236212560835, 22.014297849998428], [-80.472580936591527, 35.926128036359103]], [[-50.335917685172404, 10.849423531461483], [-41.037282141150008, 99.521035981305374]], [[3.7060647555777138, -50.51251638563128], [-33.000056918825209, 91.690666567142586]], [[-26.856701959084845, -3.2105214924453378], [96.598379912806394, -15.447865865744575]]]) | |
11559 | res=whereNonZero(arg) | |
11560 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11561 | ref=msk_ref*numarray.array([[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]]])+(1.-msk_ref)*numarray.array([[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]]]) | |
11562 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11563 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11564 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11565 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11566 | def test_whereNonZero_expandedData_rank4(self): | |
11567 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11568 | arg=msk_arg*numarray.array([[[[-13.011952221782906, 60.146594640260929, -92.58084328474439, -63.668052583858525], [-29.604118765606316, -54.921705782621324, 63.355787794763557, 32.048187979650379], [52.690986117833347, -65.333226351220446, -80.457709522487477, -98.926180293535211]], [[-7.1796814873670343, 94.388137298771483, 95.299168868419684, -54.524320427950833], [-61.062722861775207, 83.2566734157692, 19.473153243447854, -17.683274427867616], [92.214390273881946, 33.610188459781625, -81.830151098817836, 58.157655737818004]]], [[[63.469751000464782, -17.599047199042445, 78.031842669949526, -4.4970488112825819], [-66.54952900441117, 67.261106981137686, 54.23547006750232, 55.602853560488029], [45.038007193518467, -70.427944498069365, -69.825782007360743, -65.982920351293558]], [[-95.008913410852742, -39.213243291094948, 72.194277685731862, 97.046556215652714], [37.536007158729404, 44.977826357229333, -74.984923076853008, -25.784263917813036], [16.469242924065597, 55.697269253699091, -14.794604017518907, -31.753199846344259]]], [[[56.500805440617142, 35.623660964275814, -33.468639069785453, 55.151083545768927], [80.08078661666562, 86.285902320161256, 11.017641963291695, -68.900497305225002], [68.192503427277103, -86.515657932050203, 47.994984746708809, -43.370874890365265]], [[61.776516875254572, -18.579244394902929, -15.183358149836849, -74.888276150809219], [69.965669844543783, 5.4340404212045286, 28.363989733719109, 15.311329580643189], [94.76411206365961, -11.043728008539119, -15.649591146513345, 47.035633382894645]]]])+(1.-msk_arg)*numarray.array([[[[74.385412727423812, -37.538049462402647, 55.913400604665355, -70.457307068022459], [79.482613421908439, 83.515322164631527, -43.324348243704634, 14.84345334513965], [68.778457595687001, -56.301700989105122, -67.104809294858455, -93.503482897897513]], [[-23.750280106836712, 33.848737195440208, 14.997455364891138, 97.834390144064486], [-6.4280342178465446, -82.354008114682159, 1.1797643810675993, -84.817435750943289], [4.0640627650950734, 36.731149482102808, 4.4401253362509721, 50.187621844828357]]], [[[10.746049103776784, -0.50416504196932976, 6.1710864748900605, 25.710101291704632], [-8.3240472300805806, 0.40060317937977175, -4.6344318693605686, 60.779785582340679], [-45.076412053791138, -1.378387041154653, 51.553519112651571, 26.371530000106787]], [[-46.325656386879729, 38.949682993329958, -96.678227888724777, -71.397182995030661], [-39.275033452116404, -20.946676674594329, -1.9183420721467428, -16.206004000684842], [9.166499552764293, 55.367654830204089, 55.869168851337804, 31.8283590864053]]], [[[70.064271798572975, 25.227460810734044, -49.584790116912771, 6.4927871739775185], [-14.735101219279272, -32.448581566238843, 92.390606133049715, -71.298582637949863], [-39.675482065031062, 13.907314019034956, -47.48451389090782, -93.93888851018022]], [[-92.274017822855086, -10.260862968529636, 14.31392023943387, 32.589318378815591], [84.922863364253459, 71.725715754215599, 47.377427817862753, -55.639887444292157], [63.461117774674562, 89.548143331715664, 33.157691946888747, -56.134655663723642]]]]) | |
11569 | res=whereNonZero(arg) | |
11570 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11571 | ref=msk_ref*numarray.array([[[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]]])+(1.-msk_ref)*numarray.array([[[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]]]) | |
11572 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11573 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11574 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11575 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11576 | def test_whereNonZero_Symbol_rank0(self): | |
11577 | arg=Symbol(shape=()) | |
11578 | res=whereNonZero(arg) | |
11579 | s=numarray.array(-63.9986107791) | |
11580 | sub=res.substitute({arg:s}) | |
11581 | ref=numarray.array(1.0) | |
11582 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11583 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11584 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11585 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11586 | def test_whereNonZero_Symbol_rank1(self): | |
11587 | arg=Symbol(shape=(2,)) | |
11588 | res=whereNonZero(arg) | |
11589 | s=numarray.array([5.5359318226973215, -86.821749912549208]) | |
11590 | sub=res.substitute({arg:s}) | |
11591 | ref=numarray.array([1.0, 1.0]) | |
11592 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11593 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11594 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11595 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11596 | def test_whereNonZero_Symbol_rank2(self): | |
11597 | arg=Symbol(shape=(4, 5)) | |
11598 | res=whereNonZero(arg) | |
11599 | s=numarray.array([[71.725472035318546, -58.612052886303289, 62.157756415813651, -47.063778001895315, 77.803560471030494], [92.195417194871851, 89.724837980402924, -10.413176528694962, -61.838646095919756, -37.956581923595522], [-21.02513441733258, 72.503213262682806, 16.360830438439564, 15.487516956343583, -71.733457944717614], [-35.521341182196721, 90.927740424160248, 21.718277340665054, -90.551829331778478, -79.822246461445403]]) | |
11600 | sub=res.substitute({arg:s}) | |
11601 | ref=numarray.array([[1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0]]) | |
11602 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11603 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11604 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11605 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11606 | def test_whereNonZero_Symbol_rank3(self): | |
11607 | arg=Symbol(shape=(6, 2, 2)) | |
11608 | res=whereNonZero(arg) | |
11609 | s=numarray.array([[[-92.039200834931847, -62.745860821492137], [55.562355191956101, 36.13623050761575]], [[51.428582569678667, 6.7813551764689777], [34.834098385485248, -46.565103858624781]], [[-22.197926800436505, -23.75105117868452], [62.316617058759022, 39.650089801879489]], [[-17.301716595043743, -49.890756774157772], [65.113911490167396, 70.406681905728902]], [[67.970437340226084, 6.763877574674737], [-72.440603095681496, 83.905240789027999]], [[-9.4725564250577747, 6.7172370152905216], [10.657653776805361, 31.813356576401873]]]) | |
11610 | sub=res.substitute({arg:s}) | |
11611 | ref=numarray.array([[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0], [1.0, 1.0]]]) | |
11612 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11613 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11614 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11615 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11616 | def test_whereNonZero_Symbol_rank4(self): | |
11617 | arg=Symbol(shape=(3, 2, 3, 4)) | |
11618 | res=whereNonZero(arg) | |
11619 | s=numarray.array([[[[95.390257385358666, 45.581102621197772, -34.472614399751976, -44.187969729817155], [62.619954103462845, -62.125630494937909, 62.664289458215393, 38.69703477202745], [18.292449005125235, -68.461908914622853, 86.000739545438819, -48.949946326838379]], [[20.120065500586364, 83.296762964032268, 90.39226764899351, 37.379442794888803], [-48.543736312915108, -57.067875736841486, -1.3972280138476236, -7.7638288295607651], [-29.177967514332664, -81.460379350377593, 10.435285429910195, 57.630275899938113]]], [[[-45.71961261819397, 22.373502185500541, 37.662223848476089, -2.2940311095793504], [59.235081702607431, -21.847349361693887, 68.766451889270002, -25.664076299853662], [-65.794252273908256, -93.497162167099475, -45.937528408479956, -4.9683114364239316]], [[38.415579583735934, 51.680222508550969, 45.533224435884534, -95.377478810488256], [-67.689600658634703, 38.481196742257595, -85.39114161427824, 34.228355824940252], [58.581033737968397, -23.491787526221358, 14.698443690426117, -54.750734727094994]]], [[[-67.627258717531191, 88.697079672890254, 53.870078458562432, 51.736240026571721], [-70.95614948743227, 11.195775524020291, 31.058839065828323, -15.23262569608319], [-56.668773707515705, -39.564235352463164, 61.035865972707171, -59.669324480633094]], [[-85.916017079613511, 28.542821077324334, -41.081637035461597, 0.56732809105591286], [-69.673695812034737, -96.079626480303531, 72.015551834181167, 38.954889388681607], [-81.08586516893655, -41.644221407464485, -85.347230876678211, -19.457969474192112]]]]) | |
11620 | sub=res.substitute({arg:s}) | |
11621 | ref=numarray.array([[[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]], [[[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]], [[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]]]) | |
11622 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11623 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11624 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11625 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11626 | def test_sin_float_rank0(self): | |
11627 | arg=26.6185049196 | |
11628 | res=sin(arg) | |
11629 | ref=0.99638690326 | |
11630 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
11631 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11632 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11633 | def test_sin_array_rank0(self): | |
11634 | arg=numarray.array(-19.1395275546) | |
11635 | res=sin(arg) | |
11636 | ref=numarray.array(-0.285925042532) | |
11637 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11638 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
11639 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11640 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11641 | def test_sin_array_rank1(self): | |
11642 | arg=numarray.array([9.7813278790190594, -15.410822535775822]) | |
11643 | res=sin(arg) | |
11644 | ref=numarray.array([-0.34904322255989967, -0.29278743949712893]) | |
11645 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11646 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
11647 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11648 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11649 | def test_sin_array_rank2(self): | |
11650 | arg=numarray.array([[7.5709622007726978, -96.010110171854322, 64.464875837548789, 18.074098255478049, -79.887891912588785], [-61.137259666889591, 24.376915700677898, 1.6520396981142653, 73.282870077726415, 37.390208438590236], [-18.018770402944398, -20.185849422983694, 16.072369015111192, 52.807262209935885, 19.287397979810578], [-77.896963892166468, 49.777355373857489, 61.194119343070525, 50.551462513063115, 15.922964094659335]]) | |
11651 | res=sin(arg) | |
11652 | ref=numarray.array([[0.9602166212011517, -0.98171332509549469, 0.99806455979119224, -0.70004296831489288, 0.9753000889147212], [0.99234692329352858, -0.68588964365820848, 0.99670157217596123, -0.85535672018082665, -0.30401412851360171], [0.73846127084748792, -0.97262998476338458, -0.3563941257877799, 0.56448804411955977, 0.42398607347515932], [-0.59948094483604641, -0.46897252800353989, -0.99776052848304986, 0.28209783791975507, -0.21334823597722449]]) | |
11653 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11654 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
11655 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11656 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11657 | def test_sin_array_rank3(self): | |
11658 | arg=numarray.array([[[-58.576474897348007, 54.809262272793802], [-92.545446097205968, 85.575190211710776]], [[38.681288743038209, -11.603575878192785], [-95.597383200249268, -13.02556705264513]], [[61.706270910680416, 85.490591964337312], [71.624027820036616, -25.863896412300605]], [[25.476947591593444, 70.435340495814557], [-30.073684565633215, 67.490356578240863]], [[4.9713423686298341, 91.911859760915974], [30.367874697055328, -84.144554970831109]], [[98.391390622536989, 31.732748787807651], [-14.934490963501432, -59.311188442325168]]]) | |
11659 | res=sin(arg) | |
11660 | ref=numarray.array([[[-0.89737553935745262, -0.98581911829326108], [0.99136145080590388, -0.68323847477655364]], [[0.83170798407592028, 0.82079120409534756], [-0.97563646528573944, -0.44322793023104901]], [[-0.90251845539243469, -0.61909542454627942], [0.59124622666754811, -0.66773000309600883]], [[0.33744969840141792, 0.96879003389058782], [0.97399495168350392, -0.99854852911307401]], [[-0.96665851232305666, -0.72129680977545241], [-0.86645223153963946, -0.62758444363043242]], [[-0.84255979532259895, 0.31154854639750068], [-0.698623841417506, -0.37005848663264262]]]) | |
11661 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11662 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
11663 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11664 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11665 | def test_sin_array_rank4(self): | |
11666 | arg=numarray.array([[[[-50.615462747878006, -66.973812639371985, -77.708206606928769, -36.431802774059221], [84.078764335768454, -86.057175975235566, -4.2507864983636097, 32.605074036304671], [-35.47698277417679, -32.850292882440925, 19.746311000390619, 96.575011359809082]], [[37.550695304429951, -85.192245059759713, -19.585580977316283, 4.9299086609782705], [70.955489529502842, 64.084022545666187, -35.537247087129771, -47.717715879912468], [3.8361995697958662, 95.532145761226531, -51.581690563318517, -23.90597768756011]]], [[[-85.885115626404513, 27.544257154700233, 57.776442658393961, -22.764439696740865], [9.7442723032797431, -47.221529831578344, -24.523464073641321, 22.843310070989517], [67.821301169614003, 19.731335445973343, -74.187754964775991, -69.863316195387767]], [[64.051377288481888, 13.397049375815271, 7.2977357293966065, -53.46018591213759], [18.669622257829204, 64.3833982650888, 43.248464847568329, 55.630477540818163], [69.55974394554579, -47.17349597543474, 13.955474294777375, 57.58228196835239]]], [[[-67.48312543703419, -79.807110080995614, 29.982433513595652, -41.775471818361368], [-36.948208936105289, -81.305101266586661, -85.068091915731998, -25.025548528744793], [-18.039651899818338, 6.4567829828828138, 78.793240634732797, 32.996039522485205]], [[-99.940020762322376, 68.326160737955007, -61.082363029407126, 54.949813891014884], [80.038229033350177, -33.552375886074117, -31.608129371983892, 64.177422432822794], [32.303265514373805, -76.156866511153297, 64.174936832666873, 11.368893661666618]]]]) | |
11667 | res=sin(arg) | |
11668 | ref=numarray.array([[[[-0.34287929276723833, 0.84166917263443375, -0.73901678422019978, 0.95430012717376367], [0.67741096998138572, 0.943875804457038, 0.89533992846215704, 0.92805179004897842], [0.79527653438049994, -0.99070785666439132, 0.78130571381342773, 0.72728711253181411]], [[-0.1478722649927692, 0.3609099416305746, -0.67134722109833267, -0.97643572609341589], [0.96386290831076604, 0.94966646919227582, 0.83034577260054665, 0.55953618516020254], [-0.64008348060134623, 0.95925856748150318, -0.96776708303022096, 0.94140212104966459]]], [[[0.8733869978866744, 0.66692680849003383, 0.94174275492293247, 0.69849419559794712], [-0.31408653242230877, 0.097484958579927491, 0.57227483208076302, -0.75270519985308859], [-0.96186401066781391, 0.77187148397831629, 0.93578136651060684, -0.68037764724345384]], [[0.93893574912137301, 0.73838928073958066, 0.84924325972879255, 0.053085835853353053], [-0.17896430849100536, 0.99981470265224548, -0.66972046488018222, -0.79450391882013482], [0.43019210289246596, 0.04958582917574688, 0.98353924979282858, 0.85915404611622637]]], [[[0.9981329609384284, 0.95429554635975633, -0.99058870054119763, 0.80446088766755564], [0.68229912906486578, 0.36748906525527336, 0.24264389693973754, 0.10698753894470732], [0.72422099416087193, 0.17272706090204004, -0.25072034421713113, 0.99995660023908339]], [[0.55714530958135622, -0.70956285806092356, 0.98407671685665454, -0.99960641285478424], [-0.99738144842386833, -0.84423878131865737, -0.19102162937524009, 0.97474344445505001], [0.77539411931850055, -0.68793708162803491, 0.97418533082369707, -0.93112187460985318]]]]) | |
11669 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11670 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
11671 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11672 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11673 | def test_sin_constData_rank0(self): | |
11674 | arg=Data(35.9258166114,self.functionspace) | |
11675 | res=sin(arg) | |
11676 | ref=Data(-0.979567062569,self.functionspace) | |
11677 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11678 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11679 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11680 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11681 | def test_sin_constData_rank1(self): | |
11682 | arg=Data(numarray.array([11.05411721386011, 92.760749350185449]),self.functionspace) | |
11683 | res=sin(arg) | |
11684 | ref=Data(numarray.array([-0.99828685225980784, -0.99649367379012466]),self.functionspace) | |
11685 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11686 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11687 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11688 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11689 | def test_sin_constData_rank2(self): | |
11690 | arg=Data(numarray.array([[86.368381659051408, -41.695780796282492, -58.183479792434831, -70.875178760715073, -20.678382721502217], [17.695341117085974, 2.740439328337672, 62.183987328150124, -22.389692204658516, 25.527065283434851], [-19.879704086428717, 97.930429727602103, 16.055583599572529, -16.208182451420882, 54.913306337155262], [-69.833724282794194, 31.117621263412161, 97.441216860315848, 31.002527925222012, -33.156619640633039]]),self.functionspace) | |
11691 | res=sin(arg) | |
11692 | ref=Data(numarray.array([[-0.99967702286155391, 0.75462098315788761, -0.99795169465255495, -0.98212790490620516, -0.96689443052183988], [-0.91447752242728786, 0.39048036598212266, -0.60348598179363533, 0.3880765237690833, 0.38418420577157436], [-0.85737525785576585, -0.5150427020633046, -0.34066144314268004, 0.47961787867933503, -0.99791639785660491], [-0.65839615788937589, -0.2939007480209867, -0.051821376961544853, -0.40172395652639609, -0.98560222500947936]]),self.functionspace) | |
11693 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11694 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11695 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11696 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11697 | def test_sin_constData_rank3(self): | |
11698 | arg=Data(numarray.array([[[-9.383136985495085, 51.313988740117281], [-84.286741947414299, -12.349769403836447]], [[-58.98719875193035, -69.772217254427616], [25.488307874218165, 60.443485945243793]], [[80.648598553510482, 92.976864439316103], [4.2817739078012664, 91.184638461427113]], [[-76.55157819489709, -16.719487135234104], [13.038521969338817, -14.062881841606639]], [[-60.572162238841166, -8.277832942135376], [90.508007133317363, 9.9045178477461775]], [[43.319148489339796, -36.82759950317913], [23.772826290958989, 23.859083701318681]]]),self.functionspace) | |
11699 | res=sin(arg) | |
11700 | ref=Data(numarray.array([[[-0.041628942278232502, 0.86667902768507166], [-0.5109243145942064, 0.21491149901715179]], [[-0.64655635572868242, -0.61088574863445955], [0.34812162256726858, -0.68399529227053291]], [[-0.85874246895135953, -0.9553716024683695], [-0.90870917195229073, -0.078371058632619367]], [[-0.91412907684432942, 0.84764134621368814], [0.45480331572319638, -0.99724213056634026]], [[0.77194923151153583, -0.91151176131243561], [0.56313928014945791, -0.4615484409914466]], [[-0.6156012262898336, 0.76530325949300315], [-0.97784680058787665, -0.95617812015239778]]]),self.functionspace) | |
11701 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11702 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11703 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11704 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11705 | def test_sin_constData_rank4(self): | |
11706 | arg=Data(numarray.array([[[[-82.266761499442822, 10.258465683133593, 35.258711312343792, 83.260426498166652], [44.545759248512837, 78.847333090045225, -91.458863199213994, 88.135667192818687], [55.303615717334651, 57.343360606367497, 72.386684244462259, -77.851237894363791]], [[7.6357829095114624, 58.043761182779804, 32.459127943514119, -46.057054845382581], [-62.173352222977194, -91.055460532286546, 1.908599997174349, 50.256424878237198], [80.737361916893349, -59.097170441109384, -11.392890659087485, -17.113974908227121]]], [[[-69.94898633515831, 41.553507654384049, -2.0229189980548909, 11.130327214085185], [27.241980003875298, -92.430057302595131, -59.821389090442324, -10.836164150097432], [-97.960459786173644, 77.056043492990739, 18.592655235604354, -99.221726011137193]], [[-62.79302507786295, -60.628776679562854, -92.135333094895984, -7.7874612902526792], [-59.349180405626001, 98.544187052373076, 25.967954318471186, 26.092417193137578], [15.354438427681245, -0.13204595002771669, 57.604938537040567, -78.12077453253174]]], [[[26.134134711410127, -21.654760380881413, 91.027816009977528, -70.493423376080287], [50.18077929890714, -45.818068992158459, 17.514556104968705, -87.948924607482581], [-2.9358337467884752, 52.58088647758106, -88.281586106394585, -37.905045294843575]], [[9.2050228670356233, -53.760066650396411, -36.646477787406951, -50.989346886330431], [46.181223758729573, -56.454456456188559, 0.97893723365712049, 67.524717727099727], [76.315867619424694, -64.23482558405928, -9.4212307356945644, 94.459095295520825]]]]),self.functionspace) | |
11707 | res=sin(arg) | |
11708 | ref=Data(numarray.array([[[[-0.55249323661859384, -0.74041510223459006, -0.64512901510731857, 0.99996620630617827], [0.53411628907438291, -0.30269281624662714, 0.34541056811800569, 0.17023967780324173], [-0.94741280897254443, 0.71364847302087853, -0.12968690532551203, -0.63544017109361273]], [[0.97628895760467316, 0.99713590303276967, 0.86402042247071265, -0.87567650001557451], [0.61193184565404779, -0.050704669999494079, 0.94348483865887567, -0.00905745535309368], [-0.8099383976922776, -0.55892595044018734, 0.92210273022629663, 0.98645369822246709]]], [[[-0.74058999329446951, -0.65395701522909533, -0.89952178562120422, -0.99093455465566593], [0.8585084340096536, 0.96966836773299581, 0.13075320819151812, 0.98732108746426506], [0.54054731770475606, 0.99621584600900559, -0.25408417591070465, 0.9659884230955289]], [[0.038818238402855587, 0.80668212053066524, 0.85685909391293247, -0.997788337658438], [-0.33450508434738102, -0.91472013442829736, 0.74143951598281521, 0.81900568441531063], [0.34620680919904595, -0.13166255596987642, 0.87052630534488828, -0.40688535076780291]]], [[[0.84222306949426196, -0.33007987762886654, 0.078290742973310345, -0.98154597956213518], [-0.084601909290267188, -0.96509891341258691, -0.97232857103810033, 0.015669051785311802], [-0.20431011725232823, 0.73535381865796079, -0.31170965722815802, -0.20448097728983067]], [[0.21799061313810039, 0.34570643936958911, 0.86873084472110407, -0.66228504096565033], [0.8091276300491409, 0.094072003936346266, 0.82990491677663747, -0.99980940641969562], [0.79417206042993815, -0.98595060503156651, -0.0035472176358126886, 0.209746502418206]]]]),self.functionspace) | |
11709 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11710 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11711 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11712 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11713 | def test_sin_expandedData_rank0(self): | |
11714 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11715 | arg=msk_arg*(64.9800250937)+(1.-msk_arg)*(-13.9362171446) | |
11716 | res=sin(arg) | |
11717 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11718 | ref=msk_ref*(0.837897949793)+(1.-msk_ref)*(-0.979877440358) | |
11719 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11720 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11721 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11722 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11723 | def test_sin_expandedData_rank1(self): | |
11724 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11725 | arg=msk_arg*numarray.array([38.770149608840256, -60.012793688818753])+(1.-msk_arg)*numarray.array([-99.060327275798542, -82.301745794852508]) | |
11726 | res=sin(arg) | |
11727 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11728 | ref=msk_ref*numarray.array([0.87769828831808394, 0.31697021887466476])+(1.-msk_ref)*numarray.array([0.99498831041282509, -0.58130924307676168]) | |
11729 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11730 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11731 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11732 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11733 | def test_sin_expandedData_rank2(self): | |
11734 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11735 | arg=msk_arg*numarray.array([[1.8437603079485996, -55.085629630896008, 0.76077789325732681, 75.303888016859787, 44.134994661850783], [79.846819977879846, 55.190840097906744, 66.852695154059461, -2.7788078944115426, -33.754582563675072], [79.437692683252919, 25.719174268770573, 22.693852460282187, 73.984833469926286, 34.325902065505829], [36.438188095997873, -58.458802817368706, 35.872691199405381, -97.828193056307839, 17.582825707314015]])+(1.-msk_arg)*numarray.array([[5.857972204383401, 68.980392763644375, -31.110427811729835, 60.164069309555259, 59.562550189394926], [-79.365962953462713, -74.725764079778173, 85.216081299963463, -56.646488172185805, 46.373883249354861], [-96.708272172455125, -53.912331939216031, 50.478527343574285, -97.278578429153086, -19.251159449913018], [89.592226731549431, -48.83081996413825, 86.246650594081075, -29.89076793492336, -45.154211051500191]]) | |
11736 | res=sin(arg) | |
11737 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11738 | ref=msk_ref*numarray.array([[0.96297607712265498, 0.99419970184494533, 0.68948508165976352, -0.094195812584939725, 0.15210480698702625], [-0.96540800347437894, -0.97740775938701152, -0.77026043446389958, -0.35487911125423122, -0.719398961710221], [-0.78200505820620614, 0.55339355773313237, -0.64628337521816626, -0.98763721556473016, 0.22955176403585492], [-0.95237243281291895, -0.94297498574434913, -0.96750562604917711, 0.42487228151059697, -0.954126976601816]])+(1.-msk_ref)*numarray.array([[-0.4125149172810601, -0.13423914232300688, 0.30076884437212431, -0.45627887875349671, 0.12736335490838124], [0.73532534193785637, 0.62291199948324294, -0.38303500671569563, -0.097664477681636913, 0.68164355585755676], [-0.62964804242596883, 0.48403219384114982, 0.21143692166914244, -0.11056730045170879, -0.39089478845779391], [0.99838526337700328, 0.9907480912937221, -0.98919334458602826, 0.99895877973110281, -0.92149562271137819]]) | |
11739 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11740 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11741 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11742 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11743 | def test_sin_expandedData_rank3(self): | |
11744 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11745 | arg=msk_arg*numarray.array([[[-38.413084764990302, -51.052907554914874], [-70.505293089549951, 90.313652142673448]], [[14.910063396779577, 5.5459023128808838], [-17.734013723516611, -0.2879278829081926]], [[-22.114710637688262, 46.626248466538811], [67.532808824706478, -59.397222523445059]], [[92.618471591726234, 73.621613593824065], [88.375553175968605, 5.7283336450617099]], [[53.683923353330755, -77.160809717487297], [-34.501807709057687, -33.073637412461139]], [[27.624848265822479, 15.259019682038172], [0.55157605306179391, -71.932924310466888]]])+(1.-msk_arg)*numarray.array([[[-34.335248638101717, 68.752336646733312], [-43.346716752254302, -8.6223337031949683]], [[-35.640511588324259, 29.644108535921475], [64.496990192063578, 38.316350896738442]], [[-42.749910167259664, 9.2631745284455604], [73.587108766995641, -96.934463397218067]], [[-74.560330219656223, 2.8651995440780524], [65.274936254565944, -71.732320070952852]], [[66.378370922669262, -31.104012988746703], [38.402067771718777, 88.070193006735252]], [[-3.3040251330990884, -30.446998125502006], [53.53952042332989, 49.143306316308468]]]) | |
11746 | res=sin(arg) | |
11747 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11748 | ref=msk_ref*numarray.array([[[-0.65484153130973721, -0.70853858647854739], [-0.98374658316761376, 0.71213510355429321]], [[0.71589133616462552, -0.67227900197685508], [0.89814931915579443, -0.28396601912126207]], [[0.1232478868102998, 0.47735428568469945], [-0.99993464136673393, -0.28886194517886638]], [[-0.99828867944095934, -0.97889500442468336], [0.3994885492462833, -0.5268172219749746]], [[-0.27332526710635363, -0.98166466097630112], [-0.055682665640661121, -0.99622530762962569]], [[0.60477683330883625, 0.43401404656957493], [0.5240302030950843, -0.31808294342294718]]])+(1.-msk_ref)*numarray.array([[[-0.22044488395248701, -0.35480148713588266], [0.59364467642489349, -0.71905687697203813]], [[0.88336425850768363, -0.97986309124469417], [0.99555320691853921, 0.57878587408359439]], [[0.94328393594361259, 0.16090095326994339], [-0.97126219531557589, -0.43938044812272531]], [[0.74323543603717557, 0.27288743671671112], [0.6430769524396025, -0.50061664432606201]], [[-0.39395000791253521, 0.30688041201024424], [0.64647568844428205, 0.10540255889338963]], [[0.16171914304468005, 0.82427947074375341], [-0.13205843112469617, -0.90104641666580576]]]) | |
11749 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11750 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11751 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11752 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11753 | def test_sin_expandedData_rank4(self): | |
11754 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11755 | arg=msk_arg*numarray.array([[[[-68.525560759670157, 72.014851464858708, -96.064109131678975, 77.226473627484438], [10.661045262101496, 17.374475984434937, -70.970539568996642, -86.5663539792791], [42.328708688260292, -49.606342449617813, -41.332552022078197, 5.781826685010131]], [[32.656794594741456, -45.69741225061923, -75.977367014659336, 65.992637114312402], [-24.968933149299261, -19.170628852284295, -82.992054567050218, -69.278260336258882], [45.308496224570149, 58.254105930225364, -52.053961481820508, -99.633451029223679]]], [[[57.389652364413365, -6.4497448547971459, 67.302050277783934, -64.487213635922004], [2.7850477397074656, -37.14171412837635, -45.831747383644263, -81.22619991798237], [28.555595155095858, 6.3743955466930515, -9.7644609522321133, -2.1997743618038328]], [[35.568247785419004, -31.599877667329878, 82.028553557923146, -78.86370276205146], [-99.731804643220002, 69.776357240610565, -12.167123991837968, 33.790715856665315], [-10.562353591062944, -16.629309453963131, -77.001863431944969, 52.718875999701169]]], [[[-98.376736649980899, 29.119393841437898, 75.366820567618731, -66.514039609932439], [-88.471818477178289, 47.880968729353668, 65.085879417509886, 84.296285545557623], [-86.151465152354675, 9.1305089222339433, 3.0045836139087356, -81.15026537989543]], [[19.458035685379343, -16.79612796438164, -62.697038154714392, 82.150007929305815], [51.125444489928753, -39.220742821773079, -31.48429119581813, -40.990991828400048], [-20.250208920559061, 52.655819512739868, 26.546619397350256, -77.359673716677449]]]])+(1.-msk_arg)*numarray.array([[[[-18.615245719283436, 96.201699795366437, -82.66494125542863, 33.07492631817621], [82.443853712892633, -34.736058741884463, -95.351325060809899, 59.914700106027027], [-31.967579463417351, 45.580214173517021, -85.610494042354162, 49.498206680862722]], [[47.852867738343264, -35.372573605242792, 2.511993838319043, 94.155389339549941], [-1.38794622700091, 85.930835412964996, -85.707091771314651, -46.64999398418388], [57.879302040774746, -50.458699813236429, 25.001254046544503, -59.801937388884156]]], [[[99.915640912459565, 42.356808810363106, -15.646740182074836, 72.140752053033623], [22.725076309780334, -0.022312650774281906, -7.1186223183705266, -26.368838179359486], [66.038559283219001, -17.561521846617723, 4.9702769173480306, -59.711097000633437]], [[-78.084063698630573, -45.932568204284749, -45.100652927345664, 80.338502970189182], [50.249408685318571, 27.311139139809868, 9.9265850486579552, -56.606805234548688], [7.2672257036688848, 49.011928816065478, -54.764618596546889, 70.942797505173303]]], [[[61.689516820950246, -58.515211403448731, 53.79986661743186, -81.589305129450977], [74.672959560216214, 61.905849543205051, -27.673934374496582, -43.264203000639313], [66.074534000186645, -29.171690529749995, 62.854710104264711, 28.934380662657873]], [[72.033136619176673, 0.8371610199688746, -21.89771655702684, 35.848349672772173], [14.782846328746871, 69.671698166617858, -71.840672845829047, -65.869180747022639], [-87.952973126148649, -58.34136644843764, 58.528431489251943, -45.940658422238933]]]]) | |
11756 | res=sin(arg) | |
11757 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11758 | ref=msk_ref*numarray.array([[[[0.55592687965297938, 0.23943081082144563, -0.97000785672325052, 0.96704147053511302], [-0.94456504679141606, -0.99542268261330857, -0.95974459076326801, 0.98514911686367079], [-0.99657468842237251, 0.61243723818846874, 0.47225521641568707, -0.48061739888675808]], [[0.94606558536471286, -0.98960410832751255, -0.54730716207657015, -0.01919021088691918], [0.16307648225519095, -0.3155848432241144, -0.96635121146850689, -0.16249817830586416], [0.97023493524697935, 0.99094947267277556, -0.97640053267971305, 0.78177909697867587]]], [[[0.74529994268538491, -0.16579049701658166, -0.97081465164637015, -0.99642657514017952], [0.3490385329297237, 0.52897960232366481, -0.96142656801469195, 0.4396501084403685], [-0.277567581500057, 0.091083824433171562, 0.33318821411150523, -0.80862917156767822]], [[-0.84721913137013771, -0.18291546159728064, 0.34021409508202199, 0.31825330538480789], [0.71677079367561358, 0.61415820889112394, 0.38872432525224898, 0.69383676427292507], [0.90761842336617005, 0.79641644551081814, -0.99946070339480197, 0.63514722255050504]]], [[[0.83457694337317756, -0.74801090758055289, -0.031397957395935407, 0.51464528088708705], [-0.4857527846740865, -0.68680120896912167, 0.77553765270553499, 0.50269724950691053], [0.97078081455322718, 0.29004038701884971, 0.13658079814321689, 0.5065197281697561]], [[0.57162074004370722, 0.88577662065266316, 0.1344069097928022, 0.45163669702654402], [0.75781779092430412, -0.99879162771218244, -0.06831141940693769, 0.1497222316080222], [-0.98556050825669073, 0.68255692976113103, 0.98771358789813224, -0.92466033167086703]]]])+(1.-msk_ref)*numarray.array([[[[0.23217209197051894, 0.92750140233150447, -0.83245973502718251, 0.99611259648561323], [0.69069140539580076, 0.17759253084678614, -0.89280995913599226, -0.22256013812798214], [-0.52409567549761338, 0.99963225645305609, 0.70858607515885852, -0.69417690883737659]], [[-0.66610766977352276, 0.72776291956861339, 0.58882054224263247, -0.092258884266531088], [-0.98332944541626977, -0.89473334399200433, 0.77333845218638109, -0.45635622904471135], [0.97129944223643883, -0.19201736907284048, -0.13110863189212127, 0.11144498092658177]]], [[[-0.57722312856525515, -0.99850476462170312, -0.061184846303749152, 0.11561981763652862], [-0.66979133087446185, -0.022310799411864708, -0.74158975309064767, -0.9445091028081305], [-0.065067556442604341, 0.96028840893223799, -0.96693079262155868, 0.020835074713991906]], [[-0.44013825745236268, -0.92885934187433605, -0.89938286674246037, -0.97414519119251186], [-0.016073079973959268, 0.82101963337083039, -0.4810106237620847, -0.058104725027164135], [0.83274117746688869, -0.95009916753271018, 0.97734765469722507, 0.9671663248687612]]], [[[-0.90960662105081236, -0.92270873486286653, -0.38276882002523788, 0.091973697724973463], [-0.6633331176425904, -0.79922431918451375, -0.56497215635127529, 0.65795064607285259], [-0.10091619527458537, 0.78168104056774534, 0.022855042267844725, -0.61315380741542369]], [[0.22163847286200966, 0.7427452080440865, -0.093296140968069, -0.96106487708897625], [0.7986911357951999, 0.5283532279670673, -0.40406659748310347, -0.10407616703187229], [0.011620912790781377, -0.97548053305667226, 0.9175319386483336, -0.92583209645347753]]]]) | |
11759 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11760 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11761 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11762 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11763 | def test_sin_Symbol_rank0(self): | |
11764 | arg=Symbol(shape=()) | |
11765 | res=sin(arg) | |
11766 | s=numarray.array(-59.3916014281) | |
11767 | sub=res.substitute({arg:s}) | |
11768 | ref=numarray.array(-0.294238825658) | |
11769 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11770 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11771 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11772 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11773 | def test_sin_Symbol_rank1(self): | |
11774 | arg=Symbol(shape=(2,)) | |
11775 | res=sin(arg) | |
11776 | s=numarray.array([-77.518180416339703, -99.902097052938913]) | |
11777 | sub=res.substitute({arg:s}) | |
11778 | ref=numarray.array([-0.85296306795174082, 0.58822958187337715]) | |
11779 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11780 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11781 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11782 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11783 | def test_sin_Symbol_rank2(self): | |
11784 | arg=Symbol(shape=(4, 5)) | |
11785 | res=sin(arg) | |
11786 | s=numarray.array([[-68.776025628098921, 18.583534072810437, 2.5030615885359282, -81.568488722453594, -86.093220779774867], [-67.221717338138347, 7.8150319629840936, -38.212473776124511, -35.413212843434039, -29.084029341527298], [44.463615730285483, -35.607990030177803, 7.7479366716322886, -27.403061449775464, -36.661576208361481], [38.270555455018439, 43.395245412009388, -83.395946138420143, 82.237580019924621, 14.004270430298305]]) | |
11787 | sub=res.substitute({arg:s}) | |
11788 | ref=numarray.array([[0.33255619605642595, -0.2628953097831197, 0.59601657099216188, 0.11268044966812327, 0.95516575752479826], [0.94843820301578952, 0.99924155745678056, -0.49110859112560667, 0.75502592312392947, 0.72407716039519021], [0.46294834755613434, 0.86765740613097231, 0.99438250025762476, -0.76514881632423337, 0.86115409814746968], [0.54084686431197915, -0.55390877782719994, -0.98968706359916092, 0.5279381946907461, 0.99118224805070021]]) | |
11789 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11790 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11791 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11792 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11793 | def test_sin_Symbol_rank3(self): | |
11794 | arg=Symbol(shape=(6, 2, 2)) | |
11795 | res=sin(arg) | |
11796 | s=numarray.array([[[-37.699048834122337, 67.487864519915888], [2.9828406413621451, -24.732359622933814]], [[-61.929665641026645, -68.476378179772155], [-32.237324902859314, -7.6070318207624581]], [[60.977769128483089, -72.382514925143823], [-46.560105241719477, 45.937821630681839]], [[83.263439432502082, -92.94384685128874], [51.849927093272044, -78.761237021574999]], [[91.585054594657009, -36.002253133666869], [53.726162646665756, 51.861195467288468]], [[-47.206562095893624, -54.234991663118073], [24.635547568924366, 10.897512608905188]]]) | |
11797 | sub=res.substitute({arg:s}) | |
11798 | ref=numarray.array([[[6.3008955140298549e-05, -0.99841120781631043], [0.15808603528894985, 0.38976979614921003]], [[0.78468476326272762, 0.5961202571458688], [-0.73209911016042217, -0.96966254162590804]], [[-0.96014169481053901, 0.1255516807235128], [-0.53438887581027339, 0.92690049281462372]], [[0.99993689802325469, 0.96460273897511306], [0.99990686327594558, 0.21961584215844765]], [[-0.46077448262053106, 0.99206465505959207], [-0.31370028629469887, 0.99968959551254188]], [[0.082578150729693003, 0.73652370204730333], [-0.47696085874176203, -0.99519580523955087]]]) | |
11799 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11800 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11801 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11802 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11803 | def test_sin_Symbol_rank4(self): | |
11804 | arg=Symbol(shape=(3, 2, 3, 4)) | |
11805 | res=sin(arg) | |
11806 | s=numarray.array([[[[-15.890402342693434, 0.34967079278480639, -69.644962745437795, 42.940560221661485], [-87.145936678451136, 49.455183015727584, -55.024672865086053, -33.720006009004152], [-60.374597103391658, -10.062767069904965, -26.275100187070336, 73.475919773065471]], [[-21.069235104213391, -32.962767163632307, -83.961409610894236, 56.598525324661068], [10.664148354586175, -84.175124335735191, 70.938373649792197, -50.885634199045818], [-3.7753473336700836, -64.579189053025345, 39.526279799984962, -78.118476532600027]]], [[[-87.539170348669316, 53.990171737005767, 75.031120602988295, 89.786150540127636], [15.24565797164064, 47.14487621807001, -38.076038239089939, -71.863955067032919], [54.427160884365065, -51.643922687914447, 31.69388597837235, 63.197010162156403]], [[40.095787791911192, 68.569022656716015, 83.368763637032373, -64.130086266478315], [-56.640669699135394, 28.887347050286337, 42.538464681579825, -0.81329085125044287], [78.334444852851078, 53.976051151834668, -92.677265657880042, -67.717790405619212]]], [[[94.55646393436794, -74.072328469071493, 15.628014750861269, -19.08383918357049], [0.34503678387962111, 24.723546408702205, -72.452170470947522, -66.788152868232629], [61.510016195707891, 66.878349407366471, 84.66308347515232, -15.120176750922298]], [[-31.566786151962461, 45.449410239249346, -90.349459031765548, -27.203984637101513], [-39.051741216817845, -72.264868220520867, -67.902622230428847, -59.158845980218722], [0.52167726472671916, -10.820231066135364, 71.585444977834385, -19.920876608835187]]]]) | |
11807 | sub=res.substitute({arg:s}) | |
11808 | ref=numarray.array([[[[0.18142870681923798, 0.3425885406050273, -0.50546808260791642, -0.86328219433933273], [0.73022937255072884, -0.72449360648452032, 0.99890501309408652, -0.74298095956355081], [0.63215918874375432, 0.59558130798366149, -0.90961605511692745, -0.93885469749753936]], [[-0.79675938208265107, -0.99971307596321124, -0.75888030600764067, 0.049836906821785487], [-0.94557931825783614, -0.60349520540713741, 0.96828115466442444, -0.58115865307416081], [0.5921744828383132, -0.98445730548018506, 0.96731639813302839, -0.40898344979772361]]], [[[0.41270698122918936, -0.55061151710067213, -0.35891304360076959, 0.9687241365310475], [0.44601259199410115, -0.020984873750761551, -0.36806437453098872, -0.3826620757098414], [-0.85215290965973867, -0.98155654013732874, 0.27439398566293094, 0.35709603191044931]], [[0.67791057877776606, -0.5192863947552645, 0.99321476652686747, -0.96308406338850749], [-0.091872199916891564, -0.57533459294226186, -0.99195091057653295, -0.72655228515132986], [0.20393085417395668, -0.53876969374246431, 0.99999996013162051, 0.98497824474943119]]], [[[0.30380541290205748, 0.97016130669394118, 0.079863375608460366, -0.23214588781170803], [0.33823129342514735, -0.39787075152274376, 0.19429572151212773, 0.72752470593055507], [-0.9691693331376533, -0.78636565705333028, 0.15923742302181473, -0.5545203884228973]], [[-0.15028804065876869, 0.9946297066698937, -0.68654604166089739, -0.87736813185980267], [-0.97629583471350656, 0.0082370948053343829, 0.93646621708071842, -0.50675322220049412], [0.4983350007448592, 0.98466672326147653, 0.62191520543510515, -0.87783383304733476]]]]) | |
11809 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11810 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11811 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11812 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11813 | def test_cos_float_rank0(self): | |
11814 | arg=12.8022737001 | |
11815 | res=cos(arg) | |
11816 | ref=0.972303667601 | |
11817 | self.failUnless(isinstance(res,float),"wrong type of result.") | |
11818 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11819 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11820 | def test_cos_array_rank0(self): | |
11821 | arg=numarray.array(81.9030902279) | |
11822 | res=cos(arg) | |
11823 | ref=numarray.array(0.975529175116) | |
11824 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11825 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | |
11826 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11827 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11828 | def test_cos_array_rank1(self): | |
11829 | arg=numarray.array([-3.1659404550478598, -78.770544011004517]) | |
11830 | res=cos(arg) | |
11831 | ref=numarray.array([-0.9997036069247125, -0.97350024454745809]) | |
11832 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11833 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
11834 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11835 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11836 | def test_cos_array_rank2(self): | |
11837 | arg=numarray.array([[-30.794187778759778, 0.85080886747965678, 72.306186238999288, 6.9748772974918012, 79.516672956944063], [86.786469847342659, 3.7028708915669171, 80.37984411727453, 88.481994155573062, 44.230357294268288], [-58.302217071119557, -55.178139958451936, 87.593515438312323, -24.785367985815171, 98.359589229615466], [-31.854839257078595, -9.0018909167008729, 4.7136540476817572, 16.002129052312014, -11.789662012845042]]) | |
11838 | res=cos(arg) | |
11839 | ref=numarray.array([[0.81286694784924007, 0.65937524376097301, -0.99877239201012524, 0.77016789679198738, -0.55963036169023139], [0.38265829523948425, -0.84657543666548907, 0.26599065257267407, 0.8691082050444322, 0.96939052643352663], [-0.18173739330410366, 0.1989324917250061, 0.93193666987235591, 0.94027018029592546, -0.56512054377873722], [0.90521424329995193, -0.91190791424406981, 0.0012650669596327702, -0.95704434909532998, 0.7132244558805807]]) | |
11840 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11841 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
11842 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11843 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11844 | def test_cos_array_rank3(self): | |
11845 | arg=numarray.array([[[50.387970299672958, 29.283929509977696], [-66.772009838509376, 60.429920999281819]], [[-8.5766208394698822, -60.883217299800329], [95.242982403475651, -86.115091741382543]], [[-52.324500845707703, 25.632872154700763], [-0.58350729326133433, -24.097894724429821]], [[-56.715089150416162, 84.206037318419675], [-36.690358592980928, -19.579806089690194]], [[-13.309049137718802, -73.64720223221002], [-44.056513958126729, -89.338449548164448]], [[39.590677420492995, 71.64654237642219], [-60.51045883245412, -14.000945362814974]]]) | |
11846 | res=cos(arg) | |
11847 | ref=numarray.array([[[0.99250773865265618, -0.53220311324739533], [-0.69773603296499365, -0.73869738226508386]], [[-0.6613665430403447, -0.36891317441110316], [0.54433278152098952, -0.27511203517551286]], [[-0.46905641157801509, 0.87751978510932405], [0.83453542849264828, 0.51065791183165576]], [[0.9861838930452187, -0.81563853576330847], [0.53291609526312445, 0.74500754948473746]], [[0.73665981590171459, -0.17925105881386577], [0.99724719663050987, 0.19567045990235213]], [[-0.31529666740670903, -0.81959722640487132], [-0.68207612410963148, 0.13580067388724723]]]) | |
11848 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11849 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | |
11850 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11851 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11852 | def test_cos_array_rank4(self): | |
11853 | arg=numarray.array([[[[8.8585796551860625, 56.230722191967914, 32.019025852785489, -76.240723304025721], [-47.749040562512789, -98.339434837051783, 70.859766363200237, -98.311574089761322], [-52.324580920881303, 96.326373563570314, 69.773493973765369, 34.547548410615576]], [[-81.713903361911818, 96.89515505261167, 32.14011355478587, 40.833117226994347], [88.359411641871901, 99.260851582320299, 32.291978752467458, 34.648053452706648], [62.889324490972825, -83.646300835071457, 22.610216303248336, 66.616016567138644]]], [[[-17.197294613142319, -3.6842582419897667, 78.922021411276916, 35.992025233043194], [-92.506302343396186, -12.80399377292683, -18.033493882610045, 72.067566702745893], [21.035957164282863, 70.855105287036082, -8.5253976863984349, 80.750151682605122]], [[-8.8417506220947359, 61.36510079425446, -25.644929133852216, 40.188275611212987], [-25.669229350991557, -16.113815339165384, 43.92335634612391, 90.772865066514441], [26.034572422228308, -2.8711185835616675, -30.821975852409707, 99.67303892757721]]], [[[-12.673601706489663, 2.304354282387223, -44.91890224201309, -51.245125847269122], [-36.174794536889479, -6.8764825759013206, -68.713937504645145, -97.121693324391245], [-92.116548149907402, -51.150678601242895, -85.862075707093993, -26.492481960906773]], [[-9.3549875850648334, 91.091860017849058, 19.150635549346703, -59.957632280501507], [-30.353193336019046, -97.973159096626318, 12.100803192254858, 73.753754526126613], [-93.775512934495197, 2.0310829139235693, 31.781795131664779, 88.243508559195647]]]]) | |
11854 | res=cos(arg) | |
11855 | ref=numarray.array([[[[-0.84394640242754804, 0.94987966856902739, 0.82358164777126441, 0.66559941934698164], [-0.81087490180541133, -0.58163218822498852, -0.173056013152627, -0.60406691123278633], [-0.46912712992167072, -0.48625395737776261, 0.79093818984192754, -0.99995029219615772]], [[0.99947210445754142, -0.8803402908496113, 0.74903829114045251, -0.99997121680753465], [0.92306683750653218, 0.29617262700437857, 0.64018888147855402, -0.99590457207030214], [0.99834897250432109, -0.38397319491648929, -0.81441978564223916, -0.80055781398499271]]], [[[-0.081374903851665389, -0.85633516088809258, -0.92784447233066147, -0.13586874199713481], [-0.16985343142213913, 0.97190021204609445, 0.68509513388229792, -0.98218051486600799], [-0.57745249597890147, -0.16846340013067879, -0.62209529663370222, 0.59682562466322531]], [[-0.83479976539592393, 0.10385643517733804, 0.8716743341110903, -0.7946115232954305], [0.85950897121254921, -0.91876633151615572, 0.99826349361266198, -0.94496069123950321], [0.62017450370660798, -0.96364433869084776, 0.82873619390006759, 0.65400783890141501]]], [[[0.99425625331526324, -0.66951670587906009, 0.59252620664860245, 0.55731867514789302], [0.046462287647983845, 0.82910169364382147, 0.92063173530463938, -0.96438740023068792], [-0.53155481457863152, 0.6331376906760543, -0.50701857453496257, 0.20949218767157707]], [[-0.9975656400559022, -0.99989737120426636, 0.95501688058642786, -0.96446857407183784], [0.4864859369011077, -0.83438138098161108, 0.89356697671985796, -0.073606205812436112], [0.89053945351718922, -0.44420488584319706, 0.93381336417866412, 0.96135492253562493]]]]) | |
11856 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
11857 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | |
11858 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11859 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11860 | def test_cos_constData_rank0(self): | |
11861 | arg=Data(-61.9498622145,self.functionspace) | |
11862 | res=cos(arg) | |
11863 | ref=Data(0.635615451425,self.functionspace) | |
11864 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11865 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11866 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11867 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11868 | def test_cos_constData_rank1(self): | |
11869 | arg=Data(numarray.array([-89.363505318102554, 90.746151091366158]),self.functionspace) | |
11870 | res=cos(arg) | |
11871 | ref=Data(numarray.array([0.17104017933113105, -0.93588418955761465]),self.functionspace) | |
11872 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11873 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11874 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11875 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11876 | def test_cos_constData_rank2(self): | |
11877 | arg=Data(numarray.array([[-87.716817023452975, -13.508318618768172, -40.837878999841813, -94.821047816906486, 20.238625532480697], [10.664222985785372, 41.421464805806608, -59.947824248490633, -78.555304048035651, -8.6157242378561278], [12.921775769760472, -50.786928458875181, 14.281561344574072, -62.970825984819953, 69.030431174425786], [33.649169420684956, 31.961869743753539, 95.025401181456971, -69.38900568783086, 28.121974134384544]]),self.functionspace) | |
11878 | res=cos(arg) | |
11879 | ref=Data(numarray.array([[0.96945993825961785, 0.58821378024571513, -0.99999600828650015, 0.84013285161999507, 0.1807281241902764], [-0.32532112085362436, -0.83604574058067016, -0.96701340164638327, -0.99988006784331296, -0.69018350050446609], [0.93750558375153104, 0.8670997832638041, -0.1438931618585739, 0.9903587968098958, 0.99642294505936524], [-0.61504777690368062, 0.85463793445943459, 0.71258422387118503, 0.96270510850591873, -0.98841568900027077]]),self.functionspace) | |
11880 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11881 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11882 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11883 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11884 | def test_cos_constData_rank3(self): | |
11885 | arg=Data(numarray.array([[[-86.264864472603193, 7.0899163167813697], [62.034724520374027, -53.737765416027081]], [[21.737171707872307, -39.991208563910121], [41.050321790962244, -40.100213891371972]], [[80.79158486625019, 9.5468715078936839], [20.045951470114602, -73.62813814925822]], [[90.373079869171505, 55.136085676347903], [-60.773850688066375, -19.49023282382187]], [[-16.279695430573497, 70.631083378881186], [87.762984375593931, -70.166718723420061]], [[-44.704810449858392, 60.228705435547226], [-72.118752328137177, -48.200833401477624]]]),self.functionspace) | |
11886 | res=cos(arg) | |
11887 | ref=Data(numarray.array([[[-0.1285765694430033, 0.69186243246368828], [0.69876368539675648, -0.9458184296187333]], [[-0.96792086970536395, -0.6603617578658344], [-0.97811062189215869, -0.73813766065052]], [[0.62954868271257325, -0.99255583718030116], [0.36571488292688958, -0.1979726592446612]], [[-0.74309878813858687, 0.15755500107466464], [-0.46815886672734131, 0.80169133119863356]], [[-0.84096498214967286, 0.054723976242368536], [0.97974546517631589, 0.49611277631934148]], [[0.7501461251974979, -0.85850711663576951], [-0.99050978024869984, -0.47402177642967447]]]),self.functionspace) | |
11888 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11889 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11890 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11891 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11892 | def test_cos_constData_rank4(self): | |
11893 | arg=Data(numarray.array([[[[10.86769150637592, -11.766101946953086, -40.632054317141275, -44.331198232316773], [63.040749529539085, -18.188400617211855, -49.618899482969979, 16.74749768820601], [-99.222919092701332, 50.811854793623525, -98.706022950048023, -76.194952985075304]], [[-92.353764397766298, 0.88734782067865581, -6.0019342520621279, 12.072469458988607], [86.40044972063265, 93.841407292060126, 62.04309009236411, -25.676293779358559], [-53.006995335453475, 33.517916229155048, 62.667462961355739, -61.156034212813907]]], [[[-91.6272838267937, 24.711419376381642, 56.938687934439201, 85.589689401573139], [27.872798937640738, -94.922800615920181, 24.187649616642489, -82.28813915263045], [-82.429183872811905, 23.776052793476254, 49.178642418795391, 42.237566296771035]], [[-95.599653557158874, -3.2117874250670013, -4.6985177190430107, 30.009412205188966], [-94.177295806719982, -67.100440854840656, 78.043053536597739, -17.760351739077223], [-82.421230180492344, -61.760191108767785, 83.752315525263384, -43.739701552250153]]], [[[17.27288088011116, 88.675054753497733, 6.787070381501394, 69.810884667683069], [-55.219843507383715, 54.083266698745206, 86.063401087901809, -76.089326493737033], [-42.038461813845807, -49.675851649369406, -74.52809891911744, -26.645885023219407]], [[95.412577827443414, -31.818322125741673, -62.668782913250844, 51.056651157908732], [29.626229191282619, -70.916672795563258, -93.812308419630284, 50.993951822668606], [97.536350190192877, -58.491790765244666, 40.487592210008074, 58.566434870771474]]]]),self.functionspace) | |
11894 | res=cos(arg) | |
11895 | ref=Data(numarray.array([[[[-0.12753450014394557, 0.69651395400439842, -0.97831140708599751, 0.93974896212096948], [0.9782603634601218, 0.78928336789060305, 0.79814708436766113, -0.50662172029142771], [0.25973763620098306, 0.85441504186502082, -0.25141858195451089, 0.69904923600339386]], [[-0.31762040357237481, 0.63147074411941229, 0.96070895016005275, 0.88049016444672401], [0.0066516978615375373, 0.9185608137809258, 0.70472349851785032, 0.85587677865914791], [-0.92102992500063807, -0.50656262601085844, 0.98651834766531155, -0.10482957689473014]]], [[[-0.86727364348422242, 0.91254914364446615, 0.92490139133616656, -0.72021249801851428], [-0.92046217359465865, 0.78069382297587053, 0.58566862525374508, 0.82151681807034405], [0.73320378466216263, 0.21247577462533909, 0.46528475996332708, -0.17305883912173914]], [[0.21717784735742893, -0.99753735846015812, -0.013870816513353947, 0.16354403647281665], [0.99751704509186812, -0.42937551918191064, -0.87912995574006803, 0.46319081359752184], [0.7385891182610298, 0.47866569181287344, -0.47952224979636382, 0.97071772306861814]]], [[[-0.0058786807720651261, 0.75806165680370197, 0.87571333970615173, 0.76751147584898971], [0.23961770902092361, -0.77996177708505321, -0.324418473652555, 0.77054356811991798], [-0.36444710950988046, 0.83114602646711189, 0.64473117916407829, 0.057620599880895247]], [[0.3949359265321995, 0.92012546535486572, 0.98673349925454323, 0.70301464495912791], [-0.21715699760614957, -0.22879346324193936, 0.9066713780848985, 0.74619426288234914], [-0.98921817473160367, -0.36378367286102392, -0.93830096876607127, -0.43223588967640608]]]]),self.functionspace) | |
11896 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11897 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11898 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11899 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11900 | def test_cos_expandedData_rank0(self): | |
11901 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11902 | arg=msk_arg*(-36.0973683311)+(1.-msk_arg)*(-15.0675429856) | |
11903 | res=cos(arg) | |
11904 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11905 | ref=msk_ref*(-0.0309422456304)+(1.-msk_ref)*(-0.801844696357) | |
11906 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11907 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11908 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11909 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11910 | def test_cos_expandedData_rank1(self): | |
11911 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11912 | arg=msk_arg*numarray.array([13.22047315692194, 66.297986628531646])+(1.-msk_arg)*numarray.array([25.148700308715902, 90.629815998628033]) | |
11913 | res=cos(arg) | |
11914 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11915 | ref=msk_ref*numarray.array([0.79359430314944091, -0.94779722020057866])+(1.-msk_ref)*numarray.array([0.99987265658563174, -0.88866489544992711]) | |
11916 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11917 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11918 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11919 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11920 | def test_cos_expandedData_rank2(self): | |
11921 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11922 | arg=msk_arg*numarray.array([[-1.224755096301692, 97.114446084647994, 78.66934127829532, 20.492601387243852, -1.8468029073290637], [94.122385272674506, -83.420646649404915, 84.662371945918665, 96.044573177625836, -4.3173175013998133], [39.380839398982147, 49.750816368301798, -46.750527293456187, 96.2026545747689, 59.005783622713864], [-64.783479411930358, 80.977519793545952, -9.0322065293006801, 59.07665091049779, 18.567068128306488]])+(1.-msk_arg)*numarray.array([[-40.062758393821142, -77.335375405412861, 47.444663163105105, -22.075478512825967, 30.498519871683385], [-6.6058669139393373, -43.594483739360854, -79.124767745891376, 39.981887534339364, 67.873590863604875], [-35.635014978859346, -91.956973584247208, 13.377356719156637, -71.146754763345243, -24.032516390161177], [-16.058009823221269, 66.650000191064265, 33.773123019379568, -35.806618515625303, -82.89935689255681]]) | |
11923 | res=cos(arg) | |
11924 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11925 | ref=msk_ref*numarray.array([[0.33917637019859703, -0.96244524151414412, -0.99162336600665246, -0.072186299308219973, -0.27251555769578545], [0.99214842647378776, -0.16764594205585706, -0.98712676481798567, -0.22407835776507445, -0.38487416268261437], [-0.11070385395641859, 0.87045713651526513, -0.93110614158646188, -0.37470506271731796, -0.7747499584525428], [-0.37169114559236371, 0.76233091786134399, -0.923928374612207, -0.8175749134173127, 0.96036494926789795]])+(1.-msk_ref)*numarray.array([[-0.71235650110259441, -0.35821507052086493, -0.94899186128321478, -0.99644633755360834, 0.60788137929554054], [0.94838846229715867, 0.92573816396702235, -0.83373891839854186, -0.65333356768775441, 0.32342690776752892], [-0.47353549211311979, -0.65939196193876926, 0.68878387477507896, -0.44477233883471701, 0.45339573218511048], [-0.93935674812859138, -0.77973462685642325, -0.70781494235331721, -0.31617696002534756, 0.3455721479169635]]) | |
11926 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11927 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11928 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11929 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11930 | def test_cos_expandedData_rank3(self): | |
11931 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11932 | arg=msk_arg*numarray.array([[[55.483105445596493, -84.002238303792453], [28.575161935168694, 67.00969325541476]], [[-82.092190352486142, 70.81562364547608], [-74.349947649074409, -6.7333955028757941]], [[73.606514485922332, 40.968585169340713], [-10.786045857308508, 65.198060327659135]], [[-50.170284604471327, -55.056223512041669], [77.506098391169076, -23.282530663895102]], [[-26.756072717949436, 84.143805447203476], [1.180711606109071, -52.027593969940369]], [[-4.2616554777689117, -84.42480221013362], [15.144723947311817, 99.934532959080201]]])+(1.-msk_arg)*numarray.array([[[72.197802657304322, 30.031068553513251], [31.351829685111909, -36.235960482725837]], [[21.624265511345357, 23.64734280582843], [-89.88417079282425, 60.44136194543546]], [[10.996017730716773, 65.262227504852063], [-76.321146670174272, -52.668478887245065]], [[82.50391310015678, -20.135683721573756], [14.572063027442368, -0.6896670909694933]], [[60.842163889504008, 36.998458942261806], [-20.499215145000463, -72.797762608461667]], [[16.509505303768293, -79.949879255527264], [-6.9809554307616679, 66.810788972572908]]]) | |
11933 | res=cos(arg) | |
11934 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11935 | ref=msk_ref*numarray.array([[[0.48401222470712563, -0.68166289343156683], [-0.95509145527759087, -0.50945283155622245]], [[0.91680908584073406, -0.12942486038880624], [0.49906571322494375, 0.90035565457820055]], [[-0.21912040288715273, -0.99183440386679222], [-0.20799866689643615, -0.71415131202097681]], [[0.99547210549862564, 0.078271930973057291], [-0.51162790055459817, -0.27579265145672299]], [[-0.05251100009257479, -0.77807789151181295], [0.38026677268852599, -0.19015024920430146]], [[-0.43562589734555279, -0.92176067291186181], [-0.84552998640555266, 0.8273450262977281]]])+(1.-msk_ref)*numarray.array([[[-0.99827011011545363, 0.18486878514750979], [0.99794650005510754, 0.10743719861113013]], [[-0.93344994710516715, 0.08529414341350125], [-0.34175167339508283, -0.73093758146911281]], [[0.00044344313796299586, -0.75756723617489508], [0.60349204112184918, -0.73941438014513183]], [[0.68038820299051661, 0.28083933369769526], [-0.42131616285948442, 0.77145788123141812]], [[-0.40674928195501753, 0.76442141404261976], [-0.078781176005662423, -0.85712634845985503]], [[-0.69559969265779853, -0.16004220706279867], [0.76627681039248841, -0.66943880063060068]]]) | |
11936 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11937 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11938 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11939 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11940 | def test_cos_expandedData_rank4(self): | |
11941 | msk_arg=whereNegative(self.functionspace.getX()[0]-0.5) | |
11942 | arg=msk_arg*numarray.array([[[[81.658891253874316, 30.154394472077058, -36.265578949628633, -47.079147518937468], [-71.167146036277003, -41.9186826247917, -19.117903943939993, -26.079905327428762], [65.931361328358861, 90.197906187757837, -31.423335850518441, -28.286048187927378]], [[71.871283726884485, 97.6737686461978, 73.42998495160947, -14.865232484694445], [21.661875371448701, 84.396447257210269, -22.129504015834016, 42.427494938535261], [88.771175748186749, -75.408811105169974, -69.575485813748742, 5.5990892178879648]]], [[[-2.5470387198181186, 83.040539862229934, 27.081303077340337, 51.185017387292476], [-47.666956331255705, -71.09454374103494, -12.656279276279207, 46.394025119360208], [-89.901778088496684, -17.767376720946132, -99.917741127313974, -47.717421519561462]], [[8.693865786048363, 14.971207834154555, -63.535614994602518, -44.328116514882751], [-51.286711883396954, 9.1258561937947604, 43.312231786364464, -33.34607470853696], [27.51825978940407, 73.872039558971039, 84.752128628228576, -9.0124335912783948]]], [[[-26.128227021007319, 20.639092270432016, -22.680126332913247, 25.063812028694016], [-56.615261494527402, 67.210893028966325, 87.796053191372465, -81.471710946526699], [-89.314681542332949, 65.872995175957186, 43.779448960120646, 67.866612105077394]], [[-66.870791246045002, -45.354327014974331, -65.816476857544785, 53.473037113499004], [-41.393387472045397, 41.345634736576699, 40.192586700259739, 11.936195522492625], [-83.82311215875697, 79.874611048483359, -80.758910243743685, 54.169687707747642]]]])+(1.-msk_arg)*numarray.array([[[[79.975844309170498, -48.345625034036722, 66.443940680510877, 39.323120361210499], [9.3550298748197491, 52.272469669987004, 7.7830009762651002, -50.077500193710648], [-61.587099942318744, -66.863938143271454, -51.722120138546821, -43.001183411657685]], [[74.508937209465643, -17.801821857280032, -96.972937711273246, 72.41183780379302], [29.452848452635891, 94.133920463076976, -27.938357509488185, 4.098257930496942], [21.067732757629187, -52.606997531840641, 42.818983964361422, -20.470439762486563]]], [[[41.131011535410437, 33.995686953582606, -59.091466947449334, 13.06823181504609], [-26.826785538691382, -36.157623980696727, 67.955195199568607, -26.327491349671178], [-66.437617402363486, -38.150104004241527, -10.872833925186612, -7.9714487224826769]], [[59.359911777606669, 90.541284511390501, -90.232513741603299, 79.142818011771851], [-58.547802522437806, 74.087580646014828, 95.212298086166982, 58.740940692381656], [-97.360556330976905, 13.614895311489079, -16.297445160271735, -14.876606558474577]]], [[[-0.81239837735233777, -71.100446898779367, -74.082829351107051, 33.018490125485727], [8.0131639573274924, -29.224274631812278, 65.331408901937834, -93.121364679526437], [48.094133457963153, 94.659711075768058, -56.265304671957381, -44.775197816875092]], [[78.067699088113585, -50.740947996549203, -27.505788007906219, -48.105796725511851], [27.275728631570999, -82.611405981579054, 62.772330081477833, 91.643617134438784], [-79.364280665253176, -47.031342269127421, -98.190983248186029, -34.616820364422708]]]]) | |
11943 | res=cos(arg) | |
11944 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
11945 | ref=msk_ref*numarray.array([[[[0.99974648641704578, 0.30435788687272552, 0.13683280344622692, -0.99899923093822218], [-0.46294192167477966, -0.47311060525720278, 0.96421021544423069, 0.58398751340702615], [-0.9991145824550095, -0.61510218317556875, 0.9999725511540013, -0.99993138830653794]], [[-0.92666794295836774, -0.9598311886992611, -0.38706137277129665, -0.66542688071327594], [-0.94627760692292984, -0.91039672543745431, -0.99044414397882241, 0.015993433168101586], [0.69197041282698768, 0.99994395380283829, 0.89585377001765809, 0.77499061055278551]]], [[[-0.82839844046690569, 0.21008847929829561, -0.36884446429894552, 0.60619010167380138], [-0.85612803895715517, -0.39742502551382042, 0.99596093819165676, -0.74526463332938697], [-0.3582450109517854, 0.46940528357073097, 0.81779695883550263, -0.82897059205453272]], [[-0.74456579079006469, -0.74065243965863614, 0.76241328374955808, 0.94079803034423892], [0.52231795226174615, -0.95565457337977633, 0.78378107414507481, -0.35166755390596066], [-0.72753505953347086, 0.044597402857294056, -0.99748955870013933, -0.91618381584706621]]], [[[0.54409536262501013, -0.21699984096121355, -0.77189630709509238, 0.99762532313598207], [0.99778345689649628, -0.32720952301781842, 0.98583053656377828, 0.97809381526902872], [0.21892156237938304, -0.99495908440040703, 0.97949675533888336, 0.31681541317886081]], [[-0.62368710091572177, 0.19746023066230201, -0.98770566197447685, -0.99782529579539758], [-0.85111909839025046, -0.87520822274754506, -0.79722147176466518, 0.80792434147142878], [-0.54039529506920203, -0.23381695647535797, 0.60383025819594616, -0.72303366513856404]]]])+(1.-msk_ref)*numarray.array([[[[-0.13436077240726316, -0.34201567621685647, -0.89134402060793727, -0.053187082842302578], [-0.9975685881864238, -0.42249008090281082, 0.07092106962798754, 0.98238330330531154], [0.32029719862810208, -0.62902930625367448, 0.11391085089048571, 0.55609724451005038]], [[0.6299663251108153, 0.49953529411945946, -0.91453698294999897, -0.98797958829090204], [-0.38229784081228507, 0.99352504718605417, -0.94408885824716904, -0.5762485691730832], [-0.60309899769845521, -0.69665105534915361, 0.39629980402135667, -0.050066573862182912]]], [[[-0.95815603193412535, -0.84628043097907402, -0.82601627167478864, 0.8766887352613707], [-0.12293619592253698, 0.029304268667122303, 0.39948329810258998, 0.36724583096741847], [-0.89419269786037481, 0.90001510332012979, -0.1224324098233948, -0.11719712955985295]], [[-0.94592931147917447, -0.84464083011827396, -0.64201466079431768, -0.82363702778858228], [-0.41535991838593167, 0.25722868355816148, 0.5698126445332351, -0.58223630038953733], [-0.99958484980840756, 0.49885021791560108, -0.83122882247753749, -0.67387398078725091]]], [[[0.68775933759123087, -0.40283501156914814, 0.25263438090145968, -0.031761920026041855], [-0.15851092074962655, -0.58173128371482041, -0.80087771324083845, 0.42989944177895328], [-0.5650985275826873, 0.91634921141350756, 0.96012059545797757, 0.70178185948911376]], [[-0.89060741634512253, 0.8890797163293207, -0.71892217832022665, -0.55543784153332254], [-0.54147542099155643, 0.59783639656790899, 0.9982290297813865, -0.85902708455056043], [-0.67895034675987809, -0.99572053270346172, -0.69555015450633373, -0.99824220054368329]]]]) | |
11946 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
11947 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | |
11948 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11949 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11950 | def test_cos_Symbol_rank0(self): | |
11951 | arg=Symbol(shape=()) | |
11952 | res=cos(arg) | |
11953 | s=numarray.array(90.5372724402) | |
11954 | sub=res.substitute({arg:s}) | |
11955 | ref=numarray.array(-0.842486242114) | |
11956 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11957 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
11958 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11959 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11960 | def test_cos_Symbol_rank1(self): | |
11961 | arg=Symbol(shape=(2,)) | |
11962 | res=cos(arg) | |
11963 | s=numarray.array([-9.0536838172296825, 33.816188000375888]) | |
11964 | sub=res.substitute({arg:s}) | |
11965 | ref=numarray.array([-0.93193112842841397, -0.73757029996164303]) | |
11966 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11967 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
11968 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11969 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11970 | def test_cos_Symbol_rank2(self): | |
11971 | arg=Symbol(shape=(4, 5)) | |
11972 | res=cos(arg) | |
11973 | s=numarray.array([[-31.546701209629163, 39.362102781082996, -15.354595714411218, 38.340687603236177, -98.010951194079894], [82.222812801466517, -86.454712307597589, 32.12633138537268, -45.272841747188863, -11.684078726050444], [31.575597388189834, -26.847774004442044, -98.273037827965055, 89.120378763437628, 97.882547727500537], [89.465688335120035, -64.006390385826847, -38.163447134657758, -4.2672402307320567, 57.401582191500665]]) | |
11974 | sub=res.substitute({arg:s}) | |
11975 | ref=numarray.array([[0.99146117203213002, -0.09206406003479313, -0.93821266187128138, 0.80115372568056786, -0.81296002706195136], [0.85698608818153499, 0.060876669858104665, 0.75809791928896697, 0.27659756615947145, 0.63538302492165299], [0.98727966912002574, -0.14373684936927411, -0.63432167527334105, 0.40320078717966623, -0.88083395597723491], [0.069645865517830363, 0.38596994797460843, 0.89411943853466547, -0.43059213856110001, 0.65779079426598108]]) | |
11976 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11977 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
11978 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
11979 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
11980 | def test_cos_Symbol_rank3(self): | |
11981 | arg=Symbol(shape=(6, 2, 2)) | |
11982 | res=cos(arg) | |
11983 | s=numarray.array([[[98.415735048260814, 18.353441772747985], [64.296879506748496, -64.860098440847054]], [[17.35608520540994, -89.14646486132132], [61.865142970991087, 38.297409700741156]], [[-78.471447880825764, 57.222085234102735], [0.32968192830907128, 74.226443876271787]], [[-0.38397537075613286, 58.602106009712742], [23.192943302380669, 0.68715909226719418]], [[-92.072938356064185, 35.440518792877072], [59.879924556501493, 52.598144407817671]], [[-35.629803721051061, 46.196948046672787], [67.640487098408386, -4.6625958646272068]]]) | |
11984 | sub=res.substitute({arg:s}) | |
11985 | ref=numarray.array([[[-0.51793361179511976, 0.87943890784122258], [0.10557278940314231, -0.44166087291734224]], [[0.077248575506542849, 0.37919462717930402], [0.56801025787030479, 0.82629552068703671]], [[-0.99766378712807424, 0.78169489218908095], [0.94614536458526166, 0.38851230621344895]], [[0.92718275497354863, -0.46412092938877864], [-0.36068441584172917, 0.7730512437004543]], [[-0.56797626564805737, -0.63483637029213524], [-0.98206761019991662, -0.69027251657089972]], [[-0.47811898562840421, -0.60028273117574626], [0.096096526974265448, -0.049772542511485468]]]) | |
11986 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
11987 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | |
11988 | & |