/[escript]/trunk/escript/test/python/test_util.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_util.py

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

revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 614 by elspeth, Wed Mar 22 01:37:07 2006 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    to run the use:
8    
9     from esys.bruce import Brick     from esys.bruce import Brick
10     class Test_utilOnBruce(Test_util):     class Test_utilOnBruce(Test_util_no_tagged_data):
11         def setUp(self):         def setUp(self):
12             self.domain = Brick(10,10,13)             self.domain = Brick(10,10,13)
13             self.functionspace = ContinuousFunction(self.domain)             self.functionspace = ContinuousFunction(self.domain)
# Line 14  The tests must be linked with a function Line 15  The tests must be linked with a function
15     suite.addTest(unittest.makeSuite(Test_utilOnBruce))     suite.addTest(unittest.makeSuite(Test_utilOnBruce))
16     unittest.TextTestRunner(verbosity=2).run(suite)     unittest.TextTestRunner(verbosity=2).run(suite)
17    
18  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.
19  This test assumes that the functionspace has samples with tags equal to 1 and different from 1.  This test assumes that samples with x_0 coordinate 0 are tagged with 1 and all samples tagged with 1 have x_0
20    coordinate 0.
21    
22  @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 this 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.
23    
24  @var __author__: name of author  @var __author__: name of author
25  @var __licence__: licence agreement  @var __license__: licence agreement
26  @var __url__: url entry point on documentation  @var __url__: url entry point on documentation
27  @var __version__: version  @var __version__: version
28  @var __date__: date of the version  @var __date__: date of the version
29  """  """
30    
31  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
32  __licence__="contact: esys@access.uq.edu.au"  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
33                        http://www.access.edu.au
34                    Primary Business: Queensland, Australia"""
35    __license__="""Licensed under the Open Software License version 3.0
36                 http://www.opensource.org/licenses/osl-3.0.php"""
37  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys/escript"
38  __version__="$Revision$"  __version__="$Revision$"
39  __date__="$Date$"  __date__="$Date$"
# Line 35  __date__="$Date$" Line 41  __date__="$Date$"
41  import unittest  import unittest
42  import numarray  import numarray
43  from esys.escript import *  from esys.escript import *
44    from esys.escript.test_util_base import Test_util_base
45  class Test_util(unittest.TestCase):  from esys.escript.test_util_reduction_no_tagged_data import Test_util_reduction_no_tagged_data
46     RES_TOL=1.e-7 # RES_TOLerance to compare results  from esys.escript.test_util_reduction_with_tagged_data import Test_util_reduction_with_tagged_data
47     DIFF_TOL=1.e-7 # RES_TOLerance to derivatices  from esys.escript.test_util_overloaded_binary_no_tagged_data import Test_util_overloaded_binary_no_tagged_data
48  #=========================================================  from esys.escript.test_util_overloaded_binary_with_tagged_data import Test_util_overloaded_binary_with_tagged_data
49  #  constants  from esys.escript.test_util_unary_no_tagged_data import Test_util_unary_no_tagged_data
50  #=========================================================  from esys.escript.test_util_unary_with_tagged_data import Test_util_unary_with_tagged_data
51     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  from esys.escript.test_util_binary_no_tagged_data import Test_util_binary_no_tagged_data
52     def test_kronecker_1(self):  from esys.escript.test_util_binary_with_tagged_data import Test_util_binary_with_tagged_data
53        val=kronecker(d=1)  from esys.escript.test_util_spatial_functions import Test_Util_SpatialFunctions
54        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  from esys.escript.test_util_slicing_no_tagged_data import Test_util_slicing_no_tagged_data
55        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  from esys.escript.test_util_slicing_with_tagged_data import Test_util_slicing_with_tagged_data
56     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
57     def test_kronecker_2(self):  class Test_util_reduction(Test_util_reduction_no_tagged_data,Test_util_reduction_with_tagged_data):
58        val=kronecker(d=2)     """ test for reduction operation Lsup,sup,inf for all data types"""
59        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     pass
60        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  class Test_util_unary(Test_util_unary_no_tagged_data,Test_util_unary_with_tagged_data):
61        self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")     """ all unary tests """
62        self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")     pass
63        self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")  class Test_util_binary(Test_util_binary_no_tagged_data,Test_util_binary_with_tagged_data):
64     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     """
65     def test_kronecker_3(self):     test for all binary operation
66        val=kronecker(d=3)     """
67        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     pass
68        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  class Test_util_overloaded_binary(Test_util_overloaded_binary_no_tagged_data,Test_util_overloaded_binary_with_tagged_data):
69        self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")     """test for all overloaded operation"""
70        self.failUnlessEqual(val[0,2],0.0,"wrong value for (0,2)")     pass
71        self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")  class Test_util_with_tagged_data(Test_util_unary_with_tagged_data,Test_util_reduction_with_tagged_data,Test_util_binary_with_tagged_data,Test_util_overloaded_binary_with_tagged_data,Test_util_slicing_with_tagged_data):
72        self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")     """test for all operations without tagged data"""
73        self.failUnlessEqual(val[1,2],0.0,"wrong value for (1,2)")     pass
74        self.failUnlessEqual(val[2,0],0.0,"wrong value for (2,0)")  class Test_util_no_tagged_data(Test_util_unary_no_tagged_data,Test_util_reduction_no_tagged_data,Test_util_binary_no_tagged_data,Test_util_overloaded_binary_no_tagged_data, Test_util_slicing_no_tagged_data):
75        self.failUnlessEqual(val[2,1],0.0,"wrong value for (2,1)")     """all tests without tagged data"""
76        self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")     pass
77     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
78     def test_kronecker_domain(self):  class Test_util(Test_util_unary,Test_util_reduction,Test_util_binary,Test_util_overloaded_binary):
79        val=kronecker(d=self.functionspace)     """all tests"""
80        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     pass
81        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")  
82     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  class Test_util_binary_still_failing(Test_util_base):
83     def test_identityTensor_1(self):     """
84        val=identityTensor(d=1)     these binary opereations still fail! (see Mantis 0000053)
85        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     """
86        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
87     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_power_float_rank0_constData_rank0(self):
88     def test_identityTensor_2(self):        arg0=4.35251522982
89        val=identityTensor(d=2)        arg1=Data(2.94566651719,self.functionspace)
90        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        res=power(arg0,arg1)
91        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")        ref=Data(76.1230031099,self.functionspace)
92        self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
93        self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
94        self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
95     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96     def test_identityTensor_3(self):     def test_power_float_rank0_expandedData_rank0(self):
97        val=identityTensor(d=3)        arg0=3.41819405792
98        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
99        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")        arg1=msk_arg1*(3.18794922769)+(1.-msk_arg1)*(0.35955973515)
100        self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")        res=power(arg0,arg1)
101        self.failUnlessEqual(val[0,2],0.0,"wrong value for (0,2)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
102        self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")        ref=msk_ref*(50.3172415941)+(1.-msk_ref)*(1.55572132713)
103        self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
104        self.failUnlessEqual(val[1,2],0.0,"wrong value for (1,2)")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
105        self.failUnlessEqual(val[2,0],0.0,"wrong value for (2,0)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
106        self.failUnlessEqual(val[2,1],0.0,"wrong value for (2,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
107        self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")     def test_power_float_rank0_taggedData_rank0(self):
108     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=3.76704928748
109     def test_identityTensor_domain(self):        arg1=Data(1.30536801555,self.functionspace)
110        val=identityTensor(d=self.functionspace)        arg1.setTaggedValue(1,3.46723750757)
111        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        res=power(arg0,arg1)
112        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")        ref=Data(5.64798685367,self.functionspace)
113     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref.setTaggedValue(1,99.3420963479)
114     def test_identityTensor4_1(self):        self.failUnless(isinstance(res,Data),"wrong type of result.")
115        val=identityTensor4(d=1)        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
116        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
117        self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")  
118     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  class Test_util_overloaded_binary_still_failing(Test_util_base):
119     def test_identityTensor4_2(self):     """
120        val=identityTensor4(d=2)     these overloaded operations still fail!
121        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
122        self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")          - as float**Data is not implemented  (Manits 0000053)
123        self.failUnlessEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")          - wrong return value of Data binaries (Mantis 0000054)
124        self.failUnlessEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")     """
125        self.failUnlessEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
126        self.failUnlessEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")     def test_add_overloaded_float_rank0_constData_rank0(self):
127        self.failUnlessEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")        arg0=4.48433439008
128        self.failUnlessEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")        arg1=Data(-1.25231625216,self.functionspace)
129        self.failUnlessEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")        res=arg0+arg1
130        self.failUnlessEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")        ref=Data(3.23201813791,self.functionspace)
131        self.failUnlessEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
132        self.failUnlessEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
133        self.failUnlessEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
134        self.failUnlessEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
135        self.failUnlessEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")     def test_add_overloaded_float_rank0_constData_rank1(self):
136        self.failUnlessEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")        arg0=4.85806264721
137        self.failUnlessEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")        arg1=Data(numarray.array([3.4764753469957483, -4.7297221681385793]),self.functionspace)
138     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
139     def test_identityTensor4_3(self):        ref=Data(numarray.array([8.3345379942063662, 0.1283404790720386]),self.functionspace)
140        val=identityTensor4(d=3)        self.failUnless(isinstance(res,Data),"wrong type of result.")
141        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
142        self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
143        self.failUnlessEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
144        self.failUnlessEqual(val[0,0,0,2],0.0,"wrong value for (0,0,0,2)")     def test_add_overloaded_float_rank0_constData_rank2(self):
145        self.failUnlessEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")        arg0=-0.960748612766
146        self.failUnlessEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")        arg1=Data(numarray.array([[0.61422796012866687, 1.5847396672359153, -0.02029629132715538, 1.1599743577238719, -0.30494414561669991], [-1.6332700213242113, -4.1634540348788427, -3.1593884738543752, 3.138999837647523, 4.139765676872841], [-3.0736191251063238, -0.47515643032457078, -3.2556867253522856, 3.6985726867609188, -3.5706723780370697], [4.1364498963669423, -2.544180573547139, -1.0163117145359282, -1.3794398980792755, 0.58834072547391614]]),self.functionspace)
147        self.failUnlessEqual(val[0,0,1,2],0.0,"wrong value for (0,0,1,2)")        res=arg0+arg1
148        self.failUnlessEqual(val[0,0,2,0],0.0,"wrong value for (0,0,2,0)")        ref=Data(numarray.array([[-0.34652065263774023, 0.6239910544695082, -0.98104490409356249, 0.19922574495746481, -1.265692758383107], [-2.5940186340906184, -5.1242026476452498, -4.1201370866207823, 2.1782512248811159, 3.1790170641064339], [-4.0343677378727314, -1.4359050430909779, -4.2164353381186928, 2.7378240739945117, -4.5314209908034773], [3.1757012836005352, -3.5049291863135461, -1.9770603273023353, -2.3401885108456826, -0.37240788729249097]]),self.functionspace)
149        self.failUnlessEqual(val[0,0,2,1],0.0,"wrong value for (0,0,2,1)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
150        self.failUnlessEqual(val[0,0,2,2],0.0,"wrong value for (0,0,2,2)")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
151        self.failUnlessEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
152        self.failUnlessEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
153        self.failUnlessEqual(val[0,1,0,2],0.0,"wrong value for (0,1,0,2)")     def test_add_overloaded_float_rank0_constData_rank3(self):
154        self.failUnlessEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")        arg0=-3.17470622105
155        self.failUnlessEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")        arg1=Data(numarray.array([[[0.65666944854588216, -4.1171453089427104], [1.9474307214553077, 0.98996240702017069]], [[0.8351759676296, 0.84765720508473841], [-0.73306138067678361, -1.6966350647734476]], [[0.77055741316163573, -1.0104702506086003], [2.6508038143233561, 1.3075966449956189]], [[-2.4184982027935131, -4.0371906810452138], [1.2411499700180153, 1.4592005525281948]], [[1.3478873047166404, 0.21073088816010088], [3.2702195130177483, -3.1362166121457422]], [[-3.2521819658894549, -1.225716368558424], [-2.4157142528193623, -4.2847313298257017]]]),self.functionspace)
156        self.failUnlessEqual(val[0,1,1,2],0.0,"wrong value for (0,1,1,2)")        res=arg0+arg1
157        self.failUnlessEqual(val[0,1,2,0],0.0,"wrong value for (0,1,2,0)")        ref=Data(numarray.array([[[-2.5180367725044688, -7.2918515299930613], [-1.2272754995950432, -2.1847438140301803]], [[-2.3395302534207509, -2.3270490159656125], [-3.9077676017271346, -4.8713412858237986]], [[-2.4041488078887152, -4.1851764716589512], [-0.52390240672699484, -1.867109576054732]], [[-5.5932044238438641, -7.2118969020955648], [-1.9335562510323356, -1.7155056685221561]], [[-1.8268189163337105, -2.9639753328902501], [0.095513291967397329, -6.3109228331960932]], [[-6.4268881869398058, -4.400422589608775], [-5.5904204738697132, -7.4594375508760526]]]),self.functionspace)
158        self.failUnlessEqual(val[0,1,2,1],0.0,"wrong value for (0,1,2,1)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
159        self.failUnlessEqual(val[0,1,2,2],0.0,"wrong value for (0,1,2,2)")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
160        self.failUnlessEqual(val[0,2,0,0],0.0,"wrong value for (0,2,0,0)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
161        self.failUnlessEqual(val[0,2,0,1],0.0,"wrong value for (0,2,0,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
162        self.failUnlessEqual(val[0,2,0,2],1.0,"wrong value for (0,2,0,2)")     def test_add_overloaded_float_rank0_constData_rank4(self):
163        self.failUnlessEqual(val[0,2,1,0],0.0,"wrong value for (0,2,1,0)")        arg0=-1.24556902458
164        self.failUnlessEqual(val[0,2,1,1],0.0,"wrong value for (0,2,1,1)")        arg1=Data(numarray.array([[[[0.95144503839694927, 3.8747049772318984, 1.6637456016483814, 0.45629857743059787], [0.76792326033735137, 1.9249883810246082, -2.4437444255155372, 0.38011748852073701], [0.65207760300037076, -0.091909570334745894, -2.0902439423360364, 3.4217991791591587]], [[-2.8680510086311726, 4.9365226673466527, -0.89916792700143233, -4.5469112333531827], [-2.897100382404354, -4.132929551372893, -2.7160972180694412, -0.78846072447344451], [1.8280431279004761, -4.9506723340122285, 1.7565050257148807, 1.8885877844760133]]], [[[4.1775975687948534, -1.0659928286440188, -0.90921430152893645, -2.6369242728496767], [4.3543064450317637, -4.9884877795643483, 0.36411425710799339, -3.4648550299306047], [-2.6049605881010973, 1.4161117095327729, 1.8837504532810883, -4.407757287520063]], [[-2.3132870552683427, 4.2496663906996091, 4.9705995976045561, -0.05277006541191831], [-2.979704960306079, 1.373065595947792, -0.57292261081363094, 2.7719543224879137], [4.4692942689897883, -3.0137040993676734, 0.31446957898421601, -1.9473328719399072]]], [[[-4.8463597361851507, 4.4412299279977319, -4.3284149545626596, 1.8753470484358568], [2.6146814732931638, 1.3047608154660075, 3.8494725026732848, 4.9493006531083168], [2.5319156998838537, 0.12049544852721805, -1.8063580652030842, -2.2951712912760582]], [[4.1405675018147594, -0.64722844279997549, -2.8990375200828633, -0.36389730738412585], [-4.2130069316255963, -0.84404839000688536, 3.0476235653881254, 1.3810642470080126], [2.3820109788743915, -2.0352074520887209, -2.944895101856464, -4.8326554343975845]]]]),self.functionspace)
165        self.failUnlessEqual(val[0,2,1,2],0.0,"wrong value for (0,2,1,2)")        res=arg0+arg1
166        self.failUnlessEqual(val[0,2,2,0],0.0,"wrong value for (0,2,2,0)")        ref=Data(numarray.array([[[[-0.29412398618140223, 2.6291359526535469, 0.41817657707002986, -0.78927044714775363], [-0.47764576424100014, 0.67941935644625673, -3.6893134500938887, -0.86545153605761449], [-0.59349142157798074, -1.3374785949130974, -3.3358129669143879, 2.1762301545808072]], [[-4.1136200332095241, 3.6909536427683012, -2.1447369515797838, -5.7924802579315342], [-4.142669406982705, -5.3784985759512445, -3.9616662426477927, -2.034029749051796], [0.58247410332212457, -6.19624135859058, 0.51093600113652915, 0.64301875989766177]]], [[[2.9320285442165019, -2.3115618532223703, -2.154783326107288, -3.8824932974280282], [3.1087374204534122, -6.2340568041426998, -0.88145476747035811, -4.7104240545089562], [-3.8505296126794488, 0.17054268495442138, 0.63818142870273675, -5.6533263120984145]], [[-3.5588560798466942, 3.0040973661212576, 3.7250305730262046, -1.2983390899902698], [-4.2252739848844305, 0.12749657136944048, -1.8184916353919824, 1.5263852979095622], [3.2237252444114368, -4.2592731239460253, -0.93109944559413549, -3.1929018965182587]]], [[[-6.0919287607635022, 3.1956609034193804, -5.5739839791410111, 0.62977802385750525], [1.3691124487148123, 0.059191790887656026, 2.6039034780949333, 3.7037316285299653], [1.2863466753055022, -1.1250735760511335, -3.0519270897814357, -3.5407403158544097]], [[2.8949984772364079, -1.892797467378327, -4.1446065446612153, -1.6094663319624773], [-5.4585759562039478, -2.0896174145852369, 1.8020545408097739, 0.13549522242966106], [1.13644195429604, -3.2807764766670724, -4.190464126434815, -6.078224458975936]]]]),self.functionspace)
167        self.failUnlessEqual(val[0,2,2,1],0.0,"wrong value for (0,2,2,1)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
168        self.failUnlessEqual(val[0,2,2,2],0.0,"wrong value for (0,2,2,2)")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
169        self.failUnlessEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
170        self.failUnlessEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
171        self.failUnlessEqual(val[1,0,0,2],0.0,"wrong value for (1,0,0,2)")     def test_add_overloaded_float_rank0_expandedData_rank0(self):
172        self.failUnlessEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")        arg0=2.28756974271
173        self.failUnlessEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
174        self.failUnlessEqual(val[1,0,1,2],0.0,"wrong value for (1,0,1,2)")        arg1=msk_arg1*(-3.25821080509)+(1.-msk_arg1)*(-1.96555890794)
175        self.failUnlessEqual(val[1,0,2,0],0.0,"wrong value for (1,0,2,0)")        res=arg0+arg1
176        self.failUnlessEqual(val[1,0,2,1],0.0,"wrong value for (1,0,2,1)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
177        self.failUnlessEqual(val[1,0,2,2],0.0,"wrong value for (1,0,2,2)")        ref=msk_ref*(-0.970641062386)+(1.-msk_ref)*(0.322010834763)
178        self.failUnlessEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
179        self.failUnlessEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
180        self.failUnlessEqual(val[1,1,0,2],0.0,"wrong value for (1,1,0,2)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
181        self.failUnlessEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
182        self.failUnlessEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")     def test_add_overloaded_float_rank0_expandedData_rank1(self):
183        self.failUnlessEqual(val[1,1,1,2],0.0,"wrong value for (1,1,1,2)")        arg0=-1.48109757274
184        self.failUnlessEqual(val[1,1,2,0],0.0,"wrong value for (1,1,2,0)")        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
185        self.failUnlessEqual(val[1,1,2,1],0.0,"wrong value for (1,1,2,1)")        arg1=msk_arg1*numarray.array([-0.11930313378942881, -0.62281906788654862])+(1.-msk_arg1)*numarray.array([0.1478840234613461, -3.1708375150120496])
186        self.failUnlessEqual(val[1,1,2,2],0.0,"wrong value for (1,1,2,2)")        res=arg0+arg1
187        self.failUnlessEqual(val[1,2,0,0],0.0,"wrong value for (1,2,0,0)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
188        self.failUnlessEqual(val[1,2,0,1],0.0,"wrong value for (1,2,0,1)")        ref=msk_ref*numarray.array([-1.6004007065266519, -2.1039166406237717])+(1.-msk_ref)*numarray.array([-1.333213549275877, -4.6519350877492727])
189        self.failUnlessEqual(val[1,2,0,2],0.0,"wrong value for (1,2,0,2)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
190        self.failUnlessEqual(val[1,2,1,0],0.0,"wrong value for (1,2,1,0)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
191        self.failUnlessEqual(val[1,2,1,1],0.0,"wrong value for (1,2,1,1)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
192        self.failUnlessEqual(val[1,2,1,2],1.0,"wrong value for (1,2,1,2)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
193        self.failUnlessEqual(val[1,2,2,0],0.0,"wrong value for (1,2,2,0)")     def test_add_overloaded_float_rank0_expandedData_rank2(self):
194        self.failUnlessEqual(val[1,2,2,1],0.0,"wrong value for (1,2,2,1)")        arg0=-0.169932463749
195        self.failUnlessEqual(val[1,2,2,2],0.0,"wrong value for (1,2,2,2)")        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
196        self.failUnlessEqual(val[2,0,0,0],0.0,"wrong value for (2,0,0,0)")        arg1=msk_arg1*numarray.array([[-4.2612545702701947, -1.4553735194531603, -0.58970170069199934, 2.7142248448804684, 0.49630072117932134], [-4.4881867211938173, 4.7705859316762904, 0.71514670382955803, 0.49136004396150845, -1.8325172939297341], [-0.90143719345550544, -3.3235824514646928, 0.73933527403416832, 1.3622462235470776, -4.2416111224814399], [-0.72400532463398015, -2.2001224685497434, 0.016979746508940963, -2.0434113303003629, 0.15588719034756338]])+(1.-msk_arg1)*numarray.array([[2.7213765937575989, -2.2795969932854887, -0.52139742824568991, 2.8522134294177048, 0.8457424404837921], [1.9417193032851561, -1.2624908054580599, 3.3961247882993515, 3.0526027481796163, -3.2773680756777548], [0.89186961224714789, -1.9930074425254896, -3.0982993453261845, 1.5175592177325035, 4.0767012391093225], [3.0717058826665884, 0.60287437134118527, 0.69734800421018406, -3.3849064077596527, 1.9193476027911105]])
197        self.failUnlessEqual(val[2,0,0,1],0.0,"wrong value for (2,0,0,1)")        res=arg0+arg1
198        self.failUnlessEqual(val[2,0,0,2],0.0,"wrong value for (2,0,0,2)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
199        self.failUnlessEqual(val[2,0,1,0],0.0,"wrong value for (2,0,1,0)")        ref=msk_ref*numarray.array([[-4.4311870340193167, -1.6253059832022823, -0.75963416444112131, 2.5442923811313465, 0.32636825743019937], [-4.6581191849429393, 4.6006534679271684, 0.54521424008043606, 0.32142758021238649, -2.002449757678856], [-1.0713696572046274, -3.4935149152138147, 0.56940281028504636, 1.1923137597979556, -4.4115435862305619], [-0.89393778838310212, -2.3700549322988653, -0.152952717240181, -2.2133437940494849, -0.014045273401558589]])+(1.-msk_ref)*numarray.array([[2.5514441300084769, -2.4495294570346107, -0.69132989199481187, 2.6822809656685829, 0.67580997673467014], [1.7717868395360341, -1.4324232692071819, 3.2261923245502295, 2.8826702844304943, -3.4473005394268768], [0.72193714849802593, -2.1629399062746115, -3.2682318090753064, 1.3476267539833815, 3.9067687753602005], [2.9017734189174664, 0.4329419075920633, 0.52741554046106209, -3.5548388715087746, 1.7494151390419885]])
200        self.failUnlessEqual(val[2,0,1,1],0.0,"wrong value for (2,0,1,1)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
201        self.failUnlessEqual(val[2,0,1,2],0.0,"wrong value for (2,0,1,2)")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
202        self.failUnlessEqual(val[2,0,2,0],1.0,"wrong value for (2,0,2,0)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
203        self.failUnlessEqual(val[2,0,2,1],0.0,"wrong value for (2,0,2,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
204        self.failUnlessEqual(val[2,0,2,2],0.0,"wrong value for (2,0,2,2)")     def test_add_overloaded_float_rank0_expandedData_rank3(self):
205        self.failUnlessEqual(val[2,1,0,0],0.0,"wrong value for (2,1,0,0)")        arg0=-4.99910304361
206        self.failUnlessEqual(val[2,1,0,1],0.0,"wrong value for (2,1,0,1)")        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
207        self.failUnlessEqual(val[2,1,0,2],0.0,"wrong value for (2,1,0,2)")        arg1=msk_arg1*numarray.array([[[0.29850093254277077, 3.714075099304516], [-2.0062084292548397, -0.35557992699667018]], [[-1.7426953986146456, 4.8061906014757394], [1.5737034064549089, 1.6496607633994582]], [[-1.6800592932716416, -4.0500748737766106], [4.4429696282040823, -1.6492563959507054]], [[-2.5051430702127195, -3.1501945875217996], [1.4127543784903365, 0.79949247012357461]], [[-4.2713142705563358, 1.0772945429521563], [-2.4393864151027076, -1.3896557048674865]], [[0.53207200317978298, 4.0627978954482842], [1.0050799831054178, 1.4452226284926244]]])+(1.-msk_arg1)*numarray.array([[[2.3431949600418616, 0.8414028269541598], [4.6319839217175183, 0.56797063519890667]], [[-3.2338388926276354, 4.5658188965197937], [4.5411637311129489, 1.2477521190802747]], [[3.9620056685525924, 4.3928088981260256], [-4.5202678253177471, -0.70854236298596263]], [[-4.7481282129627207, 2.5902043569660824], [3.4921233211469893, 2.0298092936252115]], [[-2.6485885919561092, -1.4434844680815795], [1.4293998615045513, -3.4092526835229608]], [[-1.6057571388949521, -1.8750269826220798], [-4.0024929190275502, -3.5596610079280868]]])
208        self.failUnlessEqual(val[2,1,1,0],0.0,"wrong value for (2,1,1,0)")        res=arg0+arg1
209        self.failUnlessEqual(val[2,1,1,1],0.0,"wrong value for (2,1,1,1)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
210        self.failUnlessEqual(val[2,1,1,2],0.0,"wrong value for (2,1,1,2)")        ref=msk_ref*numarray.array([[[-4.7006021110648444, -1.2850279443030992], [-7.0053114728624548, -5.3546829706042853]], [[-6.7417984422222608, -0.19291244213187575], [-3.4253996371527062, -3.3494422802081569]], [[-6.6791623368792568, -9.0491779173842257], [-0.55613341540353289, -6.6483594395583205]], [[-7.5042461138203347, -8.1492976311294143], [-3.5863486651172787, -4.1996105734840405]], [[-9.2704173141639501, -3.9218085006554588], [-7.4384894587103227, -6.3887587484751016]], [[-4.4670310404278322, -0.93630514815933097], [-3.9940230605021974, -3.5538804151149908]]])+(1.-msk_ref)*numarray.array([[[-2.6559080835657536, -4.1577002166534553], [-0.36711912189009688, -4.4311324084087085]], [[-8.2329419362352496, -0.43328414708782148], [-0.45793931249466624, -3.7513509245273404]], [[-1.0370973750550228, -0.60629414548158955], [-9.5193708689253622, -5.7076454065935778]], [[-9.7472312565703358, -2.4088986866415327], [-1.5069797224606258, -2.9692937499824037]], [[-7.6476916355637243, -6.4425875116891946], [-3.5697031821030638, -8.4083557271305764]], [[-6.6048601825025672, -6.8741300262296949], [-9.0015959626351645, -8.558764051535702]]])
211        self.failUnlessEqual(val[2,1,2,0],0.0,"wrong value for (2,1,2,0)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
212        self.failUnlessEqual(val[2,1,2,1],1.0,"wrong value for (2,1,2,1)")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
213        self.failUnlessEqual(val[2,1,2,2],0.0,"wrong value for (2,1,2,2)")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
214        self.failUnlessEqual(val[2,2,0,0],0.0,"wrong value for (2,2,0,0)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
215        self.failUnlessEqual(val[2,2,0,1],0.0,"wrong value for (2,2,0,1)")     def test_add_overloaded_float_rank0_expandedData_rank4(self):
216        self.failUnlessEqual(val[2,2,0,2],0.0,"wrong value for (2,2,0,2)")        arg0=1.21550213728
217        self.failUnlessEqual(val[2,2,1,0],0.0,"wrong value for (2,2,1,0)")        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
218        self.failUnlessEqual(val[2,2,1,1],0.0,"wrong value for (2,2,1,1)")        arg1=msk_arg1*numarray.array([[[[1.0090528070218792, 1.9106307145237276, 1.6811659991192984, 2.8746039011671201], [3.2128900608106026, -1.0029381650779232, 4.2582290110477778, -1.5314746280325542], [4.0200741047501438, 0.85429503200093215, -0.28959048929557341, 1.4685265541069095]], [[1.2666874812904458, 0.90859131882091138, -4.2124353036681423, -1.7969402819454117], [1.0681193393672039, -4.3552123630695094, -4.0032577832731144, 3.2235178675683365], [-2.293608774526823, -0.27617082319340369, -3.0553161480163284, 2.699016796800481]]], [[[-3.1592591010135926, -1.8065617435984271, -0.93322835636729717, -0.89350955190884562], [2.1664533395005003, 3.2021639012191052, 0.15085237132003737, 3.6542023388021132], [-3.189090353824271, -0.78745648331728368, 3.5473512169629995, -0.63428493269093256]], [[-2.386669713513625, -4.7249747367905695, 3.4621305968521305, 0.34721477382276866], [2.3599620375368797, 4.925504023751424, -1.3387970171374377, 1.152119609204016], [0.57074477861866502, 1.8075335514397075, -4.0376335655417996, 0.86708280343111621]]], [[[2.9038868635591397, -0.27534668498916304, -3.9273410552323949, -2.6820553539377601], [2.4365074320647118, 0.34999517479826903, -0.22854769539843645, 4.6781171985127763], [4.3296374276993586, 0.21922883926851178, -4.1350155169284406, -2.3582136069048265]], [[2.7860786548105585, 0.83594561167553039, 3.623188500876843, 4.3388769109633465], [1.5411983648209908, -4.097340022156307, -3.2603388376815912, -3.7625212974408386], [4.3922641365190778, -1.4584604688981551, -1.9458060732729168, 4.7470750011718614]]]])+(1.-msk_arg1)*numarray.array([[[[-2.2971897212575207, -1.9323104367751931, -3.8542469069725396, 4.4485944332819258], [-0.06607231477291009, 3.5762633193874507, 3.0154617420368783, 4.9407171282501405], [2.8328870417941907, 0.23672608745144785, -4.1568219116800043, -4.1857481457198258]], [[-4.8093606380089078, -0.0397779241154117, -2.259901622863195, -2.6136275582736266], [-1.4468880860816835, -2.8849999573458129, -3.4179565382839341, -0.92149747328494236], [-2.9713341854979558, 2.8022998913702484, 2.1636456257249694, 0.86254768081227784]]], [[[2.7331065399732859, -2.2351090040619894, -4.6449973078603453, 0.13463596660747346], [2.6288109676308435, -0.037459392356389287, 1.9238240618360258, -3.6974685040353252], [-3.7273667494078842, 0.99700193553500505, 3.4049543411691605, -2.8277946400159495]], [[-0.22566250469420268, 2.9040508082870895, -2.2086574043072238, -1.4485197834588757], [-2.7506068061432885, 4.319997296598773, 4.9353724835318005, 2.4434995113874622], [-3.2330978793405016, -1.185285494021231, -3.1350829568229797, 4.9424587873350312]]], [[[0.98877632378951397, -4.3541317234880017, -3.7870507206588968, -0.87876410126227356], [2.4458382558057332, -2.9329967445924341, -3.0784459129878936, 4.664501550132039], [-0.58295001827707527, -4.1343617072890195, -0.20833671027188227, 0.33631155313822081]], [[-3.5785184648203838, 0.24035957564971877, -2.460749216305802, -4.8033953332916379], [-3.3222083232340403, 4.0706334960022428, 4.3331160444287882, -0.61020302237093649], [-2.3490864183384028, 0.58130243023294614, 1.5993199992299312, -2.5330132221058621]]]])
219        self.failUnlessEqual(val[2,2,1,2],0.0,"wrong value for (2,2,1,2)")        res=arg0+arg1
220        self.failUnlessEqual(val[2,2,2,0],0.0,"wrong value for (2,2,2,0)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
221        self.failUnlessEqual(val[2,2,2,1],0.0,"wrong value for (2,2,2,1)")        ref=msk_ref*numarray.array([[[[2.224554944300225, 3.1261328518020735, 2.8966681363976443, 4.0901060384454659], [4.4283921980889485, 0.21256397220042267, 5.4737311483261237, -0.3159724907542083], [5.2355762420284897, 2.069797169279278, 0.92591164798277248, 2.6840286913852553]], [[2.4821896185687917, 2.1240934560992573, -2.9969331663897965, -0.58143814466706578], [2.2836214766455498, -3.1397102257911635, -2.7877556459947685, 4.4390200048466824], [-1.0781066372484771, 0.93933131408494219, -1.8398140107379826, 3.9145189340788269]]], [[[-1.9437569637352468, -0.59105960632008125, 0.28227378091104871, 0.32199258536950026], [3.3819554767788462, 4.4176660384974511, 1.3663545085983833, 4.8697044760804591], [-1.9735882165459251, 0.4280456539610622, 4.7628533542413454, 0.58121720458741333]], [[-1.1711675762352791, -3.5094725995122236, 4.6776327341304764, 1.5627169111011145], [3.5754641748152256, 6.1410061610297699, -0.12329487985909182, 2.3676217464823619], [1.7862469158970109, 3.0230356887180534, -2.8221314282634538, 2.0825849407094621]]], [[[4.1193890008374856, 0.94015545228918285, -2.711838917954049, -1.4665532166594142], [3.6520095693430576, 1.5654973120766149, 0.98695444187990944, 5.8936193357911222], [5.5451395649777044, 1.4347309765468577, -2.9195133796500947, -1.1427114696264806]], [[4.0015807920889044, 2.0514477489538763, 4.8386906381551889, 5.5543790482416924], [2.7567005020993367, -2.8818378848779611, -2.0448367004032453, -2.5470191601624927], [5.6077662737974237, -0.24295833161980918, -0.73030393599457089, 5.9625771384502073]]]])+(1.-msk_ref)*numarray.array([[[[-1.0816875839791749, -0.71680829949684721, -2.6387447696941937, 5.6640965705602717], [1.1494298225054358, 4.7917654566657966, 4.2309638793152242, 6.1562192655284864], [4.0483891790725366, 1.4522282247297937, -2.9413197744016584, -2.9702460084414799]], [[-3.5938585007305619, 1.1757242131629342, -1.0443994855848491, -1.3981254209952807], [-0.23138594880333763, -1.6694978200674671, -2.2024544010055882, 0.29400466399340353], [-1.7558320482196099, 4.0178020286485943, 3.3791477630033153, 2.0780498180906237]]], [[[3.9486086772516318, -1.0196068667836435, -3.4294951705819994, 1.3501381038858193], [3.8443131049091894, 1.1780427449219566, 3.1393261991143717, -2.4819663667569793], [-2.5118646121295383, 2.2125040728133509, 4.6204564784475064, -1.6122925027376036]], [[0.9898396325841432, 4.1195529455654354, -0.99315526702887791, -0.23301764618052978], [-1.5351046688649426, 5.5354994338771188, 6.1508746208101464, 3.6590016486658081], [-2.0175957420621558, 0.030216643257114928, -1.9195808195446338, 6.1579609246133771]]], [[[2.2042784610678599, -3.1386295862096558, -2.5715485833805509, 0.33673803601607233], [3.6613403930840791, -1.7174946073140882, -1.8629437757095477, 5.8800036874103849], [0.63255211900127062, -2.9188595700106736, 1.0071654270064636, 1.5518136904165667]], [[-2.3630163275420379, 1.4558617129280647, -1.2452470790274561, -3.587893196013292], [-2.1067061859556944, 5.2861356332805887, 5.5486181817071341, 0.6052991149074094], [-1.1335842810600569, 1.796804567511292, 2.8148221365082771, -1.3175110848275162]]]])
222        self.failUnlessEqual(val[2,2,2,2],1.0,"wrong value for (2,2,2,2)")        self.failUnless(isinstance(res,Data),"wrong type of result.")
223     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
224     def test_identityTensor4_domain(self):        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
225        val=identityTensor4(d=self.functionspace)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
226        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     def test_add_overloaded_float_rank0_Symbol_rank0(self):
227        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")        arg0=-1.02534174881
228     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=())
229     def test_unitVector_1(self):        res=arg0+arg1
230        val=unitVector(i=0,d=1)        s1=numarray.array(-4.33625684225)
231        self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")        sub=res.substitute({arg1:s1})
232     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=numarray.array(-5.36159859106)
233     def test_unitVector_2(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
234        val=unitVector(i=0,d=2)        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
235        self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
236        self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 0 vector")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
237        val=unitVector(i=1,d=2)     def test_add_overloaded_float_rank0_Symbol_rank1(self):
238        self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 1 vector")        arg0=4.00638967702
239        self.failUnlessEqual(val[1],1.0,"wrong value for 1 in the 1 vector")        arg1=Symbol(shape=(2,))
240     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
241     def test_unitVector_3(self):        s1=numarray.array([-3.2788211191636272, 0.40197241921644977])
242        val=unitVector(i=0,d=3)        sub=res.substitute({arg1:s1})
243        self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")        ref=numarray.array([0.72756855785368479, 4.4083620962337617])
244        self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 0 vector")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
245        self.failUnlessEqual(val[2],0.0,"wrong value for 2 in the 0 vector")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
246        val=unitVector(i=1,d=3)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
247        self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 1 vector")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
248        self.failUnlessEqual(val[1],1.0,"wrong value for 1 in the 1 vector")     def test_add_overloaded_float_rank0_Symbol_rank2(self):
249        self.failUnlessEqual(val[2],0.0,"wrong value for 2 in the 1 vector")        arg0=4.37575468534
250        val=unitVector(i=2,d=3)        arg1=Symbol(shape=(4, 5))
251        self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 2 vector")        res=arg0+arg1
252        self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 2 vector")        s1=numarray.array([[-4.6630396568758279, -3.1956340017400708, -2.8069532594662983, 1.7209167084099626, -1.423118573430818], [2.9213094545958302, -3.3219853686124692, -4.4040134430919808, 2.7752933668193407, 4.2049998039803587], [-1.1383874736469437, 0.23485791628185027, -3.5007437909710113, 0.5915098132733192, 3.874076015675719], [0.3702045875364357, 3.0308157187054778, 0.89848093801439877, -3.761713470419914, 0.1526054517776112]])
253        self.failUnlessEqual(val[2],1.0,"wrong value for 2 in the 2 vector")        sub=res.substitute({arg1:s1})
254     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=numarray.array([[-0.28728497153464261, 1.1801206836011144, 1.568801425874887, 6.0966713937511479, 2.9526361119103672], [7.2970641399370155, 1.0537693167287161, -0.02825875775079556, 7.151048052160526, 8.5807544893215439], [3.2373672116942416, 4.6106126016230355, 0.87501089437017399, 4.9672644986145045, 8.2498307010169043], [4.745959272877621, 7.4065704040466631, 5.274235623355584, 0.61404121492127128, 4.5283601371187965]])
255     def test_unitVector_domain(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
256        val=unitVector(i=0,d=self.functionspace)        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
257        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
258        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),),"wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
259  #=========================================================================     def test_add_overloaded_float_rank0_Symbol_rank3(self):
260  #   global reduction operations (these functions have no symbolic version)        arg0=1.18463485087
261  #=========================================================================        arg1=Symbol(shape=(6, 2, 2))
262     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
263     def test_Lsup_float_rank0(self):        s1=numarray.array([[[-4.8037156497413713, -2.0905139798443759], [-4.1734764428560878, -1.5196595332126259]], [[0.5139082550288423, 1.8261032121495049], [-2.8489875583341737, -3.7544885746479384]], [[-3.8307712191969756, 3.8835809221879884], [0.38860156986987526, 4.833612940224576]], [[2.0131711043766574, -1.6211007660194667], [1.834869732218209, 1.452027834491183]], [[-2.0904105484106497, -2.5515706248989876], [1.432725583104915, 0.38179177628590466]], [[-0.1816750387292867, 0.25623546736859737], [-2.5404325223276683, -3.6270715752041993]]])
264        arg=0.479077251703        sub=res.substitute({arg1:s1})
265        ref=0.479077251703        ref=numarray.array([[[-3.6190807988741645, -0.90587912897716905], [-2.9888415919888809, -0.33502468234541904]], [[1.6985431058960492, 3.0107380630167118], [-1.6643527074669668, -2.5698537237807315]], [[-2.6461363683297687, 5.0682157730551953], [1.5732364207370821, 6.0182477910917829]], [[3.1978059552438642, -0.43646591515225985], [3.0195045830854159, 2.6366626853583899]], [[-0.90577569754344278, -1.3669357740317807], [2.6173604339721219, 1.5664266271531115]], [[1.0029598121379202, 1.4408703182358042], [-1.3557976714604614, -2.4424367243369924]]])
266        res=Lsup(arg)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
267        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
268        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
269     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
270     def test_Lsup_array_rank0(self):     def test_add_overloaded_float_rank0_Symbol_rank4(self):
271        arg=0.352800421569        arg0=-4.65129821567
272        ref=0.352800421569        arg1=Symbol(shape=(3, 2, 3, 4))
273        res=Lsup(arg)        res=arg0+arg1
274        self.failUnless(isinstance(res,float),"wrong type of result.")        s1=numarray.array([[[[0.68993670010109565, -4.0163179251569474, -4.1648310461251414, -4.778814664891148], [1.0707877090708386, 2.5326113162472019, -1.5147221392342658, 0.88657360420535625], [-4.3335120564307195, 4.3865636722950754, 4.4304446339569274, 4.7048447967064071]], [[0.32793921406159754, -1.8294601672862152, 4.0882430559927307, 2.1117933944770932], [-0.79488102071059963, 1.8905549855669266, -4.8371445680209373, -3.6127183225555006], [1.5281970384410375, -4.6239921683710383, -2.6453258525672494, 1.1246634985101176]]], [[[0.21398595796777009, 0.31807416662460319, -2.2221092516238503, 0.12560580463083504], [-4.6168031995078094, 1.9986179024253641, -1.7382356570952617, -1.9522476741058439], [-3.0079988792632961, -0.60003495704375265, 4.9879893207661503, 1.7658211080853325]], [[-0.3202973551798145, 1.136127817429081, -4.9309227460362521, -4.5290306196460426], [-0.21707037673963114, 4.6725867751122117, 1.980083908153512, -3.0159873108253166], [-2.2415810532060956, 2.9465927419293161, -1.4080210694824968, -2.7777957375257509]]], [[[-4.5562764421472721, 1.9285026147658986, -3.7918606762119875, -2.6948114406357337], [-1.3639643163845125, 1.9381789471260182, -0.71828943754706209, -4.1320520853554532], [-1.2947446193334491, 1.1673610140762491, 1.8451268841455253, -1.2878294697467965]], [[-1.5686556530611453, 1.1924537989183301, -1.1110231639994019, 1.4621405634564724], [-0.13152846075432212, 1.7791464711106739, 4.57076914605722, 4.722965521992478], [1.8530166481929111, -4.152439969506899, 1.6654844780892599, 2.3242972690569292]]]])
275        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        sub=res.substitute({arg1:s1})
276     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=numarray.array([[[[-3.961361515565466, -8.6676161408235082, -8.8161292617917031, -9.4301128805577097], [-3.580510506595723, -2.1186868994193597, -6.1660203549008274, -3.7647246114612054], [-8.9848102720972811, -0.26473454337148628, -0.22085358170963421, 0.053546581039845442]], [[-4.3233590016049641, -6.4807583829527768, -0.56305515967383091, -2.5395048211894684], [-5.4461792363771613, -2.7607432300996351, -9.4884427836874998, -8.2640165382220623], [-3.1231011772255242, -9.2752903840376, -7.296624068233811, -3.5266347171564441]]], [[[-4.4373122576987916, -4.3332240490419585, -6.873407467290412, -4.5256924110357266], [-9.268101415174371, -2.6526803132411976, -6.3895338727618238, -6.6035458897724055], [-7.6592970949298582, -5.2513331727103143, 0.33669110509958866, -2.8854771075812291]], [[-4.9715955708463762, -3.5151703982374807, -9.5822209617028129, -9.1803288353126042], [-4.8683685924061928, 0.021288559445650002, -2.6712143075130497, -7.6672855264918782], [-6.8928792688726572, -1.7047054737372456, -6.0593192851490585, -7.4290939531923126]]], [[[-9.2075746578138329, -2.7227956009006631, -8.4431588918785501, -7.3461096563022954], [-6.0152625320510742, -2.7131192685405434, -5.3695876532136237, -8.7833503010220149], [-5.9460428350000107, -3.4839372015903125, -2.8061713315210364, -5.9391276854133581]], [[-6.2199538687277069, -3.4588444167482315, -5.7623213796659636, -3.1891576522100893], [-4.7828266764208838, -2.8721517445558877, -0.080529069609341697, 0.071667306325916336], [-2.7982815674736505, -8.8037381851734615, -2.9858137375773017, -2.3270009466096324]]]])
277     def test_Lsup_array_rank1(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
278        arg=numarray.array([0.58364106865247445, 0.19224319360367659])        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
279        ref=0.583641068652        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
280        res=Lsup(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
281        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_pow_overloaded_float_rank0_constData_rank0(self):
282        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0=3.7652582944
283     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Data(3.1005820944,self.functionspace)
284     def test_Lsup_array_rank2(self):        res=arg0**arg1
285        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=Data(60.9956643611,self.functionspace)
286        ref=0.998093740073        self.failUnless(isinstance(res,Data),"wrong type of result.")
287        res=Lsup(arg)        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
288        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
289        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
290     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_pow_overloaded_float_rank0_constData_rank1(self):
291     def test_Lsup_array_rank3(self):        arg0=1.56847796034
292        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]]])        arg1=Data(numarray.array([1.668960941491038, 1.5438441811985528]),self.functionspace)
293        ref=0.978865081668        res=arg0**arg1
294        res=Lsup(arg)        ref=Data(numarray.array([2.1195606529779085, 2.003494811618745]),self.functionspace)
295        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Data),"wrong type of result.")
296        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
297     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
298     def test_Lsup_array_rank4(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
299        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]]]])     def test_pow_overloaded_float_rank0_constData_rank2(self):
300        ref=0.987063544303        arg0=0.853668063781
301        res=Lsup(arg)        arg1=Data(numarray.array([[3.2486997556413488, 0.86400711652329565, 3.2884578380088287, 1.2334289335947253, 2.5487776044652506], [3.7635594458327879, 2.0892653973449962, 3.1786608578416762, 0.14432777693961937, 2.6022783227644193], [0.10738723325449236, 1.9315854964052719, 3.1596089936211107, 0.45131939265454701, 2.5221015795578148], [3.296601365878248, 0.11581499226281025, 3.8612489083924948, 4.5664152349145377, 1.2728985965946598]]),self.functionspace)
302        self.failUnless(isinstance(res,float),"wrong type of result.")        res=arg0**arg1
303        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        ref=Data(numarray.array([[0.59810674931764074, 0.87223445231801477, 0.59435632263408789, 0.82271593116798969, 0.66814547267568969], [0.55131803150166692, 0.71852942411582488, 0.60477125876633264, 0.97742422610323876, 0.66251382293516647], [0.98315347711569301, 0.73668002747870431, 0.60659694046203705, 0.93108516866399793, 0.67097133288368638], [0.59359104068625757, 0.98184343378610262, 0.54286252143570424, 0.48555362457985307, 0.81759440057278132]]),self.functionspace)
304     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Data),"wrong type of result.")
305     def test_Lsup_constData_rank0(self):        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
306        arg=Data(0.196366308048,self.functionspace)        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
307        ref=0.196366308048     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
308        res=Lsup(arg)     def test_pow_overloaded_float_rank0_constData_rank3(self):
309        self.failUnless(isinstance(res,float),"wrong type of result.")        arg0=0.357074915448
310        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg1=Data(numarray.array([[[0.38518924057053733, 0.24038528636715123], [1.6360866883952314, 0.43029605106106911]], [[3.423417953608805, 4.2988721626759077], [1.2524682631274544, 1.1468077998964645]], [[0.58295721049108573, 3.824568580799006], [3.0208703291598176, 1.3499811271261073]], [[3.0953057377971902, 1.3094835373781], [3.6681512369867795, 4.6149094849966819]], [[2.7674281276596542, 1.1256247920546796], [1.8871491353554231, 1.9524702935330096]], [[1.7534659804811799, 0.081583735919993849], [0.44546937195258135, 0.72867650813344209]]]),self.functionspace)
311     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0**arg1
312     def test_Lsup_constData_rank1(self):        ref=Data(numarray.array([[[0.67255485268654747, 0.78071033102668452], [0.18547078622777072, 0.6420282101483078]], [[0.029438000064868096, 0.01195004623087142], [0.27532476037344766, 0.30697352764374525]], [[0.54862782939462229, 0.019475895313555789], [0.044559875252802042, 0.24901961219972699]], [[0.041271801415451524, 0.25962452868686592], [0.022879873935515389, 0.0086302791912317954]], [[0.057848702603705324, 0.31374356524419156], [0.14321555126374733, 0.13389855839543346]], [[0.16435341072630344, 0.91941680244570745], [0.63207408549094379, 0.4721785335572487]]]),self.functionspace)
313        arg=Data(numarray.array([-0.013183241788205846, 0.30081447346639489]),self.functionspace)        self.failUnless(isinstance(res,Data),"wrong type of result.")
314        ref=0.300814473466        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
315        res=Lsup(arg)        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
316        self.failUnless(isinstance(res,float),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
317        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     def test_pow_overloaded_float_rank0_constData_rank4(self):
318     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=2.54914513421
319     def test_Lsup_constData_rank2(self):        arg1=Data(numarray.array([[[[1.270326259520153, 2.703299648777842, 4.8868346033905601, 2.3051326073096781], [3.2104019478564068, 4.817944979076735, 3.3247417263409202, 0.98796021017567104], [2.8880422572281463, 3.785353186109202, 1.1117179336379168, 4.9472947776437248]], [[3.5602918771225234, 3.5282818484304541, 2.8402575218661106, 1.6543365821874987], [0.16084877586377758, 0.89809582383337261, 1.3182980703805016, 3.3178012989111392], [3.2028874945099108, 2.5648139049109338, 4.8955284805714774, 3.5432022149852789]]], [[[1.1618978717086723, 2.7972414378300354, 3.8402714340316493, 1.6001498069270363], [1.087268582711364, 1.737265734430502, 3.6813919135947497, 4.3853914265325047], [1.88609441539519, 0.76524872642235886, 3.6761434732611624, 4.3321470021505437]], [[3.8235160205264509, 1.4456401748290546, 4.9173755965598991, 0.81975566563269575], [3.2061466542685157, 4.1636780468474139, 4.6306556567028174, 2.5296462390778065], [4.845909777306229, 0.57810028049528195, 1.1669649534267978, 4.7820404580882832]]], [[[2.1014714421841116, 2.4894332649036168, 2.3637808594117877, 0.5984928521048446], [3.4559984949550633, 2.686579205418913, 2.2483997830542748, 0.020742963721536667], [4.9435995803226715, 3.1161994022593595, 1.4907525564149176, 2.7151195320092083]], [[4.9609626993990288, 3.2550482319119549, 2.756546888804754, 4.1177301026436313], [3.2969135888482954, 1.1694652654802464, 3.5049458620366489, 2.086655354958836], [1.305388807910512, 4.1439092644148641, 4.1618527860945553, 0.27563591561125417]]]]),self.functionspace)
320        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)        res=arg0**arg1
321        ref=0.96449976222        ref=Data(numarray.array([[[[3.2828699942440989, 12.548917902286258, 96.823997850208443, 8.6455645449807932], [20.169256775933832, 90.779260772485557, 22.446930364732179, 2.5205867988213329], [14.917109221466619, 34.541958014986271, 2.8300631290510951, 102.45984550866767]], [[27.982290424490554, 27.156547644185704, 14.264784430300786, 4.7023331158783899], [1.162433367658529, 2.3172946523503977, 3.433595788127132, 22.301619783037562], [20.027929872633244, 11.023675606380118, 97.614909291888679, 27.538362597921434]]], [[[2.9661217756338676, 13.701992022280693, 36.363479213061616, 4.469842090112488], [2.7660500872410752, 5.0817740136946528, 31.339903588247452, 60.561863519575425], [5.8411520949429976, 2.0464112817180369, 31.186362199170709, 57.618372322207513]], [[35.797782115214986, 3.8681232751319539, 99.631049282802593, 2.1534968710662095], [20.089103989632303, 49.214844611560132, 76.185667975322431, 10.666807966518682], [93.186153150784094, 1.7176584513241597, 2.9802192231638229, 87.779931945141115]]], [[[7.1454003570562259, 10.272878285306508, 9.1332992663966657, 1.7507504263789035], [25.380431205406289, 12.354101945587495, 8.1985574857144279, 1.0196000020407845], [102.10617058325805, 18.467431327194475, 4.0349088932001909, 12.688486277704584]], [[103.77870947420652, 21.029739940364855, 13.190026463287207, 47.143641282881781], [21.869948257238978, 2.9872001672429778, 26.569962421375287, 7.0470181501669806], [3.3923676531460898, 48.312798275660654, 49.130857281409916, 1.2942463156201212]]]]),self.functionspace)
322        res=Lsup(arg)        self.failUnless(isinstance(res,Data),"wrong type of result.")
323        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
324        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
325     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
326     def test_Lsup_constData_rank3(self):     def test_pow_overloaded_float_rank0_expandedData_rank0(self):
327        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)        arg0=0.672041586744
328        ref=0.898737574422        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
329        res=Lsup(arg)        arg1=msk_arg1*(2.50085945333)+(1.-msk_arg1)*(0.714228495159)
330        self.failUnless(isinstance(res,float),"wrong type of result.")        res=arg0**arg1
331        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
332     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=msk_ref*(0.370119550813)+(1.-msk_ref)*(0.752872459895)
333     def test_Lsup_constData_rank4(self):        self.failUnless(isinstance(res,Data),"wrong type of result.")
334        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)        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
335        ref=0.993061367437        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
336        res=Lsup(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
337        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_pow_overloaded_float_rank0_expandedData_rank1(self):
338        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0=3.83643456658
339          msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
340     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=msk_arg1*numarray.array([2.4649528119460604, 4.4015773579432063])+(1.-msk_arg1)*numarray.array([2.5050056042267443, 3.1185274699598557])
341     def test_Lsup_expandedData_rank0(self):        res=arg0**arg1
342        msk=whereNegative(self.functionspace.getX()[0]-0.5)        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
343        arg=msk*0.907507663119+(1.-msk)*0.907507663119        ref=msk_ref*numarray.array([27.501378365433037, 371.70924493690819])+(1.-msk_ref)*numarray.array([29.02300655036413, 66.220868195790914])
344          self.failUnless(isinstance(res,Data),"wrong type of result.")
345        # arg=Data(0.907507663119,self.functionspace,True)        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
346        # arg.setTaggedValue(1,0.907507663119)        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
347        res=Lsup(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
348        ref=0.907507663119     def test_pow_overloaded_float_rank0_expandedData_rank2(self):
349        self.failUnless(isinstance(res,float),"wrong type of result.")        arg0=1.13471850643
350        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
351     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=msk_arg1*numarray.array([[0.58912677090382137, 0.93983668514090013, 2.0122074986633924, 4.4727320622173794, 1.2940493913793865], [0.41905245533976337, 1.7214742795801785, 3.3690628746243316, 4.3264805098978441, 2.2821866717410533], [3.5873589494704259, 4.5154183135527708, 0.67571874016825018, 0.49739384193149055, 2.297552452346038], [2.4711308013943767, 0.035889491188690691, 0.56766133369174721, 2.9251085245873232, 4.0512786424163183]])+(1.-msk_arg1)*numarray.array([[4.3857003148743008, 4.7692907184605806, 2.1049865113290753, 4.7253126157148948, 4.6473956540399657], [4.7007738365129486, 3.4364353832802648, 1.8949658645375465, 4.6712667420053657, 3.7857807635261378], [3.2496714869217667, 1.8954007017372452, 1.414346327611854, 1.8982366357369476, 4.2242475882140065], [2.9895955236808205, 4.0056998573414901, 4.0987731208544638, 2.6341113165055616, 0.83739250662962583]])
352     def test_Lsup_expandedData_rank1(self):        res=arg0**arg1
353          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
354        msk=whereNegative(self.functionspace.getX()[0]-0.5)        ref=msk_ref*numarray.array([[1.0772985404874016, 1.1261231478052052, 1.2895741613114386, 1.7599483980551891, 1.1776817946355922], [1.0543893459992322, 1.24304977052763, 1.5308110476569741, 1.7277164132177647, 1.3343353041969708], [1.5736329944297045, 1.7694687751144236, 1.0891531288355194, 1.0648808615781149, 1.3369290986616456], [1.3665822272329975, 1.0045461819546835, 1.0743798971224092, 1.4472839975883616, 1.6686572548284615]])+(1.-msk_ref)*numarray.array([[1.7406959700520956, 1.8271638189402759, 1.3047845032528298, 1.8170363298534116, 1.7992308696652106], [1.8114098407754482, 1.5439013229774907, 1.2706067196110626, 1.8046672342912449, 1.6135946927617708], [1.5078856800121894, 1.2706765499191768, 1.1957236972774039, 1.2711320654123079, 1.7055367599969291], [1.459127798590762, 1.6590726589695033, 1.6787036103748865, 1.3950233126781093, 1.1116368001118335]])
355        arg=msk*numarray.array([0.64842023599463228, 0.7950449048151853])+(1.-msk)*numarray.array([-0.53356920308809608, -0.30392740367264159])        self.failUnless(isinstance(res,Data),"wrong type of result.")
356          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
357        # arg=Data(numarray.array([0.64842023599463228, 0.7950449048151853]),self.functionspace,True)        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
358        # arg.setTaggedValue(1,[-0.53356920308809608, -0.30392740367264159])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
359        res=Lsup(arg)     def test_pow_overloaded_float_rank0_expandedData_rank3(self):
360        ref=0.795044904815        arg0=4.69671679008
361        self.failUnless(isinstance(res,float),"wrong type of result.")        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
362        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg1=msk_arg1*numarray.array([[[4.1109492881321765, 1.5337005632312695], [4.3407884519530366, 4.6530992322911136]], [[2.5646089934744452, 2.519089903454621], [1.4887838873084611, 0.34112905345492628]], [[3.5362317357059716, 3.8706128693651469], [1.1870955077990113, 4.4747271870138459]], [[1.188825141228715, 0.62354589843593555], [2.2744424942987802, 2.6498967536945086]], [[1.900681769034668, 2.9685327729104474], [4.9963790460373829, 1.7061294551675452]], [[2.5090791675722377, 2.1621870068681837], [3.4768663195477485, 4.2757225442582376]]])+(1.-msk_arg1)*numarray.array([[[0.55947048241267894, 3.892675918272622], [2.0928980801633474, 3.4373418158231508]], [[3.1001717026044253, 0.2732937451339511], [1.3529965739226828, 2.942372355807342]], [[0.19566839701147096, 3.5887158621765871], [2.74664233625374, 0.52321381674739664]], [[4.8284101588082473, 3.8297905260356648], [0.37716052032457881, 1.5885464889650818]], [[1.1563227169890045, 2.9607643976148381], [3.2225447832954872, 1.3146888053450296]], [[3.6572582485321434, 3.2335045378392566], [0.55266266203484782, 1.6820417984729208]]])
363     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0**arg1
364     def test_Lsup_expandedData_rank2(self):        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
365          ref=msk_ref*numarray.array([[[577.71361183417048, 10.723372898515619], [824.36065818127418, 1336.3674293440472]], [[52.831128957427595, 49.239135886293603], [10.00360738339231, 1.6949956135969837]], [[237.4764687630614, 398.34185963465751], [6.2731270382215989, 1014.1368084784533]], [[6.2899333072924852, 2.6235818996943157], [33.725443528800987, 60.281732951333787]], [[18.917655727234941, 98.683288531378238], [2272.6854395211553, 14.001293771330797]], [[48.482529090228326, 28.349477896809432], [216.64029075415539, 745.42910675836185]]])+(1.-msk_ref)*numarray.array([[[2.3760146936426265, 412.1713290347119], [25.468135625976604, 203.7918870061259]], [[120.97006271287876, 1.5261499268949541], [8.1084059812258715, 94.76963162907046]], [[1.3534709167425627, 257.56041919364674], [70.013028937280922, 2.2464259022347384]], [[1752.664443764852, 373.9656614833155], [1.7921498298672001, 11.672841617856733]], [[5.9815136051294902, 97.504545603100766], [146.17983011754166, 7.6418857758763306]], [[286.36867675378357, 148.67917899777751], [2.351124714064428, 13.489200678865306]]])
366        msk=whereNegative(self.functionspace.getX()[0]-0.5)        self.failUnless(isinstance(res,Data),"wrong type of result.")
367        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]])        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
368          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
369        # 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)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
370        # 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]])     def test_pow_overloaded_float_rank0_expandedData_rank4(self):
371        res=Lsup(arg)        arg0=3.30902145167
372        ref=0.930747072265        msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5)
373        self.failUnless(isinstance(res,float),"wrong type of result.")        arg1=msk_arg1*numarray.array([[[[3.1725349657503203, 3.0845748500431833, 1.3251300629206579, 2.6569079873920867], [4.401133367358729, 0.2813959929768825, 1.7519650763785801, 2.6178805778238692], [1.8864041086569574, 3.7791551835731969, 1.3422457102105219, 0.2081604723265463]], [[2.1902428534420713, 3.0841633696278761, 2.9965222635048661, 2.2869374663249884], [2.7280695311253944, 3.9590303115195788, 3.1301491431538744, 4.182436518053791], [1.2260234819740716, 1.8242153795636069, 3.9401624249260436, 3.4349251048319336]]], [[[0.48861823801104354, 2.3131499879646946, 1.2086122619459398, 2.2409237938676974], [3.3117711127665297, 0.87018754086000127, 1.6709579147934865, 1.2893183225200897], [1.3390161693818554, 1.0108007072272069, 3.9414993282493, 1.4462150778696792]], [[3.7967170311866441, 2.0212015799940115, 3.8412381336762307, 2.4057808908249125], [0.26260712889943277, 1.5647590608685933, 2.3707533968847603, 2.6465667159258581], [4.4731993538103074, 3.7651741459195378, 3.1338509227608538, 3.5035590250769135]]], [[[3.3050973895841906, 4.0367399640154655, 2.4941086434787398, 0.39145638395278809], [1.0614822508511919, 4.5756493953902719, 0.475720968447504, 2.1319535282121014], [1.7670440121784567, 4.7448652509649039, 1.8204034323285305, 4.7703236186277493]], [[2.1011053202368353, 2.3665545270862758, 1.6073533542163603, 1.2600308196018239], [0.29247411729720818, 2.3684742025187231, 1.7771399367205181, 4.9668082864579608], [4.595426606005498, 1.6371273654479281, 1.5037601874471596, 3.78912031777574]]]])+(1.-msk_arg1)*numarray.array([[[[4.8327836291046573, 1.1638816644184602, 2.1517890444121353, 3.3263630206047123], [3.7647650305885212, 1.1608624440787043, 0.61940200250059252, 3.3853649131580092], [2.9385268975715064, 0.52662330688397618, 4.4799956940372914, 2.9996151641521429]], [[0.70044410456478112, 4.3945400808511978, 3.1252348972736086, 1.2688805783984476], [0.15599343791305745, 0.53599762707945264, 1.061576396298286, 2.5648049865803384], [0.19676100009146294, 0.32071368159627772, 4.7168617485783004, 0.11755525142074101]]], [[[3.7377217347115015, 2.9327497612552462, 1.8145282053559222, 0.56740904011144078], [1.4416030660600863, 4.1189600680246015, 2.1110973910715658, 3.5384856009199517], [0.95118141400261069, 2.4572939344524936, 0.54929526659505457, 2.9652939525377708]], [[2.0885234488307876, 0.25836797235157094, 2.6699858158100973, 3.3139553157584252], [2.6559413882762239, 1.2879435669486743, 3.3675769889236591, 4.237965236929135], [0.79625310217359302, 3.3583510561037029, 1.2582374986295783, 2.1398901148681815]]], [[[4.7482284899129752, 2.2293361019743232, 1.1930794286761943, 1.0124469031550984], [0.38197241933053727, 4.1981998835993846, 0.79098246624754098, 4.4325191244897875], [4.135761934042792, 2.5772295341335645, 2.2968196972889792, 0.4273068074746656]], [[1.1976128220324929, 1.7459294668094707, 0.96078177214101046, 4.0854494840822007], [3.2731005299433793, 0.82489742017210455, 4.9787451612568212, 1.3471667907126523], [4.343723010658568, 0.57644019147251058, 0.71342917305041831, 2.0211306038878543]]]])
374        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        res=arg0**arg1
375     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
376     def test_Lsup_expandedData_rank3(self):        ref=msk_ref*numarray.array([[[[44.541526569463137, 40.091495998956134, 4.8828067986685939, 24.032224484143175], [193.76135996199952, 1.4003654269209849, 8.1375846434933727, 22.935670648779361], [9.5579208088126997, 92.050334604168881, 4.9838450947922492, 1.2828648641369595]], [[13.748910875268686, 40.071759842941873, 36.082063760330911, 15.435490923052084], [26.168365475343812, 114.15801285560873, 42.338669214857362, 149.14562304631761], [4.3367450539559762, 8.8724583914528239, 111.60939851359214, 60.971817813198015]]], [[[1.7944637697607297, 15.927333847311955, 4.2473229866626534, 14.608551648073879], [52.616997841336541, 2.8329316847606481, 7.3857759810555583, 4.6779782048798051], [4.9646215069645256, 3.3520671162853026, 111.78809510460806, 5.644134732164181]], [[94.005281960103943, 11.230979059402637, 99.149346198163528, 17.794399015213255], [1.3692312903098052, 6.5043609053916684, 17.063949250753016, 23.736660466381913], [211.21260699785594, 90.523102907549571, 42.52663468713218, 66.190881211600896]]], [[[52.198465234023658, 125.28297981521477, 19.77822080158063, 1.597495779133167], [3.5616552748767889, 238.76083054241485, 1.7669814438499811, 12.822578271065522], [8.2857540079134431, 292.35093722860603, 8.8320781648818247, 301.39441025042674]], [[12.357868168826375, 16.978424976621678, 6.844486437856224, 4.5168689568684455], [1.4190531977552476, 17.01747238246455, 8.3864639284588733, 381.28365954211506], [244.47884719156841, 7.0927460162084532, 6.0464928235844093, 93.154587613024191]]]])+(1.-msk_ref)*numarray.array([[[[324.78475431172814, 4.0259540631320077, 13.130578736246635, 53.54383496616213], [90.478796459093957, 4.0114347064939215, 2.0984709533536985, 57.460940797659013], [33.662874823011009, 1.8779581626455863, 212.93737318668644, 36.215855509993467]], [[2.3121739758861097, 192.23862246855467, 42.090421189774155, 4.5649571677125911], [1.2052294205209508, 1.8991433322517872, 3.5620565513756124, 21.524252643769405], [1.2654838573469389, 1.4678266430201032, 282.71645200527132, 1.1510479483688476]]], [[[87.597643951351131, 33.430958374780801, 8.7702010825145305, 1.9718879873813866], [5.6130706904588212, 138.23621312261142, 12.50651858980023, 69.015953092721603], [3.1212502046915214, 18.925816809951922, 1.9296054663911439, 34.758580290537438]], [[12.173200204345505, 1.3623030451242739, 24.411277858111475, 52.754704457848213], [24.004442882739546, 4.6702887676119742, 56.25075494797089, 159.3928238308925], [2.5930590384710972, 55.633148887433734, 4.5071862303782986, 12.944938739392638]]], [[[293.5299119704776, 14.407381017935226, 4.1691054609354943, 3.3586769436892241], [1.5794682740857684, 151.98569970294611, 2.5767557720475129, 201.17700525164358], [141.04371902898262, 21.846663187868508, 15.619108363619203, 1.6675204530848913]], [[4.1917838851875393, 8.0790224539183537, 3.157314804255805, 132.80254310369224], [50.237611053976565, 2.6834829790067647, 386.76911099066751, 5.0132806634938518], [180.89686297334865, 1.9933140453396749, 2.3483825436453394, 11.230025210903007]]]])
377          self.failUnless(isinstance(res,Data),"wrong type of result.")
378        msk=whereNegative(self.functionspace.getX()[0]-0.5)        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
379        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]]])        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
380       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
381        # 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)     def test_add_overloaded_constData_rank0_Symbol_rank0(self):
382        # 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]]])        arg0=Data(0.499161085524,self.functionspace)
383        res=Lsup(arg)        arg1=Symbol(shape=())
384        ref=0.99924882354        res=arg0+arg1
385        self.failUnless(isinstance(res,float),"wrong type of result.")        s1=numarray.array(0.377874196418)
386        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        sub=res.substitute({arg1:s1})
387     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=Data(0.877035281942,self.functionspace)
388     def test_Lsup_expandedData_rank4(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
389          self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
390        msk=whereNegative(self.functionspace.getX()[0]-0.5)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
391        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]]]])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
392       def test_add_overloaded_constData_rank0_Symbol_rank1(self):
393        # 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)        arg0=Data(-4.93686078973,self.functionspace)
394        # 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]]]])        arg1=Symbol(shape=(2,))
395        res=Lsup(arg)        res=arg0+arg1
396        ref=0.998894848618        s1=numarray.array([0.51662736235119944, 2.8171396846123073])
397        self.failUnless(isinstance(res,float),"wrong type of result.")        sub=res.substitute({arg1:s1})
398        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        ref=Data(numarray.array([-4.4202334273802917, -2.1197211051191838]),self.functionspace)
399     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
400     def test_sup_float_rank0(self):        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
401        arg=0.870743835413        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
402        ref=0.870743835413     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
403        res=sup(arg)     def test_add_overloaded_constData_rank0_Symbol_rank2(self):
404        self.failUnless(isinstance(res,float),"wrong type of result.")        arg0=Data(-2.22764991169,self.functionspace)
405        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg1=Symbol(shape=(4, 5))
406     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
407     def test_sup_array_rank0(self):        s1=numarray.array([[2.0746979587719538, 0.99992890307042437, -2.3128078094931848, -4.0103712739722654, 4.8853529531011013], [0.09856857946648212, 0.73520899085847624, -3.6585265509750844, 3.0095320582437939, 3.4125902906059444], [1.4894150898632059, -1.4124339049368793, 1.5397397961722188, 4.8841402613336111, 1.1241155288598881], [2.8283598865494408, 1.5980765295723476, -1.0022373011497274, -2.0622178471715067, 4.9699555072046042]])
408        arg=0.469212543992        sub=res.substitute({arg1:s1})
409        ref=0.469212543992        ref=Data(numarray.array([[-0.15295195292152819, -1.2277210086230577, -4.5404577211866668, -6.2380211856657475, 2.6577030414076193], [-2.1290813322269999, -1.4924409208350058, -5.8861764626685664, 0.78188214655031185, 1.1849403789124624], [-0.73823482183027611, -3.6400838166303613, -0.68791011552126324, 2.6564903496401291, -1.103534382833594], [0.60070997485595878, -0.62957338212113445, -3.2298872128432095, -4.2898677588649887, 2.7423055955111222]]),self.functionspace)
410        res=sup(arg)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
411        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
412        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
413     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
414     def test_sup_array_rank1(self):     def test_add_overloaded_constData_rank0_Symbol_rank3(self):
415        arg=numarray.array([0.8163530200305178, 0.7844191729334391])        arg0=Data(-4.67318656609,self.functionspace)
416        ref=0.816353020031        arg1=Symbol(shape=(6, 2, 2))
417        res=sup(arg)        res=arg0+arg1
418        self.failUnless(isinstance(res,float),"wrong type of result.")        s1=numarray.array([[[3.9409337165894076, 1.6101568824796857], [1.2441782896909706, 1.2872758759353298]], [[4.022494973005406, -2.758155583474049], [1.8311643900357311, 4.0940647266277157]], [[2.5378127449303243, 0.063283784588161751], [4.5495644157820809, 2.8673770080506742]], [[-0.93484143473477577, 4.914438575705228], [-1.951066895455166, -1.2021165219313259]], [[-0.4220608661301819, -4.9682501775464418], [0.98338081352961559, 3.4054674805751066]], [[3.9967556325744127, -4.7659141789100659], [0.34265275409881024, -0.25226631819007572]]])
419        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        sub=res.substitute({arg1:s1})
420     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=Data(numarray.array([[[-0.73225284950136693, -3.0630296836110888], [-3.429008276399804, -3.3859106901554448]], [[-0.6506915930853685, -7.4313421495648235], [-2.8420221760550435, -0.57912183946305884]], [[-2.1353738211604503, -4.6099027815026128], [-0.12362215030869361, -1.8058095580401003]], [[-5.6080280008255503, 0.24125200961445348], [-6.6242534615459405, -5.8753030880221004]], [[-5.0952474322209564, -9.6414367436372164], [-3.6898057525611589, -1.2677190855156679]], [[-0.67643093351636185, -9.4391007450008395], [-4.3305338119919643, -4.9254528842808503]]]),self.functionspace)
421     def test_sup_array_rank2(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
422        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]])        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
423        ref=0.773008977017        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
424        res=sup(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
425        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_add_overloaded_constData_rank0_Symbol_rank4(self):
426        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0=Data(4.16645075056,self.functionspace)
427     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=(3, 2, 3, 4))
428     def test_sup_array_rank3(self):        res=arg0+arg1
429        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]]])        s1=numarray.array([[[[1.5917180025121436, -0.50082927718401749, 0.71261274386013618, 2.4216324938382936], [2.5988764746053095, 0.15985324844397741, -2.1952754277135025, -2.1102730593254035], [4.7816092243808672, -3.1240954141765496, 4.0831220997721331, 2.4301203557965216]], [[3.4691826046114969, -2.4961081730013177, -4.9623977358253111, 2.2652744558918698], [0.41830032681767193, -3.2186897293959649, -4.1590967541108324, -1.7789994379155196], [-0.17901184206486764, -0.85223673399918809, 1.2515459884606104, -4.530305999148645]]], [[[-4.9028671865135838, 3.9106181278983012, 0.69716765577825246, 4.8537569187159395], [-2.8912890367657318, -4.8177854256421764, -4.3303142092509415, -0.99481907472179198], [-1.2640734452454305, 4.8028129765204639, -2.5491771511234962, 3.2550469051981921]], [[2.0572417475748761, 3.7392706991121187, 4.5778678295843704, 3.6658188498258486], [-2.7069743698567206, -2.684769111460461, -3.0941141983763156, -2.1180719361316589], [-1.4744678905986119, 1.926687036555828, 2.2206999030392947, 0.72956973127168734]]], [[[-2.8290294475300151, -3.1467788245496631, 3.6471044178360348, 3.5237454065241209], [-1.6165850845596652, 1.2437746199742081, -2.8022357261752004, -1.9652183524467781], [-2.3842126490032092, 3.7068998814751613, -1.389546865398994, -1.7153758702474589]], [[-1.0746517242894815, -4.3575382718398723, 0.93160793707280121, 1.4002531109392731], [-1.5745690740270168, -3.4394046042905124, 4.2641517580348793, -1.7620679696550843], [-4.2559205627171135, 2.1912319337278863, 1.1987265764805723, -3.2957352772592809]]]])
430        ref=0.911963051515        sub=res.substitute({arg1:s1})
431        res=sup(arg)        ref=Data(numarray.array([[[[5.7581687530761378, 3.6656214733799768, 4.8790634944241305, 6.5880832444022879], [6.7653272251693037, 4.3263039990079717, 1.9711753228504918, 2.0561776912385907], [8.9480599749448615, 1.0423553363874447, 8.2495728503361274, 6.5965711063605159]], [[7.6356333551754911, 1.6703425775626766, -0.7959469852613168, 6.4317252064558641], [4.5847510773816662, 0.94776102116802941, 0.0073539964531619262, 2.3874513126484747], [3.9874389084991266, 3.3142140165648062, 5.4179967390246047, -0.36385524858465068]]], [[[-0.7364164359495895, 8.0770688784622955, 4.8636184063422467, 9.0202076692799338], [1.2751617137982625, -0.6513346750781821, -0.16386345868694718, 3.1716316758422023], [2.9023773053185637, 8.9692637270844582, 1.6172735994404981, 7.4214976557621863]], [[6.2236924981388704, 7.905721449676113, 8.7443185801483647, 7.8322696003898429], [1.4594763807072737, 1.4816816391035332, 1.0723365521876786, 2.0483788144323354], [2.6919828599653823, 6.0931377871198222, 6.3871506536032889, 4.8960204818356816]]], [[[1.3374213030339792, 1.0196719260143312, 7.8135551684000291, 7.6901961570881152], [2.5498656660043291, 5.4102253705382024, 1.3642150243887938, 2.2012323981172162], [1.7822381015607851, 7.8733506320391555, 2.7769038851650003, 2.4510748803165354]], [[3.0917990262745128, -0.19108752127587803, 5.0980586876367955, 5.5667038615032673], [2.5918816765369774, 0.72704614627348185, 8.4306025085988736, 2.40438278090891], [-0.089469812153119221, 6.3576826842918805, 5.3651773270445666, 0.87071547330471333]]]]),self.functionspace)
432        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
433        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
434     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
435     def test_sup_array_rank4(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
436        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]]]])     def test_add_overloaded_constData_rank1_Symbol_rank0(self):
437        ref=0.983949391382        arg0=Data(numarray.array([3.8454947431609945, 3.4801848055393254]),self.functionspace)
438        res=sup(arg)        arg1=Symbol(shape=())
439        self.failUnless(isinstance(res,float),"wrong type of result.")        res=arg0+arg1
440        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        s1=numarray.array(0.181985677208)
441     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        sub=res.substitute({arg1:s1})
442     def test_sup_constData_rank0(self):        ref=Data(numarray.array([4.0274804203691783, 3.6621704827475092]),self.functionspace)
443        arg=Data(0.165371505685,self.functionspace)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
444        ref=0.165371505685        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
445        res=sup(arg)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
446        self.failUnless(isinstance(res,float),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
447        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     def test_add_overloaded_constData_rank1_Symbol_rank1(self):
448     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=Data(numarray.array([2.6719646801005306, 4.0262173014652003]),self.functionspace)
449     def test_sup_constData_rank1(self):        arg1=Symbol(shape=(2,))
450        arg=Data(numarray.array([-0.89603386749185288, -0.68712608295212729]),self.functionspace)        res=arg0+arg1
451        ref=-0.687126082952        s1=numarray.array([3.7355891147806837, -3.0309968912239551])
452        res=sup(arg)        sub=res.substitute({arg1:s1})
453        self.failUnless(isinstance(res,float),"wrong type of result.")        ref=Data(numarray.array([6.4075537948812142, 0.99522041024124519]),self.functionspace)
454        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
455     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
456     def test_sup_constData_rank2(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
457        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)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
458        ref=0.996425639372     def test_add_overloaded_constData_rank2_Symbol_rank0(self):
459        res=sup(arg)        arg0=Data(numarray.array([[2.209887477038702, 2.087043312051243, 3.7254247294014622, -3.7510652436671732, 0.70343608099575317], [4.1654611738215745, 1.5418518980850271, 2.7730022594684423, 3.386030420596251, 1.2758288509710365], [2.2174938185138764, -1.244837837360393, 2.2331288285078887, -1.1442348969501834, 1.9394801392868004], [0.68612447219195705, 0.7127527031233436, -3.6346644102130776, 2.0671128943191714, 3.7445028703597156]]),self.functionspace)
460        self.failUnless(isinstance(res,float),"wrong type of result.")        arg1=Symbol(shape=())
461        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        res=arg0+arg1
462     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        s1=numarray.array(4.82316401579)
463     def test_sup_constData_rank3(self):        sub=res.substitute({arg1:s1})
464        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=Data(numarray.array([[7.0330514928326018, 6.9102073278451428, 8.5485887451953619, 1.0720987721267266, 5.5266000967896529], [8.9886251896154743, 6.3650159138789268, 7.596166275262342, 8.2091944363901508, 6.0989928667649362], [7.0406578343077761, 3.5783261784335068, 7.0562928443017885, 3.6789291188437163, 6.7626441550807002], [5.5092884879858568, 5.5359167189172434, 1.1884996055808221, 6.8902769101130712, 8.5676668861536154]]),self.functionspace)
465        ref=0.986762707603        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
466        res=sup(arg)        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
467        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
468        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
469     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_add_overloaded_constData_rank2_Symbol_rank2(self):
470     def test_sup_constData_rank4(self):        arg0=Data(numarray.array([[-3.62961836797558, 4.0323249470469893, -2.4833229912823516, -0.0081902035785272886, -0.26448613257378906], [2.0867535529248489, 0.049446344294963751, 4.4906317789174501, 2.6121865600043499, 1.3687146632565392], [4.2509170325103511, 2.9845191554148567, -0.9329820582137387, -0.58236994049271118, -3.4448732067194388], [-2.3231599587033402, 1.6550934434842866, -4.5990521452319584, -2.1470268566500152, -3.9698084155531008]]),self.functionspace)
471        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)        arg1=Symbol(shape=(4, 5))
472        ref=0.912098525978        res=arg0+arg1
473        res=sup(arg)        s1=numarray.array([[3.3234017918244003, 3.3386199217996175, -2.5928786077225316, -4.1429140632213803, 0.42204291369978719], [3.4123580113357495, -3.9076190537235664, 1.8779298531672159, 0.98377543853039562, -4.9365820051249267], [4.5252395032935961, -4.8193051910732096, 1.060979071451845, -3.2927325266544871, -3.3828356655691971], [-4.6411804903406182, -0.42921544747540707, -2.4541073523344323, -0.70845691989162329, -1.2357505826155588]])
474        self.failUnless(isinstance(res,float),"wrong type of result.")        sub=res.substitute({arg1:s1})
475        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        ref=Data(numarray.array([[-0.3062165761511797, 7.3709448688466068, -5.0762015990048832, -4.1511042667999076, 0.15755678112599814], [5.4991115642605983, -3.8581727094286027, 6.3685616320846661, 3.5959619985347455, -3.5678673418683875], [8.7761565358039473, -1.834786035658353, 0.12799701323810631, -3.8751024671471983, -6.8277088722886354], [-6.9643404490439584, 1.2258779960088795, -7.0531594975663907, -2.8554837765416385, -5.2055589981686596]]),self.functionspace)
476     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
477     def test_sup_expandedData_rank0(self):        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
478          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
479        msk=whereNegative(self.functionspace.getX()[0]-0.5)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
480        arg=msk*0.842459260157+(1.-msk)*0.985691469761     def test_add_overloaded_constData_rank3_Symbol_rank0(self):
481          arg0=Data(numarray.array([[[-2.0819775543023136, 4.4438294149957258], [1.203494127071604, 1.3934659764012478]], [[-1.7207192546012995, 1.128687542370864], [1.013953229943537, 2.0535582502969056]], [[-1.8482126685735398, 0.64499519705235819], [-4.1200947648310313, 3.8041018736261574]], [[-0.12876390427677542, -0.26859118353213773], [-2.8945993824974847, -3.3476923883525944]], [[3.1332107854705562, -4.6334666373330595], [3.0499420638074994, -2.7959034777693104]], [[4.726734207260332, -1.3724501610660034], [3.3499737674080023, -2.515294322458935]]]),self.functionspace)
482        # arg=Data(0.842459260157,self.functionspace,True)        arg1=Symbol(shape=())
483        # arg.setTaggedValue(1,0.842459260157)        res=arg0+arg1
484        res=sup(arg)        s1=numarray.array(0.860178486532)
485        ref=0.985691469761        sub=res.substitute({arg1:s1})
486        self.failUnless(isinstance(res,float),"wrong type of result.")        ref=Data(numarray.array([[[-1.2217990677700952, 5.3040079015279442], [2.0636726136038224, 2.2536444629334662]], [[-0.86054076806908109, 1.9888660289030824], [1.8741317164757554, 2.913736736829124]], [[-0.98803418204132143, 1.5051736835845766], [-3.2599162782988129, 4.6642803601583758]], [[0.73141458225544298, 0.59158730300008067], [-2.0344208959652663, -2.487513901820376]], [[3.9933892720027746, -3.7732881508008411], [3.9101205503397178, -1.935724991237092]], [[5.5869126937925504, -0.51227167453378497], [4.2101522539402207, -1.6551158359267166]]]),self.functionspace)
487        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
488     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
489     def test_sup_expandedData_rank1(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
490       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
491        msk=whereNegative(self.functionspace.getX()[0]-0.5)     def test_add_overloaded_constData_rank3_Symbol_rank3(self):
492        arg=msk*numarray.array([0.47024430020620023, -0.40410868427962021])+(1.-msk)*numarray.array([0.34568516056640197, -0.43342673126146103])        arg0=Data(numarray.array([[[-1.849788129717993, 0.64693319038907493], [3.0379670344950327, 0.80277076526299229]], [[2.4995340022105639, -4.3955703049125949], [0.58331276679079203, 0.044119077451267863]], [[2.2979922792046947, 1.6054844683234073], [0.50524258350986084, -3.5539312710422779]], [[-1.1980433912188793, -2.6450000406046001], [-2.4128326188310121, 0.80678465051263526]], [[-2.9963692865064209, -1.0152803020104519], [-0.21931259441936035, -1.153119362615751]], [[-4.2927186206837717, 0.4561872009236847], [3.0860876046130041, -0.78568544768378068]]]),self.functionspace)
493          arg1=Symbol(shape=(6, 2, 2))
494        # arg=Data(numarray.array([0.47024430020620023, -0.40410868427962021]),self.functionspace,True)        res=arg0+arg1
495        # arg.setTaggedValue(1,[0.34568516056640197, -0.43342673126146103])        s1=numarray.array([[[-3.4985389035935222, 1.8888458641158987], [-4.2891085749380489, 2.8296217607019845]], [[-0.8200921678141917, 4.4359194831012676], [-4.6185751325042244, 0.16520675598470014]], [[-2.801157092531934, 3.6231020804204928], [1.5439760747845899, 2.0378140868272894]], [[0.99864930993784018, 3.369884315459073], [4.399815205976239, -4.9546136700941936]], [[1.6240932313892289, -3.4517363344048615], [2.8668483027947236, 1.1624090061600336]], [[2.6364367974081624, 2.628371373764919], [-2.5877409052653833, -1.29236451403668]]])
496        res=sup(arg)        sub=res.substitute({arg1:s1})
497        ref=0.470244300206        ref=Data(numarray.array([[[-5.3483270333115147, 2.5357790545049737], [-1.2511415404430162, 3.6323925259649767]], [[1.6794418343963722, 0.040349178188672674], [-4.0352623657134323, 0.209325833435968]], [[-0.50316481332723928, 5.2285865487439001], [2.0492186582944507, -1.5161171842149885]], [[-0.19939408128103908, 0.72488427485447282], [1.9869825871452269, -4.1478290195815584]], [[-1.372276055117192, -4.4670166364153134], [2.6475357083753632, 0.0092896435442826331]], [[-1.6562818232756094, 3.0845585746886037], [0.49834669934762088, -2.0780499617204606]]]),self.functionspace)
498        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
499        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
500     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
501     def test_sup_expandedData_rank2(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
502       def test_add_overloaded_constData_rank4_Symbol_rank0(self):
503        msk=whereNegative(self.functionspace.getX()[0]-0.5)        arg0=Data(numarray.array([[[[-0.026017904532606551, -0.80192450547405958, 0.93785799257835656, -4.4900007911078319], [-1.8444162073720949, 1.2059856695600812, 1.8326324480310756, 3.3745782356451564], [3.0929324433706693, -0.94197156488767142, -2.3469684397851207, -4.8976052662192613]], [[1.2658444546015346, 3.0389250549456399, -2.567254770133963, 3.7513728753285314], [-0.10225306211433605, -0.34121316520335299, -2.8745573331597321, -0.73976781968982142], [4.6114590072566681, 3.5325642767850063, 2.1587079910040661, 3.8644723652636905]]], [[[-2.5953113243103623, 0.6437882672443429, 4.5677362343759853, 3.4108524985046262], [2.9904338528780352, 0.73113299006492127, 2.4253724263400445, 3.8646536702562031], [-1.2545053686514152, -4.2675706218911706, -3.6576679389702105, -0.29502287354943402]], [[0.9550527228483654, 2.9537233833481267, -2.6904009310953283, 1.5998857010519698], [-3.7171702199982004, -1.1578306702024044, 1.764070139728485, -1.1506068782808967], [1.5727320181060982, 0.18468074769418674, 3.3262967055395372, -1.2208265816075849]]], [[[-0.25003967903418278, -2.603663543909648, 4.6824047463125531, 1.0968919539473987], [1.3471700099604398, -3.8321880437450218, -4.2809409903460676, 1.2933005361204906], [-2.857251250328674, 3.6768205829450178, -2.7999953058490643, 2.1117422072666692]], [[-2.1994223710236427, 3.7669030216280923, -3.5232105054852991, -3.7071480752824462], [-0.35952695279389246, 2.5451704526750873, -4.2842310996736144, -1.3813503044378783], [-2.5647173415905145, 4.7437501634141572, -4.2234318870342245, 2.1862042652792866]]]]),self.functionspace)
504        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]])        arg1=Symbol(shape=())
505          res=arg0+arg1
506        # 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)        s1=numarray.array(0.33323555487)
507        # 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]])        sub=res.substitute({arg1:s1})
508        res=sup(arg)        ref=Data(numarray.array([[[[0.30721765033724147, -0.46868895060421156, 1.2710935474482046, -4.1567652362379839], [-1.5111806525022469, 1.5392212244299293, 2.1658680029009236, 3.7078137905150044], [3.4261679982405173, -0.6087360100178234, -2.0137328849152727, -4.5643697113494133]], [[1.5990800094713826, 3.3721606098154879, -2.234019215264115, 4.0846084301983794], [0.23098249275551197, -0.0079776103335049697, -2.541321778289884, -0.4065322648199734], [4.9446945621265161, 3.8657998316548543, 2.4919435458739141, 4.1977079201335386]]], [[[-2.2620757694405143, 0.97702382211419092, 4.9009717892458333, 3.7440880533744743], [3.3236694077478832, 1.0643685449347693, 2.7586079812098925, 4.1978892251260511], [-0.92126981378156714, -3.9343350670213226, -3.3244323841003625, 0.038212681320413999]], [[1.2882882777182134, 3.2869589382179747, -2.3571653762254803, 1.9331212559218178], [-3.3839346651283524, -0.82459511533255636, 2.097305694598333, -0.81737132341104868], [1.9059675729759462, 0.51791630256403476, 3.6595322604093852, -0.88759102673773693]]], [[[0.083195875835665234, -2.2704279890398, 5.0156403011824011, 1.4301275088172467], [1.6804055648302878, -3.4989524888751737, -3.9477054354762195, 1.6265360909903386], [-2.524015695458826, 4.0100561378148658, -2.4667597509792163, 2.4449777621365172]], [[-1.8661868161537947, 4.1001385764979403, -3.1899749506154511, -3.3739125204125981], [-0.026291397924044446, 2.8784060075449354, -3.9509955448037664, -1.0481147495680303], [-2.2314817867206664, 5.0769857182840052, -3.8901963321643764, 2.5194398201491346]]]]),self.functionspace)
509        ref=0.989333342819        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
510        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
511        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
512     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
513     def test_sup_expandedData_rank3(self):     def test_add_overloaded_constData_rank4_Symbol_rank4(self):
514          arg0=Data(numarray.array([[[[1.6204760394819004, -0.95393695229398112, -1.221681223499369, 2.6618713903411937], [-1.5387523541807724, 4.6220978399651482, -2.1795716817360713, -3.776821154104939], [1.4330066566763016, 3.7880327985429378, -0.65902727001966976, -4.29506128665055]], [[-4.0199255222547103, -3.644811287300751, 3.6508998060332054, -3.569704984460552], [-3.8429890733645489, -2.9119635791576437, 2.3183698092323652, 1.3643661323778851], [2.9328022056563725, -0.080129403375118535, 0.15566128013433289, 2.344258136058456]]], [[[3.03272210358924, 2.8841814084596393, -4.059068204445289, -0.091640986980607408], [-4.2591024547151859, -0.36305436045316863, 0.19284537915686428, 4.5041324479849649], [1.2988816365062537, -1.6778808169453416, -3.5496975707176146, 4.314356820196215]], [[-1.4533462849506518, -1.003910808707118, 3.8948057966291092, 1.266066103629278], [-4.4119138102620346, -2.1246183047037603, -2.4610566322999161, -3.5862383252945271], [2.9290698526446066, -0.26093763373887136, 0.87809331627623344, -0.47993365832407076]]], [[[2.1717793325666745, 0.83592896851733212, -2.2538107669063279, 1.6303402530881517], [-0.53207705017646578, -4.5214994998308979, -3.6999121226789988, 3.5355643886671686], [3.3936340080223193, -2.1140030580705247, 1.821327452830638, -1.6123768640462668]], [[2.3105165926895497, -3.0414367260786292, -1.5788704194425076, 1.0377969965556915], [1.3575822980511116, 4.3465002873169833, 0.55678010189701688, 4.99079375906609], [4.2819911907361128, 4.9615031124625322, 2.7964852390480104, 0.029646894001982282]]]]),self.functionspace)
515        msk=whereNegative(self.functionspace.getX()[0]-0.5)        arg1=Symbol(shape=(3, 2, 3, 4))
516        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]]])        res=arg0+arg1
517          s1=numarray.array([[[[3.779495003239937, -4.7840877608643506, 2.651273004571375, -2.179381582597685], [-0.27370078331190673, -3.6151069379138887, -0.6880481455894909, 4.4373993248198644], [-1.6276288613086387, -1.6376839670015721, -3.1138607609774835, -2.7809800576738719]], [[0.85446276622548556, -4.3676040003341114, -4.0083595770538496, -3.915065868011578], [1.6989039436984452, 3.5347026474299419, -1.8748410832866327, -4.6526613314583045], [1.9480513434936046, 4.7386182205273322, -1.2001630607496541, 1.8094726084650006]]], [[[4.9996435011863589, 0.60285036470010045, 1.457536438507919, 2.7443970579013879], [4.131864622110669, 0.20996245110639133, 3.3652305004680549, 3.1437873739212119], [-3.0818670302029405, -2.461603163946088, -0.56609916674720218, -4.1186964404844861]], [[-2.7183232427482262, -2.1509712746053999, -2.281087666097271, -2.4094567126275344], [-3.4723848022755091, -1.563218902128277, -4.7598832341275878, 1.8751725484288029], [-4.0474621098792882, 0.59894943914858167, 1.0736279895120182, 4.5015525072725033]]], [[[-3.0082200796749703, 0.23283074563588535, 2.5230303985659734, 4.8262414779000231], [3.3772486493634837, 1.8234317033464915, -1.7905158376185746, -2.9990918311449244], [-3.6765085717620041, 2.0057610304617572, -2.1487273241068525, -4.1965541804451352]], [[0.26210933249566715, -2.9167787158271663, -0.89589477578380539, -0.41427249402553912], [-3.1708181836677332, 4.3890602408555726, -1.1754542095914857, 4.8422639037274919], [-3.0044937138520034, -4.1626528668210083, 0.20385989364778467, -0.016309737359709864]]]])
518        # 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)        sub=res.substitute({arg1:s1})
519        # 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]]])        ref=Data(numarray.array([[[[5.3999710427218375, -5.7380247131583317, 1.429591781072006, 0.48248980774350869], [-1.8124531374926791, 1.0069909020512595, -2.8676198273255622, 0.66057817071492542], [-0.19462220463233715, 2.1503488315413657, -3.7728880309971533, -7.0760413443244214]], [[-3.1654627560292248, -8.0124152876348624, -0.35745977102064419, -7.4847708524721295], [-2.1440851296661037, 0.62273906827229819, 0.44352872594573256, -3.2882951990804195], [4.8808535491499772, 4.6584888171522136, -1.0445017806153212, 4.1537307445234566]]], [[[8.0323656047755989, 3.4870317731597398, -2.60153176593737, 2.6527560709207805], [-0.12723783260451693, -0.1530919093467773, 3.5580758796249192, 7.6479198219061768], [-1.7829853936966868, -4.1394839808914297, -4.1157967374648168, 0.19566037971172889]], [[-4.171669527698878, -3.154882083312518, 1.6137181305318382, -1.1433906089982564], [-7.8842986125375436, -3.6878372068320373, -7.2209398664275035, -1.7110657768657243], [-1.1183922572346816, 0.33801180540971032, 1.9517213057882516, 4.0216188489484326]]], [[[-0.83644074710829575, 1.0687597141532175, 0.26921963165964558, 6.4565817309881748], [2.8451715991870179, -2.6980677964844064, -5.4904279602975734, 0.53647255752224421], [-0.28287456373968478, -0.10824202760876744, -0.3273998712762145, -5.808931044491402]], [[2.5726259251852168, -5.9582154419057956, -2.474765195226313, 0.62352450253015235], [-1.8132358856166215, 8.7355605281725559, -0.61867410769446884, 9.833057662793582], [1.2774974768841094, 0.79885024564152385, 3.0003451326957951, 0.013337156642272419]]]]),self.functionspace)
520        res=sup(arg)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
521        ref=0.946515361836        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
522        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
523        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
524     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_add_overloaded_taggedData_rank0_Symbol_rank0(self):
525     def test_sup_expandedData_rank4(self):        arg0=Data(3.50668349593,self.functionspace)
526          arg0.setTaggedValue(1,-3.09146650776)
527        msk=whereNegative(self.functionspace.getX()[0]-0.5)        arg1=Symbol(shape=())
528        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]]]])        res=arg0+arg1
529          s1=numarray.array(-4.32369560802)
530        # 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)        sub=res.substitute({arg1:s1})
531        # 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]]]])        ref=Data(-0.81701211209,self.functionspace)
532        res=sup(arg)        ref.setTaggedValue(1,-7.41516211578)
533        ref=0.990730927773        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
534        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
535        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
536     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
537     def test_inf_float_rank0(self):     def test_add_overloaded_taggedData_rank0_Symbol_rank1(self):
538        arg=0.857535693433        arg0=Data(3.83444600418,self.functionspace)
539        ref=0.857535693433        arg0.setTaggedValue(1,-0.266863397142)
540        res=inf(arg)        arg1=Symbol(shape=(2,))
541        self.failUnless(isinstance(res,float),"wrong type of result.")        res=arg0+arg1
542        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        s1=numarray.array([3.6938635924807581, -2.3199399928130826])
543     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        sub=res.substitute({arg1:s1})
544     def test_inf_array_rank0(self):        ref=Data(numarray.array([7.5283095966592981, 1.5145060113654574]),self.functionspace)
545        arg=0.170725403135        ref.setTaggedValue(1,numarray.array([3.4270001953384694, -2.5868033899553713]))
546        ref=0.170725403135        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
547        res=inf(arg)        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
548        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
549        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
550     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_add_overloaded_taggedData_rank0_Symbol_rank2(self):
551     def test_inf_array_rank1(self):        arg0=Data(-2.85642807584,self.functionspace)
552        arg=numarray.array([-0.20582799927627726, 0.0065475369467946631])        arg0.setTaggedValue(1,-0.357260114938)
553        ref=-0.205827999276        arg1=Symbol(shape=(4, 5))
554        res=inf(arg)        res=arg0+arg1
555        self.failUnless(isinstance(res,float),"wrong type of result.")        s1=numarray.array([[4.4124412590911621, 1.732298167196193, 1.8228166076040306, -3.9853565905277355, 3.3793508288079881], [-1.5339512663354116, -2.8915144317379058, -3.6493591659102464, 1.4243106283527815, -0.6931246781623841], [4.7714119110273394, 0.45700055229079606, 1.2539528503924027, -1.4029360809413403, 2.8915917074007416], [4.2546657221847255, 3.2639891865967527, -0.4712967898993945, -3.9077971138749112, -3.5655383189938084]])
556        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        sub=res.substitute({arg1:s1})
557     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=Data(numarray.array([[1.5560131832472779, -1.1241299086476912, -1.0336114682398536, -6.8417846663716197, 0.52292275296410384], [-4.3903793421792958, -5.74794250758179, -6.5057872417541311, -1.4321174474911027, -3.5495527540062684], [1.9149838351834552, -2.3994275235530882, -1.6024752254514816, -4.2593641567852245, 0.035163631556857311], [1.3982376463408412, 0.40756111075286849, -3.3277248657432787, -6.7642251897187951, -6.4219663948376926]]),self.functionspace)
558     def test_inf_array_rank2(self):        ref.setTaggedValue(1,numarray.array([[4.0551811441529519, 1.3750380522579828, 1.4655564926658204, -4.3426167054659457, 3.0220907138697779], [-1.8912113812736218, -3.248774546676116, -4.0066192808484562, 1.0670505134145714, -1.0503847931005943], [4.4141517960891292, 0.099740437352585865, 0.89669273545419248, -1.7601961958795505, 2.5343315924625314], [3.8974056072465153, 2.9067290716585426, -0.82855690483760469, -4.2650572288131219, -3.9227984339320185]]))
559        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]])        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
560        ref=-0.788847536632        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
561        res=inf(arg)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
562        self.failUnless(isinstance(res,float),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
563        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     def test_add_overloaded_taggedData_rank0_Symbol_rank3(self):
564     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=Data(-2.98759917871,self.functionspace)
565     def test_inf_array_rank3(self):        arg0.setTaggedValue(1,-4.26584239637)
566        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]]])        arg1=Symbol(shape=(6, 2, 2))
567        ref=-0.976813524666        res=arg0+arg1
568        res=inf(arg)        s1=numarray.array([[[0.65736935684204045, 1.4685807994312459], [0.99740155640158257, -2.8001282911414127]], [[-0.80947613326718226, -4.0270117786915378], [1.1564198209626229, -4.917538904347448]], [[-1.0488230155998202, 4.0958534641909754], [-4.9502522108275002, -0.19486641488505008]], [[-4.507307254914509, -0.98539101308887389], [-4.5909807035957675, 2.4265853650826985]], [[-4.252924691613126, 0.42394291278212481], [3.4198717705842103, -4.6000003047031024]], [[4.9609535782609235, 3.1625779529060711], [0.26834958946896492, 3.0941570460788874]]])
569        self.failUnless(isinstance(res,float),"wrong type of result.")        sub=res.substitute({arg1:s1})
570        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        ref=Data(numarray.array([[[-2.3302298218695272, -1.5190183792803218], [-1.9901976223099851, -5.7877274698529799]], [[-3.7970753119787499, -7.0146109574031055], [-1.8311793577489448, -7.9051380830590157]], [[-4.0364221943113883, 1.1082542854794077], [-7.9378513895390679, -3.1824655935966177]], [[-7.4949064336260767, -3.9729901918004416], [-7.5785798823073351, -0.56101381362886915]], [[-7.2405238703246937, -2.5636562659294428], [0.43227259187264266, -7.5875994834146701]], [[1.9733543995493559, 0.17497877419450347], [-2.7192495892426027, 0.10655786736731976]]]),self.functionspace)
571     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref.setTaggedValue(1,numarray.array([[[-3.6084730395261495, -2.7972615969369441], [-3.2684408399666074, -7.0659706875096031]], [[-5.0753185296353722, -8.2928541750597269], [-3.1094225754055671, -9.183381300715638]], [[-5.3146654119680097, -0.16998893217721456], [-9.2160946071956893, -4.46070881125324]], [[-8.773149651282699, -5.2512334094570638], [-8.8568230999639574, -1.8392570312854915]], [[-8.5187670879813169, -3.8418994835860651], [-0.84597062578397964, -8.8658427010712924]], [[0.69511118189273358, -1.1032644434621188], [-3.997492806899225, -1.1716853502893025]]]))
572     def test_inf_array_rank4(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
573        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]]]])        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
574        ref=-0.978171335098        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
575        res=inf(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
576        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_add_overloaded_taggedData_rank0_Symbol_rank4(self):
577        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0=Data(-3.36894529378,self.functionspace)
578     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0.setTaggedValue(1,-4.62956527999)
579     def test_inf_constData_rank0(self):        arg1=Symbol(shape=(3, 2, 3, 4))
580        arg=Data(0.0114629834279,self.functionspace)        res=arg0+arg1
581        ref=0.0114629834279        s1=numarray.array([[[[-4.6824549992604805, 0.17860523484039881, -3.9939994980255102, -0.36579022311332743], [-2.0003582573358858, 3.3436256968249793, -1.5671485178714373, 3.9554829351801821], [4.0499415739210693, -3.1796189569360358, 0.28181611699077536, 1.4851321313182684]], [[4.9608073066477267, 2.1353944107091136, 3.2103965744924743, 0.36273874746876089], [0.33193515801312934, -1.8768462949087295, -3.5968753845201462, -1.9342255010038101], [-0.98845968068423407, -2.6505467151645048, -3.9269883741621214, -1.2671783073823359]]], [[[4.0296290320262234, 0.094183089334959114, -1.6548527114390654, 1.1815006848827636], [4.4205350333429578, 1.0602877007979998, -2.7207610093848364, 2.5749353581909009], [2.368743673752042, 0.36879117257479166, 3.1294699111463196, 3.8766421343643209]], [[-4.2994052301352443, -4.4665347726615128, -4.9654257982784813, 1.4010627781386145], [-0.49010647980719568, 1.1149343027340697, 3.8533389980231654, -1.4762647122950145], [-2.4078638813490985, 4.4431147205208923, 3.0392301612263246, -2.3032611338556377]]], [[[1.1388924488325571, 4.4978561941078308, -3.3123851704811691, 1.3453478111463726], [4.1779635175178385, 3.1786527767023234, -2.8109803623964669, 4.7217176158252876], [0.26914741902392958, -1.6630169842885789, -3.6267544687045641, -4.7016327677304943]], [[0.44478691577550755, 2.9451130426961889, -1.0836274217802466, -4.8754431681482586], [1.6457024072282014, -1.106310648992209, -3.2732924796145912, 4.7940609535301668], [-4.2482158844391957, 2.2391243759174451, 4.6408645091714327, 4.1449515947243611]]]])
582        res=inf(arg)        sub=res.substitute({arg1:s1})
583        self.failUnless(isinstance(res,float),"wrong type of result.")        ref=Data(numarray.array([[[[-8.0514002930449351, -3.1903400589440558, -7.3629447918099649, -3.734735516897782], [-5.3693035511203409, -0.025319596959475277, -4.9360938116558923, 0.5865376413957275], [0.68099628013661473, -6.5485642507204904, -3.0871291767936793, -1.8838131624661862]], [[1.5918620128632721, -1.233550883075341, -0.15854871929198033, -3.0062065463156937], [-3.0370101357713253, -5.2457915886931836, -6.9658206783046008, -5.3031707947882651], [-4.3574049744686887, -6.0194920089489594, -7.2959336679465761, -4.6361236011667906]]], [[[0.66068373824176874, -3.2747622044494955, -5.0237980052235205, -2.187444608901691], [1.0515897395585032, -2.3086575929864548, -6.0897063031692911, -0.79400993559355371], [-1.0002016200324126, -3.000154121209663, -0.23947538263813506, 0.5076968405798663]], [[-7.668350523919699, -7.8354800664459674, -8.3343710920629359, -1.9678825156458402], [-3.8590517735916503, -2.2540109910503849, 0.48439370423871075, -4.8452100060794692], [-5.7768091751335531, 1.0741694267364377, -0.32971513255813001, -5.6722064276400923]]], [[[-2.2300528449518975, 1.1289109003233762, -6.6813304642656242, -2.023597482638082], [0.80901822373338383, -0.19029251708213124, -6.1799256561809219, 1.352772322040833], [-3.099797874760525, -5.0319622780730331, -6.9956997624890187, -8.0705780615149489]], [[-2.9241583780089471, -0.42383225108826572, -4.4525727155647008, -8.2443884619327132], [-1.7232428865562532, -4.4752559427766636, -6.6422377733990459, 1.4251156597457122], [-7.6171611782236504, -1.1298209178670096, 1.2719192153869781, 0.77600630093990652]]]]),self.functionspace)
584        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        ref.setTaggedValue(1,numarray.array([[[[-9.3120202792456048, -4.4509600451447255, -8.6235647780106355, -4.9953555030984518], [-6.6299235373210106, -1.285939583160145, -6.1967137978565621, -0.67408234480494222], [-0.579623706064055, -7.8091842369211601, -4.347749162994349, -3.144433148666856]], [[0.33124202666260238, -2.4941708692760107, -1.4191687054926501, -4.2668265325163635], [-4.297630121971995, -6.5064115748938534, -8.2264406645052706, -6.5637907809889349], [-5.6180249606693584, -7.2801119951496291, -8.5565536541472458, -5.8967435873674603]]], [[[-0.59993624795890099, -4.5353821906501652, -6.2844179914241902, -3.4480645951023607], [-0.20903024664216652, -3.5692775791871245, -7.3503262893699608, -2.0546299217942234], [-2.2608216062330824, -4.2607741074103327, -1.5000953688388048, -0.75292314562080342]], [[-8.9289705101203687, -9.0961000526466371, -9.5949910782636056, -3.2285025018465099], [-5.11967175979232, -3.5146309772510547, -0.77622628196195897, -6.1058299922801389], [-7.0374291613342228, -0.18645055946423206, -1.5903351187587997, -6.932826413840762]]], [[[-3.4906728311525672, -0.13170908587729357, -7.9419504504662939, -3.2842174688387518], [-0.45160176246728589, -1.450912503282801, -7.4405456423815917, 0.092152335840163246], [-4.3604178609611948, -6.2925822642737028, -8.2563197486896875, -9.3311980477156187]], [[-4.1847783642096168, -1.6844522372889355, -5.7131927017653705, -9.505008448133383], [-2.983862872756923, -5.7358759289773333, -7.9028577595997156, 0.16449567354504246], [-8.8777811644243201, -2.3904409040676793, 0.011299229186308324, -0.48461368526076321]]]]))
585     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
586     def test_inf_constData_rank1(self):        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
587        arg=Data(numarray.array([-0.13734485813185704, -0.54812466656634307]),self.functionspace)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
588        ref=-0.548124666566     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
589        res=inf(arg)     def test_add_overloaded_taggedData_rank1_Symbol_rank0(self):
590        self.failUnless(isinstance(res,float),"wrong type of result.")        arg0=Data(numarray.array([-4.9434811071655114, 1.7588416724781917]),self.functionspace)
591        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0.setTaggedValue(1,numarray.array([3.0524482361043965, -0.58828792238396233]))
592     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=())
593     def test_inf_constData_rank2(self):        res=arg0+arg1
594        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)        s1=numarray.array(-4.86003727467)
595        ref=-0.930735007638        sub=res.substitute({arg1:s1})
596        res=inf(arg)        ref=Data(numarray.array([-9.8035183818403411, -3.1011956021966389]),self.functionspace)
597        self.failUnless(isinstance(res,float),"wrong type of result.")        ref.setTaggedValue(1,numarray.array([-1.8075890385704341, -5.4483251970587929]))
598        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
599     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
600     def test_inf_constData_rank3(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
601        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)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
602        ref=-0.859092544977     def test_add_overloaded_taggedData_rank1_Symbol_rank1(self):
603        res=inf(arg)        arg0=Data(numarray.array([0.47124983588436109, 3.3842142103059487]),self.functionspace)
604        self.failUnless(isinstance(res,float),"wrong type of result.")        arg0.setTaggedValue(1,numarray.array([4.4506172428158504, -1.5976912605342894]))
605        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg1=Symbol(shape=(2,))
606     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
607     def test_inf_constData_rank4(self):        s1=numarray.array([2.7380372395241483, -1.2414970456241372])
608        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)        sub=res.substitute({arg1:s1})
609        ref=-0.94417114371        ref=Data(numarray.array([3.2092870754085094, 2.1427171646818115]),self.functionspace)
610        res=inf(arg)        ref.setTaggedValue(1,numarray.array([7.1886544823399987, -2.8391883061584267]))
611        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
612        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
613     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
614     def test_inf_expandedData_rank0(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
615       def test_add_overloaded_taggedData_rank2_Symbol_rank0(self):
616        msk=whereNegative(self.functionspace.getX()[0]-0.5)        arg0=Data(numarray.array([[3.7123556177495072, -1.2322724929891438, -4.3196981967098704, 4.5149190397092358, -3.4294461596271342], [-0.32526237821140569, 4.906418518064358, 1.6782843293160443, -4.5452294423093242, -3.4252951962126454], [4.7623389482797158, 4.8957853100883888, 2.4605965522735644, -3.3235939770772349, -3.6622677868193731], [3.7849671492059009, -3.7965523255405484, -0.98706292680421903, -2.9575953641431996, 3.7235194699440495]]),self.functionspace)
617        arg=msk*0.97331285569+(1.-msk)*0.911344578019        arg0.setTaggedValue(1,numarray.array([[3.846235478086534, -2.9152984736534773, 2.1299170235868692, 1.4194093106373815, -1.9728564928751369], [0.12730504885223404, -2.4537968289763077, 1.8352652361138375, -1.1054616749639532, -0.67553225283567997], [-4.6542627767136047, 0.014905560429250286, 0.84138572626791408, -1.4074784720342515, -3.3322631066777983], [-0.64893500421415951, 4.4524265176475826, -3.5204114624144456, 3.5239615703390363, 2.3718443568961201]]))
618          arg1=Symbol(shape=())
619        # arg=Data(0.97331285569,self.functionspace,True)        res=arg0+arg1
620        #arg.setTaggedValue(1,0.97331285569)        s1=numarray.array(3.4845259086)
621        res=inf(arg)        sub=res.substitute({arg1:s1})
622        ref=0.911344578019        ref=Data(numarray.array([[7.1968815263516515, 2.2522534156130005, -0.83517228810772615, 7.9994449483113801, 0.055079748975010112], [3.1592635303907386, 8.3909444266665023, 5.1628102379181886, -1.06070353370718, 0.059230712389498841], [8.2468648568818601, 8.3803112186905331, 5.9451224608757087, 0.16093193152490937, -0.17774187821722887], [7.2694930578080452, -0.31202641693840416, 2.4974629817979253, 0.52693054445894472, 7.2080453785461938]]),self.functionspace)
623        self.failUnless(isinstance(res,float),"wrong type of result.")        ref.setTaggedValue(1,numarray.array([[7.3307613866886783, 0.56922743494866701, 5.6144429321890135, 4.9039352192395258, 1.5116694157270074], [3.6118309574543783, 1.0307290796258366, 5.3197911447159818, 2.3790642336381911, 2.8089936557664643], [-1.1697368681114604, 3.4994314690313946, 4.3259116348700584, 2.0770474365678928, 0.15226280192434594], [2.8355909043879848, 7.9369524262497269, -0.035885553812301296, 7.0084874789411806, 5.8563702654982643]]))
624        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
625     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
626     def test_inf_expandedData_rank1(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
627       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
628        msk=whereNegative(self.functionspace.getX()[0]-0.5)     def test_add_overloaded_taggedData_rank2_Symbol_rank2(self):
629        arg=msk*numarray.array([-0.025782649803792301, 0.15017595667012174])+(1.-msk)*numarray.array([-0.69996944983865683, 0.23286168827412723])        arg0=Data(numarray.array([[2.7675952117994296, 0.98431175880226363, -1.8309000840442566, 2.0351166910383416, 2.1718600084175153], [0.64718493825654111, 3.0274641310077364, 4.6031246235215555, -0.072830522019846633, -3.436466903373192], [-2.7989895712459734, 3.2804563231391093, 3.1416998470123456, 0.25702028842752966, -3.1553411419958821], [-4.5620989116806543, -0.23300222673645532, -2.3978689464069101, 0.41391436589174457, -3.7252639362836382]]),self.functionspace)
630          arg0.setTaggedValue(1,numarray.array([[-2.1509506437818238, -2.5007519800405218, 0.30616207266744233, -0.46790716227581797, 0.6454558125610621], [1.9589653025955753, -4.9059174981425437, -4.7107956989445992, 2.6150016745692826, -3.3329567586885211], [1.1850451086308738, 3.8781029980110997, -4.7104324292639133, -4.8362413881812492, 4.9066980390674555], [-1.2440311634968171, -1.6429522113717008, 4.0547225056117124, -0.33314796054153195, -2.6143781039708855]]))
631        # arg=Data(numarray.array([-0.025782649803792301, 0.15017595667012174]),self.functionspace,True)        arg1=Symbol(shape=(4, 5))
632        # arg.setTaggedValue(1,[-0.69996944983865683, 0.23286168827412723])        res=arg0+arg1
633        res=inf(arg)        s1=numarray.array([[-0.0104190624259477, 3.439083370835446, -1.7585221913131677, 3.8784501968475897, 0.08088556648108991], [0.53276272310770789, -1.3171951284400176, -0.841014288686317, 2.4350359443944622, 0.55796159262639922], [-3.3985580423616479, 0.73804937880111687, 0.84641655693241269, -2.0376479444757822, -0.094456394031885438], [0.8829252865168975, 0.84170422580042903, -1.9539396350167637, -4.8054718599517194, -0.37594711864698205]])
634        ref=-0.699969449839        sub=res.substitute({arg1:s1})
635        self.failUnless(isinstance(res,float),"wrong type of result.")        ref=Data(numarray.array([[2.7571761493734819, 4.4233951296377096, -3.5894222753574243, 5.9135668878859313, 2.2527455748986052], [1.179947661364249, 1.7102690025677187, 3.7621103348352385, 2.3622054223746156, -2.8785053107467928], [-6.1975476136076217, 4.0185057019402262, 3.9881164039447583, -1.7806276560482526, -3.2497975360277676], [-3.6791736251637568, 0.60870199906397371, -4.3518085814236738, -4.3915574940599749, -4.1012110549306202]]),self.functionspace)
636        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        ref.setTaggedValue(1,numarray.array([[-2.1613697062077715, 0.93833139079492422, -1.4523601186457253, 3.4105430345717718, 0.72634137904215201], [2.4917280257032832, -6.2231126265825614, -5.5518099876309162, 5.0500376189637448, -2.7749951660621219], [-2.2135129337307742, 4.6161523768122166, -3.8640158723315006, -6.8738893326570309, 4.8122416450355701], [-0.36110587697991958, -0.80124798557127175, 2.1007828705949487, -5.1386198204932514, -2.9903252226178676]]))
637     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
638     def test_inf_expandedData_rank2(self):        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
639          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
640        msk=whereNegative(self.functionspace.getX()[0]-0.5)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
641        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]])     def test_add_overloaded_taggedData_rank3_Symbol_rank0(self):
642          arg0=Data(numarray.array([[[1.6094791339338048, 4.27222307751477], [4.9486531857239697, -4.5552975586923292]], [[-0.12032729123703056, -4.1413061177629231], [-2.7473350985925316, 4.7319188820310991]], [[0.13107637034429231, -3.2138415379490204], [-3.9942457581718696, 1.3262496008026838]], [[2.56850905863657, 1.8321753808437329], [4.5176482730823331, 4.4664637318837137]], [[0.50860355331966556, 0.55279434819439199], [3.1688695988617859, -2.6740526298455016]], [[4.4977965557520072, 3.6422271944652209], [3.7948343945899445, -3.0377990068633332]]]),self.functionspace)
643        # 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)        arg0.setTaggedValue(1,numarray.array([[[-2.9548694146760557, 3.1101651017467038], [-0.31006440672923752, 0.74616091042484989]], [[-3.1016477433464864, 2.9532816390640111], [-2.0494474684559894, -1.1448583599993354]], [[4.2052724347365604, -1.8157003708847643], [4.8073133555422327, -2.7045312989764492]], [[-2.3803833325202763, 0.19928505008920272], [-2.8622812030202094, 3.9488692362256081]], [[-4.1266217915470236, 4.8461083576413735], [-3.1895474177762351, 4.4625154514412237]], [[-0.65350755924337811, 2.8015786665738105], [0.94103003425367859, 0.27556367440023166]]]))
644        # 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]])        arg1=Symbol(shape=())
645        res=inf(arg)        res=arg0+arg1
646        ref=-0.961574871167        s1=numarray.array(4.49324308458)
647        self.failUnless(isinstance(res,float),"wrong type of result.")        sub=res.substitute({arg1:s1})
648        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        ref=Data(numarray.array([[[6.1027222185118468, 8.765466162092812], [9.4418962703020117, -0.062054474114287217]], [[4.3729157933410114, 0.35193696681511888], [1.7459079859855104, 9.2251619666091411]], [[4.6243194549223343, 1.2794015466290216], [0.49899732640617245, 5.8194926853807258]], [[7.061752143214612, 6.3254184654217749], [9.0108913576603751, 8.9597068164617557]], [[5.0018466378977076, 5.046037432772434], [7.6621126834398279, 1.8191904547325404]], [[8.9910396403300492, 8.1354702790432629], [8.2880774791679865, 1.4554440777147089]]]),self.functionspace)
649     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref.setTaggedValue(1,numarray.array([[[1.5383736699019863, 7.6034081863247458], [4.1831786778488045, 5.2394039950028919]], [[1.3915953412315556, 7.4465247236420531], [2.4437956161220526, 3.3483847245787066]], [[8.6985155193146024, 2.6775427136932777], [9.3005564401202747, 1.7887117856015928]], [[2.1128597520577657, 4.6925281346672447], [1.6309618815578326, 8.4421123208036501]], [[0.36662129303101842, 9.3393514422194155], [1.3036956668018069, 8.9557585360192657]], [[3.8397355253346639, 7.2948217511518525], [5.4342731188317206, 4.7688067589782737]]]))
650     def test_inf_expandedData_rank3(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
651          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
652        msk=whereNegative(self.functionspace.getX()[0]-0.5)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
653        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]]])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
654       def test_add_overloaded_taggedData_rank3_Symbol_rank3(self):
655        # 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)        arg0=Data(numarray.array([[[-2.7345315461324993, 4.5316724428402377], [-1.2207000383039999, -2.1651454481686692]], [[-2.5222456135735638, 3.1325113872519896], [0.54140311786327011, -1.6266115642059011]], [[4.3999274072752783, -0.64510581732829841], [-3.3878893926233533, -0.14783111107246061]], [[2.4816188811184228, 1.505965932327137], [-2.8128544405052458, 3.2460332510852936]], [[1.5649806120186849, 1.1768584297160487], [-3.3133262672401544, -2.5740884272652789]], [[2.936076596237732, -0.80694051724477056], [1.6382059835800931, -0.059174653042079584]]]),self.functionspace)
656        # 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]]])        arg0.setTaggedValue(1,numarray.array([[[4.107948776768561, 4.79459166600315], [-0.070211802843057391, -2.3000592273671394]], [[1.53142006950028, 0.5983353676488381], [4.2000369856633419, -3.7326077043834074]], [[-3.6852528003303684, -0.40061815593309014], [4.849947657932514, 3.2046322763443698]], [[4.6824735127774275, -2.3356975272114679], [-1.4284737023138216, -0.96863966970867921]], [[4.4306883649430571, 0.16250464015770305], [4.7866411719098583, -1.6949698779239197]], [[-4.9624929004021014, -0.4120760567738655], [-3.510925072784119, -0.26388846668772636]]]))
657        res=inf(arg)        arg1=Symbol(shape=(6, 2, 2))
658        ref=-0.866630803474        res=arg0+arg1
659        self.failUnless(isinstance(res,float),"wrong type of result.")        s1=numarray.array([[[3.7560333190798687, 0.63030183757017788], [-3.8821224320935288, 4.3508142113739634]], [[4.3548667192676795, -3.4709315123037445], [-0.19540447292770935, -1.1720138856956916]], [[3.7993994701980398, -4.5475458462287497], [-0.20650310401114513, -2.7802894344079201]], [[-0.46867874332271242, 0.82685022383334505], [-3.5357776147305264, 0.7633420403065605]], [[-0.19578164461526359, -4.1370261640670458], [-1.2073883253186946, 0.74664652191646397]], [[-0.697880661399644, -0.46932885527321488], [2.4087818009804716, -1.8245102799854829]]])
660        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        sub=res.substitute({arg1:s1})
661     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=Data(numarray.array([[[1.0215017729473694, 5.1619742804104156], [-5.1028224703975287, 2.1856687632052942]], [[1.8326211056941157, -0.33842012505175489], [0.34599864493556076, -2.7986254499015928]], [[8.1993268774733181, -5.1926516635570481], [-3.5943924966344984, -2.9281205454803807]], [[2.0129401377957103, 2.3328161561604821], [-6.3486320552357718, 4.0093752913918541]], [[1.3691989674034213, -2.9601677343509971], [-4.520714592558849, -1.8274419053488149]], [[2.238195934838088, -1.2762693725179854], [4.0469877845605646, -1.8836849330275625]]]),self.functionspace)
662     def test_inf_expandedData_rank4(self):        ref.setTaggedValue(1,numarray.array([[[7.8639820958484297, 5.4248935035733279], [-3.9523342349365862, 2.050754984006824]], [[5.8862867887679595, -2.8725961446549064], [4.0046325127356326, -4.904621590079099]], [[0.11414666986767141, -4.9481640021618398], [4.6434445539213689, 0.42434284193644967]], [[4.2137947694547151, -1.5088473033781229], [-4.9642513170443481, -0.20529762940211871]], [[4.2349067203277935, -3.9745215239093428], [3.5792528465911637, -0.94832335600745576]], [[-5.6603735618017454, -0.88140491204708038], [-1.1021432718036475, -2.0883987466732092]]]))
663          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
664        msk=whereNegative(self.functionspace.getX()[0]-0.5)        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
665        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]]]])        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
666       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
667        # 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)     def test_add_overloaded_taggedData_rank4_Symbol_rank0(self):
668        # 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]]]])        arg0=Data(numarray.array([[[[1.2403285479679145, -0.65355746314869823, 0.23507371305026048, 2.9495208917061202], [-4.4153187452600653, -1.0271324152128747, 3.6087985228033794, 1.587633224392107], [1.5882989512534262, -2.3766989521547401, -4.6462509853387939, 1.1425676014861166]], [[-4.8469447836806694, -1.4338245370809863, -4.8441809139347694, 0.082128480181090424], [4.2695412477206585, -2.0376229192188622, -2.685821131586259, -4.5654361329152717], [3.5226403567783482, -4.9633770210253347, 4.1637469549065127, -3.5898874968684167]]], [[[2.7439089503129228, 0.81346375693975492, -2.576882111469688, 4.758878084101946], [0.098363354586225249, -4.314913184354209, -1.1821682575010484, 4.9687115939178916], [-2.5414207769554564, 1.9836872846103208, -1.5982744174212127, 4.5509211096426121]], [[4.759533396882766, -4.550347299113696, 4.9394743649799153, -3.9692445921595421], [1.5755016838325195, 2.6599597206311305, -0.59545966103916648, -1.308464088815966], [1.7018715016873482, 0.31781368103450536, -0.91184792887657995, -0.60566457689943931]]], [[[-0.365764084374395, -0.75878286483821444, -3.1104661623240091, -3.7302303444372109], [0.58052395594970907, 0.14085590954626337, 4.6712439745076182, 0.65991412045590181], [-4.5675491076195733, -3.3042112830144132, -2.6719400309110553, -3.8520603991598765]], [[3.4260488825099618, -1.2789319515430164, 1.8435112511824903, 1.0773214658952854], [-4.0772283149901236, 1.0211433275718873, -2.015430043082814, 0.1376630245430368], [1.3249956905172624, 3.1987247807146968, 1.0304156332749459, 3.785256475561086]]]]),self.functionspace)
669        res=inf(arg)        arg0.setTaggedValue(1,numarray.array([[[[-3.8774766185796605, 3.1521364883779448, -4.9233158714840091, 3.7988193665209522], [4.8244393256113263, 2.4688683468745563, -4.5044275072582254, 1.1107496985072052], [-2.9980383766650376, -4.2922660982517158, 3.4924104659712771, -0.5135964311738892]], [[1.9573144047865201, -2.2686101409008961, -2.907052414660404, -4.0582253229051144], [-2.0281877168409657, 1.7867206317317663, 0.018511114285918673, -4.0475974398672498], [1.3023403490307315, 1.9932255873687215, -4.6698465653310688, -4.5630845029599421]]], [[[-1.9525649263627876, -0.72040110769848908, -3.6987029249472769, -3.3184217891099999], [-4.0519149413902857, 4.1195877398536549, -3.8261874289376463, 3.423780007792768], [0.11768639970294359, -1.4898880703788131, -1.1746648112150213, -0.28493737967147226]], [[-2.0138403307539932, 3.9987186392010816, -1.0125535260055338, 0.57376641241565363], [4.213727608092972, 0.51388058678005066, -4.4106027756910908, -1.9979423050108283], [1.5708368447511347, -1.6270284297780933, -0.55277364435139376, -1.7748804647831715]]], [[[2.7639070541103061, 2.7303808332951629, 0.41148416591473591, -1.9337000414572802], [-2.7585163378482456, 2.2319457297797207, 3.7988668025967804, 3.6103374331669471], [-4.5925114196923271, -2.1274746711435997, 3.3094547630756779, -4.1386856959210352]], [[-2.1348423629137692, 3.539794593057783, 4.8265405725541157, 4.9426398297282788], [4.5757071915543417, -4.0433372993763399, -0.84096548582416997, 2.0567811910343226], [4.5367596882428671, -4.9139510999364404, 1.1342166543217944, 1.4859311895053571]]]]))
670        ref=-0.995075343007        arg1=Symbol(shape=())
671        self.failUnless(isinstance(res,float),"wrong type of result.")        res=arg0+arg1
672        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        s1=numarray.array(4.83582066753)
673  #=========================================================        sub=res.substitute({arg1:s1})
674  #  Symbols        ref=Data(numarray.array([[[[6.0761492154946453, 4.1822632043780326, 5.0708943805769913, 7.785341559232851], [0.4205019222666655, 3.8086882523138561, 8.4446191903301102, 6.4234538919188378], [6.424119618780157, 2.4591217153719906, 0.18956968218793691, 5.9783882690128474]], [[-0.011124116153938601, 3.4019961304457444, -0.008360246408038563, 4.9179491477078212], [9.1053619152473892, 2.7981977483078686, 2.1499995359404718, 0.27038453461145906], [8.358461024305079, -0.12755635349860395, 8.9995676224332435, 1.2459331706583141]]], [[[7.5797296178396536, 5.6492844244664857, 2.2589385560570427, 9.5946987516286768], [4.934184022112956, 0.52090748317252178, 3.6536524100256824, 9.8045322614446224], [2.2943998905712744, 6.8195079521370516, 3.2375462501055181, 9.3867417771693429]], [[9.5953540644094968, 0.28547336841303483, 9.7752950325066461, 0.86657607536718873], [6.4113223513592503, 7.4957803881578613, 4.2403610064875643, 3.5273565787107648], [6.537692169214079, 5.1536343485612361, 3.9239727386501508, 4.2301560906272915]]], [[[4.4700565831523358, 4.0770378026885163, 1.7253545052027217, 1.1055903230895199], [5.4163446234764399, 4.9766765770729942, 9.507064642034349, 5.4957347879826326], [0.26827155990715745, 1.5316093845123175, 2.1638806366156755, 0.98376026836685426]], [[8.2618695500366925, 3.5568887159837144, 6.679331918709221, 5.9131421334220162], [0.75859235253660717, 5.8569639950986181, 2.8203906244439167, 4.9734836920697676], [6.1608163580439932, 8.0345454482414276, 5.8662363008016767, 8.6210771430878168]]]]),self.functionspace)
675  #=========================================================        ref.setTaggedValue(1,numarray.array([[[[0.95834404894707026, 7.9879571559046756, -0.087495203957278278, 8.634640034047683], [9.6602599931380571, 7.304689014401287, 0.3313931602685054, 5.946570366033936], [1.8377822908616932, 0.543554569275015, 8.3282311334980079, 4.3222242363528416]], [[6.7931350723132509, 2.5672105266258347, 1.9287682528663268, 0.77759534462161639], [2.8076329506857651, 6.6225412992584971, 4.8543317818126495, 0.78822322765948094], [6.1381610165574623, 6.8290462548954523, 0.165974102195662, 0.27273616456678873]]], [[[2.8832557411639432, 4.1154195598282417, 1.1371177425794539, 1.5173988784167309], [0.78390572613644505, 8.9554084073803857, 1.0096332385890845, 8.2596006753194988], [4.9535070672296744, 3.3459325971479177, 3.6611558563117095, 4.5508832878552585]], [[2.8219803367727376, 8.8345393067278124, 3.823267141521197, 5.4095870799423844], [9.0495482756197028, 5.3497012543067815, 0.42521789183563996, 2.8378783625159025], [6.4066575122778655, 3.2087922377486375, 4.283047023175337, 3.0609402027435593]]], [[[7.5997277216370369, 7.5662015008218937, 5.2473048334414667, 2.9021206260694505], [2.0773043296784852, 7.0677663973064515, 8.6346874701235112, 8.4461581006936779], [0.24330924783440366, 2.7083459963831311, 8.1452754306024087, 0.6971349716056956]], [[2.7009783046129616, 8.3756152605845138, 9.6623612400808465, 9.7784604972550095], [9.4115278590810725, 0.79248336815039089, 3.9948551817025608, 6.8926018585610533], [9.3725803557695979, -0.078130432409709627, 5.9700373218485252, 6.3217518570320879]]]]))
676     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
677     def test_Symbol_rank0_dNone_nargs0(self):        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
678        s2=Symbol(shape=())        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
679        s=Symbol(shape=(),dim=None,args=[])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
680        self.failUnlessEqual(s.getRank(),0,"wrong rank.")     def test_add_overloaded_taggedData_rank4_Symbol_rank4(self):
681        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        arg0=Data(numarray.array([[[[-3.1509236523814286, 1.680234058442708, -1.7187977550532416, 3.9846453843972913], [-1.6754979614332322, -3.8450074807346901, -1.5740330789137689, -4.4201074343218751], [2.276529915966389, -0.80235747833916982, 4.571247045598767, -3.4093255486695617]], [[-4.0166628667791446, -1.3933240066153738, -1.215071574667598, -3.4706735067142258], [-3.0960303329082572, 4.3009033191704589, 4.4065883064621634, 4.8965445768019009], [-4.4443460968929758, 3.8975314333052253, -4.4153045047286144, 1.7496820405056166]]], [[[1.634274247051799, -2.4623052709302771, 1.4279180811059975, 0.92544783745377668], [-4.4862942162658106, -0.17080151547727951, 0.52532922395695625, -0.11419327223481623], [-1.1603038628614835, -2.5757515035829472, 1.9959550719114718, -1.7953240768392242]], [[4.9309159450812103, 3.2298165897638906, -0.075208625571880461, -1.1899071115534432], [1.6545058865005409, -1.9426363189361773, 1.620629502101667, -4.2257681218133687], [-0.24689686416986767, 2.1247379677905815, -0.022501917990521925, -1.9988138278359822]]], [[[-2.16170138942825, 1.2184335532362125, 1.1509535832826323, 2.2195238124001797], [2.7455643566460015, 4.6453581322389361, -4.1082447076462643, -4.0639146315693067], [-4.96116105494092, -3.6915142795866762, -1.2186796693827917, 4.7933913234222967]], [[2.0022553772723217, -0.96891528014022654, -2.5457411370843142, -3.3574915783043058], [0.10326637441549735, 2.2065594442944327, 3.4159550457557479, -0.71182719653128945], [-1.5473005591196651, -1.8237704422942014, 3.7660184612895105, -2.1565964302540372]]]]),self.functionspace)
682        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        arg0.setTaggedValue(1,numarray.array([[[[-2.7644812297675436, 0.40931971763703956, 3.611075059192606, 0.50972765741910564], [-4.2130726841282584, -1.1190277433669751, -0.71203745760782766, -3.152956525368753], [-1.6186056313723087, 1.1274726343098616, 4.4133392834898437, 1.5220424195160689]], [[0.16147933294385375, 2.4654462130650998, -2.2315133839410328, -4.5248215067907562], [2.2226933853289026, 3.7083490689582508, 1.6042940030913613, 0.26178935291219929], [2.4033332562872989, 2.6116613010273229, -3.5340848426974594, -4.3871506552920767]]], [[[-2.5011422414749243, -2.9785737952530678, -4.0632268435384287, -2.9061747268645899], [-3.4361922491984487, 0.92512310228203631, -3.7591410062368915, -0.10199113857196274], [1.4370716393838645, 0.71874746237537668, -4.5480615526025323, -3.9385610102938093]], [[-3.5039474073115562, 1.4740925776889409, -0.06403798877318323, -3.3828440686373753], [-1.9590119108809123, -0.13446729158123816, -2.4360152863347251, 0.81375486060557112], [2.4638296949211451, 0.84554464160795018, 1.0770605717668191, 0.90311465710515648]]], [[[-3.0365259446312756, -2.1113062138954444, 3.190598106141481, 4.7146234105400531], [4.7073713389281071, 2.0949812753843036, 1.902801485931489, -0.4384294077249864], [-4.4341512258710214, 4.114619941421422, 4.1663347911930675, -0.082374028629738305]], [[-0.58950965471106098, -1.9744112566224792, -0.0098348725084971278, 2.3871548847218813], [-1.1861224380121662, -3.8703032573387253, 0.2332725218101972, 2.7881117501797101], [-4.3313677243610327, 2.5428749523942127, 3.9018944633638419, -0.49408732338659789]]]]))
683        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        arg1=Symbol(shape=(3, 2, 3, 4))
684          res=arg0+arg1
685        ss=s.substitute({s:numarray.zeros(())})        s1=numarray.array([[[[1.8433628252117984, 1.5322432245117268, 0.55363793461945665, 4.6657626927783653], [-0.94710403494804751, 3.9800168829397649, 3.0366988370600794, 2.8875431155604332], [-1.188024345098996, 1.0665386751463011, 4.7835901054797993, 2.5969696632689807]], [[-1.99850752062535, 1.1333681341555639, -0.49718999089842697, 1.1440753369804515], [0.26294280812698378, -3.8684363170040701, 0.061030108864615684, -4.1179127492349608], [-4.67031644465197, 4.9054510497550492, -0.2640662442281041, 1.363134852748785]]], [[[-1.4621905107325697, -2.8811881835070574, -2.0127263016810106, 3.9187151372775499], [4.0559843147336121, 3.8748150284806506, -4.7195991819934049, 1.6441241199343715], [1.1018797372155733, 1.5720711461020827, -2.8718182782954003, -2.4926472889456743]], [[2.1583981297206112, -2.7029142786449709, -4.0306810999276212, -0.041927417439557857], [2.5297094316362001, 3.2023688131127575, -0.87830172094753056, 1.5087811969314782], [0.94040146920827272, 1.8042467131134678, 2.6306472495122346, 0.16819275341523543]]], [[[0.15798239523545377, 2.4104584738150319, 2.3850248364278386, 3.2174938931658534], [4.8575582926065533, 0.30772922316230389, -4.4397211951638047, 0.39063821497748741], [-2.3146321369181688, -3.0703095447217885, 1.7397877979741549, 4.033153568325778]], [[-1.7935270727714037, -3.9682025038313595, -3.4065483616803141, 2.1844510922893523], [-4.2449404804537032, 1.9572337718531996, -4.6593011375931308, 0.98236210083608633], [4.8624542464851288, 0.5657266529616205, 0.50114562982511135, -3.2736237576584317]]]])
686        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        sub=res.substitute({arg1:s1})
687        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        ref=Data(numarray.array([[[[-1.3075608271696302, 3.2124772829544348, -1.165159820433785, 8.6504080771756566], [-2.6226019963812797, 0.13500940220507474, 1.4626657581463105, -1.5325643187614419], [1.088505570867393, 0.26418119680713126, 9.3548371510785664, -0.81235588540058101]], [[-6.0151703874044946, -0.25995587245980989, -1.7122615655660249, -2.3265981697337743], [-2.8330875247812735, 0.43246700216638878, 4.4676184153267791, 0.77863182756694016], [-9.1146625415449449, 8.8029824830602745, -4.6793707489567185, 3.1128168932544016]]], [[[0.17208373631922935, -5.3434934544373345, -0.58480822057501314, 4.8441629747313266], [-0.4303099015321985, 3.7040135130033711, -4.1942699580364486, 1.5299308476995552], [-0.058424125645910152, -1.0036803574808646, -0.87586320638392845, -4.2879713657848981]], [[7.0893140748018215, 0.52690231111891972, -4.1058897254995017, -1.2318345289930011], [4.184215318136741, 1.2597324941765802, 0.74232778115413645, -2.7169869248818905], [0.69350460503840505, 3.9289846809040494, 2.6081453315217127, -1.8306210744207467]]], [[[-2.0037189941927962, 3.6288920270512444, 3.5359784197104709, 5.4370177055660331], [7.6031226492525548, 4.95308735540124, -8.5479659028100698, -3.6732764165918192], [-7.2757931918590888, -6.7618238243084647, 0.52110812859136324, 8.8265448917480747]], [[0.20872830450091806, -4.9371177839715861, -5.9522894987646282, -1.1730404860149535], [-4.1416741060382058, 4.1637932161476323, -1.2433460918373829, 0.27053490430479687], [3.3151536873654637, -1.2580437893325809, 4.2671640911146218, -5.430220187912469]]]]),self.functionspace)
688        try:        ref.setTaggedValue(1,numarray.array([[[[-0.92111840455574523, 1.9415629421487663, 4.1647129938120626, 5.1754903501974709], [-5.1601767190763059, 2.8609891395727898, 2.3246613794522517, -0.26541340980831984], [-2.8066299764713047, 2.1940113094561626, 9.1969293889696431, 4.1190120827850496]], [[-1.8370281876814962, 3.5988143472206637, -2.7287033748394598, -3.3807461698103047], [2.4856361934558864, -0.16008724804581931, 1.665324111955977, -3.8561233963227615], [-2.2669831883646712, 7.5171123507823721, -3.7981510869255635, -3.0240158025432917]]], [[[-3.9633327522074939, -5.8597619787601252, -6.0759531452194393, 1.0125404104129601], [0.61979206553516342, 4.7999381307626869, -8.4787401882302973, 1.5421329813624087], [2.5389513765994378, 2.2908186084774593, -7.4198798308979326, -6.4312082992394837]], [[-1.345549277590945, -1.22882170095603, -4.0947190887008045, -3.4247714860769332], [0.57069752075528779, 3.0679015215315193, -3.3143170072822556, 2.3225360575370493], [3.4042311641294178, 2.649791354721418, 3.7077078212790537, 1.0713074105203919]]], [[[-2.8785435493958218, 0.29915225991958749, 5.5756229425693196, 7.9321173037059065], [9.5649296315346604, 2.4027104985466075, -2.5369197092323157, -0.047791192747498989], [-6.7487833627891902, 1.0443103966996334, 5.9061225891672224, 3.9507795396960397]], [[-2.3830367274824646, -5.9426137604538383, -3.4163832341888112, 4.5716059770112336], [-5.4310629184658694, -1.9130694854855257, -4.4260286157829336, 3.7704738510157965], [0.53108652212409613, 3.1086016053558332, 4.4030400931889533, -3.7677110810450296]]]]))
689          s.substitute({s:numarray.zeros((5,))})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
690          fail("illegal substition was successful")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
691        except TypeError:        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
692          pass     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
693       def test_add_overloaded_expandedData_rank0_Symbol_rank0(self):
694        dsdarg=s.diff(Symbol(shape=()))        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
695        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        arg0=msk_arg0*(-0.481249850026)+(1.-msk_arg0)*(-1.48465416864)
696        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        arg1=Symbol(shape=())
697        dsdarg=s.diff(Symbol(shape=(2,)))        res=arg0+arg1
698        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        s1=numarray.array(-2.65110429185)
699        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        sub=res.substitute({arg1:s1})
700        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
701        dsdarg=s.diff(Symbol(shape=(4, 5)))        ref=msk_ref*(-3.13235414188)+(1.-msk_ref)*(-4.13575846049)
702        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
703        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
704        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
705        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
706        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")     def test_add_overloaded_expandedData_rank0_Symbol_rank1(self):
707        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
708        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        arg0=msk_arg0*(1.13411439983)+(1.-msk_arg0)*(-0.629637549331)
709        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        arg1=Symbol(shape=(2,))
710        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        res=arg0+arg1
711        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        s1=numarray.array([-0.62992419613163175, 4.55886114005793])
712        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        sub=res.substitute({arg1:s1})
713          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
714        dsds=s.diff(s)        ref=msk_ref*numarray.array([0.50419020369403444, 5.6929755398835962])+(1.-msk_ref)*numarray.array([-1.259561745462479, 3.9292235907270827])
715        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
716        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
717          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
718        sa=s.getSubstitutedArguments({s2:-10})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
719        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")     def test_add_overloaded_expandedData_rank0_Symbol_rank2(self):
720          msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
721        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        arg0=msk_arg0*(3.01809294358)+(1.-msk_arg0)*(0.889743657807)
722        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        arg1=Symbol(shape=(4, 5))
723        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")        res=arg0+arg1
724        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        s1=numarray.array([[-2.793178683106079, -2.6222774715493582, 1.0142792223620747, -3.0640922264732984, -2.3554298671206055], [0.088775964219395043, 3.4441381957619619, 3.3892189758872853, 2.7423767697866088, 3.977644321141641], [1.4526982641352157, 2.2184052986969505, -3.952710218879385, -4.7169576073736375, -0.7937042808225101], [2.2686916098744314, -1.553248315886353, -2.7367045745859819, 3.7958840729585344, 1.4548199443717298]])
725        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        sub=res.substitute({arg1:s1})
726        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
727        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        ref=msk_ref*numarray.array([[0.22491426047411567, 0.39581547203083645, 4.0323721659422693, -0.045999282893103732, 0.66266307645958911], [3.1068689077995897, 6.4622311393421565, 6.4073119194674799, 5.7604697133668035, 6.9957372647218357], [4.4707912077154104, 5.2364982422771451, -0.93461727529919036, -1.6988646637934428, 2.2243886627576845], [5.2867845534546261, 1.4648446276938416, 0.28138836899421271, 6.813977016538729, 4.4729128879519244]])+(1.-msk_ref)*numarray.array([[-1.9034350252987218, -1.732533813742001, 1.9040228801694319, -2.1743485686659412, -1.4656862093132483], [0.97851962202675224, 4.3338818535693191, 4.2789626336946425, 3.632120427593966, 4.8673879789489982], [2.3424419219425729, 3.1081489565043077, -3.0629665610720278, -3.8272139495662802, 0.096039376984847102], [3.1584352676817886, -0.66350465807899583, -1.8469609167786247, 4.6856277307658916, 2.344563602179087]])
728     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
729     def test_Symbol_rank0_dNone_nargs1(self):        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
730        s2=Symbol(shape=())        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
731        s=Symbol(shape=(),dim=None,args=[s2])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
732        self.failUnlessEqual(s.getRank(),0,"wrong rank.")     def test_add_overloaded_expandedData_rank0_Symbol_rank3(self):
733        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
734        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        arg0=msk_arg0*(-4.98444562132)+(1.-msk_arg0)*(4.30756765987)
735        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        arg1=Symbol(shape=(6, 2, 2))
736          res=arg0+arg1
737        ss=s.substitute({s:numarray.zeros(())})        s1=numarray.array([[[1.9993822405268356, -3.1230808428690615], [4.9036400439562815, -4.8838867997176525]], [[0.42763250705520939, 1.7579324334230453], [-3.7242679708963458, 1.8833596506298056]], [[-3.5481907533254931, 0.2040318933875751], [-2.5124574767604746, -4.1576503017979416]], [[2.4187154671810562, -0.51775884222858526], [-1.722028671225063, 4.8177194310600537]], [[3.5460779618762999, 3.7426721831596925], [-3.14876579453641, -1.8491069265603413]], [[-2.0602497125201733, 1.8445672729830882], [2.6289048953955998, -2.1171625740448654]]])
738        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        sub=res.substitute({arg1:s1})
739        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
740        try:        ref=msk_ref*numarray.array([[[-2.9850633807947604, -8.1075264641906575], [-0.080805577365314463, -9.8683324210392485]], [[-4.5568131142663866, -3.2265131878985507], [-8.7087135922179417, -3.1010859706917904]], [[-8.5326363746470886, -4.7804137279340209], [-7.4969030980820701, -9.1420959231195376]], [[-2.5657301541405397, -5.5022044635501812], [-6.7064742925466589, -0.16672619026154223]], [[-1.4383676594452961, -1.2417734381619034], [-8.1332114158580069, -6.8335525478819372]], [[-7.0446953338417693, -3.1398783483385078], [-2.3555407259259962, -7.1016081953664614]]])+(1.-msk_ref)*numarray.array([[[6.3069499004015404, 1.1844868170056433], [9.2112077038309863, -0.57631913984294769]], [[4.7352001669299142, 6.0655000932977501], [0.58329968897835904, 6.1909273105045104]], [[0.75937690654921175, 4.5115995532622799], [1.7951101831142302, 0.14991735807676321]], [[6.726283127055761, 3.7898088176461195], [2.5855389886496418, 9.1252870909347585]], [[7.8536456217510047, 8.0502398430343973], [1.1588018653382948, 2.4584607333143635]], [[2.2473179473545315, 6.152134932857793], [6.9364725552703046, 2.1904050858298394]]])
741          s.substitute({s:numarray.zeros((5,))})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
742          fail("illegal substition was successful")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
743        except TypeError:        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
744          pass     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
745       def test_add_overloaded_expandedData_rank0_Symbol_rank4(self):
746        dsdarg=s.diff(Symbol(shape=()))        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
747        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        arg0=msk_arg0*(-2.9697925334)+(1.-msk_arg0)*(-4.26135335725)
748        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        arg1=Symbol(shape=(3, 2, 3, 4))
749        dsdarg=s.diff(Symbol(shape=(2,)))        res=arg0+arg1
750        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        s1=numarray.array([[[[3.9689996783063126, 2.6024749301521517, -2.8657897182202263, 3.4523361907793202], [1.0646468808240472, 2.2809214673673006, 1.9110441510817342, 3.6637536830808415], [-4.8161620946685977, 1.1260192950202335, -1.5444099528131283, 4.5856953227320361]], [[3.4807853259935388, 1.0632821522370133, -1.7813251042294, 0.96803702807832348], [-2.2395880868316476, 4.8919502166960243, 3.0915081953974273, -0.85921425228962178], [-0.24500754865585961, -3.000069805276242, -2.3285433357124861, -3.7526812827715004]]], [[[-2.6148866735769314, -2.9426881222754986, -2.1105189060422127, -1.718323686970705], [0.38236683235255065, 4.8146833101999391, -0.69724678041282662, -3.674837501299455], [-1.1217878757973345, 1.9457797122429064, 4.3330454272287042, 1.2870165165330079]], [[0.90390350707926448, 4.0932246664578322, 4.0170833493811937, 2.3057200276883218], [-4.1149618340720506, 4.3206785552080422, 4.5478406361616468, 3.4270491303459689], [-3.2122582790653578, -0.051138136931458078, 2.847106348954056, -2.0922906343243097]]], [[[-3.8470709835005801, 0.79389346854249432, 1.9702586564654192, -1.230993932131331], [0.52027641197917784, 4.1606002966489264, -4.1240899145057277, 3.0855602864655047], [1.2434749670286918, 1.9421106344042691, -4.7997149299258455, -3.1016051858236517]], [[-4.0158867307020536, -1.2810983979769732, 4.1806447574751786, 2.4159993753375488], [3.8210591526688589, 2.9170696329659753, 0.212629682453775, -3.6791629346607402], [-0.52709663403725493, -2.0893727810689953, -1.7473644406170976, -4.1869442335699976]]]])
751        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        sub=res.substitute({arg1:s1})
752        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
753        dsdarg=s.diff(Symbol(shape=(4, 5)))        ref=msk_ref*numarray.array([[[[0.99920714490574225, -0.36731760324841867, -5.8355822516207967, 0.48254365737874982], [-1.9051456525765231, -0.68887106603326975, -1.0587483823188362, 0.69396114968027112], [-7.7859546280691685, -1.8437732383803369, -4.5142024862136987, 1.6159027893314657]], [[0.51099279259296848, -1.9065103811635571, -4.7511176376299709, -2.0017555053222469], [-5.2093806202322179, 1.9221576832954539, 0.12171566199685691, -3.8290067856901921], [-3.21480008205643, -5.9698623386768119, -5.2983358691130569, -6.7224738161720712]]], [[[-5.5846792069775013, -5.9124806556760685, -5.0803114394427826, -4.6881162203712758], [-2.5874257010480197, 1.8448907767993687, -3.667039313813397, -6.6446300347000253], [-4.0915804091979044, -1.024012821157664, 1.3632528938281339, -1.6827760168675625]], [[-2.0658890263213059, 1.1234321330572619, 1.0472908159806233, -0.66407250571224852], [-7.0847543674726214, 1.3508860218074719, 1.5780481027610764, 0.45725659694539855], [-6.1820508124659277, -3.0209306703320284, -0.12268618444651436, -5.0620831677248805]]], [[[-6.8168635169011509, -2.175899064858076, -0.99953387693515117, -4.2007864655319018], [-2.4495161214213925, 1.190807763248356, -7.0938824479062976, 0.11576775306493436], [-1.7263175663718786, -1.0276818989963012, -7.7695074633264163, -6.0713977192242226]], [[-6.9856792641026235, -4.250890931377544, 1.2108522240746082, -0.55379315806302154], [0.8512666192682885, -0.052722900434595044, -2.7571628509467954, -6.6489554680613105], [-3.4968891674378253, -5.0591653144695652, -4.7171569740176675, -7.1567367669705675]]]])+(1.-msk_ref)*numarray.array([[[[-0.29235367894345909, -1.65887842709762, -7.1271430754699985, -0.80901716647045152], [-3.1967064764257245, -1.9804318898824711, -2.3503092061680375, -0.59759967416893023], [-9.0775154519183694, -3.1353340622295383, -5.8057633100629005, 0.32434196548226435]], [[-0.78056803125623286, -3.1980712050127584, -6.0426784614791718, -3.2933163291714482], [-6.5009414440814197, 0.63059685944625254, -1.1698451618523444, -5.1205676095393935], [-4.5063609059056313, -7.2614231625260137, -6.5898966929622578, -8.0140346400212721]]], [[[-6.8762400308267031, -7.2040414795252703, -6.3718722632919844, -5.9796770442204767], [-3.8789865248972211, 0.5533299529501674, -4.9586001376625983, -7.9361908585492262], [-5.3831412330471062, -2.3155736450068654, 0.071692069978932516, -2.9743368407167639]], [[-3.3574498501705072, -0.16812869079193948, -0.244270007868578, -1.9556333295614499], [-8.3763151913218223, 0.059325197958270515, 0.28648727891187509, -0.83430422690380279], [-7.4736116363151295, -4.3124914941812298, -1.4142470082957157, -6.3536439915740814]]], [[[-8.1084243407503518, -3.4674598887072774, -2.2910947007843525, -5.4923472893811027], [-3.7410769452705939, -0.10075306060084532, -8.3854432717554985, -1.175793070784267], [-3.01787839022108, -2.3192427228455026, -9.0610682871756172, -7.3629585430734235]], [[-8.2772400879518244, -5.5424517552267449, -0.080708599774593104, -1.8453539819122229], [-0.44029420458091284, -1.3442837242837964, -4.0487236747959967, -7.9405162919105123], [-4.7884499912870266, -6.350726138318767, -6.0087177978668693, -8.4482975908197702]]]])
754        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
755        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
756        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
757        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
758        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")     def test_add_overloaded_expandedData_rank1_Symbol_rank0(self):
759        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
760        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        arg0=msk_arg0*numarray.array([2.1945719955206853, -3.4851810549539852])+(1.-msk_arg0)*numarray.array([-3.159460740559509, 1.0507096466806898])
761        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        arg1=Symbol(shape=())
762        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        res=arg0+arg1
763        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        s1=numarray.array(2.92811762582)
764        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        sub=res.substitute({arg1:s1})
765          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
766        dsds=s.diff(s)        ref=msk_ref*numarray.array([5.1226896213358133, -0.5570634291388572])+(1.-msk_ref)*numarray.array([-0.23134311474438096, 3.9788272724958178])
767        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
768        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
769          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
770        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
771        sa=s.getSubstitutedArguments({s2:-10})     def test_add_overloaded_expandedData_rank1_Symbol_rank1(self):
772        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
773        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        arg0=msk_arg0*numarray.array([1.9387192390641195, -2.294788495198282])+(1.-msk_arg0)*numarray.array([-3.9950296964046816, -4.9584579002903517])
774          arg1=Symbol(shape=(2,))
775        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        res=arg0+arg1
776        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        s1=numarray.array([0.68148355985483988, 0.33396702170122339])
777        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")        sub=res.substitute({arg1:s1})
778        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
779        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        ref=msk_ref*numarray.array([2.6202027989189594, -1.9608214734970586])+(1.-msk_ref)*numarray.array([-3.3135461365498418, -4.6244908785891283])
780        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
781        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
782     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
783     def test_Symbol_rank0_dNone_nargs2(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
784        s2=Symbol(shape=())     def test_add_overloaded_expandedData_rank2_Symbol_rank0(self):
785        s=Symbol(shape=(),dim=None,args=[1, -1.0])        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
786        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        arg0=msk_arg0*numarray.array([[1.9335525790389809, 4.8876884032830024, -3.6794048434152948, -2.9337672885330814, 0.5880232587543972], [1.2731441866942719, 4.8021715240969982, 2.9871285060348427, 4.3674026791776921, 2.3324101078324144], [3.257367767879968, 3.614481137699638, -4.0465097244122443, -3.3712543524462166, 0.83424572698980626], [-4.7734011845397317, -1.1918316514932537, -2.641576771310632, -3.7441723823507447, 2.5792398168240602]])+(1.-msk_arg0)*numarray.array([[0.51038147587387783, -3.548018657118809, 3.7494118465432393, 3.6729170048063136, -2.9522974158811746], [3.2109365766033289, -1.7347320393345091, -0.9996429948297223, -0.75500884718678307, 1.5928790967815267], [-4.1174844249701259, 4.2030131668606234, -4.8484509001230229, 2.7032344298767921, 4.3009935101668333], [-1.4527019870327429, 3.9347061378002781, 1.21415230923688, -3.666838308237784, -3.8400590973123858]])
787        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        arg1=Symbol(shape=())
788        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        res=arg0+arg1
789        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        s1=numarray.array(3.22997214356)
790          sub=res.substitute({arg1:s1})
791        ss=s.substitute({s:numarray.zeros(())})        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
792        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        ref=msk_ref*numarray.array([[5.1635247225953336, 8.117660546839355, -0.44943269985894219, 0.29620485502327121, 3.8179954023107499], [4.5031163302506245, 8.0321436676533509, 6.2171006495911953, 7.5973748227340447, 5.5623822513887671], [6.4873399114363206, 6.8444532812559906, -0.81653758085589168, -0.14128220888986398, 4.0642178705461589], [-1.5434290409833791, 2.038140492063099, 0.58839537224572069, -0.51420023879439203, 5.8092119603804129]])+(1.-msk_ref)*numarray.array([[3.7403536194302305, -0.31804651356245639, 6.979383990099592, 6.9028891483626662, 0.27767472767517809], [6.4409087201596815, 1.4952401042218435, 2.2303291487266304, 2.4749632963695696, 4.8228512403378794], [-0.88751228141377325, 7.4329853104169761, -1.6184787565666703, 5.9332065734331447, 7.5309656537231859], [1.7772701565236098, 7.1646782813566308, 4.4441244527932326, -0.43686616468143136, -0.61008695375603317]])
793        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
794        try:        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
795          s.substitute({s:numarray.zeros((5,))})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
796          fail("illegal substition was successful")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
797        except TypeError:     def test_add_overloaded_expandedData_rank2_Symbol_rank2(self):
798          pass        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
799          arg0=msk_arg0*numarray.array([[-0.074742989914646785, -1.8482493880577588, 1.0926262448311599, 4.5158483202643716, -3.0805669333005561], [0.0085606966159099684, -2.9696862086974996, 3.3024460854167597, 1.5088165460119427, -3.6452065491857266], [0.18694035412066512, -4.6738922180085147, 3.9551045875071438, 4.0084174115638724, -0.63332177275981749], [2.5093858800842108, -0.36171911019222946, 0.19138395375626427, -3.1795621861527734, -2.6267949144535008]])+(1.-msk_arg0)*numarray.array([[-3.5942187686631524, -3.7060821431133406, 0.9533196788857623, -4.8840044000628744, 0.3938790125214453], [4.0652979493208985, 4.5325841421496644, -0.4281905049316661, -1.742508580451184, 2.7120740894023898], [0.56888661640784566, -2.4569299021956068, 3.568568120069024, -2.0793352745659766, -1.7689628659930126], [-4.8632954420706014, -2.8828667280653364, 3.4090243893802246, 3.0651732601260697, 4.6463764755640256]])
800        dsdarg=s.diff(Symbol(shape=()))        arg1=Symbol(shape=(4, 5))
801        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        res=arg0+arg1
802        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        s1=numarray.array([[-1.4953863183942318, -3.5127993001524969, 2.9138150805794103, -1.6144165168200519, -0.65062618022498242], [-4.9181569250500168, -2.6971927119277908, 4.2365880197149934, -4.2036145824282496, 2.2260090531531453], [4.0868409931398002, -3.3893548967194032, 2.9012650531553019, -2.2355683566643378, 2.9627609193479501], [4.9921359000605019, 0.6569024014440803, 3.3639734573108839, 0.89356331435440595, -4.0709626638242327]])
803        dsdarg=s.diff(Symbol(shape=(2,)))        sub=res.substitute({arg1:s1})
804        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
805        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        ref=msk_ref*numarray.array([[-1.5701293083088785, -5.3610486882102553, 4.0064413254105702, 2.9014318034443196, -3.7311931135255385], [-4.9095962284341068, -5.6668789206252903, 7.5390341051317531, -2.6947980364163069, -1.4191974960325813], [4.2737813472604653, -8.0632471147279183, 6.8563696406624457, 1.7728490548995346, 2.3294391465881326], [7.5015217801447127, 0.29518329125185083, 3.5553574110671482, -2.2859988717983675, -6.6977575782777334]])+(1.-msk_ref)*numarray.array([[-5.0896050870573841, -7.2188814432658379, 3.8671347594651726, -6.4984209168829263, -0.25674716770353712], [-0.85285897572911828, 1.8353914302218737, 3.8083975147833273, -5.9461231628794335, 4.9380831425555352], [4.6557276095476459, -5.8462847989150095, 6.4698331732243259, -4.3149036312303144, 1.1937980533549375], [0.12884045798990051, -2.2259643266212561, 6.7729978466911085, 3.9587365744804757, 0.57541381173979289]])
806        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
807        dsdarg=s.diff(Symbol(shape=(4, 5)))        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
808        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
809        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
810        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")     def test_add_overloaded_expandedData_rank3_Symbol_rank0(self):
811        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
812        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        arg0=msk_arg0*numarray.array([[[-2.1957568090391955, 0.56747277575122101], [-1.4226171578539604, -3.1174336379255854]], [[1.9150168705353749, 0.46771483389240665], [-0.73261624542450932, 1.4533109165427449]], [[-4.3700026677098416, -4.4121889510507675], [-4.2432470132589684, -4.6365817911825937]], [[4.3712760608754326, 0.48815678812850649], [-4.2919585871561221, 2.8753619236403747]], [[4.7410827225779482, -3.2941488290580354], [3.5834613437014919, 0.53477849558006074]], [[-2.2697241902980902, 1.4839036193452078], [4.3514574228344109, 2.0334834769049763]]])+(1.-msk_arg0)*numarray.array([[[1.9065956016010119, 3.8011536401496766], [4.2481111431072272, 0.7657337986451509]], [[1.7488690210709832, 4.5064595133713876], [-1.261534521038973, -1.5095749568667172]], [[1.2010203264269057, 0.055494332510111377], [4.3269730839285749, -0.54412407243328076]], [[-2.6257140205956175, -3.4462245120816002], [1.3451771798822101, 2.462398203439907]], [[-2.5713124204289493, 1.9356323962441504], [1.8879658089499234, 3.1212800001648091]], [[1.942043508304808, 0.80539011514164471], [-0.3765200612428643, 0.73339801844715691]]])
813        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        arg1=Symbol(shape=())
814        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        res=arg0+arg1
815        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        s1=numarray.array(2.24723235412)
816        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        sub=res.substitute({arg1:s1})
817        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
818        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        ref=msk_ref*numarray.array([[[0.05147554507665264, 2.8147051298670691], [0.82461519626188773, -0.87020128380973727]], [[4.162249224651223, 2.7149471880082547], [1.5146161086913388, 3.700543270658593]], [[-2.1227703135939935, -2.1649565969349194], [-1.9960146591431203, -2.3893494370667456]], [[6.6185084149912807, 2.7353891422443546], [-2.044726233040274, 5.1225942777562228]], [[6.9883150766937963, -1.0469164749421873], [5.83069369781734, 2.7820108496959088]], [[-0.022491836182242153, 3.7311359734610559], [6.598689776950259, 4.2807158310208244]]])+(1.-msk_ref)*numarray.array([[[4.15382795571686, 6.0483859942655247], [6.4953434972230752, 3.012966152760999]], [[3.9961013751868313, 6.7536918674872357], [0.98569783307687509, 0.73765739724913093]], [[3.4482526805427538, 2.3027266866259595], [6.574205438044423, 1.7031082816825673]], [[-0.37848166647976944, -1.1989921579657521], [3.5924095339980582, 4.7096305575557551]], [[-0.32408006631310116, 4.1828647503599985], [4.1351981630657715, 5.3685123542806572]], [[4.1892758624206561, 3.0526224692574928], [1.8707122928729838, 2.980630372563005]]])
819          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
820        dsds=s.diff(s)        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
821        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
822        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
823       def test_add_overloaded_expandedData_rank3_Symbol_rank3(self):
824        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
825        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        arg0=msk_arg0*numarray.array([[[-3.6330041831896742, 1.9011276595647058], [4.0527837903730326, 3.7453216540822218]], [[1.1423057067323032, -4.6191355501663702], [-0.19479401086936399, 3.6518312558771875]], [[-0.78164127432320996, -0.0025588788834731702], [-2.5155059876978534, -2.7853664238124578]], [[-2.4557560474662496, -1.7001261418483038], [2.2437567320884249, -4.5528490181464578]], [[3.3965240991344601, 2.7531638892344281], [-1.0182649859279858, 0.37879180372082377]], [[-2.2634040587587356, -3.6908761533687482], [-2.6652399154901509, -2.0159814304593739]]])+(1.-msk_arg0)*numarray.array([[[4.9981907924797788, 4.277720751221235], [-4.4785446333946686, -3.8140270519701982]], [[1.4517149340948965, 1.9122847710945834], [-1.0984824997077558, 4.9260526287710995]], [[3.0231870187238314, -4.426803554802202], [-0.1009215503507912, -2.4226611633877337]], [[3.1439947236211125, -2.7156096061802728], [-0.27949941006709977, 0.15562912547547469]], [[-1.6704879956646712, -0.87822202800174587], [-4.0968204088950708, -4.8812474874399072]], [[-3.0876637956180186, 0.42808604578959475], [-0.76617423765119153, 1.4811418969805343]]])
826        sa=s.getSubstitutedArguments({s2:-10})        arg1=Symbol(shape=(6, 2, 2))
827        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        res=arg0+arg1
828        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        s1=numarray.array([[[-3.655791939954395, 1.9082625611635287], [2.0305234873740705, -3.9575879711347337]], [[0.58883813376680294, -0.44253502109642717], [-0.50659655202841058, 4.7262250303753071]], [[2.3551049262619417, -2.7472704728416062], [-4.2131185370897501, 1.1560716927603512]], [[-1.8521430501234626, -2.8126771236453196], [-1.6116964851382032, 4.3144406033510982]], [[-4.4005771771028979, -3.8795508309654512], [0.95903540985898683, -0.84559016177598512]], [[-2.6007509769442674, -0.13151235868250399], [-1.5038936232862978, -3.9733280592961249]]])
829        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        sub=res.substitute({arg1:s1})
830          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
831        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        ref=msk_ref*numarray.array([[[-7.2887961231440688, 3.8093902207282344], [6.0833072777471031, -0.21226631705251187]], [[1.7311438404991062, -5.0616705712627974], [-0.70139056289777457, 8.3780562862524945]], [[1.5734636519387317, -2.7498293517250794], [-6.7286245247876035, -1.6292947310521066]], [[-4.3078990975897122, -4.5128032654936234], [0.63206024695022167, -0.23840841479535957]], [[-1.0040530779684378, -1.1263869417310231], [-0.059229576068998924, -0.46679835805516134]], [[-4.8641550357030034, -3.8223885120512522], [-4.1691335387764488, -5.9893094897554988]]])+(1.-msk_ref)*numarray.array([[[1.3423988525253838, 6.1859833123847636], [-2.4480211460205981, -7.7716150231049319]], [[2.0405530678616994, 1.4697497499981562], [-1.6050790517361664, 9.6522776591464066]], [[5.3782919449857731, -7.1740740276438082], [-4.3140400874405413, -1.2665894706273826]], [[1.29185167349765, -5.5282867298255924], [-1.891195895205303, 4.4700697288265729]], [[-6.0710651727675691, -4.757772858967197], [-3.137784999036084, -5.7268376492158923]], [[-5.688414772562286, 0.29657368710709076], [-2.2700678609374894, -2.4921861623155905]]])
832        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
833        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
834        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
835        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
836        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")     def test_add_overloaded_expandedData_rank4_Symbol_rank0(self):
837        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
838     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=msk_arg0*numarray.array([[[[4.965007128412612, 3.4584141019026564, -1.0391619896304451, 4.5542963326499351], [-0.0016792172679549466, -2.9053441565334981, 0.025786108583792711, -0.89554847161554374], [4.4904084527351209, -0.89553646258473307, 3.8929449623498495, -2.8715607346304415]], [[-3.727374719009604, 2.2555823384608908, 0.53380019017552272, -0.29480940480144113], [-3.6344667828862445, -4.8499559892732567, 3.5342171405331317, 1.9875915936023327], [3.0643486049591804, -2.9482947381564806, 1.257296440825332, -4.4599817600046716]]], [[[-3.7989993001254971, 4.2006768317373879, -1.9340842456373886, 0.25295780568139836], [0.15305381262779072, 2.184447614622945, -2.0595806484522039, 1.6196719151709491], [-1.550459702477788, 2.2328097059995393, -3.2648987061947632, -1.7698524550474004]], [[-3.1067614393264673, 3.6490340896776274, 4.2948603770463407, -3.4382940099694084], [-1.765073080880275, 2.5928931740693892, 2.2530590640640069, 2.7653349815108443], [-0.88766895991026384, 3.8444038125137965, 3.8283329993863564, 1.6961545196727537]]], [[[-1.6941819291782823, -4.3507603532160344, 0.58625398426930175, -4.9534370199923137], [4.3258398610183271, 4.7398172498630355, -0.27425006429631082, -0.80958052389792012], [0.27800145594245151, -0.70646630926925713, -1.3619199397032533, -0.22712536683851958]], [[-3.7307177958823781, -0.17135910311966995, -1.2454260400370809, 1.8499155339141273], [0.7652733563966283, -4.2318891899847593, 4.1390775019993704, 2.1086112655335079], [-4.4480501135282662, 4.3290513315610166, -4.1098101623830443, -2.8839598970399614]]]])+(1.-msk_arg0)*numarray.array([[[[3.9323713317642746, 4.4527426387356446, 1.8489227456459432, 2.295838413561385], [-1.5932231826477694, -0.043483214358698064, 2.6866561252017789, -1.3064680912144833], [-4.563955043071191, -4.5294274892608124, 1.1139333008427865, -3.356095173880258]], [[-0.39784058429088365, 1.3572530126249651, 0.73921609667405086, -2.8036097598039502], [-1.6466307808609693, -3.6730522383966999, -4.2815488732075613, -3.0943250956889665], [0.84471742986867238, 3.3304241697775492, -2.7207357502431542, -1.8257126717947059]]], [[[0.21030801293033274, 4.6379651350087698, 4.213456762528347, 4.0550184068364885], [-2.5755175539757227, 2.6713165204428986, 3.2808072440183729, 2.8475364996882107], [4.8503832880401561, -0.89396576884489498, 4.8726952699950328, 1.8570156992262419]], [[-4.6778874236692944, 2.1109769293880465, 0.79097589510131172, -2.1112073984121893], [2.558958067688426, 2.8307096810380727, 0.012443144332241474, -3.7601222060065065], [-1.3755439053562823, 2.9800220614031678, 1.6579582033193425, 4.4427116407434362]]], [[[-0.86660146317817688, 1.3032310329697525, 3.0027070238303377, -2.9114837729491319], [-3.4567748888099636, 3.3638086688271702, 4.1486162466002519, 2.0749122046757407], [0.84439318528796647, -3.6592289308593697, 0.77430002321168345, 1.7927967246699836]], [[-1.1981415218608116, 2.3445312580391588, -1.5436298697897444, 1.6111465180751141], [1.6230738725320037, -1.3035089800291666, -4.6787506207538687, 2.9155460797717678], [3.3315156088599238, -3.5200805068877128, -1.1181004173108544, -2.2485916181204857]]]])
839     def test_Symbol_rank0_dd_nargs0(self):        arg1=Symbol(shape=())
840        s2=Symbol(shape=())        res=arg0+arg1
841        s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[])        s1=numarray.array(3.43950171094)
842        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        sub=res.substitute({arg1:s1})
843        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
844        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        ref=msk_ref*numarray.array([[[[8.4045088393544027, 6.8979158128444471, 2.4003397213113455, 7.9937980435917257], [3.4378224936738357, 0.5341575544082926, 3.4652878195255834, 2.543953239326247], [7.9299101636769116, 2.5439652483570576, 7.3324466732916402, 0.56794097631134921]], [[-0.28787300806781335, 5.6950840494026815, 3.9733019011173134, 3.1446923061403496], [-0.19496507194445378, -1.410454278331466, 6.9737188514749224, 5.4270933045441234], [6.5038503159009711, 0.49120697278531011, 4.6967981517671227, -1.0204800490628809]]], [[[-0.35949758918370645, 7.6401785426791786, 1.5054174653044021, 3.6924595166231891], [3.5925555235695814, 5.6239493255647357, 1.3799210624895868, 5.0591736261127398], [1.8890420084640027, 5.67231141694133, 0.1746030047470275, 1.6696492558943903]], [[0.33274027161532338, 7.0885358006194181, 7.7343620879881314, 0.0012077009723823195], [1.6744286300615157, 6.0323948850111799, 5.6925607750057976, 6.204836692452635], [2.5518327510315268, 7.2839055234555872, 7.2678347103281471, 5.1356562306145443]]], [[[1.7453197817635084, -0.91125864227424369, 4.0257556952110924, -1.513935309050523], [7.7653415719601178, 8.1793189608048262, 3.1652516466454799, 2.6299211870438706], [3.7175031668842422, 2.7330354016725336, 2.0775817712385374, 3.2123763441032711]], [[-0.29121608494058737, 3.2681426078221207, 2.1940756709047098, 5.289417244855918], [4.204775067338419, -0.79238747904296858, 7.5785792129411611, 5.5481129764752986], [-1.0085484025864755, 7.7685530425028073, -0.67030845144125362, 0.55554181390182933]]]])+(1.-msk_ref)*numarray.array([[[[7.3718730427060652, 7.8922443496774353, 5.2884244565877339, 5.7353401245031757], [1.8462785282940213, 3.3960184965830926, 6.1261578361435696, 2.1330336197273074], [-1.1244533321294004, -1.0899257783190217, 4.5534350117845772, 0.083406537061532671]], [[3.041661126650907, 4.7967547235667558, 4.1787178076158416, 0.63589195113784047], [1.7928709300808214, -0.23355052745490923, -0.84204716226577059, 0.34517661525282417], [4.2842191408104631, 6.7699258807193399, 0.71876596069863652, 1.6137890391470848]]], [[[3.6498097238721234, 8.0774668459505605, 7.6529584734701377, 7.4945201177782792], [0.86398415696606801, 6.1108182313846893, 6.7203089549601636, 6.2870382106300013], [8.2898849989819468, 2.5455359420968957, 8.3121969809368235, 5.2965174101680326]], [[-1.2383857127275038, 5.5504786403298372, 4.2304776060431024, 1.3282943125296014], [5.9984597786302167, 6.2702113919798634, 3.4519448552740322, -0.32062049506471579], [2.0639578055855083, 6.4195237723449585, 5.0974599142611332, 7.8822133516852269]]], [[[2.5729002477636138, 4.7427327439115432, 6.4422087347721284, 0.52801793799265884], [-0.017273177868172951, 6.8033103797689609, 7.5881179575420425, 5.5144139156175314], [4.2838948962297572, -0.21972721991757904, 4.2138017341534741, 5.2322984356117743]], [[2.2413601890809791, 5.7840329689809495, 1.8958718411520463, 5.0506482290169048], [5.0625755834737944, 2.1359927309126241, -1.239248909812078, 6.3550477907135585], [6.7710173198017145, -0.080578795945922099, 2.3214012936309363, 1.190910092821305]]]])
845        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
846          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
847        ss=s.substitute({s:numarray.zeros(())})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
848        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
849        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")     def test_add_overloaded_expandedData_rank4_Symbol_rank4(self):
850        try:        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
851          s.substitute({s:numarray.zeros((5,))})        arg0=msk_arg0*numarray.array([[[[3.2510674404409041, 2.1171696862303406, 2.9610258759664267, -3.8373977579450456], [0.75383244276133166, 2.4077943881602728, 3.873284406870285, 3.7937584009819574], [-4.6069898901399364, -2.5452970249895754, 3.650830786457707, -0.56630176651201847]], [[3.6738989513815135, -1.1553536380556686, 4.303352195803182, 2.0201689947921695], [2.5110280594242029, 1.1178178456135743, 3.5722095880572251, -3.0495901167648221], [-1.8161969765914288, -3.850369287459924, 1.8305771607495833, 3.8129356009276751]]], [[[4.8159492177547296, -2.7259760165966638, -0.056119891503465524, 3.2320437499651025], [4.1412540490540568, 2.3145635424798332, 4.2298625240821792, -4.9326174629443722], [1.2505234798682396, 4.1728981653768358, -1.4526511101284445, -0.73865645812869563]], [[-2.5027203270038956, -0.75821705726011146, -2.0074201432570495, -0.20166798891695503], [1.7962444938241209, 4.9186635916785164, -3.3612255674731486, -3.1402103698143327], [4.8100127068213077, -3.7003932729639377, -2.3809463861562454, 2.6337296431542621]]], [[[0.8461884816413443, 2.2850095300693116, 3.1039351776827235, 2.7358221987272575], [-1.331100327658973, -2.4718869003284438, 3.8392116060077814, 3.7886003252177218], [-2.740692362699221, -1.1104811343803189, 1.065443269317063, -1.604926521206449]], [[3.1359320207935291, 2.4159415877072101, -2.9781841648177654, 0.4457695581762291], [1.4022534028069558, 3.2181877465159641, 4.1561033889739196, -4.5314636502141923], [2.4896032954770373, -1.6749755107952033, -4.2977752660345292, 4.3862296692093636]]]])+(1.-msk_arg0)*numarray.array([[[[3.8098232095134126, -2.0180524002497693, 4.420784171182504, -2.4324750966542674], [2.4681882567616125, 3.0279649104786941, 2.2383665512055266, -0.091420157761364251], [4.7846856391630048, 0.45001495814867454, 2.8428137570111911, 3.6542996408716562]], [[-3.3832925941075711, -4.6684050424331947, 2.7145812310865534, 0.57489640415196952], [3.2363298539062395, -0.28076205609599914, -2.1610563710523598, -3.9600308036480381], [4.1445091213012599, 0.23464603550937735, -4.9214532841127738, 3.7601288072640866]]], [[[4.5878923885513938, -2.7602444517968006, -2.4823493575559641, -1.1998619544811917], [-1.0165322624110429, 4.8743114304602564, 3.0069704689379755, 2.0086372739622043], [-1.7482883016273565, 4.5233781656491008, 1.0481669308330579, 3.3780108680134457]], [[-4.5351514069636076, -4.760484108729206, -1.7334568308716203, -4.3080131499917833], [4.0321976091043883, -2.6576000312675063, 1.3372423488299923, -3.8949616711167625], [3.5793384711817051, 2.60693067621275, 1.8056256765125287, -3.9915454170699869]]], [[[0.39851532295995273, 2.2465287291059273, 0.64170560779626662, -4.7331314705888738], [3.5329039709028898, -2.5311269573107662, 2.8367974744858193, -4.3457969220676684], [-1.526677955424999, -2.5983211468943357, -1.3293797580217093, -3.1887378668078279]], [[3.1416335105809505, 0.35146012646543134, 2.428390004415637, 2.7813900205500861], [3.5228217461650111, -0.012304332300811183, -3.1395042313107369, 4.8647351561551702], [2.2570133784920099, -1.7535240218446777, 0.38792070998653028, -0.21839923153693785]]]])
852          fail("illegal substition was successful")        arg1=Symbol(shape=(3, 2, 3, 4))
853        except TypeError:        res=arg0+arg1
854          pass        s1=numarray.array([[[[-0.55399336747432937, -3.6468486902030306, 2.4533567494215669, 4.8267547347789659], [1.1480960590338416, 3.5599245920968787, -2.8247534868419724, -2.2031349101131505], [1.7520095897646017, 4.4293583295521266, -3.2046920932014888, -3.8760923163847472]], [[3.9288042477427645, 1.103593535294765, 0.62546922225950485, 2.5431633219905123], [2.5483588394973191, -0.82358610517599207, -0.47010674146441023, 2.7635563586840011], [3.5616440522317419, 2.2995934729430481, -3.501591556463012, 1.3778428754586027]]], [[[-4.3918539920661051, 0.24976043236636869, -2.4847081470778463, 4.8636790550226792], [-4.2172400078729559, -2.0316184192507647, -0.53464794178739794, -0.035422588600630966], [1.7049703562375615, 4.2019750499164399, -3.7430217705554858, -3.4952387702082346]], [[-0.39925876875124189, 1.4505137462439404, -4.1941814051173072, -1.844757872605356], [-3.4448187389632414, -3.5340944666273377, -3.178247383159305, -1.7824872241435519], [-3.6843631882800798, -4.1186208792142187, 2.0636953370355959, -0.18717114434561122]]], [[[-2.4316812831173742, 0.39582208925882689, 1.4893695917228467, -3.1232026180567773], [2.1122901499636226, 4.9884613457151978, -4.7793541216702149, -3.9541373136233391], [-4.8256481088328194, -0.10764491664526066, 2.9970513787255895, -1.0443943611478437]], [[3.6491162738908258, 3.4225261399204765, -2.9600723325757849, 3.3422667802452324], [-3.763493116056098, 4.6894908619506595, 2.532040050484988, 0.99028387045053101], [2.5962274887920085, -0.2721955960411897, -4.7946284910477441, -0.96141278632713245]]]])
855          sub=res.substitute({arg1:s1})
856        dsdarg=s.diff(Symbol(shape=()))        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
857        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        ref=msk_ref*numarray.array([[[[2.6970740729665748, -1.52967900397269, 5.4143826253879936, 0.98935697683392032], [1.9019285017951733, 5.9677189802571515, 1.0485309200283126, 1.5906234908688068], [-2.8549803003753347, 1.8840613045625512, 0.44613869325621813, -4.4423940828967652]], [[7.6027031991242779, -0.051760102760903592, 4.9288214180626868, 4.5633323167826818], [5.059386898921522, 0.29423174043758227, 3.1021028465928149, -0.28603375808082099], [1.7454470756403131, -1.550775814516876, -1.6710143957134287, 5.1907784763862779]]], [[[0.42409522568862457, -2.4762155842302951, -2.5408280385813118, 8.0957228049877816], [-0.075985958818899135, 0.28294512322906851, 3.6952145822947813, -4.9680400515450032], [2.9554938361058012, 8.3748732152932757, -5.1956728806839303, -4.2338952283369302]], [[-2.9019790957551375, 0.6922966889838289, -6.2016015483743567, -2.046425861522311], [-1.6485742451391205, 1.3845691250511787, -6.5394729506324536, -4.922697593957885], [1.1256495185412279, -7.8190141521781564, -0.3172510491206495, 2.4465584988086508]]], [[[-1.5854928014760299, 2.6808316193281385, 4.5933047694055702, -0.38738041932951983], [0.78118982230464962, 2.516574445386754, -0.94014251566243345, -0.16553698840561726], [-7.5663404715320404, -1.2181260510255796, 4.0624946480426525, -2.6493208823542926]], [[6.7850482946843549, 5.8384677276276866, -5.9382564973935503, 3.7880363384214615], [-2.3612397132491423, 7.9076786084666235, 6.6881434394589077, -3.5411797797636613], [5.0858307842690458, -1.9471711068363931, -9.0924037570822733, 3.4248168828822312]]]])+(1.-msk_ref)*numarray.array([[[[3.2558298420390832, -5.6649010904527994, 6.8741409206040709, 2.3942796381246985], [3.6162843157954541, 6.5878895025755728, -0.58638693563644573, -2.2945550678745148], [6.5366952289276066, 4.8793732877008011, -0.36187833619029774, -0.22179267551309101]], [[0.54551165363519338, -3.5648115071384296, 3.3400504533460582, 3.1180597261424818], [5.7846886934035586, -1.1043481612719912, -2.63116311251677, -1.196474444964037], [7.7061531735330018, 2.5342395084524254, -8.4230448405757858, 5.1379716827226893]]], [[[0.19603839648528876, -2.5104840194304319, -4.9670575046338108, 3.6638171005414875], [-5.2337722702839988, 2.8426930112094917, 2.4723225271505775, 1.9732146853615733], [-0.043317945389794943, 8.7253532155655407, -2.6948548397224279, -0.11722790219478885]], [[-4.9344101757148495, -3.3099703624852657, -5.9276382359889279, -6.1527710225971397], [0.58737887014114687, -6.1916944978948436, -1.8410050343293127, -5.6774488952603139], [-0.10502471709837469, -1.5116902030014687, 3.8693210135481246, -4.1787165614155981]]], [[[-2.0331659601574215, 2.6423508183647542, 2.1310751995191133, -7.8563340886456512], [5.6451941208665124, 2.4573343884044316, -1.9425566471843956, -8.2999342356910084], [-6.3523260642578183, -2.7059660635395963, 1.6676716207038802, -4.2331322279556716]], [[6.7907497844717764, 3.7739862663859078, -0.53168232816014793, 6.1236568007953185], [-0.24067136989108695, 4.6771865296498483, -0.60746418082574882, 5.8550190266057012], [4.8532408672840184, -2.0257196178858674, -4.4067077810612139, -1.1798120178640703]]]])
858        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
859        dsdarg=s.diff(Symbol(shape=(2,)))        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
860        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
861        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
862        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")     def test_sub_overloaded_constData_rank0_Symbol_rank0(self):
863        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg0=Data(1.30830371112,self.functionspace)
864        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        arg1=Symbol(shape=())
865        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        res=arg0-arg1
866        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        s1=numarray.array(0.0412291309402)
867        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        sub=res.substitute({arg1:s1})
868        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        ref=Data(1.26707458018,self.functionspace)
869        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
870        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
871        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
872        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
873        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")     def test_sub_overloaded_constData_rank0_Symbol_rank1(self):
874        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        arg0=Data(-4.2604726935,self.functionspace)
875          arg1=Symbol(shape=(2,))
876        dsds=s.diff(s)        res=arg0-arg1
877        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        s1=numarray.array([-3.8546037299533653, -1.305392606117024])
878        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        sub=res.substitute({arg1:s1})
879          ref=Data(numarray.array([-0.4058689635493371, -2.9550800873856784]),self.functionspace)
880        sa=s.getSubstitutedArguments({s2:-10})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
881        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
882          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
883        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
884        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")     def test_sub_overloaded_constData_rank0_Symbol_rank2(self):
885        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")        arg0=Data(0.902009664206,self.functionspace)
886        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        arg1=Symbol(shape=(4, 5))
887        self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")        res=arg0-arg1
888        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        s1=numarray.array([[-3.117681444740418, -3.2512793024980069, -3.7762244881344218, -0.50644943812549315, 3.066726444630655], [-2.6348956508380805, -0.90372740616696667, 0.5252271533586752, 2.0132741900533446, 2.0837322808099037], [0.088376617597372586, 0.67864487020517306, 3.7057383001711681, 1.0445042366908988, -2.1093161712985955], [4.328915747720707, -0.73501622742024342, -0.088412628376807412, -3.0414953794209754, 1.610361274316344]])
889        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        sub=res.substitute({arg1:s1})
890        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        ref=Data(numarray.array([[4.0196911089468177, 4.1532889667044071, 4.6782341523408215, 1.4084591023318929, -2.1647167804242553], [3.5369053150444802, 1.8057370703733664, 0.37678251084772452, -1.1112645258469449, -1.181722616603504], [0.81363304660902713, 0.22336479400122666, -2.8037286359647684, -0.14249457248449904, 3.0113258355049952], [-3.4269060835143073, 1.6370258916266431, 0.99042229258320713, 3.9435050436273751, -0.7083516101099443]]),self.functionspace)
891     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
892     def test_Symbol_rank0_dd_nargs1(self):        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
893        s2=Symbol(shape=())        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
894        s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[s2])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
895        self.failUnlessEqual(s.getRank(),0,"wrong rank.")     def test_sub_overloaded_constData_rank0_Symbol_rank3(self):
896        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        arg0=Data(4.30012329043,self.functionspace)
897        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        arg1=Symbol(shape=(6, 2, 2))
898        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        res=arg0-arg1
899          s1=numarray.array([[[-2.4328051948060772, 1.3096803933228829], [-1.9201038070201615, 2.2529209930562519]], [[4.4911763191005498, -0.0070408039855616167], [-4.5070979412665588, 0.23394826644475319]], [[-2.0679275681214171, 4.7260141882743518], [-1.9530690972223672, 4.2165911161948344]], [[4.2340594486013217, 0.31531838157863668], [1.2102543060708451, 4.5768051588147358]], [[4.9016533619135778, 1.0237157761801843], [-1.6198381225390657, 1.509534129406096]], [[-2.8351524725878399, -0.8712771035569391], [-1.2500793307427105, 0.52784760832550681]]])
900        ss=s.substitute({s:numarray.zeros(())})        sub=res.substitute({arg1:s1})
901        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        ref=Data(numarray.array([[[6.732928485237343, 2.990442897108383], [6.2202270974514278, 2.0472022973750139]], [[-0.19105302866928398, 4.3071640944168275], [8.8072212316978238, 4.0661750239865126]], [[6.3680508585526834, -0.42589089784308598], [6.2531923876536331, 0.083532174236431445]], [[0.066063841829944181, 3.9848049088526292], [3.0898689843604208, -0.27668186838346998]], [[-0.60153007148231197, 3.2764075142510816], [5.9199614129703315, 2.7905891610251699]], [[7.1352757630191057, 5.1714003939882049], [5.5502026211739768, 3.772275682105759]]]),self.functionspace)
902        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
903        try:        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
904          s.substitute({s:numarray.zeros((5,))})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
905          fail("illegal substition was successful")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
906        except TypeError:     def test_sub_overloaded_constData_rank0_Symbol_rank4(self):
907          pass        arg0=Data(-3.5839426267,self.functionspace)
908          arg1=Symbol(shape=(3, 2, 3, 4))
909        dsdarg=s.diff(Symbol(shape=()))        res=arg0-arg1
910        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        s1=numarray.array([[[[-2.9729696451374421, 2.7845056200381855, 0.070436437102223692, 0.66836223796868044], [0.40381761203578836, -1.7869220467261826, -4.3681167712065552, 1.0762008553734699], [-3.4293067325266744, -3.8959384230092855, -4.2869773308861872, -3.5982581222849266]], [[3.8085384127848325, -4.9902013750126919, 1.7025140755302903, -1.8585391591273237], [-1.8948326373524536, 2.0874520505745666, -1.8647114753321095, 3.9665649921657007], [-2.6617432109425376, -0.043781338271665859, -4.3924469058705498, -4.6038566089651081]]], [[[4.1612414942039617, -0.24691459950937489, 1.8801077349311939, -4.0607604598486082], [-0.48975931816079132, 4.776651055544292, 2.5892649853139229, 2.6300466396994988], [-0.6331493645323949, -4.8747858313906498, 2.5714462579440713, -0.12625615907892662]], [[1.8766405716198298, 0.97931619405259518, -1.2333119307639082, 3.632140408148242], [0.96979041799351151, -4.0819837173164526, 3.4625138677193164, -1.7431511130821575], [-2.7530992377422381, -3.1495479306859906, 1.3466227111831488, -2.3016323722421128]]], [[[-2.8378224290103491, -0.7230057223129247, 0.95865498114414649, 0.14297561114879365], [2.3319242484901492, 4.9972541799736234, -1.7121650896762564, 1.6097551517446558], [2.7133813837524077, -3.1913323682416994, -0.39896207531318861, -3.2753783571190107]], [[1.3158800827274399, -0.034075573686918936, 3.2707189112070392, -2.9118211235462041], [4.362994678434946, -3.2771781302292515, 3.4919565479064456, 1.6061522420425254], [-1.8973785117347788, -4.4461539342202174, -3.8132486661529263, -0.74231592463494511]]]])
911        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        sub=res.substitute({arg1:s1})
912        dsdarg=s.diff(Symbol(shape=(2,)))        ref=Data(numarray.array([[[[-0.61097298156602342, -6.368448246741651, -3.6543790638056892, -4.252304864672146], [-3.9877602387392539, -1.7970205799772829, 0.78417414450308964, -4.6601434820769354], [-0.15463589417679113, 0.31199579630581997, 0.70303470418272163, 0.014315495581461057]], [[-7.392481039488298, 1.4062587483092264, -5.2864567022337559, -1.7254034675761418], [-1.689109989351012, -5.6713946772780321, -1.7192311513713561, -7.5505076188691662], [-0.9221994157609279, -3.5401612884317997, 0.80850427916708423, 1.0199139822616425]]], [[[-7.7451841209074272, -3.3370280271940906, -5.4640503616346594, 0.4768178331451427], [-3.0941833085426742, -8.3605936822477567, -6.1732076120173884, -6.2139892664029643], [-2.9507932621710706, 1.2908432046871843, -6.1553888846475369, -3.4576864676245389]], [[-5.4605831983232953, -4.5632588207560607, -2.3506306959395573, -7.2160830348517075], [-4.553733044696977, 0.49804109061298707, -7.0464564944227819, -1.840791513621308], [-0.83084338896122745, -0.43439469601747493, -4.9305653378866143, -1.2823102544613527]]], [[[-0.74612019769311644, -2.8609369043905408, -4.542597607847612, -3.7269182378522592], [-5.9158668751936148, -8.5811968066770881, -1.8717775370272092, -5.1936977784481213], [-6.2973240104558732, -0.39261025846176612, -3.1849805513902769, -0.30856426958445482]], [[-4.8998227094309055, -3.5498670530165466, -6.8546615379105047, -0.67212150315726138], [-7.9469373051384116, -0.306764496474214, -7.0758991746099111, -5.1900948687459909], [-1.6865641149686867, 0.8622113075167519, 0.22930603944946082, -2.8416267020685204]]]]),self.functionspace)
913        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
914        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
915        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
916        dsdarg=s.diff(Symbol(shape=(4, 5)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
917        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     def test_sub_overloaded_constData_rank1_Symbol_rank0(self):
918        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        arg0=Data(numarray.array([2.6649927252905226, 0.29496968217893382]),self.functionspace)
919        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        arg1=Symbol(shape=())
920        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        res=arg0-arg1
921        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        s1=numarray.array(1.03366663195)
922        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        sub=res.substitute({arg1:s1})
923        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        ref=Data(numarray.array([1.6313260933372291, -0.73869694977435962]),self.functionspace)
924        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
925        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
926        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
927        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
928       def test_sub_overloaded_constData_rank1_Symbol_rank1(self):
929        dsds=s.diff(s)        arg0=Data(numarray.array([3.9090880537794526, -3.9706193840215942]),self.functionspace)
930        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        arg1=Symbol(shape=(2,))
931        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        res=arg0-arg1
932          s1=numarray.array([-3.7233870114697742, 0.99043840493200186])
933        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        sub=res.substitute({arg1:s1})
934        sa=s.getSubstitutedArguments({s2:-10})        ref=Data(numarray.array([7.6324750652492268, -4.9610577889535961]),self.functionspace)
935        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
936        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
937          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
938        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
939        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")     def test_sub_overloaded_constData_rank2_Symbol_rank0(self):
940        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")        arg0=Data(numarray.array([[2.8033126273843685, 0.51509190965393792, 3.931306976936968, -3.3823534090429486, -2.3486719525293087], [-2.9837425664154784, -2.4457160287299686, 3.8981965382683743, -0.89609359902144714, 4.1620406111464288], [3.6868893591462246, -2.9993029597001462, 1.8283120616948665, -2.0195573949932277, -2.1640627499057361], [-2.9723279323425489, -4.8559061533246624, -1.0130455282709172, -3.7833351321644395, 3.514692525422209]]),self.functionspace)
941        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        arg1=Symbol(shape=())
942        self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")        res=arg0-arg1
943        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        s1=numarray.array(4.86937457463)
944        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        sub=res.substitute({arg1:s1})
945        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        ref=Data(numarray.array([[-2.0660619472497519, -4.3542826649801825, -0.93806759769715242, -8.2517279836770694, -7.2180465271634286], [-7.8531171410495988, -7.315090603364089, -0.97117803636574607, -5.7654681736555675, -0.70733396348769162], [-1.1824852154878958, -7.8686775343342665, -3.0410625129392539, -6.8889319696273486, -7.0334373245398565], [-7.8417025069766693, -9.7252807279587827, -5.8824201029050371, -8.6527097067985608, -1.3546820492119114]]),self.functionspace)
946     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
947     def test_Symbol_rank0_dd_nargs2(self):        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
948        s2=Symbol(shape=())        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
949        s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[1, -1.0])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
950        self.failUnlessEqual(s.getRank(),0,"wrong rank.")     def test_sub_overloaded_constData_rank2_Symbol_rank2(self):
951        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        arg0=Data(numarray.array([[-1.1140360715186182, -1.5235600156934481, 4.3075103934286023, 4.6800377743432158, -3.2505150436972521], [0.39123458636258768, 0.41088806870879768, -2.9614108446790501, 1.1049238977643405, 0.92166667279843395], [0.54565864417397059, -4.8476249672143004, 4.9444652981547943, 4.0252126389168215, -3.9123423425216322], [-3.6777596228844844, -3.4408972758983558, 2.7718180074050611, -0.3997152204895924, -0.16573647825956073]]),self.functionspace)
952        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        arg1=Symbol(shape=(4, 5))
953        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        res=arg0-arg1
954          s1=numarray.array([[-2.4209487163246299, 1.3152643083131128, -0.71046464711788015, 0.21557543046364458, -2.202065459251934], [-3.9101544501984198, -2.8682151089642827, 2.7125251197023488, 1.4173123031722534, 2.7246295240806209], [-1.5744991442525436, 3.0598215212654001, 0.63494427405471487, -4.906149376046594, -1.6839564426436748], [4.0729555430880922, -0.83371622418680769, 0.46337987461630981, 4.0014755703742395, -2.1103899940006032]])
955        ss=s.substitute({s:numarray.zeros(())})        sub=res.substitute({arg1:s1})
956        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        ref=Data(numarray.array([[1.3069126448060118, -2.8388243240065609, 5.0179750405464825, 4.4644623438795712, -1.0484495844453181], [4.301389036561007, 3.2791031776730803, -5.6739359643813989, -0.31238840540791291, -1.8029628512821869], [2.1201577884265141, -7.9074464884797004, 4.3095210241000794, 8.9313620149634154, -2.2283858998779573], [-7.7507151659725766, -2.6071810517115481, 2.3084381327887513, -4.4011907908638319, 1.9446535157410425]]),self.functionspace)
957        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
958        try:        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
959          s.substitute({s:numarray.zeros((5,))})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
960          fail("illegal substition was successful")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
961        except TypeError:     def test_sub_overloaded_constData_rank3_Symbol_rank0(self):
962          pass        arg0=Data(numarray.array([[[-2.6064326776506652, 4.9989076052590633], [-3.0068821433777249, -3.1193113732509516]], [[-1.3190483681618739, 3.9479827067009108], [1.0954417889014865, 4.6359051697534426]], [[-2.9778493741722056, 3.4845430816156977], [1.7569072943914552, 1.1616150547614428]], [[-0.91210869485198565, -1.3406976214361355], [3.2217649968914159, -2.662260898242006]], [[4.1697693146337542, -1.1741423631833072], [-4.9803850608859115, 1.2700647554700222]], [[4.6074170359664368, 1.453706456526124], [0.20949339688511692, 3.0091215511346796]]]),self.functionspace)
963          arg1=Symbol(shape=())
964        dsdarg=s.diff(Symbol(shape=()))        res=arg0-arg1
965        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        s1=numarray.array(-1.04145599079)
966        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        sub=res.substitute({arg1:s1})
967        dsdarg=s.diff(Symbol(shape=(2,)))        ref=Data(numarray.array([[[-1.5649766868561219, 6.0403635960536066], [-1.9654261525831815, -2.0778553824564083]], [[-0.27759237736733056, 4.9894386974954541], [2.1368977796960298, 5.6773611605479859]], [[-1.9363933833776623, 4.525999072410241], [2.7983632851859985, 2.2030710455559861]], [[0.12934729594255767, -0.29924163064159215], [4.2632209876859593, -1.6208049074474626]], [[5.2112253054282975, -0.13268637238876391], [-3.9389290700913682, 2.3115207462645655]], [[5.6488730267609801, 2.4951624473206673], [1.2509493876796602, 4.0505775419292229]]]),self.functionspace)
968        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
969        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
970        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
971        dsdarg=s.diff(Symbol(shape=(4, 5)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
972        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     def test_sub_overloaded_constData_rank3_Symbol_rank3(self):
973        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        arg0=Data(numarray.array([[[2.0075159970537113, 4.417162011434554], [0.71949384400506577, 1.0783048900035652]], [[4.7614254606302335, -2.0888542276996978], [-3.5997702799671547, 4.2825487871951644]], [[-0.39389734575197544, 1.3283252585178928], [3.6919455158435834, -0.76277259642421402]], [[-4.4972180700076887, -3.7983795355307128], [-0.26779668046970784, -0.79380221724008582]], [[-2.0572521505738273, -1.5154686544559368], [4.0972713376059851, 4.5986089620495108]], [[-1.3971821196462377, 0.16028646761807508], [-0.63755809097850857, -3.3787710682197272]]]),self.functionspace)
974        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        arg1=Symbol(shape=(6, 2, 2))
975        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        res=arg0-arg1
976        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        s1=numarray.array([[[3.5103565349856751, 0.91526758558677379], [-3.7224124618951135, -0.27931399630195397]], [[1.5813622936549105, 3.6172915696233972], [-1.2364412564258132, 0.16417768270487709]], [[0.64050559170122234, 4.6361361331624593], [-0.47839680540824325, -2.1615310941440589]], [[-0.85667930966756511, 1.669882578368358], [0.22343162562157293, 0.80905790542025358]], [[-3.5873387244847543, 3.1163266795230058], [3.5553732672252671, -4.6758779472194405]], [[3.6742958529176484, 0.58762359541383802], [1.5778519953325496, -0.39731537378910975]]])
977        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        sub=res.substitute({arg1:s1})
978        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        ref=Data(numarray.array([[[-1.5028405379319638, 3.5018944258477802], [4.4419063059001793, 1.3576188863055192]], [[3.180063166975323, -5.7061457973230949], [-2.3633290235413416, 4.1183711044902873]], [[-1.0344029374531978, -3.3078108746445665], [4.1703423212518267, 1.3987584977198448]], [[-3.6405387603401236, -5.4682621138990708], [-0.49122830609128076, -1.6028601226603394]], [[1.5300865739109271, -4.6317953339789426], [0.54189807038071791, 9.2744869092689513]], [[-5.0714779725638861, -0.42733712779576294], [-2.2154100863110582, -2.9814556944306174]]]),self.functionspace)
979        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
980        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
981        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
982        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
983       def test_sub_overloaded_constData_rank4_Symbol_rank0(self):
984        dsds=s.diff(s)        arg0=Data(numarray.array([[[[0.66483074145605592, 2.9129070748039982, -1.8655842911981346, -1.098354904466996], [1.7426470733136448, -2.4896761957460898, 4.3864323453867851, -4.0781460331955177], [-0.62183708580819008, -2.6186592235582786, -1.8750164189422014, -3.9631241880095969]], [[4.0419620323350909, 0.15536839603964836, 1.9771157591398101, -2.6101097405194453], [-4.7364297803535704, 1.8318126417179714, 3.2354822684907454, 2.2507758179659376], [-4.8699934080808029, -0.35744120243411981, 4.0908957400805122, -3.8440017446794084]]], [[[4.5466344627836612, -2.8174576749848423, -0.32339288977492142, -3.3368918944053516], [3.3311423168153738, -1.2448667289851647, -0.66737673743075376, -3.9953617725851598], [-4.8878412407428931, 3.1347720870691358, -2.4390985397355847, -3.5615840737730475]], [[-3.7978882365989697, 4.345238312451805, 2.8310129832366435, 2.8564779239624674], [-0.85025481289091864, -4.3757742754757345, 3.5451710843902031, -2.5068001174158816], [2.6943798866386315, 2.2746017608025317, -4.2655778273063607, 0.97165631163417387]]], [[[-2.9330039029788955, 4.3910413333213238, 2.5513441899802833, -3.8678703253194402], [-2.6748516851594308, -3.8887038302549062, 1.2485088138696518, -3.9629424578182251], [-0.38166273681210328, 3.82781593241344, -4.1817331752844087, 4.682478964767725]], [[-0.85849290617372809, -0.49338756563096275, -1.0480256440941615, -0.51008618582467946], [-0.26820315453886501, 4.8354933917592806, 2.9555158912003154, -2.4766421456452479], [2.5098219987182944, 3.6215601735655589, -4.4497307132070123, -3.9295385075107028]]]]),self.functionspace)
985        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        arg1=Symbol(shape=())
986        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        res=arg0-arg1
987          s1=numarray.array(-2.59361652138)
988        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        sub=res.substitute({arg1:s1})
989        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        ref=Data(numarray.array([[[[3.2584472628375467, 5.506523596185489, 0.72803223018335617, 1.4952616169144948], [4.3362635946951356, 0.10394032563540101, 6.9800488667682759, -1.4845295118140269], [1.9717794355733007, -0.025042702176787834, 0.7186001024392894, -1.3695076666281061]], [[6.6355785537165817, 2.7489849174211392, 4.5707322805213009, -0.01649321913795454], [-2.1428132589720796, 4.4254291630994622, 5.8290987898722362, 4.8443923393474284], [-2.2763768866993122, 2.236175318947371, 6.6845122614620029, -1.2503852232979176]]], [[[7.140250984165152, -0.22384115360335155, 2.2702236316065694, -0.74327537302386082], [5.9247588381968646, 1.3487497923963261, 1.926239783950737, -1.401745251203669], [-2.2942247193614023, 5.7283886084506266, 0.15451798164590613, -0.96796755239155674]], [[-1.2042717152174789, 6.9388548338332958, 5.4246295046181343, 5.4500944453439581], [1.7433617084905721, -1.7821577540942437, 6.1387876057716939, 0.08681640396560919], [5.2879964080201223, 4.8682182821840225, -1.6719613059248699, 3.5652728330156647]]], [[[-0.33938738159740467, 6.9846578547028146, 5.1449607113617741, -1.2742538039379494], [-0.081235163777940045, -1.2950873088734154, 3.8421253352511426, -1.3693259364367343], [2.2119537845693875, 6.4214324537949308, -1.5881166539029179, 7.2760954861492158]], [[1.7351236152077627, 2.100228955750528, 1.5455908772873292, 2.0835303355568113], [2.3254133668426258, 7.4291099131407714, 5.5491324125818062, 0.11697437573624292], [5.1034385200997852, 6.2151766949470497, -1.8561141918255215, -1.335921986129212]]]]),self.functionspace)
990        sa=s.getSubstitutedArguments({s2:-10})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
991        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
992        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
993        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
994       def test_sub_overloaded_constData_rank4_Symbol_rank4(self):
995        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        arg0=Data(numarray.array([[[[2.140332416756844, -4.5756565160935745, 1.0268217328307561, 1.594533973931731], [4.1426026647673879, 0.1548614651600202, 3.351820863446946, 0.54777524679756073], [-4.6470169243406527, -3.4101935702258368, 1.3604597013400213, -4.3236653508957374]], [[2.3543066928954612, 1.6355558219698443, 3.8590758340122093, 0.055467084597328409], [1.3949738751098479, -2.9042097100731445, 2.1331143130237962, -0.45715627400394165], [3.9505052117900146, -4.8644226435153097, 0.13641466419900183, 0.92434447564323374]]], [[[-4.2036478385109302, -2.2096856472681958, -3.309442061812593, -0.17761420723311439], [-4.5417481392819026, 3.354117107537796, 2.9925164896060084, 4.231145636082223], [-4.3165407391400308, -0.16204594013147311, -1.5308101185053733, 3.7017204822457384]], [[2.4648028362561725, 0.43817614121240833, -4.4908194091317366, -0.081928750874263656], [-3.4087689978816016, 4.259133980931324, -4.2850896710829334, 4.6395735766216326], [-1.3584480043808989, -4.7738821023855085, -1.2617431337636842, -1.2598313032270116]]], [[[2.2708892792624855, 1.9132737394453327, -0.50215367058696003, 0.19108419265161469], [-2.0796597802531669, 1.1505151966811367, 1.2957662425378791, -1.5883201097665802], [-1.7035021892623838, 4.8639671345493021, 3.1243484697100534, 0.47610495992410051]], [[-4.0444287366693015, -1.3614006776767349, -0.18268931922481002, 4.8063591217845332], [3.1407426206783704, 2.8940879164962441, -4.9664997014592807, 1.6951588068340158], [-3.895479459710558, 1.7220903215355694, -3.7165673657855267, 3.1903385713544257]]]]),self.functionspace)
996        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        arg1=Symbol(shape=(3, 2, 3, 4))
997        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")        res=arg0-arg1
998        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        s1=numarray.array([[[[-4.3482304868754991, -1.2480666735558845, 0.43538858115159051, -2.0858236027245205], [-2.442305699452354, 2.0213192586154003, -2.5262404161243679, -4.458062700052194], [0.26228138879138641, -2.6430658161459242, -4.7246503759525602, 4.2538788761081854]], [[-1.6124403577544308, -1.8284497197976037, -3.0160374139385002, 2.7523938918136759], [1.4437250527651582, -2.7814473787336489, 3.5116683735594361, -3.9808640616716562], [1.7054962689298705, 4.7974185413341068, 1.9447068850818283, -1.2797130952071156]]], [[[3.7642823106611107, 0.11145650212965919, -0.096799862214571597, 2.0215787533002523], [0.26390717935294816, 0.12612295721321498, 4.0275730341758482, -1.2268861937462172], [-2.947926663434548, -1.4514539315574626, 2.4550945474164232, -2.7897655841602651]], [[-1.5947829088079746, 0.80620330852535815, -4.5614285986030234, -1.9102368071164841], [2.0807019362652692, -4.099640999530064, -1.8395330667711352, -4.6367501410986929], [-2.5162327168837786, 4.6954385782651951, -2.1576821461704854, -1.62194811763983]]], [[[0.06729391952569852, -0.57919376543293488, -3.1838952254737416, 1.7056529660452817], [3.6116233555564143, 0.81964000588296315, -0.16440769780998377, 0.079355513141521783], [2.9805073823987431, 1.3188532056435962, 3.4153481616516537, -2.5138710663982189]], [[2.8884594089569315, 1.1351683507610142, -0.68804270946144719, -4.7325886514124882], [1.1204800401276476, 0.55566378590737031, 0.94240513232859335, 2.9610440134171334], [-2.6222587774463815, -4.4048348584786705, -0.29650368246657699, -1.0078523107846902]]]])
999        self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")        sub=res.substitute({arg1:s1})
1000        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        ref=Data(numarray.array([[[[6.4885629036323431, -3.32758984253769, 0.59143315167916555, 3.6803575766562515], [6.5849083642197419, -1.8664577934553801, 5.8780612795713143, 5.0058379468497547], [-4.9092983131320391, -0.76712775407991263, 6.0851100772925815, -8.5775442270039228]], [[3.9667470506498921, 3.464005541767448, 6.8751132479507095, -2.6969268072163475], [-0.048751177655310229, -0.12276233133949566, -1.3785540605356399, 3.5237077876677145], [2.2450089428601441, -9.6618411848494166, -1.8082922208828265, 2.2040575708503494]]], [[[-7.9679301491720409, -2.321142149397855, -3.2126421995980214, -2.1991929605333667], [-4.8056553186348507, 3.227994150324581, -1.0350565445698399, 5.4580318298284407], [-1.3686140757054828, 1.2894079914259895, -3.9859046659217965, 6.4914860664060035]], [[4.0595857450641475, -0.36802716731294982, 0.070609189471286804, 1.8283080562422205], [-5.4894709341468708, 8.3587749804613871, -2.4455566043117982, 9.2763237177203255], [1.1577847125028797, -9.4693206806507035, 0.89593901240680118, 0.3621168144128184]]], [[[2.203595359736787, 2.4924675048782676, 2.6817415548867816, -1.514568773393667], [-5.6912831358095808, 0.33087519079817351, 1.4601739403478629, -1.667675622908102], [-4.684009571661127, 3.5451139289057059, -0.29099969194160025, 2.9899760263223194]], [[-6.932888145626233, -2.4965690284377491, 0.50535339023663717, 9.5389477731970214], [2.0202625805507228, 2.3384241305888738, -5.908904833787874, -1.2658852065831177], [-1.2732206822641765, 6.1269251800142399, -3.4200636833189497, 4.1981908821391158]]]]),self.functionspace)
1001        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1002        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1003     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1004     def test_Symbol_rank0_d1_nargs0(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1005        s2=Symbol(shape=())     def test_sub_overloaded_taggedData_rank0_Symbol_rank0(self):
1006        s=Symbol(shape=(),dim=1,args=[])        arg0=Data(-2.29417952191,self.functionspace)
1007        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        arg0.setTaggedValue(1,-4.27612309963)
1008        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        arg1=Symbol(shape=())
1009        self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")        res=arg0-arg1
1010        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        s1=numarray.array(-2.86386679086)
1011          sub=res.substitute({arg1:s1})
1012        ss=s.substitute({s:numarray.zeros(())})        ref=Data(0.569687268944,self.functionspace)
1013        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        ref.setTaggedValue(1,-1.41225630877)
1014        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1015        try:        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1016          s.substitute({s:numarray.zeros((5,))})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1017          fail("illegal substition was successful")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1018        except TypeError:     def test_sub_overloaded_taggedData_rank0_Symbol_rank1(self):
1019          pass        arg0=Data(-4.72691427991,self.functionspace)
1020          arg0.setTaggedValue(1,0.483106242273)
1021        dsdarg=s.diff(Symbol(shape=()))        arg1=Symbol(shape=(2,))
1022        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        res=arg0-arg1
1023        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        s1=numarray.array([-0.58516003749737244, 2.93231182282255])
1024        dsdarg=s.diff(Symbol(shape=(2,)))        sub=res.substitute({arg1:s1})
1025        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        ref=Data(numarray.array([-4.1417542424175267, -7.6592261027374491]),self.functionspace)
1026        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        ref.setTaggedValue(1,numarray.array([1.0682662797700972, -2.4492055805498252]))
1027        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1028        dsdarg=s.diff(Symbol(shape=(4, 5)))        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1029        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1030        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1031        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")     def test_sub_overloaded_taggedData_rank0_Symbol_rank2(self):
1032        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg0=Data(4.84060376911,self.functionspace)
1033        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        arg0.setTaggedValue(1,-3.32867505476)
1034        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        arg1=Symbol(shape=(4, 5))
1035        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        res=arg0-arg1
1036        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        s1=numarray.array([[3.5332516865172998, 4.2256878903288939, -4.6404295927681405, 4.9721874322243114, -1.5545932240349902], [0.40603544670242542, -2.879718425724147, -2.1385047584627337, 4.6127992237598132, 0.57646645021785048], [-2.6334801212800754, -2.3655947826469701, 0.48086858542515643, 1.0360291664664301, -3.4378490059536082], [-0.23853194944872236, -2.0363663305583768, -2.3289186751171798, 3.5102407359843486, 4.1303419895739388]])
1037        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        sub=res.substitute({arg1:s1})
1038        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        ref=Data(numarray.array([[1.3073520825884426, 0.6149158787768485, 9.4810333618738838, -0.13158366311856895, 6.3951969931407326], [4.434568322403317, 7.7203221948298895, 6.9791085275684761, 0.2278045453459292, 4.2641373188878919], [7.4740838903858178, 7.2061985517527125, 4.359735183680586, 3.8045746026393124, 8.2784527750593497], [5.0791357185544648, 6.8769700996641188, 7.1695224442229222, 1.3303630331213938, 0.71026177953180358]]),self.functionspace)
1039        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        ref.setTaggedValue(1,numarray.array([[-6.8619267412736988, -7.5543629450852929, 1.3117545380117415, -8.3008624869807104, -1.7740818307214088], [-3.7347105014588244, -0.44895662903225197, -1.1901702962936653, -7.9414742785162122, -3.9051415049742495], [-0.69519493347632366, -0.96308027210942893, -3.8095436401815554, -4.3647042212228291, 0.10917395119720918], [-3.0901431053076767, -1.2923087241980222, -0.99975637963921926, -6.8389157907407476, -7.4590170443303379]]))
1040          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1041        dsds=s.diff(s)        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1042        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1043        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1044       def test_sub_overloaded_taggedData_rank0_Symbol_rank3(self):
1045        sa=s.getSubstitutedArguments({s2:-10})        arg0=Data(-3.20552188916,self.functionspace)
1046        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        arg0.setTaggedValue(1,-0.473083670166)
1047          arg1=Symbol(shape=(6, 2, 2))
1048        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        res=arg0-arg1
1049        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        s1=numarray.array([[[0.71230320805011704, -3.008236723891188], [0.81066003773158002, -3.6043239509733382]], [[3.691034498943317, -3.3919882986743777], [0.84551364067512935, 3.3207859438709946]], [[0.41963337446652105, -3.6038224020133991], [-2.3537235378574151, -3.7120927558232997]], [[-3.4588851001838727, -0.31880183563871789], [-1.3379489058063267, -3.9118810181560226]], [[4.4984539881701195, -3.2158956295350851], [1.5013508852420685, 2.8717656529358955]], [[-0.13701019263353231, -3.1176264463626078], [-1.67955120335195, 4.317481449568719]]])
1050        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")        sub=res.substitute({arg1:s1})
1051        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")        ref=Data(numarray.array([[[-3.917825097207726, -0.19728516526642093], [-4.016181926889189, 0.3988020618157293]], [[-6.896556388100926, 0.18646640951676874], [-4.0510355298327383, -6.5263078330286035]], [[-3.62515526362413, 0.39830051285579016], [-0.85179835130019388, 0.50657086666569073]], [[0.2533632110262638, -2.886720053518891], [-1.8675729833512822, 0.70635912899841369]], [[-7.7039758773277285, 0.010373740377476182], [-4.7068727743996774, -6.0772875420935044]], [[-3.0685116965240766, -0.087895442795001166], [-1.525970685805659, -7.523003338726328]]]),self.functionspace)
1052        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        ref.setTaggedValue(1,numarray.array([[[-1.1853868782160886, 2.5351530537252165], [-1.2837437078975515, 3.1312402808073667]], [[-4.1641181691092886, 2.9189046285084062], [-1.3185973108411009, -3.7938696140369661]], [[-0.89271704463249257, 3.1307387318474276], [1.8806398676914435, 3.2390090856573281]], [[2.9858014300179012, -0.15428183452725364], [0.86486523564035522, 3.4387973479900511]], [[-4.9715376583360911, 2.7428119593691136], [-1.97443455540804, -3.344849323101867]], [[-0.33607347753243921, 2.6445427761966362], [1.2064675331859784, -4.7905651197346906]]]))
1053        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1054        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1055     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1056     def test_Symbol_rank0_d1_nargs1(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1057        s2=Symbol(shape=())     def test_sub_overloaded_taggedData_rank0_Symbol_rank4(self):
1058        s=Symbol(shape=(),dim=1,args=[s2])        arg0=Data(-0.215341183726,self.functionspace)
1059        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        arg0.setTaggedValue(1,-3.01917111711)
1060        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        arg1=Symbol(shape=(3, 2, 3, 4))
1061        self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")        res=arg0-arg1
1062        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        s1=numarray.array([[[[3.1718058337950783, -4.3218518167555349, 4.7360170033398816, 2.6415781893387447], [1.7953624357215787, 0.37239845986582054, 0.85595953231170441, -4.2093909477304852], [-4.0724848735753412, -2.3789549933876364, 3.8266481046469991, -4.4686983670793881]], [[-1.3807814097985793, -0.9345570079736385, 3.2111606830229267, 2.5248569160832579], [-0.19847478717542089, 3.6200277417416071, -1.3367301493578787, -1.9914051287776093], [4.2384277387383236, -3.1625190831895669, -4.8267032630177118, -3.7590986361039294]]], [[[-0.96721285038350846, 0.23717549644533698, -2.0558971771798862, -2.1889488119398925], [2.1163450477817447, -4.308535473047935, 0.96468545582662735, 0.58036767508710252], [-0.26889479983427034, -4.6749066439752021, -2.6908936581627731, 3.3090528029139286]], [[1.0683391958055246, -4.3705975019062535, 4.6959723711804546, -0.58815635047014858], [-1.7921642772643898, 2.8079866307247423, 4.5837878995413348, -3.6656523242301429], [2.1083853748587442, -0.44280454111162726, -2.5427523262585563, 3.9551312168955626]]], [[[4.0479839543530591, 1.694708528108122, -1.8081650371476021, 2.5627212563151982], [2.9443513555348222, -3.4330381296191126, -2.3471872352829837, 2.9291777099369405], [0.92208424820838264, -1.7857214370413055, 3.2638247404414695, 3.3713981402987798]], [[-2.3853121535462418, 2.1417428055374232, 3.1558224539661612, -4.4802179321245248], [-3.0197245205703069, 2.7624146301708477, -4.6790033997765104, -4.0453165901737584], [4.8295161047601614, -3.5764718373510842, 4.356981591617421, -4.7034098127513264]]]])
1063          sub=res.substitute({arg1:s1})
1064        ss=s.substitute({s:numarray.zeros(())})        ref=Data(numarray.array([[[[-3.3871470175211567, 4.1065106330294565, -4.95135818706596, -2.856919373064823], [-2.0107036194476571, -0.5877396435918989, -1.0713007160377828, 3.9940497640044068], [3.8571436898492628, 2.163613809661558, -4.0419892883730775, 4.2533571833533097]], [[1.165440226072501, 0.71921582424756014, -3.426501866749005, -2.7401980998093363], [-0.01686639655065747, -3.8353689254676855, 1.1213889656318003, 1.776063945051531], [-4.4537689224644019, 2.9471778994634885, 4.6113620792916334, 3.543757452377851]]], [[[0.7518716666574301, -0.45251668017141533, 1.8405559934538078, 1.9736076282138142], [-2.3316862315078231, 4.0931942893218567, -1.1800266395527057, -0.79570885881318087], [0.053553616108191981, 4.4595654602491237, 2.4755524744366948, -3.5243939866400069]], [[-1.283680379531603, 4.1552563181801752, -4.911313554906533, 0.37281516674407023], [1.5768230935383114, -3.0233278144508207, -4.7991290832674132, 3.4503111405040645], [-2.3237265585848226, 0.2274633573855489, 2.3274111425324779, -4.1704724006216409]]], [[[-4.2633251380791375, -1.9100497118342004, 1.5928238534215238, -2.7780624400412766], [-3.1596925392609005, 3.2176969458930342, 2.1318460515569053, -3.1445188936630188], [-1.137425431934461, 1.5703802533152271, -3.4791659241675479, -3.5867393240248582]], [[2.1699709698201635, -2.3570839892635016, -3.3711636376922396, 4.2648767483984464], [2.8043833368442286, -2.977755813896926, 4.463662216050432, 3.8299754064476801], [-5.0448572884862397, 3.3611306536250058, -4.5723227753434994, 4.4880686290252481]]]]),self.functionspace)
1065        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        ref.setTaggedValue(1,numarray.array([[[[-6.1909769509085075, 1.3026806996421056, -7.7551881204533109, -5.6607493064521739], [-4.8145335528350079, -3.3915695769792498, -3.8751306494251336, 1.1902198306170559], [1.0533137564619119, -0.64021612372579284, -6.8458192217604283, 1.4495272499659588]], [[-1.6383897073148499, -2.0846141091397907, -6.2303318001363559, -5.5440280331966871], [-2.8206963299380083, -6.6391988588550364, -1.6824409677555505, -1.0277659883358199], [-7.2575988558517528, 0.14334796607613765, 1.8075321459042826, 0.73992751899050013]]], [[[-2.0519582667299208, -3.2563466135587662, -0.96327393993354304, -0.83022230517353668], [-5.1355161648951739, 1.2893643559345058, -3.9838565729400566, -3.5995387922005317], [-2.7502763172791589, 1.6557355268617728, -0.32827745895065608, -6.3282239200273578]], [[-4.0875103129189538, 1.3514263847928243, -7.7151434882938839, -2.4310147666432806], [-1.2270068398490395, -5.8271577478381715, -7.602959016654764, 0.64648120711671364], [-5.1275564919721734, -2.576366576001802, -0.47641879085487293, -6.9743023340089918]]], [[[-7.0671550714664884, -4.7138796452215512, -1.2110060799658271, -5.5818923734286274], [-5.9635224726482514, 0.41386701250568336, -0.67198388183044555, -5.9483488270503697], [-3.9412553653218119, -1.2334496800721237, -6.2829958575548988, -6.390569257412209]], [[-0.63385896356718741, -5.1609139226508525, -6.1749935710795905, 1.4610468150110956], [0.0005534034568777102, -5.7815857472842769, 1.6598322826630811, 1.0261454730603292], [-7.8486872218735906, 0.55730072023765498, -7.3761527087308503, 1.6842386956378972]]]]))
1066        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1067        try:        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1068          s.substitute({s:numarray.zeros((5,))})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1069          fail("illegal substition was successful")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1070        except TypeError:     def test_sub_overloaded_taggedData_rank1_Symbol_rank0(self):
1071          pass        arg0=Data(numarray.array([3.3101673523710691, 0.048409361416743124]),self.functionspace)
1072          arg0.setTaggedValue(1,numarray.array([0.70887806236646611, -0.73932065177372408]))
1073        dsdarg=s.diff(Symbol(shape=()))        arg1=Symbol(shape=())
1074        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        res=arg0-arg1
1075        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        s1=numarray.array(1.15960287006)
1076        dsdarg=s.diff(Symbol(shape=(2,)))        sub=res.substitute({arg1:s1})
1077        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        ref=Data(numarray.array([2.1505644823090515, -1.1111935086452744]),self.functionspace)
1078        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        ref.setTaggedValue(1,numarray.array([-0.45072480769555145, -1.8989235218357416]))
1079        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1080        dsdarg=s.diff(Symbol(shape=(4, 5)))        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1081        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1082        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1083        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")     def test_sub_overloaded_taggedData_rank1_Symbol_rank1(self):
1084        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg0=Data(numarray.array([-2.0708546339036071, 2.2714034647505121]),self.functionspace)
1085        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        arg0.setTaggedValue(1,numarray.array([-0.16265022615439584, -0.29272834777410406]))
1086        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        arg1=Symbol(shape=(2,))
1087        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        res=arg0-arg1
1088        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        s1=numarray.array([1.8495632665872739, -2.2808524667130694])
1089        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        sub=res.substitute({arg1:s1})
1090        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        ref=Data(numarray.array([-3.920417900490881, 4.5522559314635815]),self.functionspace)
1091        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        ref.setTaggedValue(1,numarray.array([-2.0122134927416697, 1.9881241189389653]))
1092          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1093        dsds=s.diff(s)        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1094        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1095        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1096       def test_sub_overloaded_taggedData_rank2_Symbol_rank0(self):
1097        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        arg0=Data(numarray.array([[4.703380807076492, -4.2567944639019304, -2.0784707905046593, 0.18023637488621791, 1.1164321428411501], [3.3809585074696322, 1.5795463086222137, 1.5300027430790495, -1.6695215658775489, -4.9671698822372887], [-0.56875186129757704, -0.88988163011215704, 1.0953422249288387, 1.2629450835517639, 1.9829321534877584], [-2.3470243950738103, -1.5345245349366401, 1.7913793425402638, 3.2778179482022125, 3.2743088989127749]]),self.functionspace)
1098        sa=s.getSubstitutedArguments({s2:-10})        arg0.setTaggedValue(1,numarray.array([[2.1331140495285128, 4.902243346193929, -3.8569193535703947, -1.2051025219030698, 4.8526791592750644], [-1.9285295160668192, -2.2715983725035862, -1.6280809153232632, 0.63571110979312273, -4.5616322454088643], [1.1933837591252878, -2.4657544917793928, 3.8511059475300904, -3.0018611957635444, 3.560382804940847], [-4.284584247208282, -4.3366343606789348, 3.6048395763720524, -2.2301793774115106, 4.6397261587379131]]))
1099        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        arg1=Symbol(shape=())
1100        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        res=arg0-arg1
1101          s1=numarray.array(0.0560012612314)
1102        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        sub=res.substitute({arg1:s1})
1103        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        ref=Data(numarray.array([[4.6473795458450571, -4.3127957251333653, -2.1344720517360942, 0.12423511365478301, 1.0604308816097152], [3.3249572462381973, 1.5235450473907788, 1.4740014818476146, -1.7255228271089837, -5.0231711434687236], [-0.62475312252901194, -0.94588289134359194, 1.0393409636974038, 1.206943822320329, 1.9269308922563235], [-2.4030256563052452, -1.590525796168075, 1.7353780813088289, 3.2218166869707776, 3.21830763768134]]),self.functionspace)
1104        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")        ref.setTaggedValue(1,numarray.array([[2.0771127882970779, 4.8462420849624941, -3.9129206148018296, -1.2611037831345047, 4.7966778980436295], [-1.9845307772982541, -2.3275996337350211, -1.6840821765546981, 0.57970984856168783, -4.6176335066402991], [1.1373824978938529, -2.5217557530108277, 3.7951046862986555, -3.0578624569949793, 3.5043815437094121], [-4.3405855084397169, -4.3926356219103697, 3.5488383151406175, -2.2861806386429455, 4.5837248975064782]]))
1105        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1106        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1107        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1108        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1109     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_sub_overloaded_taggedData_rank2_Symbol_rank2(self):
1110     def test_Symbol_rank0_d1_nargs2(self):        arg0=Data(numarray.array([[0.044613582775737015, -0.22965054883260905, -3.3954728255423361, -0.043404784226975579, -0.81018025865095922], [4.0980455142640473, 3.3299876326958326, 4.4694158188546833, 0.047800124529065791, -4.1128886475115927], [-0.86793714814288414, 3.7852706993586231, 2.8168181178475837, -2.6081900317073039, 1.795227525921204], [-2.7964436060814792, 2.46599228887926, -4.3894587372918519, -3.0809581135280197, 4.5629513161933648]]),self.functionspace)
1111        s2=Symbol(shape=())        arg0.setTaggedValue(1,numarray.array([[0.18467263707487369, -2.906541382403959, -4.2471361917218733, 1.7478696798949915, -2.0555035204044225], [-4.1703824796767011, -0.58145273211245829, -1.3034416354534684, -4.4238643252257699, -3.0019960418182654], [-0.011560599410600503, 4.5614736908410478, -4.1865499712522745, 0.41611035316936196, 1.4719370557053075], [3.3285499812876207, 4.2147545548351992, 3.8796865015190463, -2.8665673368928459, 3.8754754018195001]]))
1112        s=Symbol(shape=(),dim=1,args=[1, -1.0])        arg1=Symbol(shape=(4, 5))
1113        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        res=arg0-arg1
1114        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        s1=numarray.array([[-0.34040680852948757, 0.51480179015857086, 2.6579250902566542, -3.8908104282358877, -1.0766494604779266], [-1.7785348143550985, 1.7875285221080928, -0.26464821727786259, 3.7856697734154743, 0.14935084548977784], [1.6454427368239299, -3.0878902261983701, 2.1577262475041596, -3.540342914142153, 2.8529020416879671], [2.8849125795379305, -3.1409630887157123, -0.30215664293811351, 3.5493007526176896, 0.27226779139430857]])
1115        self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")        sub=res.substitute({arg1:s1})
1116        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        ref=Data(numarray.array([[0.38502039130522459, -0.74445233899117991, -6.0533979157989908, 3.8474056440089122, 0.26646920182696743], [5.8765803286191458, 1.5424591105877399, 4.7340640361325459, -3.7378696488864085, -4.2622394930013705], [-2.5133798849668141, 6.8731609255569932, 0.65909187034342409, 0.93215288243484906, -1.0576745157667631], [-5.6813561856194097, 5.6069553775949723, -4.0873020943537384, -6.6302588661457094, 4.2906835247990562]]),self.functionspace)
1117          ref.setTaggedValue(1,numarray.array([[0.52507944560436126, -3.4213431725625298, -6.9050612819785275, 5.6386801081308793, -0.97885405992649588], [-2.3918476653216025, -2.3689812542205511, -1.0387934181756058, -8.2095340986412442, -3.1513468873080432], [-1.6570033362345304, 7.6493639170394179, -6.3442762187564341, 3.9564532673115149, -1.3809649859826596], [0.44363740174969024, 7.3557176435509115, 4.1818431444571598, -6.4158680895105356, 3.6032076104251916]]))
1118        ss=s.substitute({s:numarray.zeros(())})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1119        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1120        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1121        try:     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1122          s.substitute({s:numarray.zeros((5,))})     def test_sub_overloaded_taggedData_rank3_Symbol_rank0(self):
1123          fail("illegal substition was successful")        arg0=Data(numarray.array([[[-0.70323441272603926, -1.4205742401701604], [-3.6004008923276585, 4.1739347100888349]], [[-2.7687391296703767, -0.96114141211843496], [0.45711266950319906, 0.36713165606152121]], [[3.8726070188081287, 2.6611494194452137], [-0.28060302358441547, 1.0399275995737964]], [[2.5912385881777, -0.12172669528696911], [1.831517522951442, -4.9891623764024926]], [[3.8572507842255241, 2.9719918728052663], [0.42882676434271261, -1.4826468418372341]], [[0.16110396579090835, 4.8052378752678955], [2.4890225545274554, -1.4594734254395068]]]),self.functionspace)
1124        except TypeError:        arg0.setTaggedValue(1,numarray.array([[[3.4601998637619467, 3.5105292543746671], [-1.9715134513187751, 1.6897677346566677]], [[0.99895689216195205, 3.7908023259957879], [-2.9811497902134496, 0.46336396583979944]], [[-2.0979181014824011, 0.68992077008736707], [4.5817275596392033, 3.1112543881649586]], [[-1.0666850119171398, -3.7136243224538679], [-2.1842168128700248, -0.60998709362389292]], [[-1.0817587775668578, 1.1357523207967555], [0.72114300996433212, 2.0871085948686607]], [[2.6196090777455074, -4.8403131105182826], [4.4462612480444346, 2.6275786734235638]]]))
1125          pass        arg1=Symbol(shape=())
1126          res=arg0-arg1
1127        dsdarg=s.diff(Symbol(shape=()))        s1=numarray.array(3.40075496466)
1128        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        sub=res.substitute({arg1:s1})
1129        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        ref=Data(numarray.array([[[-4.1039893773891789, -4.8213292048333001], [-7.0011558569907981, 0.77317974542569523]], [[-6.1694940943335164, -4.3618963767815746], [-2.9436422951599406, -3.0336233086016184]], [[0.4718520541449891, -0.73960554521792599], [-3.6813579882475551, -2.3608273650893432]], [[-0.80951637648543961, -3.5224816599501088], [-1.5692374417116977, -8.3899173410656331]], [[0.4564958195623845, -0.42876309185787331], [-2.971928200320427, -4.8834018065003733]], [[-3.2396509988722313, 1.4044829106047558], [-0.91173241013568429, -4.8602283901026464]]]),self.functionspace)
1130        dsdarg=s.diff(Symbol(shape=(2,)))        ref.setTaggedValue(1,numarray.array([[[0.059444899098807014, 0.10977428971152747], [-5.3722684159819147, -1.7109872300064719]], [[-2.4017980725011876, 0.39004736133264828], [-6.3819047548765893, -2.9373909988233402]], [[-5.4986730661455407, -2.7108341945757726], [1.1809725949760637, -0.28950057649818106]], [[-4.4674399765802795, -7.1143792871170071], [-5.5849717775331644, -4.0107420582870326]], [[-4.4825137422299974, -2.2650026438663842], [-2.6796119546988075, -1.3136463697944789]], [[-0.7811458869176322, -8.2410680751814223], [1.0455062833812949, -0.77317629123957587]]]))
1131        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1132        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1133        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1134        dsdarg=s.diff(Symbol(shape=(4, 5)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1135        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     def test_sub_overloaded_taggedData_rank3_Symbol_rank3(self):
1136        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        arg0=Data(numarray.array([[[-2.8893927498914151, -3.9495986710021471], [2.0674301637688552, -4.9323681378020368]], [[-3.9365223323164567, -3.9166796931279513], [-2.1295831296849688, 0.049270642730291137]], [[1.1604521699930164, -4.7263968957110194], [0.18403419227820805, -3.9919770732677948]], [[-4.4683480884742268, 3.1077188243660192], [0.090355977211302729, -0.013539049772621325]], [[1.2239143556433882, 4.66468811676115], [4.6443599318212119, 2.902664355759085]], [[3.1499666861977964, 3.5678517696258449], [0.73557701807290599, -4.1703133219986768]]]),self.functionspace)
1137        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        arg0.setTaggedValue(1,numarray.array([[[0.62745401025262382, 0.69024538347902542], [4.3685303267738433, 2.2109723240557235]], [[-0.7348498808881363, -2.7513236139357309], [2.5887407011037489, 4.1931952710033542]], [[2.1336250254996258, -2.1610465999144091], [-4.054796877122568, 0.054975312915938268]], [[2.8778982280083021, 0.031841424972327559], [-1.6040852288365626, -0.14653197703489251]], [[1.0241081083490533, 2.0236436389548764], [-4.7683548819587331, 0.81201234013234735]], [[-3.2923450240347405, 2.2531528995219965], [-3.594199051432386, -1.9523442452177875]]]))
1138        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg1=Symbol(shape=(6, 2, 2))
1139        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        res=arg0-arg1
1140        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        s1=numarray.array([[[0.67454553417657603, 2.9833990689244789], [-3.9375622829117427, 0.0094498156860893801]], [[2.1574617938010734, -0.48892733726965609], [0.62118276066421352, 0.99065918564407696]], [[1.7968244154456219, -1.6314349433046926], [1.8612952961850224, 4.6630470176393288]], [[0.43763307675500052, 4.0271951272236688], [-1.1711764825930993, -4.5547560714878275]], [[2.514477748308436, 3.7600620047710827], [1.5805136896170069, 2.4948517124974012]], [[-0.74781838229224817, -2.9876928953003903], [4.1339271192034222, 4.4719827170790509]]])
1141        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        sub=res.substitute({arg1:s1})
1142        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        ref=Data(numarray.array([[[-3.5639382840679912, -6.932997739926626], [6.004992446680598, -4.9418179534881261]], [[-6.0939841261175296, -3.4277523558582952], [-2.7507658903491823, -0.94138854291378582]], [[-0.63637224545260551, -3.0949619524063268], [-1.6772611039068144, -8.6550240909071228]], [[-4.9059811652292273, -0.91947630285764959], [1.261532459804402, 4.5412170217152061]], [[-1.2905633926650477, 0.90462611199006737], [3.063846242204205, 0.40781264326168376]], [[3.8977850684900446, 6.5555446649262352], [-3.3983501011305162, -8.6422960390777277]]]),self.functionspace)
1143        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        ref.setTaggedValue(1,numarray.array([[[-0.047091523923952217, -2.2931536854454535], [8.3060926096855852, 2.2015225083696341]], [[-2.8923116746892097, -2.2623962766660748], [1.9675579404395354, 3.2025360853592773]], [[0.33680061005400397, -0.52961165660971643], [-5.9160921733075904, -4.6080717047233906]], [[2.4402651512533016, -3.9953537022513412], [-0.43290874624346332, 4.4082240944529349]], [[-1.4903696399593827, -1.7364183658162062], [-6.34886857157574, -1.6828393723650539]], [[-2.5445266417424923, 5.2408457948223868], [-7.7281261706358082, -6.4243269622968384]]]))
1144        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1145        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1146          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1147        dsds=s.diff(s)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1148        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")     def test_sub_overloaded_taggedData_rank4_Symbol_rank0(self):
1149        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        arg0=Data(numarray.array([[[[3.1002455029763922, 2.6515488300516923, -0.77582358496211956, -3.4443694355246803], [-2.6599091620789581, -0.70044327546902529, -4.3223485855396966, 4.9338402947088049], [-4.5546987200991147, -4.159833516760548, -1.2113818643763619, 1.341501344402797]], [[-0.99132126989665803, -3.81966827017445, -1.5631671743562592, -2.9170370396917167], [0.94015514336519956, -4.5328623228274036, 2.5469993786586862, 4.5298447080413311], [-1.8826808741220304, -0.21100480137345734, -1.7750931594239239, -3.5343470478632764]]], [[[-3.4624410933639691, 3.7419877938482422, -4.1641241285521557, -2.8763768520849711], [4.3838179808162643, -0.076650368742670949, -2.2790272387608601, 1.4407514353417152], [-0.58059366739859364, 3.0282179950037378, 4.3946428646333242, -3.9361840734571896]], [[-0.40769305246403231, -0.93123230765280152, -3.5500981163613665, -1.4382421516555786], [0.18862577968690264, 3.8234595158976035, 1.2783334948832605, -0.84599833008897818], [-1.5452449895609535, -2.1285283532469434, 2.9517034908101669, -1.043778516582341]]], [[[2.5188074736534176, 4.926760464276164, -1.2494158315784532, -4.1847607799981805], [1.764772573553314, 4.6090994448443769, -3.7864884573437072, 2.5743244083963681], [-0.44624416686502322, -0.44288726525437028, -2.5180469174818598, -4.8009656021603]], [[-1.0967276921708047, -1.5639987059537273, -3.3122649580537331, -3.947879272385495], [4.1267460589959857, -4.5801997177900287, 0.85366271506547697, -3.5573421152778972], [-4.7127368302025108, -4.5592524679039892, -1.8586387462495613, -3.2614675219884837]]]]),self.functionspace)
1150          arg0.setTaggedValue(1,numarray.array([[[[-3.6140016210408508, -4.1545999292001445, 4.9863169403898908, -2.2007289242442383], [-2.3634275248295822, 1.4929955627211893, 1.1905831175627091, -3.1298255396253936], [-0.78867439130174599, -2.5664248245819756, -1.882393556334109, -2.3300345925878529]], [[3.7578772846055983, -1.9632657478837121, -1.3792653830852455, -0.23840250166856869], [-1.650781665029756, -3.2744446113480907, -1.2541229166086589, -2.3471598629273149], [-1.939332795628903, 0.81542234976851624, 0.52422540705571663, 0.91808367692950554]]], [[[-3.0689349511345867, -4.8032602579819264, 3.769084882991141, -1.5864959564378189], [-3.2063200431555905, -0.3347729502698602, 1.763270929850381, 0.65936335478094321], [-3.6143633139881959, 0.15424644431103118, 3.7156782910709154, -3.2826914978804203]], [[-0.091940996157960697, 2.5331247115220021, 3.4383904670893202, 0.77887041122794898], [4.2850997491436988, 3.3877021574758341, 3.9303516193668084, 0.97217787674818279], [-1.8219977615256742, 3.7582967180633755, -3.967674705101544, 3.2183851949652524]]], [[[3.8000102844693906, -2.9266220460152672, 0.11901081743168795, -0.70455205529677301], [4.6787843021952913, -3.2637583894745239, 4.6693989140352041, 2.042172937625808], [-2.9445501417858964, 0.36254085518902812, 2.8333171427728354, -2.7757509476245721]], [[3.8180860212706147, -3.4817247466262815, -3.2683613783585006, -2.0706219843820262], [4.8065072235822566, 2.2788211866672707, 3.8562835841415382, -1.1633706258500731], [2.652336823163191, -2.6060953909144513, 0.62089818312127321, -1.6242126976534612]]]]))
1151        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        arg1=Symbol(shape=())
1152        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        res=arg0-arg1
1153        sa=s.getSubstitutedArguments({s2:-10})        s1=numarray.array(-4.55573857649)
1154        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        sub=res.substitute({arg1:s1})
1155        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        ref=Data(numarray.array([[[[7.6559840794689205, 7.2072874065442205, 3.7799149915304087, 1.1113691409678479], [1.8958294144135701, 3.8552953010235029, 0.23338999095283164, 9.4895788712013331], [0.0010398563934135296, 0.3959050597319802, 3.3443567121161664, 5.8972399208953252]], [[3.5644173065958702, 0.73607030631807824, 2.992571402136269, 1.6387015368008115], [5.4958937198577278, 0.02287625366512458, 7.1027379551512144, 9.0855832845338593], [2.6730577023704978, 4.3447337751190709, 2.7806454170686044, 1.0213915286292519]]], [[[1.0932974831285591, 8.2977263703407704, 0.39161444794037248, 1.6793617244075572], [8.9395565573087925, 4.4790882077498573, 2.2767113377316681, 5.9964900118342435], [3.9751449090939346, 7.583956571496266, 8.9503814411258524, 0.61955450303533866]], [[4.1480455240284959, 3.6245062688397267, 1.0056404601311617, 3.1174964248369497], [4.7443643561794309, 8.3791980923901317, 5.8340720713757888, 3.70974024640355], [3.0104935869315748, 2.4272102232455848, 7.5074420673026951, 3.5119600599101872]]], [[[7.0745460501459458, 9.4824990407686922, 3.3063227449140751, 0.3709777964943477], [6.3205111500458422, 9.1648380213369052, 0.76925011914882102, 7.1300629848888963], [4.109494409627505, 4.1128513112381579, 2.0376916590106684, -0.24522702566777177]], [[3.4590108843217235, 2.991739870538801, 1.2434736184387951, 0.60785930410703326], [8.6824846354885139, -0.024461141297500433, 5.4094012915580052, 0.99839646121463099], [-0.15699825370998255, -0.0035138914114609676, 2.697099830242967, 1.2942710545040446]]]]),self.functionspace)
1156        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        ref.setTaggedValue(1,numarray.array([[[[0.94173695545167746, 0.40113864729238369, 9.542055516882419, 2.35500965224829], [2.192311051662946, 6.0487341392137175, 5.7463216940552373, 1.4259130368671347], [3.7670641851907822, 1.9893137519105526, 2.6733450201584192, 2.2257039839046753]], [[8.3136158610981266, 2.5924728286088161, 3.1764731934072827, 4.3173360748239595], [2.9049569114627722, 1.2812939651444375, 3.3016156598838693, 2.2085787135652133], [2.6164057808636252, 5.3711609262610445, 5.0799639835482449, 5.4738222534220338]]], [[[1.4868036253579415, -0.24752168148939813, 8.3248234594836692, 2.9692426200547093], [1.3494185333369377, 4.220965626222668, 6.3190095063429093, 5.2151019312734714], [0.94137526250433234, 4.7099850208035594, 8.2714168675634436, 1.273047078612108]], [[4.4637975803345675, 7.0888632880145304, 7.9941290435818484, 5.3346089877204772], [8.8408383256362271, 7.9434407339683624, 8.4860901958593367, 5.527916453240711], [2.7337408149668541, 8.3140352945559037, 0.58806387139098426, 7.7741237714577807]]], [[[8.3557488609619188, 1.629116530477261, 4.6747493939242162, 3.8511865211957552], [9.2345228786878195, 1.2919801870180043, 9.2251374905277324, 6.5979115141183362], [1.6111884347066319, 4.9182794316815563, 7.3890557192653636, 1.7799876288679561]], [[8.3738245977631429, 1.0740138298662467, 1.2873771981340276, 2.4851165921105021], [9.3622458000747848, 6.834559763159799, 8.4120221606340664, 3.3923679506424551], [7.2080753996557192, 1.9496431855780769, 5.1766367596138014, 2.931525878839067]]]]))
1157          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1158        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1159        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1160        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1161        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")     def test_sub_overloaded_taggedData_rank4_Symbol_rank4(self):
1162        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        arg0=Data(numarray.array([[[[2.1869721643026576, 0.35542091272423715, 2.5099944114031967, 4.7276012581949995], [-0.23596027111215712, 3.2557128306673206, -2.4174678213407566, 4.9025765849007588], [3.4987602616867228, -2.3969967727517094, 2.614715035832643, -3.9538109091356577]], [[0.54151166641114745, 4.3433313907072311, -3.9824411189395126, 0.11193040884063787], [-4.3326960505433521, -2.6555021449849603, -1.6650005107909016, -0.21278258756168267], [2.9438726263016104, 4.614591333740627, -1.4283352855346321, 4.195747529596801]]], [[[0.4129039465707498, 0.25218586208094607, 4.2227877593235625, -3.8395686827717723], [-4.246422814789943, -4.2708029152046789, -4.4791253262093615, 2.3703854064691221], [-0.32074671911367325, -4.0633264555676574, -4.8034904727622223, 0.101245496731595]], [[3.3860052077100544, 4.4048456672981686, 3.3258905421337257, -0.60591078242426555], [2.9574702297232829, 2.9390786518156196, 3.0627580449874809, -2.1902821038190523], [1.2765769390449559, 4.5442832941192819, 0.47031486471564055, -3.2094801674304509]]], [[[1.4972627407797212, -2.7514173987810633, 0.19744444113354387, 1.3720920976100972], [-3.147124860705004, -3.6707691951555885, 1.1521564952279704, -0.12493802519996233], [1.3717811158015873, -1.737983464544548, -2.5919544001996897, -4.4195022009129206]], [[-3.5078213357756582, 1.5909514876001909, 3.932618549290213, 0.32844467348406869], [-0.037083415286228494, 2.358949404615915, -3.7082781631298478, -4.9441324919087766], [1.219588665287433, -2.1155364750524797, 2.3443039764677165, 4.1618790582351313]]]]),self.functionspace)
1163        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        arg0.setTaggedValue(1,numarray.array([[[[3.8216987557975131, -0.59039813916696193, -1.9474433412604117, 4.1666345075852202], [1.0033840403657788, -1.8365638623400207, -1.1472895447555285, 0.49043998461267968], [1.525782098623524, 0.98710575843395354, 1.9521603305269073, 1.4982217977497818]], [[4.8105014981222372, 0.18255767851204219, 0.10092997041413909, 2.3610713615733667], [3.8639541584797801, 1.8455276769077198, 3.9278199867001007, 2.5501176762845867], [3.2925051662999447, 0.78129602184334157, -0.73105877010655362, 2.9378923845982694]]], [[[1.3162347911484948, -1.7534583809398363, -4.4745574675152744, 0.84388146264593455], [-2.1398633576757309, 1.6224556269216279, 4.0151064679341637, 0.81646760002277574], [0.95506629968888479, -3.384786519820715, 2.08961451298733, 1.4802214615087061]], [[2.5752388025402837, -2.7094797245847468, -2.6808155024703106, -1.7780191613070642], [-0.58755728186204248, -4.3097624692690948, 3.6757907841395685, -1.8312242243207608], [-3.7229135985460826, -1.5786991892133564, 2.6894504757052617, -0.48567336902160463]]], [[[3.4562176552233623, -1.5291903913231595, 4.9276217294297595, -1.4641622460496571], [-3.9633150641051529, -1.3895475276782743, -2.0928641563143735, 4.286214622292805], [-0.016872120519226819, -0.86571000346058913, 4.2635805792181465, 4.0351866281897113]], [[-1.973695982407413, -4.452260246087465, -2.5681734906597109, 3.0954829513656215], [2.6526834215550927, -4.3976717675273207, 2.0111485813735106, 2.7969396373439324], [-0.72100288848623784, 1.4868693846138363, 2.3876845459322045, -3.759851286518614]]]]))
1164        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg1=Symbol(shape=(3, 2, 3, 4))
1165     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0-arg1
1166     def test_Symbol_rank0_d2_nargs0(self):        s1=numarray.array([[[[-1.2326165508314046, 0.019536700697927678, 3.3313535404093759, -2.4782775769684271], [3.9342491756801525, 1.2904741959913864, -2.7701975380199206, 2.4757520771582744], [2.5202328466158281, -1.3683915774027189, 3.4678638218372768, -2.2884507446983129]], [[-4.9275394706777931, 4.7975831194456333, 1.7829898690658723, -0.96339421834763073], [-2.7923805247323799, -0.026981154987572253, 2.5136604629187271, 0.14658337947380495], [1.1254475424349959, 4.8000437885357261, 3.3479331374253167, 1.6298765760037002]]], [[[-0.46473842692243572, 1.2430212762010644, -0.23618382206216726, -1.2230171932711418], [2.0127498669810855, -0.31475870950595031, -0.20645609212011973, -4.9825089187683691], [-4.6108703987985988, -0.47963035537661725, -3.1919702863790422, -3.9993603357626117]], [[3.8402219409685951, 3.04406815317755, 4.7640360318949195, 1.5279973254325983], [-4.9716807317737235, -3.4706635767559693, -1.2581696190523903, -2.591452040312936], [1.6191001515432157, -3.5419762128533741, 0.92904425652178801, 4.6966930122512043]]], [[[-2.4787875268428614, 4.8717538415307775, 3.6264063974305554, 2.0645154974740256], [-4.5070489852671329, 2.3540394703493703, 3.2007816723140134, -0.44359603196672026], [2.5406621078154732, 3.6651768892659895, -2.7039262200534422, -1.9309627063916244]], [[-0.037762488646412962, -4.6825147640959859, -3.1180187992817956, -0.3407644296025687], [-1.6601757648009907, -1.0174825465103088, 0.060955158106047236, 1.2341204474061849], [-0.24621306712976931, -1.3620636349151272, -0.12322079758969373, 2.3717593913603183]]]])
1167        s2=Symbol(shape=())        sub=res.substitute({arg1:s1})
1168        s=Symbol(shape=(),dim=2,args=[])        ref=Data(numarray.array([[[[3.4195887151340623, 0.33588421202630947, -0.82135912900617924, 7.2058788351634266], [-4.1702094467923096, 1.9652386346759343, 0.35272971667916408, 2.4268245077424844], [0.97852741507089469, -1.0286051953489905, -0.85314878600463384, -1.6653601644373448]], [[5.4690511370889405, -0.45425172873840225, -5.7654309880053844, 1.0753246271882686], [-1.5403155258109722, -2.628520989997388, -4.1786609737096292, -0.35936596703548762], [1.8184250838666145, -0.18545245479509909, -4.7762684229599488, 2.5658709535931008]]], [[[0.87764237349318552, -0.99083541412011833, 4.4589715813857298, -2.6165514895006305], [-6.2591726817710285, -3.9560442056987286, -4.2726692340892418, 7.3528943252374912], [4.2901236796849256, -3.5836961001910401, -1.6115201863831801, 4.1006058324942067]], [[-0.45421673325854073, 1.3607775141206186, -1.4381454897611938, -2.1339081078568638], [7.9291509614970064, 6.4097422285715888, 4.3209276640398713, 0.40116993649388366], [-0.34252321249825979, 8.0862595069726559, -0.45872939180614747, -7.9061731796816552]]], [[[3.9760502676225826, -7.6231712403118408, -3.4289619562970115, -0.69242339986392842], [1.359924124562129, -6.0248086655049589, -2.0486251770860431, 0.31865800676675793], [-1.1688809920138858, -5.4031603538105379, 0.11197181985375249, -2.4885394945212962]], [[-3.4700588471292453, 6.2734662516961768, 7.0506373485720086, 0.66920910308663739], [1.6230923495147622, 3.3764319511262237, -3.7692333212358951, -6.1782529393149614], [1.4658017324172024, -0.7534728401373525, 2.4675247740574102, 1.7901196668748129]]]]),self.functionspace)
1169        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        ref.setTaggedValue(1,numarray.array([[[[5.0543153066289177, -0.60993483986488961, -5.2787968816697877, 6.6449120845536473], [-2.9308651353143738, -3.127038058331407, 1.6229079932643922, -1.9853120925455947], [-0.99445074799230415, 2.3554973358366724, -1.5157034913103695, 3.7866725424480947]], [[9.7380409688000302, -4.6150254409335911, -1.6820598986517332, 3.3244655799209974], [6.6563346832121599, 1.872508831895292, 1.4141595237813736, 2.4035342968107818], [2.1670576238649488, -4.0187477666923845, -4.0789919075318704, 1.3080158085945692]]], [[[1.7809732180709306, -2.9964796571409007, -4.2383736454531071, 2.0668986559170763], [-4.1526132246568164, 1.9372143364275782, 4.2215625600542834, 5.7989765187911448], [5.5659366984874836, -2.9051561644440977, 5.2815847993663727, 5.4795817972713179]], [[-1.2649831384283114, -5.7535478777622968, -7.4448515343652302, -3.3060164867396624], [4.384123449911681, -0.83909889251312553, 4.9339604031919588, 0.76022781599217515], [-5.3420137500892988, 1.9632770236400177, 1.7604062191834737, -5.1823663812728089]]], [[[5.9350051820662237, -6.400944232853937, 1.3012153319992041, -3.5286777435236827], [0.54373392116198005, -3.7435869980276446, -5.293645828628387, 4.7298106542595253], [-2.5575342283347, -4.5308868927265786, 6.9675067992715887, 5.9661493345813357]], [[-1.935933493761, 0.23025451800852093, 0.54984530862208469, 3.4362473809681902], [4.3128591863560839, -3.3801892210170119, 1.9501934232674634, 1.5628191899377475], [-0.47478982135646852, 2.8489330195289635, 2.5109053435218982, -6.1316106778789319]]]]))
1170        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1171        self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1172        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1173       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1174        ss=s.substitute({s:numarray.zeros(())})     def test_sub_overloaded_expandedData_rank0_Symbol_rank0(self):
1175        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1176        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        arg0=msk_arg0*(2.42413566075)+(1.-msk_arg0)*(2.73592046896)
1177        try:        arg1=Symbol(shape=())
1178          s.substitute({s:numarray.zeros((5,))})        res=arg0-arg1
1179          fail("illegal substition was successful")        s1=numarray.array(0.0730314190245)
1180        except TypeError:        sub=res.substitute({arg1:s1})
1181          pass        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1182          ref=msk_ref*(2.35110424173)+(1.-msk_ref)*(2.66288904994)
1183        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1184        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1185        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1186        dsdarg=s.diff(Symbol(shape=(2,)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1187        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")     def test_sub_overloaded_expandedData_rank0_Symbol_rank1(self):
1188        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1189        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        arg0=msk_arg0*(-2.38585027921)+(1.-msk_arg0)*(-2.14546935212)
1190        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg1=Symbol(shape=(2,))
1191        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        res=arg0-arg1
1192        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        s1=numarray.array([1.0449404678521192, -2.9654578889240057])
1193        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        sub=res.substitute({arg1:s1})
1194        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1195        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        ref=msk_ref*numarray.array([-3.4307907470591283, 0.57960760971699665])+(1.-msk_ref)*numarray.array([-3.1904098199744872, 0.81998853680163775])
1196        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1197        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1198        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1199        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1200        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")     def test_sub_overloaded_expandedData_rank0_Symbol_rank2(self):
1201        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1202          arg0=msk_arg0*(2.15276640076)+(1.-msk_arg0)*(-2.04284766814)
1203        dsds=s.diff(s)        arg1=Symbol(shape=(4, 5))
1204        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        res=arg0-arg1
1205        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        s1=numarray.array([[-2.5429314638433684, 2.0318827224945402, -2.3636856893688076, 3.4855417570765717, 0.44952339669472341], [2.5403509140391156, 2.3524971436536095, 3.9461465487262188, 2.6955339698780154, -0.45702899742654868], [-1.0602022717036155, 0.74771157767510843, 1.6452939357358289, -3.0322095528230921, 1.6787335078454735], [-4.263078102519902, 3.2046384335109863, 4.0147512257312048, 3.3998288702285713, -0.56118778404289138]])
1206          sub=res.substitute({arg1:s1})
1207        sa=s.getSubstitutedArguments({s2:-10})        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1208        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        ref=msk_ref*numarray.array([[4.6956978646047602, 0.12088367826685165, 4.5164520901301994, -1.3327753563151798, 1.7032430040666684], [-0.38758451327772381, -0.19973074289221771, -1.793380147964827, -0.5427675691166236, 2.6097953981879405], [3.2129686724650073, 1.4050548230862834, 0.50747246502556287, 5.1849759535844839, 0.47403289291591832], [6.4158445032812939, -1.0518720327495945, -1.861984824969813, -1.2470624694671795, 2.7139541848042832]])+(1.-msk_ref)*numarray.array([[0.50008379570506278, -4.0747303906328458, 0.32083802123050198, -5.5283894252148773, -2.4923710648330291], [-4.5831985821774213, -4.3953448117919152, -5.9889942168645245, -4.7383816380163211, -1.585818670711757], [-0.98264539643469018, -2.7905592458134141, -3.6881416038741346, 0.98936188468478647, -3.7215811759837791], [2.2202304343815964, -5.247486101649292, -6.0575988938695104, -5.4426765383668769, -1.4816598840954143]])
1209          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1210        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1211        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1212        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1213        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")     def test_sub_overloaded_expandedData_rank0_Symbol_rank3(self):
1214        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1215        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        arg0=msk_arg0*(3.30825297654)+(1.-msk_arg0)*(-3.92076322418)
1216        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg1=Symbol(shape=(6, 2, 2))
1217     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0-arg1
1218     def test_Symbol_rank0_d2_nargs1(self):        s1=numarray.array([[[-0.52002332126128437, 4.3478222442071139], [3.3434922005534364, 2.8013302606159396]], [[-2.3200079969586795, -3.0556917667690642], [-2.7103276420969582, 4.1511200748037105]], [[-0.92404095393396624, 2.6484690327098859], [-2.1529217611726503, 4.4602897709717144]], [[0.58271708006920253, 1.9322598870751975], [-3.5184596230462182, -4.4222029485403436]], [[-4.3953168785776278, -4.450145776704125], [4.2137072146995536, 3.8966485797913304]], [[3.1838339108927798, -3.6438064267677328], [1.3789445362861974, -2.9975552731311272]]])
1219        s2=Symbol(shape=())        sub=res.substitute({arg1:s1})
1220        s=Symbol(shape=(),dim=2,args=[s2])        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1221        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        ref=msk_ref*numarray.array([[[3.8282762978010325, -1.0395692676673658], [-0.035239224013688286, 0.50692271592380855]], [[5.6282609734984277, 6.3639447433088119], [6.0185806186367063, -0.84286709826396233]], [[4.2322939304737144, 0.65978394382986227], [5.4611747377123985, -1.1520367944319663]], [[2.7255358964705456, 1.3759930894645507], [6.8267125995859663, 7.7304559250800917]], [[7.7035698551173759, 7.7583987532438732], [-0.90545423815980541, -0.58839560325158224]], [[0.12441906564696836, 6.952059403307481], [1.9293084402535507, 6.3058082496708749]]])+(1.-msk_ref)*numarray.array([[[-3.4007399029178136, -8.2685854683862114], [-7.2642554247325339, -6.7220934847950371]], [[-1.6007552272204184, -0.86507145741003377], [-1.2104355820821397, -8.071883298982808]], [[-2.9967222702451317, -6.5692322568889843], [-1.7678414630064476, -8.3810529951508119]], [[-4.5034803042483009, -5.853023111254295], [-0.40230360113287977, 0.50143972436124562]], [[0.47455365439852981, 0.52938255252502708], [-8.1344704388786511, -7.8174118039704279]], [[-7.1045971350718773, -0.27695679741136514], [-5.2997077604652958, -0.92320795104797071]]])
1222        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1223        self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1224        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1225       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1226        ss=s.substitute({s:numarray.zeros(())})     def test_sub_overloaded_expandedData_rank0_Symbol_rank4(self):
1227        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1228        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        arg0=msk_arg0*(4.28115160685)+(1.-msk_arg0)*(-2.99624588284)
1229        try:        arg1=Symbol(shape=(3, 2, 3, 4))
1230          s.substitute({s:numarray.zeros((5,))})        res=arg0-arg1
1231          fail("illegal substition was successful")        s1=numarray.array([[[[-3.7034845683259832, -3.2006988280486115, 4.6850337347787345, -1.5431340070704103], [-3.9508001556883876, 4.7231128873762902, -3.0051096732527691, -0.071944916970104522], [3.2109725637398565, 4.0910170733379978, -3.7166755556626772, -4.402146700420734]], [[-1.5273991623031669, -1.4865381526416344, 3.902360473786171, -1.3538484671917517], [0.38707743115008331, 4.3855048056490773, 1.9022231675241139, 1.397387379628614], [1.0431068102446126, 3.0934379513218886, 2.0138255231319624, 4.2870052231295865]]], [[[-4.2737086360299941, 4.2752748398653857, -3.7092106416006629, 1.417380944080846], [-2.4275128587779737, -2.879911926405645, -4.23153844815229, -0.30555854124221682], [-2.6571106905165331, 2.6754859746804112, -4.5544081791240201, -0.020082609244357563]], [[1.0570642052363857, -1.7647078574502792, 2.6330635742775668, 3.717540829723692], [4.9220552078075279, -3.9060168420798869, 1.4799017868437296, 2.7842835488914588], [-2.0839669385912343, -4.8850626605172867, 1.7595980725429907, 3.0026383083452117]]], [[[-0.83195539201513036, -1.2109400306251725, 2.0638657571201078, -0.86905066581365009], [-0.54092453152611775, 3.4954317917180884, 3.7826658876966359, -2.5779636206330894], [1.6720368874738147, 0.42564364358069096, -4.9027760864384096, 0.66861897918883617]], [[-4.1302737255553801, -3.2949127465748109, 1.5706320204575341, -2.2912291830881903], [-2.19574275564025, 3.983182476523945, 2.032922034582441, -2.7459308093848711], [4.6025690264891459, 3.7012963844874829, 0.1748188819614116, 4.2002322255258893]]]])
1232        except TypeError:        sub=res.substitute({arg1:s1})
1233          pass        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1234          ref=msk_ref*numarray.array([[[[7.984636175171131, 7.4818504348937598, -0.40388212793358669, 5.8242856139155581], [8.2319517625335354, -0.44196128053114236, 7.286261280097917, 4.3530965238152524], [1.0701790431052913, 0.19013453350715004, 7.997827162507825, 8.6832983072658827]], [[5.8085507691483151, 5.7676897594867818, 0.37879113305897683, 5.6350000740368991], [3.8940741756950645, -0.10435319880392946, 2.3789284393210339, 2.8837642272165338], [3.2380447966005352, 1.1877136555232592, 2.2673260837131854, -0.0058536162844387007]]], [[[8.5548602428751419, 0.005876766979762138, 7.9903622484458108, 2.8637706627643018], [6.7086644656231211, 7.1610635332507933, 8.5126900549974387, 4.5867101480873647], [6.938262297361681, 1.6056656321647367, 8.835559785969167, 4.3012342160895054]], [[3.2240874016087622, 6.0458594642954271, 1.6480880325675811, 0.5636107771214558], [-0.64090360096238008, 8.1871684489250356, 2.8012498200014182, 1.496868057953689], [6.3651185454363821, 9.1662142673624345, 2.5215535343021571, 1.2785132984999361]]], [[[5.1131069988602782, 5.4920916374703204, 2.2172858497250401, 5.1502022726587979], [4.8220761383712656, 0.78571981512705946, 0.49848571914851192, 6.8591152274782372], [2.6091147193713331, 3.8555079632644569, 9.1839276932835574, 3.6125326276563117]], [[8.4114253324005279, 7.5760643534199588, 2.7105195863876137, 6.5723807899333382], [6.4768943624853978, 0.29796913032120287, 2.2482295722627068, 7.0270824162300194], [-0.32141741964399806, 0.57985522235766496, 4.1063327248837362, 0.080919381319258576]]]])+(1.-msk_ref)*numarray.array([[[[0.70723868548106505, 0.20445294520369339, -7.6812796176236526, -1.4531118757745078], [0.9545542728434695, -7.7193587702212083, 0.0088637904078510132, -2.9243009658748136], [-6.2072184465847746, -7.0872629561829159, 0.72042967281775905, 1.4059008175758159]], [[-1.4688467205417512, -1.5097077302032837, -6.8986063566310891, -1.6423974156531664], [-3.3833233139950014, -7.3817506884939954, -4.898469050369032, -4.3936332624735321], [-4.0393526930895307, -6.0896838341668067, -5.0100714059768805, -7.2832511059745046]]], [[[1.277462753185076, -7.2715207227103038, 0.71296475875574483, -4.4136268269257641], [-0.56873302406694437, -0.11633395643927313, 1.2352925653073719, -2.6906873416027013], [-0.33913519232838496, -5.6717318575253293, 1.558162296279102, -2.9761632736005605]], [[-4.0533100880813038, -1.2315380253946389, -5.6293094571224849, -6.7137867125686101], [-7.918301090652446, 0.90977095923496876, -4.4761476696886477, -5.7805294317363769], [-0.91227894425368383, 1.8888167776723686, -4.7558439553879088, -5.9988841911901298]]], [[[-2.1642904908297877, -1.7853058522197456, -5.0601116399650259, -2.127195217031268], [-2.4553213513188004, -6.4916776745630065, -6.778911770541554, -0.41828226221182874], [-4.6682827703187328, -3.4218895264256091, 1.9065302035934915, -3.6648648620337543]], [[1.134027842710462, 0.29866686372989282, -4.5668779033024522, -0.70501669975672776], [-0.8005031272046681, -6.9794283593688631, -5.0291679174273591, -0.250315073460047], [-7.598814909334064, -6.697542267332401, -3.1710647648063297, -7.1964781083708074]]]])
1235        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1236        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1237        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1238        dsdarg=s.diff(Symbol(shape=(2,)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1239        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")     def test_sub_overloaded_expandedData_rank1_Symbol_rank0(self):
1240        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1241        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        arg0=msk_arg0*numarray.array([0.57185536765716005, -4.5016440600070959])+(1.-msk_arg0)*numarray.array([-0.4418100919929735, 1.7838290839713755])
1242        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg1=Symbol(shape=())
1243        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        res=arg0-arg1
1244        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        s1=numarray.array(4.01685432532)
1245        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        sub=res.substitute({arg1:s1})
1246        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1247        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        ref=msk_ref*numarray.array([-3.4449989576654145, -8.5184983853296714])+(1.-msk_ref)*numarray.array([-4.4586644173155481, -2.2330252413511991])
1248        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1249        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1250        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1251        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1252        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")     def test_sub_overloaded_expandedData_rank1_Symbol_rank1(self):
1253        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1254          arg0=msk_arg0*numarray.array([-4.1734209340603439, 4.5527582003296185])+(1.-msk_arg0)*numarray.array([-1.7000682822887789, 0.76683988376374757])
1255        dsds=s.diff(s)        arg1=Symbol(shape=(2,))
1256        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        res=arg0-arg1
1257        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        s1=numarray.array([-1.5016152385157842, 0.80809700227400683])
1258          sub=res.substitute({arg1:s1})
1259        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1260        sa=s.getSubstitutedArguments({s2:-10})        ref=msk_ref*numarray.array([-2.6718056955445597, 3.7446611980556117])+(1.-msk_ref)*numarray.array([-0.19845304377299477, -0.041257118510259261])
1261        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1262        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1263          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1264        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1265        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")     def test_sub_overloaded_expandedData_rank2_Symbol_rank0(self):
1266        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1267        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")        arg0=msk_arg0*numarray.array([[3.3500126396534871, 3.4943903203535527, -1.7005861531401179, 1.4952347206139418, -4.5979578172283739], [-2.3055331093587372, -3.6474162865795225, -3.0632961186256935, 4.7258384683418715, -0.58388337502415943], [4.7641302227265427, -0.11182220465882864, 2.8628458472454756, 1.6967713595739653, 2.8474759788446562], [2.5863322473986914, 1.6349340161801535, -2.9934700314340712, 3.4068691472223609, -0.97913156666695667]])+(1.-msk_arg0)*numarray.array([[-0.34407378508566389, 2.6789454460601672, -3.3795587578901665, -4.1659261688389009, 2.3147542825953309], [-2.0615148857755603, -2.1181768528675784, 4.7855957803525566, 2.4248630846228734, 4.4597452365342818], [4.5985091304874572, 2.9992334161018466, 0.73974708846994552, -0.24440017509511858, -0.49166350583553875], [1.5878740787090537, 3.0210382196579779, 3.6343442933400869, 1.5494651243470852, -3.3635312675197349]])
1268        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        arg1=Symbol(shape=())
1269        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        res=arg0-arg1
1270        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        s1=numarray.array(-3.53998589595)
1271     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        sub=res.substitute({arg1:s1})
1272     def test_Symbol_rank0_d2_nargs2(self):        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1273        s2=Symbol(shape=())        ref=msk_ref*numarray.array([[6.8899985356048354, 7.0343762163049011, 1.8393997428112305, 5.0352206165652902, -1.0579719212770256], [1.2344527865926112, -0.10743039062817417, 0.47668977732565487, 8.2658243642932199, 2.9561025209271889], [8.3041161186778911, 3.4281636912925197, 6.402831743196824, 5.2367572555253137, 6.3874618747960046], [6.1263181433500398, 5.1749199121315019, 0.54651586451727718, 6.9468550431737093, 2.5608543292843917]])+(1.-msk_ref)*numarray.array([[3.1959121108656845, 6.2189313420115155, 0.16042713806118192, -0.6259402728875525, 5.8547401785466793], [1.4784710101757881, 1.42180904308377, 8.325581676303905, 5.9648489805742217, 7.9997311324856302], [8.1384950264388056, 6.539219312053195, 4.2797329844212939, 3.2955857208562298, 3.0483223901158096], [5.1278599746604021, 6.5610241156093263, 7.1743301892914353, 5.0894510202984335, 0.17645462843161352]])
1274        s=Symbol(shape=(),dim=2,args=[1, -1.0])        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1275        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1276        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1277        self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1278        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")     def test_sub_overloaded_expandedData_rank2_Symbol_rank2(self):
1279          msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1280        ss=s.substitute({s:numarray.zeros(())})        arg0=msk_arg0*numarray.array([[2.0867998826855514, 2.311725929216629, -3.4719596731221403, 1.7817832811577139, 1.5141982978301929], [3.1010865709749673, -2.1704923524391537, 3.7204405507466163, 4.629811066660821, 1.6635344950905893], [-2.574527711983543, -1.6203338172344193, 3.7119433126415871, -4.2495237660622687, -2.1154248806831588], [0.14708606411584846, -4.3739162090051034, 0.28212084215683131, -3.2454357930486841, 4.0490170686662843]])+(1.-msk_arg0)*numarray.array([[2.5664289274057825, -3.8876267007915413, 3.0606117231617365, 0.45673258502894409, -2.4098041248367421], [2.4831763479900646, -4.4003484897067748, -3.6829879581883054, -4.4939546625771341, 0.095882545889256932], [4.8837698588887477, 4.688682977288769, -1.7221295814057069, -2.8466915452782313, -1.7320653753684723], [0.9117963691890596, -0.77307239329958843, -4.179217925450148, -2.8549317288801146, 2.3840070557997581]])
1281        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        arg1=Symbol(shape=(4, 5))
1282        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        res=arg0-arg1
1283        try:        s1=numarray.array([[3.235357796595256, -1.480870361715898, 4.6623764990451662, -0.75539625063053251, 1.764045470290668], [0.076611613190003425, -4.3375283365611939, -0.16726979393963415, 3.2199460507232871, -3.1622960810628884], [0.33570324662007156, 1.8340432936621101, 3.3105489280357343, -4.5476113052695135, 1.6510039686145541], [1.9731991965232831, -1.2055959073743616, 3.1802938969891557, 1.6969195493915894, 4.7202410276309497]])
1284          s.substitute({s:numarray.zeros((5,))})        sub=res.substitute({arg1:s1})
1285          fail("illegal substition was successful")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1286        except TypeError:        ref=msk_ref*numarray.array([[-1.1485579139097046, 3.792596290932527, -8.1343361721673055, 2.5371795317882464, -0.24984717246047516], [3.0244749577849639, 2.1670359841220401, 3.8877103446862504, 1.4098650159375339, 4.8258305761534777], [-2.9102309586036146, -3.4543771108965293, 0.40139438460585275, 0.29808753920724484, -3.7664288492977129], [-1.8261131324074347, -3.1683203016307417, -2.8981730548323243, -4.9423553424402735, -0.67122395896466536]])+(1.-msk_ref)*numarray.array([[-0.66892886918947347, -2.4067563390756432, -1.6017647758834297, 1.2121288356594766, -4.1738495951274102], [2.4065647348000612, -0.062820153145580981, -3.5157181642486712, -7.7139007133004212, 3.2581786269521453], [4.5480666122686761, 2.854639683626659, -5.0326785094414408, 1.7009197599912822, -3.3830693439830264], [-1.0614028273342235, 0.43252351407477319, -7.3595118224393037, -4.5518512782717035, -2.3362339718311915]])
1287          pass        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1288          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1289        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1290        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1291        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     def test_sub_overloaded_expandedData_rank3_Symbol_rank0(self):
1292        dsdarg=s.diff(Symbol(shape=(2,)))        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1293        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        arg0=msk_arg0*numarray.array([[[-4.4842044121065818, 4.4928465492805714], [-0.8488426741388917, -4.6899835951885827]], [[-3.8520901512994188, -4.2130527577972394], [-1.9136871018997637, -1.6373131250552273]], [[-4.193784678832186, -0.65999502399047039], [-0.57202165743856082, -2.5346604397115016]], [[-3.7518661140733869, -4.2333127035460327], [-1.185325910878734, 0.27013359391463077]], [[4.7175093778110231, -2.5123249429723304], [3.8200721640724424, 4.5930030128887935]], [[-4.7065467532244636, -1.7055937731234607], [-1.331474083968188, -4.3474657122786562]]])+(1.-msk_arg0)*numarray.array([[[3.7753100517410338, 3.7909180149825001], [0.99488027773324017, -3.0286171370440904]], [[3.6374742681576677, 1.145681069564648], [-0.002113196116643401, -0.3884450840387661]], [[-2.5595107128502024, -3.4455619811895488], [-4.5771852308072871, 1.3642969267838581]], [[-0.18445690526205638, 0.49675060587106934], [-3.8670923300147821, -4.1547783162827496]], [[-3.9389053222472947, 1.3272580810242838], [3.5990473792265725, 2.2029039321052881]], [[-4.5403710311302428, -0.87738273585574866], [3.383530992594503, 3.353845130538776]]])
1294        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        arg1=Symbol(shape=())
1295        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        res=arg0-arg1
1296        dsdarg=s.diff(Symbol(shape=(4, 5)))        s1=numarray.array(-4.30522721091)
1297        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        sub=res.substitute({arg1:s1})
1298        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1299        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        ref=msk_ref*numarray.array([[[-0.17897720120150851, 8.7980737601856447], [3.4563845367661816, -0.38475638428350933]], [[0.45313705960565454, 0.092174453107833898], [2.3915401090053097, 2.667914085849846]], [[0.11144253207288735, 3.6452321869146029], [3.7332055534665125, 1.7705667711935718]], [[0.55336109683168644, 0.071914507359040591], [3.1199013000263394, 4.5753608048197041]], [[9.0227365887160964, 1.7929022679327429], [8.1252993749775158, 8.8982302237938669]], [[-0.40131954231939027, 2.5996334377816126], [2.9737531269368853, -0.042238501373582871]]])+(1.-msk_ref)*numarray.array([[[8.0805372626461072, 8.0961452258875735], [5.3001074886383135, 1.2766100738609829]], [[7.942701479062741, 5.4509082804697213], [4.3031140147884299, 3.9167821268663072]], [[1.7457164980548709, 0.8596652297155245], [-0.2719580199022138, 5.6695241376889314]], [[4.1207703056430169, 4.8019778167761427], [0.43813488089029118, 0.15044889462232369]], [[0.36632188865777859, 5.6324852919293571], [7.9042745901316458, 6.5081311430103614]], [[-0.23514382022516944, 3.4278444750493247], [7.6887582034995763, 7.6590723414438493]]])
1300        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1301        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1302        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1303        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1304        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))     def test_sub_overloaded_expandedData_rank3_Symbol_rank3(self):
1305        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1306        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        arg0=msk_arg0*numarray.array([[[2.0747863514072602, 3.5162387004014164], [0.60187542749819123, -1.4464372144424988]], [[-0.79722414010768361, -3.2668034589151995], [3.6997621801618905, -2.3676159172001379]], [[-4.2988464154229238, 2.9969641407457024], [2.6364527127840898, 1.1108844479920323]], [[-1.1644293703177389, 4.7657018637717314], [3.954999187366635, -3.1405571932690379]], [[1.9169748083366978, 3.5980880196573022], [4.6505164496107305, -3.4906561986190576]], [[-4.799933282554286, 3.4274402953401566], [-3.2690807817244751, 3.3152263479112811]]])+(1.-msk_arg0)*numarray.array([[[-0.19327777478115316, 1.1303927856512574], [0.070720562815962396, 0.2691348667587512]], [[-2.2293468476711373, 4.4261476420776269], [-2.1677478226049174, 3.9963032240053238]], [[-3.0163006244468358, 0.039611843610902753], [-1.7062014469652445, -0.85393662791937786]], [[2.3270289055995583, 1.3694144393292564], [1.7400166142803206, 1.0276232159123833]], [[0.34573570990013103, -3.0575470737366093], [-0.16902625990476849, -2.0541180978179363]], [[1.4322948650591076, 1.3766358910177399], [-1.2248059444270067, 3.8606015627846109]]])
1307        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        arg1=Symbol(shape=(6, 2, 2))
1308          res=arg0-arg1
1309        dsds=s.diff(s)        s1=numarray.array([[[-0.065448649070245501, -1.0082288113108073], [2.940556380714975, 2.6943538184190166]], [[4.4012174975531551, 2.1536331083101858], [0.42620647125632161, -3.3632985397458972]], [[0.7816306898353016, -4.1519556164933835], [4.587159382474109, 3.7392943755961223]], [[1.0899221203445091, -3.3294088440228276], [4.0864323956812836, -1.4550107947057112]], [[3.7465493005246273, 3.1852429656365171], [-3.8082443104157484, -2.7860725384289688]], [[-4.7267420836233232, 0.9545260667209563], [-4.6866116848499395, 0.18931611034152862]]])
1310        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        sub=res.substitute({arg1:s1})
1311        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1312          ref=msk_ref*numarray.array([[[2.1402350004775057, 4.5244675117122242], [-2.3386809532167838, -4.1407910328615154]], [[-5.1984416376608387, -5.4204365672253854], [3.2735557089055689, 0.99568262254575934]], [[-5.0804771052582254, 7.1489197572390859], [-1.9507066696900193, -2.62840992760409]], [[-2.2543514906622479, 8.095110707794559], [-0.13143320831464855, -1.6855463985633268]], [[-1.8295744921879296, 0.41284505402078508], [8.4587607600264789, -0.70458366019008878]], [[-0.07319119893096282, 2.4729142286192003], [1.4175309031254644, 3.1259102375697525]]])+(1.-msk_ref)*numarray.array([[[-0.12782912571090765, 2.1386215969620648], [-2.8698358178990127, -2.4252189516602654]], [[-6.6305643452242924, 2.2725145337674411], [-2.593954293861239, 7.359601763751221]], [[-3.7979313142821374, 4.1915674601042863], [-6.2933608294393535, -4.5932310035155002]], [[1.2371067852550492, 4.698823283352084], [-2.346415781400963, 2.4826340106180944]], [[-3.4008135906244963, -6.2427900393731264], [3.6392180505109799, 0.73195444061103254]], [[6.1590369486824308, 0.42210982429678356], [3.4618057404229328, 3.6712854524430822]]])
1313        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1314        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1315        sa=s.getSubstitutedArguments({s2:-10})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1316        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1317        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")     def test_sub_overloaded_expandedData_rank4_Symbol_rank0(self):
1318        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1319          arg0=msk_arg0*numarray.array([[[[-2.3915780501354655, -1.5713847750997409, -2.0965030994469647, -2.1551686098873679], [3.3436095870548073, 3.0694003316976595, -0.81504636610563619, -2.4693923873770118], [-2.319226534159692, -3.4872612814422221, -0.52829274680925575, 0.30144897282215677]], [[-4.8403842893778295, 2.5434758702608882, -0.65369410807785577, 2.38720324090216], [-4.436083252026509, -1.9729315005424199, 2.1429634466708958, -4.4793507786187812], [-4.6789538924900809, -1.2258958461641156, 4.6704546977809684, -4.1766942543918724]]], [[[-0.99705682132654605, 0.63139391938552247, 3.648090293364568, 0.9177900253507385], [-2.6400178360936186, -4.9693099498708015, -2.0831389743339668, -4.8827387011810046], [0.92728596167706101, -0.70240094092455596, -4.2968994749977032, -1.8662843872126853]], [[4.4680529533242801, -0.62442225881816338, 3.3149308543703011, -4.9724764458198436], [-2.5558868654124858, 0.54392866523319405, -4.0956874823606899, -3.1974475782258649], [-1.1195425378333166, 1.4289844369376148, -1.2628376022909036, -2.0331849636301413]]], [[[0.15561155815826755, 1.0566531457111576, -1.6429274914523804, -3.1609988875067607], [-3.9169786589191657, -0.0862972748194899, -2.2849500782464229, -3.593674280376046], [4.5374768908066745, 1.9914470295786906, -2.6711697877422749, -4.6476473568202383]], [[4.7467779338409635, 1.4258515187294085, 1.3579719892502204, 3.8840821581627232], [-0.74410865296963191, -4.1369032807050301, 0.10505268333553275, 0.20183690831668066], [3.2258506139241625, -0.19145900822910011, -1.9876999864961387, -1.118642852906222]]]])+(1.-msk_arg0)*numarray.array([[[[-4.1006205365267823, 0.98436034016399709, -2.0659912052394889, -4.829130675843226], [-3.2904658009023189, 1.8958877020661227, -4.4668040074389035, 4.7329845357071445], [-1.7781671949524789, -0.77841298536212911, -2.7909279205249824, -3.9295744077558559]], [[-1.3638768752460773, 4.4638784666445588, 2.5119633402011221, 3.4658456524464523], [-2.3171958056993116, -2.6568253529176222, 2.2419660036743707, -1.9675169728612851], [-1.1143935824519682, 1.186871291556292, 1.8459225649295181, 3.4239497313955702]]], [[[3.2057908235968178, 1.0054526017670806, 2.8530443499731035, 2.9117538931912392], [3.7690204040343271, -0.2740720613800427, -1.6755030321386211, -4.0975186439069002], [1.5575983081276483, -1.4138189638564769, -4.5799310621318954, -2.1831715499767892]], [[4.2307751851678876, -4.574159194957832, 3.6142529396906227, 2.9695212799242778], [1.1073212833019772, 3.5565535386979832, 4.1163170572300576, -2.6051576587226011], [-2.4885332002171778, 2.7193644049811461, 3.6891018981647203, 2.2279362582877482]]], [[[3.8371440925068896, 0.098907118846149444, -4.8484985466419248, -3.2646614116360695], [-1.3166337092696869, 3.8989945382792683, 2.4522596196795661, 4.8579102565531542], [2.8065577922030176, -2.6140964300168221, 0.26485552888380326, -3.2455906809923696]], [[3.4179005303801677, -4.9507538637080364, -3.9286015574556798, 0.67686821786057827], [1.2296342635912527, -1.0149250475477691, 1.9729311750755993, -4.6474538783990385], [-1.2276432760256037, 2.5170369379074629, 0.97453825295943464, 3.8596939709877667]]]])
1320        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        arg1=Symbol(shape=())
1321        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        res=arg0-arg1
1322        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")        s1=numarray.array(3.09580908291)
1323        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")        sub=res.substitute({arg1:s1})
1324        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1325        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        ref=msk_ref*numarray.array([[[[-5.4873871330441668, -4.6671938580084422, -5.1923121823556659, -5.2509776927960692], [0.24780050414610599, -0.026408751211041803, -3.9108554490143375, -5.5652014702857127], [-5.4150356170683933, -6.5830703643509239, -3.624101829717957, -2.7943601100865445]], [[-7.9361933722865308, -0.5523332126478131, -3.749503190986557, -0.70860584200654131], [-7.5318923349352103, -5.0687405834511212, -0.95284563623780549, -7.5751598615274824], [-7.7747629753987821, -4.3217049290728173, 1.5746456148722672, -7.2725033373005736]]], [[[-4.0928659042352473, -2.4644151635231788, 0.55228121045586676, -2.1780190575579628], [-5.7358269190023199, -8.0651190327795028, -5.1789480572426676, -7.9785477840897059], [-2.1685231212316403, -3.7982100238332572, -7.3927085579064045, -4.9620934701213866]], [[1.3722438704155788, -3.7202313417268646, 0.21912177146159983, -8.0682855287285449], [-5.651695948321187, -2.5518804176755072, -7.1914965652693912, -6.2932566611345662], [-4.2153516207420179, -1.6668246459710865, -4.3586466851996049, -5.1289940465388426]]], [[[-2.9401975247504337, -2.0391559371975436, -4.7387365743610816, -6.256807970415462], [-7.012787741827867, -3.1821063577281912, -5.3807591611551242, -6.6894833632847472], [1.4416678078979732, -1.1043620533300107, -5.7669788706509761, -7.7434564397289396]], [[1.6509688509322622, -1.6699575641792928, -1.7378370936584808, 0.7882730752540219], [-3.8399177358783332, -7.2327123636137314, -2.9907563995731685, -2.8939721745920206], [0.13004153101546123, -3.2872680911378014, -5.0835090694048404, -4.2144519358149228]]]])+(1.-msk_ref)*numarray.array([[[[-7.1964296194354835, -2.1114487427447042, -5.1618002881481901, -7.9249397587519272], [-6.3862748838110202, -1.1999213808425786, -7.5626130903476048, 1.6371754527984432], [-4.8739762778611802, -3.8742220682708304, -5.8867370034336837, -7.0253834906645576]], [[-4.459685958154779, 1.3680693837358575, -0.58384574270757916, 0.37003656953775099], [-5.4130048886080129, -5.7526344358263231, -0.85384307923433056, -5.063326055769986], [-4.2102026653606694, -1.9089377913524093, -1.2498865179791832, 0.32814064848686897]]], [[[0.1099817406881165, -2.0903564811416206, -0.24276473293559775, -0.18405518971746204], [0.67321132112562587, -3.369881144288744, -4.7713121150473228, -7.1933277268156015], [-1.5382107747810529, -4.5096280467651777, -7.6757401450405967, -5.2789806328854905]], [[1.1349661022591864, -7.6699682778665332, 0.5184438567819214, -0.12628780298442344], [-1.9884877996067241, 0.46074445578928191, 1.0205079743213563, -5.7009667416313023], [-5.5843422831258795, -0.3764446779275552, 0.59329281525601907, -0.86787282462095305]]], [[[0.74133500959818832, -2.9969019640625518, -7.9443076295506261, -6.3604704945447708], [-4.4124427921783882, 0.80318545537056707, -0.6435494632291352, 1.762101173644453], [-0.28925129070568367, -5.7099055129255234, -2.830953554024898, -6.3413997639010713]], [[0.32209144747146645, -8.0465629466167385, -7.0244106403643816, -2.418940865048123], [-1.8661748193174486, -4.1107341304564704, -1.1228779078331019, -7.7432629613077397], [-4.323452358934305, -0.57877214500123841, -2.1212708299492666, 0.76388488807906541]]]])
1326        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1327     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1328     def test_Symbol_rank0_d3_nargs0(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1329        s2=Symbol(shape=())     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1330        s=Symbol(shape=(),dim=3,args=[])     def test_sub_overloaded_expandedData_rank4_Symbol_rank4(self):
1331        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1332        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        arg0=msk_arg0*numarray.array([[[[4.7227008802641297, 2.8863279383915197, -2.1896969198324809, 4.4302312776864046], [-2.0197165879770251, -4.9702841021278301, 4.7902292515365534, 4.5956841306054539], [2.93934146754248, 1.646059013328439, 0.99083597111362476, 3.3910212199665182]], [[1.2787313823171234, 1.3787912835332463, -0.071420926539018659, -3.2388329800378415], [3.349975825307892, -1.7816480803027677, 2.2965490165680036, -1.9018094630451774], [-1.1200280993595113, -0.66137198885848481, 0.21843601647543931, -1.4087126883569634]]], [[[-1.9454924644698748, 0.7634003631723596, 4.1323447887625271, 1.443298202567032], [-3.7655189569283309, 0.99421618018940361, 4.6046246816957677, 0.74421638400845325], [-3.5622774770791485, 1.2397714154717114, -1.0582462113989424, 1.2971002709503896]], [[1.3379013865706302, -0.39532127021252883, 4.7111583084640927, -0.88268548014728054], [-4.8134271904014936, -3.1339427094271266, 2.1759548242117912, -1.5082214108365442], [-3.2684776044041417, -1.1500337944886265, -4.7387724227769104, -0.87161000308836023]]], [[[-0.77862807704750203, 4.0600646358304022, -0.60854424079166769, -2.1879855865994302], [-3.1756330451114421, 2.3997197078889831, 3.48971886859092, 1.3336201149028941], [-3.1489389998309738, -3.126335897832373, 4.4951625025311497, 4.8070472911835367]], [[-0.48575660505239959, 2.6019068715787999, 2.0846243088005867, -4.1696787529733781], [4.548381761398181, 2.8671236182352331, -2.4623488980316131, -2.7420314450035965], [-2.6608024266156169, 1.9100775920001078, -4.7415568715485605, 4.335606352714283]]]])+(1.-msk_arg0)*numarray.array([[[[-0.066813883761502879, 2.3352842907581648, 1.9822821047204409, 2.2488083940398429], [-3.5461097023132315, 3.9394596449218593, -3.1392993492194812, -1.195903516669877], [-2.4035485197244641, -1.2564828050011667, 4.2913267573861269, 3.3717435374804552]], [[2.0596631449037996, 1.766648199074103, 3.7051853214349446, 2.3190764926321314], [2.0765914923551589, -3.0883600344375619, 3.3829116246346622, -0.77543432130851642], [-1.0720358718139797, 1.757742252759785, 0.37504357425332913, 2.5917331896567894]]], [[[-4.2390464570087687, 0.22513794491672012, 2.4848124269039893, 0.40807584912367822], [3.4683686407549388, 0.16480295091112396, 2.9378502257107231, -4.5549662855752659], [-3.9215318218115671, -0.029245135802563382, -2.553738608483358, 2.451028936659565]], [[-3.607109515954888, -3.993893382807582, 0.073725334847121182, -2.1709804092290019], [0.33344114744651687, -0.58055248058879805, -2.3870396661749513, 4.2208499406342153], [2.5521039977169968, 0.99728976648084799, -2.2262756306598854, -1.1032924331956737]]], [[[4.966005471135805, -2.2223123277417969, 3.9211131181159882, 1.2020059492898092], [-1.9322416802383922, 1.9213246599314813, -4.9244981020217091, 3.9198631295221293], [0.441626539964318, -4.8403835386932315, 0.067761940060105275, -3.3198352912434692]], [[3.7289362256010783, 4.4966066758919183, 4.7606849535179343, -4.2473703353049705], [-4.1395576165491477, 1.394341710895656, 1.1616039705755199, 3.875922408907579], [3.2845443210135308, 4.7114056834057489, 1.3775615753886044, -3.9913085015805105]]]])
1333        self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")        arg1=Symbol(shape=(3, 2, 3, 4))
1334        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        res=arg0-arg1
1335          s1=numarray.array([[[[-1.3801587913318047, -1.0654264899468902, 0.63456255053258914, 0.019001978473544234], [2.9683175293448718, 3.6853848061948291, -3.378954186340446, 0.041808892524110242], [-0.43021730340079323, 3.8311628728062068, -2.1793361115232388, 3.1444277139479642]], [[4.3924534836876852, 4.6258828194696662, -1.337885612990688, 4.1259618924749724], [-4.4897704263159222, 0.15369009386017485, 2.6962829695946411, 2.0341337355139855], [-2.3651800760864128, 2.5627722574362446, 4.595047097795911, -4.3290029697233141]]], [[[4.178160967558556, -4.7760981608958755, -1.9186656311572339, 1.2206352911034513], [-0.085772738154105355, -1.3074976307569877, -1.956712770838227, 3.2327542991796854], [1.1038448851539249, 3.3037436446982742, -0.27900134960503031, -0.91401651221828928]], [[-2.3182986051061674, -1.849076104179066, 1.7255801749968178, -4.800626013966669], [-1.065938515473257, -1.7027357609246607, -4.5450782032387052, 4.2110109611691939], [0.42483398312984555, -2.0300778021420198, -1.8600131931716146, -0.65565335271777681]]], [[[1.5409796879232402, 3.8526060616448135, 4.5046749363240419, -2.3425879056067043], [-2.0020629040094438, 4.0201378578644089, -0.91649358299543415, -4.6048272916989044], [2.9771669103984353, -0.18712141889004474, 4.7604346415721732, 3.1208517541066438]], [[-2.0397258049700016, 4.8476984980922424, -0.83670507076672873, -0.65429392708528322], [1.8648243434781451, -3.0663012456143979, -0.46932892583376429, 1.7337690374943984], [-2.830192293285001, 2.4237706377557764, -4.5545542759999593, -1.4623880986500994]]]])
1336        ss=s.substitute({s:numarray.zeros(())})        sub=res.substitute({arg1:s1})
1337        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1338        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        ref=msk_ref*numarray.array([[[[6.1028596715959349, 3.9517544283384098, -2.8242594703650701, 4.4112292992128603], [-4.9880341173218969, -8.6556689083226601, 8.169183437876999, 4.5538752380813436], [3.3695587709432733, -2.1851038594777679, 3.1701720826368636, 0.24659350601855401]], [[-3.1137221013705618, -3.2470915359364199, 1.2664646864516693, -7.3647948725128138], [7.8397462516238141, -1.9353381741629425, -0.3997339530266375, -3.9359431985591629], [1.2451519767269015, -3.2241442462947294, -4.3766110813204717, 2.9202902813663507]]], [[[-6.1236534320284308, 5.5394985240682351, 6.051010419919761, 0.22266291146358075], [-3.6797462187742256, 2.3017138109463913, 6.5613374525339943, -2.4885379151712321], [-4.6661223622330734, -2.0639722292265628, -0.77924486179391206, 2.2111167831686789]], [[3.6561999916767975, 1.4537548339665372, 2.9855781334672749, 3.9179405338193884], [-3.7474886749282366, -1.4312069485024659, 6.7210330274504964, -5.7192323720057381], [-3.6933115875339873, 0.8800440076533933, -2.8787592296052957, -0.21595665037058343]]], [[[-2.3196077649707423, 0.20745857418558877, -5.1132191771157096, 0.15460231900727406], [-1.1735701411019983, -1.6204181499754258, 4.4062124515863541, 5.9384474066017985], [-6.1261059102294091, -2.9392144789423282, -0.26527213904102354, 1.6861955370768928]], [[1.553969199917602, -2.2457916265134426, 2.9213293795673154, -3.5153848258880949], [2.6835574179200359, 5.9334248638496305, -1.9930199721978488, -4.4758004824979949], [0.16938986666938405, -0.51369304575566854, -0.18700259554860121, 5.7979944513643824]]]])+(1.-msk_ref)*numarray.array([[[[1.3133449075703019, 3.4007107807050549, 1.3477195541878517, 2.2298064155662987], [-6.5144272316581038, 0.25407483872703018, 0.2396548371209648, -1.2377124091939873], [-1.9733312163236709, -5.0876456778073731, 6.4706628689093657, 0.22731582353249102]], [[-2.3327903387838855, -2.8592346203955632, 5.0430709344256321, -1.8068853998428409], [6.5663619186710811, -3.2420501282977368, 0.68662865504002113, -2.8095680568225019], [1.293144204272433, -0.80503000467645958, -4.2200035235425819, 6.9207361593801036]]], [[[-8.4172074245673247, 5.0012361058125956, 4.4034780580612232, -0.81255944197977303], [3.5541413789090441, 1.4723005816681116, 4.8945629965489506, -7.7877205847549513], [-5.025376706965492, -3.3329887805008376, -2.2747372588783277, 3.3650454488778543]], [[-1.2888109108487207, -2.144817278628516, -1.6518548401496966, 2.6296456047376671], [1.3993796629197739, 1.1221832803358627, 2.1580385370637538, 0.0098389794650213247], [2.1272700145871513, 3.0273675686228678, -0.36626243748827081, -0.44763908047789691]]], [[[3.4250257832125648, -6.0749183893866103, -0.58356181820805375, 3.5445938548965135], [0.069821223771051599, -2.0988131979329276, -4.008004519026275, 8.5246904212210346], [-2.5355403704341173, -4.6532621198031867, -4.6926727015120679, -6.4406870453501135]], [[5.7686620305710798, -0.35109182220032409, 5.597390024284663, -3.5930764082196873], [-6.0043819600272927, 4.4606429565100534, 1.6309328964092842, 2.1421533714131806], [6.1147366142985318, 2.2876350456499726, 5.9321158513885637, -2.5289204029304111]]]])
1339        try:        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1340          s.substitute({s:numarray.zeros((5,))})        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1341          fail("illegal substition was successful")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1342        except TypeError:     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1343          pass     def test_mult_overloaded_constData_rank0_Symbol_rank0(self):
1344          arg0=Data(4.62465145684,self.functionspace)
1345        dsdarg=s.diff(Symbol(shape=()))        arg1=Symbol(shape=())
1346        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        res=arg0*arg1
1347        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        s1=numarray.array(-4.83968289402)
1348        dsdarg=s.diff(Symbol(shape=(2,)))        sub=res.substitute({arg1:s1})
1349        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        ref=Data(-22.3818465465,self.functionspace)
1350        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1351        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1352        dsdarg=s.diff(Symbol(shape=(4, 5)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1353        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1354        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")     def test_mult_overloaded_constData_rank0_Symbol_rank1(self):
1355        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        arg0=Data(3.61282962415,self.functionspace)
1356        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg1=Symbol(shape=(2,))
1357        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        res=arg0*arg1
1358        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        s1=numarray.array([-1.5808963858957537, 2.6509696096021864])
1359        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        sub=res.substitute({arg1:s1})
1360        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        ref=Data(numarray.array([-5.7115092956749542, 9.5775015382906385]),self.functionspace)
1361        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1362        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1363        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1364       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1365        dsds=s.diff(s)     def test_mult_overloaded_constData_rank0_Symbol_rank2(self):
1366        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        arg0=Data(1.49025589385,self.functionspace)
1367        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        arg1=Symbol(shape=(4, 5))
1368          res=arg0*arg1
1369        sa=s.getSubstitutedArguments({s2:-10})        s1=numarray.array([[4.1668790679299175, -2.8153908003971773, 3.9030969110369043, -0.17962827030748763, 2.1351246321738504], [-3.6496148227091672, 1.387147904486504, -1.1823464175604426, 1.1752089388333173, -1.7608073918316345], [1.1775740286573697, 1.5139307880954602, -4.5926484431964676, -1.3565377974967943, 2.5163302873137585], [-4.9066894975281929, -0.71152046468118701, 3.1503673258369584, -1.582645414456433, 4.0919813724626888]])
1370        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        sub=res.substitute({arg1:s1})
1371          ref=Data(numarray.array([[6.2097160899280084, -4.1956527337729987, 5.8166131759266637, -0.26769208852717874, 3.1818820671938379], [-5.4388599998117435, 2.0672053402977806, -1.7619987173376985, 1.7513620475973966, -2.6240535936055083], [1.7548866366471667, 2.2561442798348774, -6.8442214108383101, -2.0215884479450947, 3.7499760415336878], [-7.3122229429659207, -1.0603475660835118, 4.6948534751098423, -2.3585466567627744, 6.0980993578224529]]),self.functionspace)
1372        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1373        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1374        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1375        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1376        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")     def test_mult_overloaded_constData_rank0_Symbol_rank3(self):
1377        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        arg0=Data(-4.8189372207,self.functionspace)
1378        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg1=Symbol(shape=(6, 2, 2))
1379     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0*arg1
1380     def test_Symbol_rank0_d3_nargs1(self):        s1=numarray.array([[[-2.1082618280451539, -1.3955382894516588], [-3.4395290563777836, 4.8101517504101992]], [[-2.0990702249254642, -0.19805771431177988], [3.5892783984855807, 2.3466998684539329]], [[1.0198837335276068, 1.3499161645518498], [2.1694219720539518, -4.6399343230104897]], [[0.39865646301668001, -4.6889954108117458], [-1.8077039797673278, -2.0729006873515732]], [[-1.4351307436857752, -0.27135779329323384], [-0.11640854123168598, 3.5462285443877146]], [[-4.7284739075521287, -2.9968208233684992], [-0.63458679250348737, -0.3430241153835798]]])
1381        s2=Symbol(shape=())        sub=res.substitute({arg1:s1})
1382        s=Symbol(shape=(),dim=3,args=[s2])        ref=Data(numarray.array([[[10.159581394141497, 6.7250114059464261], [16.574874591447742, -23.179819307252547]], [[10.11528763575015, 0.95442769134320948], [-17.296507269905895, -11.308599341897418]], [[-4.9147556842796076, -6.5051612501794489], [-10.454308288528681, 22.359552210744798]], [[-1.9211004679024974, 22.595974512838154], [8.7112119921028786, 9.9891782770868964]], [[6.9158049573139522, 1.307656170226968], [0.56096545214841331, -17.089052725648113]], [[22.786218910197551, 14.441491409490299], [3.058033914157781, 1.6530116772185961]]]),self.functionspace)
1383        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1384        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1385        self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1386        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1387       def test_mult_overloaded_constData_rank0_Symbol_rank4(self):
1388        ss=s.substitute({s:numarray.zeros(())})        arg0=Data(-0.0961090764765,self.functionspace)
1389        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        arg1=Symbol(shape=(3, 2, 3, 4))
1390        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        res=arg0*arg1
1391        try:        s1=numarray.array([[[[-1.3508458008250446, -1.7001494994927766, -1.1781435318758104, 0.94544141796815939], [0.48819490611616523, -1.7587019774587032, -3.7925425828521075, 4.7932646338579481], [0.58005604545753187, -1.1056764808385546, -0.51753380988709718, 0.78769257503235046]], [[2.2158543714442409, 2.8083791437737293, 4.2821497276046312, 3.557157624087198], [1.3939326777613186, 1.1701609581270382, 0.2011137853628675, 2.0268107124192767], [4.9657490768337222, -0.36506867019444478, 1.9579179042357691, 2.3678413818675184]]], [[[4.6392916421533705, 4.4042259724661363, -0.16399061756687949, -2.3651374585729892], [-3.2439831086523521, -0.75751658111162179, 0.90117784493079078, 3.4349562957397168], [2.5698732564560274, 2.3597838208145365, -4.9703254679114597, 3.3611480514859409]], [[3.5875371307296735, 3.7296897049486226, 0.57748787491421005, -3.5628770219331427], [-2.1948129576712505, 4.1072354163079758, 3.4869674239178412, 1.087096416125072], [-1.8854495462953502, -0.47642374646276409, -4.0405955013288795, 2.2924875059879755]]], [[[4.5285297494026793, -2.5139281223909449, 2.208483948920561, -2.7970423581490991], [-1.7523437586040416, 1.8001610169726279, -2.0370614441012389, -1.7571467006380495], [-4.7379091083725093, -1.7199833882948159, -1.9229770651511577, 1.983783387985067]], [[3.6886437141901496, 1.3947955105400336, -1.5553692753039892, -3.1732704417249646], [-3.1233013224428783, -0.18349036348379588, -2.6033177681431141, -4.8475794865627444], [0.44359684613617745, 2.4458348840139719, -4.4593547045866213, 2.8568083531481321]]]])
1392          s.substitute({s:numarray.zeros((5,))})        sub=res.substitute({arg1:s1})
1393          fail("illegal substition was successful")        ref=Data(numarray.array([[[[0.12982854237943392, 0.16339979826821033, 0.11323028680532936, -0.090865501543539021], [-0.046919961567349337, 0.16902722285092533, 0.36449776513566223, -0.4606762372674883], [-0.055748650833525863, 0.10626554545516434, 0.049739696513606095, -0.075704405933744209]], [[-0.21296371724588994, -0.26991072590391707, -0.41155345565411638, -0.34187513413231108], [-0.13396958233003523, -0.11246308901442943, -0.019328860177915387, -0.19479490576326494], [-0.47725355778845102, 0.035086412742886867, -0.18817368159287634, -0.22757104845409318]]], [[[-0.44587803523243974, -0.42328609080747298, 0.015760986805161359, 0.2273111768833927], [0.31177622067789706, 0.072804219026262926, -0.086611370417368036, -0.33013047732063483], [-0.24698814533960797, -0.22679664370263819, 0.4776933905085276, -0.32303683512905357]], [[-0.34479488045953066, -0.35845703308646898, -0.055501826334373089, 0.34242482017728643], [0.21094144640040824, -0.39474260273287426, -0.33512921881633451, -0.10447983259467819], [0.18120881463745528, 0.045788646284003677, 0.38833790204776181, -0.22032885703438657]]], [[[-0.43523281201138325, 0.2416113101712597, -0.21225535274389759, 0.26882115790732197], [0.16841614030876842, -0.17301181285021075, 0.19578009411842659, 0.16887774663202701], [0.45535606883521218, 0.16530601500391165, 0.18481554981714085, -0.19065958934863894]], [[-0.35451214082160976, -0.13405250839155117, 0.1494851046293674, 0.30498009156431655], [0.30017760565777185, 0.017635089376762319, 0.25020246647106092, 0.46589638759990259], [-0.042633683210029791, -0.23506693191655562, 0.42858446233889236, -0.27456521249137733]]]]),self.functionspace)
1394        except TypeError:        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1395          pass        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1396          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1397        dsdarg=s.diff(Symbol(shape=()))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1398        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")     def test_mult_overloaded_constData_rank1_Symbol_rank0(self):
1399        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        arg0=Data(numarray.array([0.27659058494851418, 4.1541405281225892]),self.functionspace)
1400        dsdarg=s.diff(Symbol(shape=(2,)))        arg1=Symbol(shape=())
1401        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        res=arg0*arg1
1402        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        s1=numarray.array(3.8719303416)
1403        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        sub=res.substitute({arg1:s1})
1404        dsdarg=s.diff(Symbol(shape=(4, 5)))        ref=Data(numarray.array([1.0709394780619239, 16.08454275409127]),self.functionspace)
1405        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1406        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1407        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1408        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1409        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")     def test_mult_overloaded_constData_rank1_Symbol_rank1(self):
1410        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        arg0=Data(numarray.array([3.7426337922420245, 3.9291817340183464]),self.functionspace)
1411        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        arg1=Symbol(shape=(2,))
1412        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        res=arg0*arg1
1413        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        s1=numarray.array([0.24137850302835329, -1.7566967446888535])
1414        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        sub=res.substitute({arg1:s1})
1415        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        ref=Data(numarray.array([0.90339134215470884, -6.9023807614409334]),self.functionspace)
1416          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1417        dsds=s.diff(s)        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1418        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1419        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1420       def test_mult_overloaded_constData_rank2_Symbol_rank0(self):
1421        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        arg0=Data(numarray.array([[-4.5985565783651303, 1.9500350746471993, 4.9713294753194841, -4.1975843272554876, -2.7203349447146974], [0.6454726334120906, 4.0369461924736108, -0.05835204361358759, -4.4624467830414529, -3.7659400185729366], [2.0977327530498648, 0.21380148281940414, -2.0069737126558609, 2.3624658088422841, 4.2025541873980536], [3.414052245462365, -0.88493614463302261, -1.2061553540091854, 4.49473416391168, 2.5601548526811913]]),self.functionspace)
1422        sa=s.getSubstitutedArguments({s2:-10})        arg1=Symbol(shape=())
1423        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        res=arg0*arg1
1424        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        s1=numarray.array(1.33330352327)
1425          sub=res.substitute({arg1:s1})
1426        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        ref=Data(numarray.array([[-6.1312716879061586, 2.5999886355337587, 6.6282911047962196, -5.5966539727668181, -3.6270321662717726], [0.86061093630488039, 5.3824745816900785, -0.077800985340197651, -5.9497960182490823, -5.021141095199475], [2.7969144705273297, 0.2850622703241823, -2.6759051222010943, 3.1498839865422879, 5.603280304805077], [4.5519678875143299, -1.179888479511161, -1.608171183115485, 5.9928448969206256, 3.4134634852052463]]),self.functionspace)
1427        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1428        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1429        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1430        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1431        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")     def test_mult_overloaded_constData_rank2_Symbol_rank2(self):
1432        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg0=Data(numarray.array([[-0.80021427988594684, -1.1537754790930244, 2.8892977581295964, 3.7382841198075329, 2.3764815828521835], [0.29503112693550992, -2.1167484120073929, -3.8919266120092, 1.3224523748721193, 2.9631976530881987], [-2.8104707825838995, -2.0632038633268568, -3.0589018293825343, -1.678440560478224, -4.5543583893018766], [-0.82692491278534597, 3.2768573560743448, 3.9160327845735843, 2.3191381875549339, 4.4585962073227758]]),self.functionspace)
1433     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=(4, 5))
1434     def test_Symbol_rank0_d3_nargs2(self):        res=arg0*arg1
1435        s2=Symbol(shape=())        s1=numarray.array([[0.84019739061084842, -0.26041818053762533, -4.1862385457734819, 2.5897362481178323, 1.3358121377857461], [-2.9413855411668366, -0.72774497299829122, -3.5296778480396993, -2.4701281082949977, 1.8361878086654535], [2.766871279727253, -4.8815007323834605, -2.5917825490500368, -4.9262737607479554, -2.1516904953173679], [1.8198771262398861, -3.8256760862124253, 4.2065485224111754, 2.1262330288097564, 0.59770635028954899]])
1436        s=Symbol(shape=(),dim=3,args=[1, -1.0])        sub=res.substitute({arg1:s1})
1437        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        ref=Data(numarray.array([[-0.67233794988971163, 0.3004641110143324, -12.095289645299022, 9.6811698908288335, 3.174532943598229], [-0.86780029096226652, 1.5404530159404959, 13.737247148605071, -3.2666267830530953, 5.4409874052666343], [-7.7762108908439682, 10.071531169886436, 7.9280083806508852, 8.2684576920589663, 9.799569658529764], [-1.5049017338959638, -12.536194825062895, 16.472981923661731, 4.9310282127532963, 2.6649312664937215]]),self.functionspace)
1438        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1439        self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1440        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1441       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1442        ss=s.substitute({s:numarray.zeros(())})     def test_mult_overloaded_constData_rank3_Symbol_rank0(self):
1443        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        arg0=Data(numarray.array([[[-0.93968623179119604, 3.5541982898616844], [-4.4072293043240576, -3.6076482066197646]], [[1.7484917853830488, 4.9003868861327007], [4.7568448118670297, -2.9711396711199276]], [[3.8141950057192862, 1.8792050658033421], [-3.9338669245816726, 1.8697569231208337]], [[2.7319382834348493, 4.8419678958442489], [1.6265368297291136, 2.7028283208639312]], [[-2.4918167983349662, 0.66893189862375824], [-0.98140319773957252, -4.1758241797866216]], [[2.3073753559238792, -1.9496085178777891], [-0.68687199404203181, -1.8466377636332689]]]),self.functionspace)
1444        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        arg1=Symbol(shape=())
1445        try:        res=arg0*arg1
1446          s.substitute({s:numarray.zeros((5,))})        s1=numarray.array(-4.7863046684)
1447          fail("illegal substition was successful")        sub=res.substitute({arg1:s1})
1448        except TypeError:        ref=Data(numarray.array([[[4.497624598049291, -17.011475867168713], [21.094342193976221, 17.267303453273268]], [[-8.3688143950302809, -23.454744630041624], [-22.767708529872653, 14.22077967833674]], [[-18.255899362045483, -8.9944479793272372], [18.828685625972383, -8.9492262898982791]], [[-13.075888959772939, -23.175133544101051], [-7.7851008214498698, -12.936559810022931]], [[11.926594374657277, -3.2017118692216404], [4.6972947069193065, 19.986766766112023]], [[-11.04380143779947, 9.331420350662329], [3.2875786316735858, 8.8385709489135635]]]),self.functionspace)
1449          pass        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1450          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1451        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1452        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1453        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     def test_mult_overloaded_constData_rank3_Symbol_rank3(self):
1454        dsdarg=s.diff(Symbol(shape=(2,)))        arg0=Data(numarray.array([[[-3.7703901363085679, -1.2567782536949124], [-4.6867702962008151, -4.0264117118029379]], [[4.9065305059289148, -2.9124024019871833], [2.1575041693932544, -2.447359134212459]], [[-4.2014241124001597, 2.1567970243772496], [-0.21332683825097298, -4.1649402688134085]], [[2.4269573018600399, 1.862212593201459], [-0.8497946023648062, -0.85421311729337468]], [[-3.9387175807922148, 2.8138330952953154], [-3.5224045840887532, 2.3328843983658345]], [[-4.1835084349073455, 1.5103476384019734], [3.5299839973193272, 0.52130047189201001]]]),self.functionspace)
1455        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        arg1=Symbol(shape=(6, 2, 2))
1456        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        res=arg0*arg1
1457        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        s1=numarray.array([[[3.7025504227899226, 0.94126871779523835], [0.2494407260336402, -1.4801201322289135]], [[2.2922758002791603, -0.52083778427225891], [-3.8446937528722511, 4.7302904730413342]], [[4.5317616448777596, 4.7075623194640848], [3.6913207941396351, -0.94890681756314521]], [[0.10066689821055874, -0.2379214158604368], [3.5670839439496831, 1.12875998069849]], [[-3.2904800400470879, 0.6205159319494804], [3.0069046365957437, -0.47921917980699202]], [[-2.06878107963567, -2.1195493051668968], [-1.6911454119040039, 1.930100136733504]]])
1458        dsdarg=s.diff(Symbol(shape=(4, 5)))        sub=res.substitute({arg1:s1})
1459        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        ref=Data(numarray.array([[[-13.960059593272241, -1.182966055408349], [-1.1690713854372303, 5.9595730352818101]], [[11.247121142072317, 1.5168892139602093], [-8.2949428018620797, -11.576719596675883]], [[-19.039852646439627, 10.153256402690602], [-0.78745779398387905, 3.952140215820322]], [[0.24431426366771691, -0.44306025680762678], [-3.0312886817506057, -0.9642015817884666]], [[12.960271582979336, 1.7460282654774637], [-10.591534675862574, -1.1179629479694033]], [[8.6547630966325499, -3.2012562875353661], [-5.9697162411611355, 1.0061621120780087]]]),self.functionspace)
1460        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1461        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1462        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1463        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1464        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")     def test_mult_overloaded_constData_rank4_Symbol_rank0(self):
1465        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        arg0=Data(numarray.array([[[[0.62243391611320931, 2.0870921150140633, -1.966483871868502, 2.0460162713266978], [-4.0678614422698969, -1.0483170813789053, -3.3875965478845105, -0.56278682367596566], [-3.1888119343249111, 1.1466037700100813, -0.08422750542817603, 1.334817640609244]], [[0.94229536045356443, -0.46607285357294259, 3.2913807414193705, 4.4571709007297127], [-4.8728928412169248, 1.2037128407211304, 1.7363887141819356, -1.8638393114984897], [0.2688971714658468, -1.0619718642775746, -1.5898347593643845, 4.0497830306245604]]], [[[-3.0176256202980776, 4.6481698965552418, 2.9546667018974437, -0.80203271850496982], [0.920018392214903, 2.5683755474820238, -0.39881454964042007, -1.8042576364273657], [-2.3945875160036332, 4.1111523243175156, 0.78082260002804471, -4.7775799631740909]], [[2.8847051100624723, 3.801654962351078, 1.7703173227715148, 4.1273910274214991], [-0.89823810002448035, -0.13134866838888204, -2.9139897570290261, 3.0266778096414111], [-4.6565287368895367, 4.2608689122302597, 4.4884714229987637, 0.39909756290562726]]], [[[-3.0170682335317931, 3.5429625779103553, -1.5481240066779933, 2.2741378666795491], [0.99402869902853208, -2.7818018223223495, -4.1871147291249109, -3.2256430704428585], [-1.1555881857999983, -1.3659488684092769, -3.6647624059065964, -4.1746014766224038]], [[-0.16412546559365726, 2.0500472712024926, 0.70515501953914139, 4.9173519977774696], [4.8984165381421718, 2.4090796502395673, -4.3641606786463338, -2.9169347489558826], [-2.5705157992905558, -2.1873999149378887, 0.30099797008132612, -0.40586512460845547]]]]),self.functionspace)
1466        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        arg1=Symbol(shape=())
1467        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        res=arg0*arg1
1468        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        s1=numarray.array(-4.38997505647)
1469        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        sub=res.substitute({arg1:s1})
1470          ref=Data(numarray.array([[[[-2.7324693660399006, -9.1622823254735639, 8.6328151464594995, -8.9819603962624388], [17.857810264753809, 4.6020858385281453, 14.87146434660761, 2.470620118049252], [13.998804851470311, -5.033561950002353, 0.36975664789865109, -5.8598161472149455]], [[-4.13665312822154, 2.046048201684489, -14.449079356187196, -19.566869076641478], [21.39187802580896, -5.2842693459222208, -7.6227031436002131, 8.1822080867524907], [-1.1804518754912556, 4.6620299948548602, 6.9793349375236682, -17.778446488570129]]], [[[13.247301202882928, -20.405349904126975, -12.970913121521617, 3.5209036287121829], [-4.0388577933199716, -11.2751045891017, 1.7507859250800237, 7.9206460193673678], [10.51217946579799, -18.047856157115579, -3.4277917376536409, 20.973456868640252]], [[-12.663783478454937, -16.689170458038671, -7.7716488890093069, -18.119143658691538], [3.9432428538813187, 0.5766173779281577, 12.79234234817573, -13.287040088306636], [20.442045004695569, -18.705108243592797, -19.704277588657195, -1.7520283462549344]]], [[[13.244854288882133, -15.55351734304433, 6.7962257736436893, -9.9834085097043221], [-4.3637611941537289, 12.212040612046716, 18.381329219449761, 14.160492620329668], [5.0730033112170725, 5.9964814607344739, 16.088215549830551, 18.326396353088406]], [[0.72050670008820039, -8.9996563851698248, -3.0956129467236795, -21.587052614141587], [-21.503926418659777, -10.575799573608803, 19.158556521698415, 12.805270789276145], [11.284500241155726, 9.6026310651088593, -1.3213735807060782, 1.7817377733234934]]]]),self.functionspace)
1471        dsds=s.diff(s)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1472        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1473        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1474       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1475        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")     def test_mult_overloaded_constData_rank4_Symbol_rank4(self):
1476        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        arg0=Data(numarray.array([[[[0.92475193690629176, -2.8751640037436377, 2.3253579475929946, -1.4883270341411139], [0.99308590109939665, -4.571048057187971, 0.29582761355193554, 0.13789701080785477], [-4.8513899543422578, -3.6257472257559966, -0.35978952486470916, 3.2517553292871213]], [[1.4829500707237964, -2.4100404084555849, -1.3007935048236199, -1.9592333033911915], [-3.2571300156448268, 3.5809336502177818, 4.572845912197149, 0.11594932874247199], [4.1148495529245857, -4.948814678027361, 0.20924193900359267, -1.1213985895158896]]], [[[-2.5470666325037494, 3.6152403556802923, 3.973428980280806, -2.5374743265932209], [-1.5104931521079923, 1.9242528516494346, 1.2141691608491234, 4.0577747879052453], [3.8342739616484334, -3.0938013228729275, -0.013278763548063566, -0.42321566529779808]], [[2.6294282632341996, 3.3952741627917256, 2.4458864889971466, 4.2648559736340506], [-3.7590978982471257, 1.9398108969769856, -0.72053544714256734, -2.2852607861733709], [-3.2806396751883415, 0.51560443280332802, 3.3391590838269085, -2.5163633463539634]]], [[[4.01150830599126, -0.63639401929707073, -3.1327871719882161, 3.2114179123865725], [2.4499611723235173, 2.7753873236361759, -4.685579988073755, -2.2124483061230249], [-1.592101861637012, -4.6991157531893437, 1.8862972499478818, -2.4723033101868044]], [[1.6629673331527997, -3.797885972234567, -2.7734235709739954, -0.64462102158809298], [-0.88743325197640388, 2.5092803298320216, 1.525489125478364, 2.2445055975567962], [-1.160115769838137, -1.3355312013577905, -1.0067006671660481, 3.6058946626271364]]]]),self.functionspace)
1477        sa=s.getSubstitutedArguments({s2:-10})        arg1=Symbol(shape=(3, 2, 3, 4))
1478        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        res=arg0*arg1
1479        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        s1=numarray.array([[[[1.1454670721774276, -0.011324883951625786, -3.6679325603974888, 0.094693748129400568], [-0.94166879518392843, -4.1783274612573384, -0.26913364710175003, -3.1060599945156477], [2.1413905443235972, 3.4882436840724846, 2.2658723445074678, 2.1819015356595139]], [[-1.9800856525493749, 2.7480580905119893, -3.1758715478375219, 4.1124829257304629], [2.0216531202224841, 4.0515397505305888, 4.044920456333422, -2.3883049937748946], [1.5444958016374528, -1.2594632181245204, 3.5895692628257976, -1.8412492131846401]]], [[[-0.79280116164120962, -1.2215336421582137, -4.9961696612945055, -2.7749169673973384], [-0.23664202961414915, -3.5042031492270143, -4.0093512501017203, 0.23193992235689542], [3.1633334993556197, 1.6180559532355963, 2.5015418045872986, 4.5068540065663516]], [[-4.1132185738946214, 4.1318631987586905, -4.2991786205876377, 0.23269781735957817], [1.6926075754432439, -3.007700180988361, 3.1039787293459948, 3.355203306995362], [-4.1457163793408522, -1.2887202396242636, -2.7544192723911931, -4.0173861352686675]]], [[[1.4375090967135709, 0.047062319770922123, -0.75634196908244178, -0.17805460405137996], [2.5278812537929483, -3.9412959574596886, -0.1516720332141368, -2.385490768218621], [2.0634420046107511, 3.7303717046166387, -3.7967716979561583, -0.36579638919369373]], [[-0.89677692789005903, -0.33159623329473931, -2.0783805922287799, 3.3237758621528677], [1.8764406996924805, 3.8567013916314448, 2.4876054261100879, -3.122046411865298], [-3.9505368448428069, -3.9474451391708176, 0.76222063661286921, 2.065165407462576]]]])
1480        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        sub=res.substitute({arg1:s1})
1481          ref=Data(numarray.array([[[[1.0592728936584552, 0.032560898684288464, -8.5292561305554226, -0.14093526530513639], [-0.93515800400241478, 19.099335624075504, -0.079617164548639499, -0.42831638863356958], [-10.388720575054998, -12.647489860286688, -0.81523713423442645, 7.0950099465605785]], [[-2.9363681584872698, -6.6229310429171893, 4.1311530815811848, -8.0573135077187672], [-6.584787059098673, 14.508295027869941, 18.496797973906915, -0.27692236086049277], [6.3553678588617721, 6.2328500602902022, 0.75108843274136661, 2.0647742706124967]]], [[[2.0193173850265365, -4.4161377189515036, -19.851925322587327, 7.0412805631986641], [0.35744616523310901, -6.7429729026590115, -4.8680306428853894, 0.94115996924851042], [12.129087268589474, -5.0059436486027034, -0.033217382128710969, -1.9073712167890253]], [[-10.815413171058387, 14.028808362935354, -10.515302901880693, 0.99242267641760229], [-6.3626775794058616, -5.8343695859208742, -2.2365267016703343, -7.6675145471157151], [13.600601636143761, -0.6644698681936374, -9.1974441340729562, 10.10920321894068]]], [[[5.7665796814044832, -0.029950178836461127, 2.3694584183777816, -0.57180774483350039], [6.1932109200372141, -10.938622839032124, 0.71067144357861733, 5.2777750094174012], [-3.2852098569207846, -17.529448442415831, -7.1618400125346513, 0.90435962385794955]], [[-1.4913107362062921, 1.2593646828759113, 5.76422972394219, -2.1425757917908261], [-1.6652158722689767, 9.6775449400565687, 3.7948150260119111, -7.0074506472637719], [4.5830800930287374, 5.2719361490107728, -0.76732802340590534, 7.4467689202114986]]]]),self.functionspace)
1482        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1483        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1484        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1485        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1486        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")     def test_mult_overloaded_taggedData_rank0_Symbol_rank0(self):
1487        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        arg0=Data(3.142013671,self.functionspace)
1488        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg0.setTaggedValue(1,-2.04077395087)
1489     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=())
1490     def test_Symbol_rank1_dNone_nargs0(self):        res=arg0*arg1
1491        s2=Symbol(shape=())        s1=numarray.array(-0.905206509275)
1492        s=Symbol(shape=(2,),dim=None,args=[])        sub=res.substitute({arg1:s1})
1493        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        ref=Data(-2.84417122722,self.functionspace)
1494        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        ref.setTaggedValue(1,1.84732186428)
1495        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1496        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1497          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1498        ss=s.substitute({s:numarray.zeros((2,))})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1499        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")     def test_mult_overloaded_taggedData_rank0_Symbol_rank1(self):
1500        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        arg0=Data(1.54368119889,self.functionspace)
1501        try:        arg0.setTaggedValue(1,-0.973182859739)
1502          s.substitute({s:numarray.zeros((5,))})        arg1=Symbol(shape=(2,))
1503          fail("illegal substition was successful")        res=arg0*arg1
1504        except TypeError:        s1=numarray.array([-0.97051483006179051, -4.8243289242685101])
1505          pass        sub=res.substitute({arg1:s1})
1506          ref=Data(numarray.array([-1.4981654964063673, -7.4472258576349226]),self.functionspace)
1507        dsdarg=s.diff(Symbol(shape=()))        ref.setTaggedValue(1,numarray.array([0.94448839773843207, 4.6949542188401541]))
1508        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1509        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1510        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1511        dsdarg=s.diff(Symbol(shape=(2,)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1512        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")     def test_mult_overloaded_taggedData_rank0_Symbol_rank2(self):
1513        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")        arg0=Data(0.576275206322,self.functionspace)
1514        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        arg0.setTaggedValue(1,-0.446417285252)
1515        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg1=Symbol(shape=(4, 5))
1516        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        res=arg0*arg1
1517        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        s1=numarray.array([[-3.7798020411794298, 2.8125776443752777, -0.74593700484018655, 4.9042983986909512, -1.1062378936297144], [1.3747147971013396, 1.7312150406230939, -2.4865059810459189, -3.9444781957615138, -4.8713070674060148], [4.7677542872819085, -0.65669250050514094, -2.2966507465733335, 4.6331137703181184, -4.2587467390331817], [-2.2122452558031123, -0.89486317692759698, -2.7263171047505361, 1.4136050574112167, 1.5057522304514919]])
1518        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        sub=res.substitute({arg1:s1})
1519        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        ref=Data(numarray.array([[-2.1782062011384205, 1.6208187623100703, -0.42986500136777495, 2.8262255715721345, -0.63749747039309623], [0.79221405333400008, 0.99765630472347699, -1.4329117472490631, -2.2731049860965866, -2.8072134853290578], [2.7475385855977827, -0.37843560621895822, -1.3235028828319906, 2.6699485939051231, -2.4542101557111002], [-1.2748620912236397, -0.5156874619142493, -1.5711089520403427, 0.81462554611800553, 0.86772767727381395]]),self.functionspace)
1520        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        ref.setTaggedValue(1,numarray.array([[1.6873689660148408, -1.255583276563631, 0.33299917267007023, -2.189363577211358, 0.49384371731752186], [-0.61369644771829823, -0.77284431862310299, 1.1100192498224006, 1.7608832478891809, 2.1746356766622736], [-2.1284079256789306, 0.29315888332112217, 1.0252645914581893, -2.0683020716109741, 1.9011781578167486], [0.98758452140814967, 0.39948239011636527, 1.2170750806399457, -0.63105773214859318, -0.6721938229809169]]))
1521        self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1522        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1523          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1524        dsds=s.diff(s)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1525        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")     def test_mult_overloaded_taggedData_rank0_Symbol_rank3(self):
1526        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        arg0=Data(4.6954921918,self.functionspace)
1527        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        arg0.setTaggedValue(1,3.80656545201)
1528        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        arg1=Symbol(shape=(6, 2, 2))
1529        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        res=arg0*arg1
1530        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        s1=numarray.array([[[3.3283491776040073, -3.9068878738203718], [-2.1695978858355423, -2.2223735496995447]], [[-2.3211489651914921, 4.272069872491878], [1.636342469753175, -4.2787938517786497]], [[2.7410635950334186, -3.5668158773147507], [-1.0064480730166228, 1.389332564769]], [[0.77463712529690731, -0.94041585508240466], [3.6978341544417166, -2.6780892355753592]], [[-4.4954676727861065, -4.2409706282499835], [2.3785224394198679, -4.1039517994892138]], [[-2.0175257524312817, 0.85038925666007348], [-3.2277420742959917, -3.855794844823607]]])
1531          sub=res.substitute({arg1:s1})
1532        sa=s.getSubstitutedArguments({s2:-10})        ref=Data(numarray.array([[[15.628237575034362, -18.344761505774329], [-10.187329932293613, -10.43513764988427]], [[-10.89893684206883, 20.05947072912349], [7.6834332898420676, -20.091043121362375]], [[12.870642707715545, -16.747956101531248], [-4.7257690683049729, 6.5236002096908132]], [[3.6373025733125388, -4.4157153045874011], [17.36315139876443, -12.574947094596416]], [[-21.10843335607106, -19.913444470614692], [11.168333542324792, -19.270073630038475]], [[-9.4732764173030475, 3.9929961146407393], [-15.155837707011633, -18.104854587064445]]]),self.functionspace)
1533        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        ref.setTaggedValue(1,numarray.array([[[12.669578991701924, -14.871824405371543], [-8.258716356981127, -8.4596103757528684]], [[-8.8356054598727027, 16.261913585211406], [6.2288447130233893, -16.28750885246448]], [[10.434037982623636, -13.5773180922763], [-3.8311104639897189, 5.2885853424057174]], [[2.948706919001554, -3.5797545044815582], [14.07604773957002, -10.194321961547963]], [[-17.112291933867024, -16.143532276496508], [9.0540013447323737, -15.621961136660534]], [[-7.6798438277506191, 3.2370623651649013], [-12.286611468022571, -14.677335446353782]]]))
1534          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1535        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1536        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1537        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1538        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")     def test_mult_overloaded_taggedData_rank0_Symbol_rank4(self):
1539        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        arg0=Data(-1.72281700023,self.functionspace)
1540        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        arg0.setTaggedValue(1,1.23448641864)
1541        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg1=Symbol(shape=(3, 2, 3, 4))
1542     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0*arg1
1543     def test_Symbol_rank1_dNone_nargs1(self):        s1=numarray.array([[[[-4.3265612601968471, 4.9346403281714331, 2.8024200919119817, -3.9056671936664311], [0.98069732637570617, -2.2852413242790757, 3.2075463029671312, -2.6966078512789116], [-2.1601129611240619, -2.6503532815304762, -4.675750160645002, 3.2350739199006568]], [[-4.1760984392537086, 4.3345400423125842, 2.3141216950646779, 0.60673873055732486], [3.6895192429599195, -1.0430965175426432, 0.33936966744652075, -4.9652989404647769], [0.016939166262534222, -3.5215478761207564, 0.96881594277756378, 2.4707123930500092]]], [[[-4.0598585401879825, 0.32726568454206451, -3.8317591404661555, -4.8432615549786364], [-1.8707032325346216, 0.11786029243200069, -1.2644962697725761, 4.5016381310909193], [1.0052891428203132, 3.5573702004465542, 0.94853515124922705, -3.266716026917611]], [[4.4268917686602247, 1.7045644573811822, -4.2672635941058026, 4.4735466129490451], [-3.3659634968161098, -3.7740307778271154, -0.23936175808445981, 1.638694221507726], [-2.6562820856857803, -1.8386899346245853, -3.8721446565337256, 2.2142808663189424]]], [[[-4.9689140219050429, 3.0036100506068504, 1.7161971518176031, 1.2296325439044953], [-4.2017528414854652, -1.8394187611478952, -4.4722717389932569, -2.3151891625454821], [1.0583223957426515, 4.9808003293003509, -0.20896133794562566, -3.9944246041361611]], [[-3.3354149131160451, 1.5689046088326091, 1.0657585673339192, -2.4003243575280555], [0.12124021598431511, -1.1303400850693057, -1.9271523374197388, -1.7678094654193863], [1.3900959283471721, 1.5973269294693555, 3.1820328180383193, 0.020208485606988624]]]])
1544        s2=Symbol(shape=())        sub=res.substitute({arg1:s1})
1545        s=Symbol(shape=(2,),dim=None,args=[s2])        ref=Data(numarray.array([[[[7.4538732915852082, -8.5014822473732448, -4.8280569761201289, 6.7287498384724653], [-1.6895620259559927, 3.9370526030863635, -5.5260152997629799, 4.6457618491254991], [3.7214793318324864, 4.5660736900247683, 8.0554618655674215, -5.5734403461917594]], [[7.1946533857624484, -7.4676192730552966, -3.9868081968486213, -1.045299799699541], [-6.3563664744313337, 1.7970644132987275, -0.58467183243782017, 8.554301425835547], [-0.029183083606744185, 6.06698254808967, -1.6690925763069098, -4.2565853134149645]]], [[[6.9943933115474914, -0.56381888491958132, 6.601419787965443, 8.344053343456924], [3.2228793313878823, -0.20305171545342732, 2.1784956702862215, -7.7554987011078413], [-1.7319292253931926, -6.1286978574257542, -1.6341524838838573, 5.6279539060835297]], [[-7.626724397207207, -2.9366526251568561, 7.3517142643698472, -7.7071021560908708], [5.7989391344540557, 6.5019643834157081, 0.41237650603182713, -2.8231702629851867], [4.5762879346145349, 3.1677262775151811, 6.6709966416095421, -3.8148007197688423]]], [[[8.5605295495980389, -5.1746704572343623, -2.9566936288903536, -2.1184318506694821], [7.2388512260579478, 3.1689819122397545, 7.7049057815666941, 3.988647247971739], [-1.823295815105068, -8.5810074820485838, 0.36000214540263886, 6.8816626141257302]], [[5.7463095151227659, -2.702935531829326, -1.8361069779390997, 4.1353196092052489], [-0.20887470520881798, 1.9473691145940035, 3.3201308089314878, 3.0456122001844874], [-2.3948808973010833, -2.7519019890081795, -5.4820602341926197, -0.034815522552537087]]]]),self.functionspace)
1546        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        ref.setTaggedValue(1,numarray.array([[[[-5.3410811151064834, 6.0917464659774998, 3.4595495427759313, -4.8214931062905171], [1.2106575302027247, -2.8210993781265854, 3.9596723481566771, -3.3289257687890399], [-2.66663011322566, -3.2718251306347788, -5.7721500702479123, 3.9936548173985087]], [[-5.1553368061426292, 5.3509308132656104, 2.8567518036265622, 0.74901072253301881], [4.554661396727484, -1.2876884842321341, 0.41894724535949618, -6.1295941064678363], [0.020911170694103174, -4.3473030256449352, 1.1959901235162222, 3.0500608935740701]]], [[[-5.0118402294424564, 0.40400504285255151, -4.7302546183870042, -5.9789406115194401], [-2.3093577338610776, 0.14549693030368552, -1.5610034714491989, 5.5572111344423751], [1.2410157936131636, 4.39152519850908, 1.1709537618153174, -4.0327165687679427]], [[5.4649377651792932, 2.104261672325459, -5.2678789516603199, 5.5225325368173852], [-4.1552362224415518, -4.6589897387390575, -0.29548883949592541, 2.0229457607473758], [-3.2791441588432502, -2.2698377523754134, -4.7801099894819963, 2.7334996565146623]]], [[[-6.1340568754081053, 3.7079158143505366, 2.1186220756193546, 1.5179646753620302], [-5.1870068172759387, -2.2707374788199806, -5.5209587222334928, -2.85806957773395], [1.3064846240818391, 6.1487303604553372, -0.25795993371372866, -4.9310629240686339]], [[-4.1175244107552791, 1.9367914317381283, 1.3156644769179004, -2.963167819687802], [0.14966940002504314, -1.3953894834570877, -2.3790433871858725, -2.1823367757951], [1.7160545441447639, 1.9718784005502887, 3.9281762975200034, 0.024947101023013681]]]]))
1547        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1548        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1549        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1550       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1551        ss=s.substitute({s:numarray.zeros((2,))})     def test_mult_overloaded_taggedData_rank1_Symbol_rank0(self):
1552        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        arg0=Data(numarray.array([-0.099233059085104713, 4.771977048069223]),self.functionspace)
1553        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        arg0.setTaggedValue(1,numarray.array([3.9729085267773208, 4.512809517509826]))
1554        try:        arg1=Symbol(shape=())
1555          s.substitute({s:numarray.zeros((5,))})        res=arg0*arg1
1556          fail("illegal substition was successful")        s1=numarray.array(0.26176969234)
1557        except TypeError:        sub=res.substitute({arg1:s1})
1558          pass        ref=Data(numarray.array([-0.025976207346631468, 1.249158963725014]),self.functionspace)
1559          ref.setTaggedValue(1,numarray.array([1.0399870427481233, 1.1813167589860505]))
1560        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1561        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1562        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1563        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1564        dsdarg=s.diff(Symbol(shape=(2,)))     def test_mult_overloaded_taggedData_rank1_Symbol_rank1(self):
1565        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        arg0=Data(numarray.array([0.84702689091359229, -3.3372769586299422]),self.functionspace)
1566        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")        arg0.setTaggedValue(1,numarray.array([-2.152707415414048, 1.9005183627662312]))
1567        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        arg1=Symbol(shape=(2,))
1568        dsdarg=s.diff(Symbol(shape=(4, 5)))        res=arg0*arg1
1569        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        s1=numarray.array([0.22148437875716098, 4.0581595354793194])
1570        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        sub=res.substitute({arg1:s1})
1571        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        ref=Data(numarray.array([0.18760322472460655, -13.543202312199522]),self.functionspace)
1572        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        ref.setTaggedValue(1,numarray.array([-0.47679106454891407, 7.7126067162133252]))
1573        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1574        self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1575        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1576       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1577        dsds=s.diff(s)     def test_mult_overloaded_taggedData_rank2_Symbol_rank0(self):
1578        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")        arg0=Data(numarray.array([[-4.9957974390113735, 4.9127660926149055, -0.033400607153987849, -4.5745875540405283, -3.40034229393263], [4.6311740546030773, 4.0795994583149682, 4.8540687237153293, 4.9306788508967045, 3.1060981817064288], [-1.3242874361820456, -3.3839454855009707, 0.088505407790738566, -4.4328915815516297, -3.0958370529970693], [-2.3333608177639089, -4.3040231210385214, 4.1339174077369343, -4.5703847879440351, -3.3406709387044389]]),self.functionspace)
1579        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        arg0.setTaggedValue(1,numarray.array([[-0.78277733029185015, 4.3160080804422201, -3.0818130197239957, 1.7055665928942068, -3.3364799279772583], [4.5669273627829092, 3.6704066897391243, 2.6983979089447621, -1.2237350853460538, -0.1257348607090929], [2.1891872096029914, -0.7503980382583979, 1.9746042593444724, -2.0584330310875232, -0.7673935307397155], [-0.23746062225782705, 2.8663010003293437, 3.8185722602896526, 4.8671017855990222, -1.9042813962136051]]))
1580        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        arg1=Symbol(shape=())
1581        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        res=arg0*arg1
1582        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        s1=numarray.array(-0.123633480243)
1583        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        sub=res.substitute({arg1:s1})
1584          ref=Data(numarray.array([[0.61764782397173934, -0.60738236964752024, 0.0041294333046613622, 0.56557217998023424, 0.4203961518147894], [-0.57256816597952853, -0.50437507902705625, -0.60012540964938543, -0.60959698629464243, -0.38401772817938795], [0.16372626457665548, 0.41836895732351315, -0.01094223158545413, 0.54805381376508067, 0.38274910912583321], [0.28848151856172877, 0.53212135749834688, -0.51109059615373209, 0.56505257738107939, 0.41301877449713931]]),self.functionspace)
1585        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        ref.setTaggedValue(1,numarray.array([[0.096777485598944848, -0.53360309973999165, 0.38101526908524591, -0.21086513366492038, 0.41250062525520415], [-0.56462512387573127, -0.4537851529579448, -0.33361232456203066, 0.15129462749623307, 0.015545038417276023], [-0.27065683362567039, 0.092774321037059626, -0.24412719668449809, 0.25449123947954888, 0.09487553292096082], [0.029358083150294065, -0.35437076809338752, -0.47210337809722808, -0.60173673244828274, 0.23543293637500923]]))
1586        sa=s.getSubstitutedArguments({s2:-10})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1587        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1588        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1589       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1590        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")     def test_mult_overloaded_taggedData_rank2_Symbol_rank2(self):
1591        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        arg0=Data(numarray.array([[-2.5363493699555439, 1.9315826441262116, -4.797663921800063, -2.3131658171459835, -1.4174075473244754], [-0.4937783451212221, -4.7652740781432534, 1.5781017135273068, -4.2362357361072114, -3.918073606586808], [2.094919785395116, 1.3684348598821918, -4.2376402301126852, -1.6050592311847534, 3.151025223042982], [-2.6417620339476366, 0.27296872857386667, -1.4323869283247213, -4.6402797342361799, -3.9199666124863741]]),self.functionspace)
1592        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")        arg0.setTaggedValue(1,numarray.array([[-0.69802384928264605, 0.87453186333400357, 0.81014803662176149, -4.214756633799734, 0.78685864942817574], [0.48682400140861759, -2.7486583171634758, 0.40554914153896249, -1.7609786982015061, -0.39145780725801416], [1.2068445571926318, 0.18236245525374706, 4.017808328373075, -1.0950851034750277, 0.12173582687690843], [0.22180579191198468, -4.2110674925319236, 2.9122016067639365, 4.5406571257464297, 3.0637655540581346]]))
1593        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        arg1=Symbol(shape=(4, 5))
1594        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        res=arg0*arg1
1595        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        s1=numarray.array([[-2.7914057802277092, -3.2955192040483841, -0.4909883356152811, -4.414815259808397, 1.1535659837090115], [0.30062418712185313, 4.6879078677821262, 2.641934893458421, -4.6213986057014331, 2.2307025160830776], [4.0559589148649486, -0.33010334091372151, -1.5019795108463163, 1.5894091005782052, 4.3064711265533191], [2.9888346593766579, -4.5884630123207506, 2.4921626108815289, -3.5186629218511625, -1.0861727773454932]])
1596        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        sub=res.substitute({arg1:s1})
1597     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=Data(numarray.array([[7.0799802919708137, -6.3655676979244857, 2.3555970238060953, 10.212199748003247, -1.6350731316459357], [-0.14844171362044126, -22.339165843065977, 4.1692419823943165, 19.577333924268451, -8.7400566524118908], [8.4969085795002854, -0.45172491906991191, 6.364848799967322, -2.5510957490121045, 13.569799142075835], [-7.895789928888072, -1.2525069145814096, -3.5697411470863107, 16.327580247874213, 4.2577610225859299]]),self.functionspace)
1598     def test_Symbol_rank1_dNone_nargs2(self):        ref.setTaggedValue(1,numarray.array([[1.9484678076243735, -2.8820365501694258, -0.39777323610290649, 18.607371903277738, 0.90769337196755784], [0.14635106969487355, -12.885456950875437, 1.071434428043893, 8.1381845005383653, -0.87322591559081664], [4.8949119406016965, -0.060198455736490949, -6.0346657877240473, -1.7405382293708347, 0.52425182351249966], [0.66294083851702656, 19.32232743186902, 7.2576799597261958, -15.977041869203234, -3.3277787409867781]]))
1599        s2=Symbol(shape=())        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1600        s=Symbol(shape=(2,),dim=None,args=[1, -1.0])        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1601        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1602        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1603        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")     def test_mult_overloaded_taggedData_rank3_Symbol_rank0(self):
1604        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        arg0=Data(numarray.array([[[0.20286433747766175, 2.066180723397264], [-3.1327754856901735, -1.1194293005675835]], [[-1.7914925359739922, 1.275772548969373], [-2.3842819867614953, -3.1968139299234077]], [[-3.5171630188865488, -1.4300055611015186], [4.2854751694367756, 1.7799374077309524]], [[-4.2108803597952917, -1.5964309596888695], [2.7414856168787471, 1.1873651110226469]], [[-3.5913507733928229, -1.3017853623346696], [-0.13258097661378798, -3.1022689591044426]], [[4.9076894073951749, 2.8964781538465161], [2.969217301725779, 1.8197050412291595]]]),self.functionspace)
1605          arg0.setTaggedValue(1,numarray.array([[[3.7913962593423918, 4.4765688935993317], [1.4500345756448763, 4.8443295010220275]], [[1.7391435441206662, 4.4187921026078829], [-4.2876409136689784, -4.1427096121048841]], [[0.11488507950500271, 2.1339510129273167], [-2.8155795121378926, -4.6369329094888991]], [[0.67434242728218052, 4.9095299484356563], [0.94463745614236405, 3.557499141589803]], [[0.038621679734069048, -0.10332111066950311], [-2.0403842705827979, 1.0573287011436552]], [[-2.1400599935190945, 4.2642563454671869], [3.9163707220927186, -2.5416950274474726]]]))
1606        ss=s.substitute({s:numarray.zeros((2,))})        arg1=Symbol(shape=())
1607        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        res=arg0*arg1
1608        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        s1=numarray.array(3.22032001333)
1609        try:        sub=res.substitute({arg1:s1})
1610          s.substitute({s:numarray.zeros((5,))})        ref=Data(numarray.array([[[0.65328808596966281, 6.6537631347069341], [-10.088539593828681, -3.6049205801225788]], [[-5.7691792673232181, 4.108395871899436], [-7.6781509993834112, -10.294763877415299]], [[-11.326390459854416, -4.6050755275843107], [13.800601454753718, 5.7319680565855959]], [[-13.560382296374918, -5.1410185693811012], [8.8284609982830986, 3.8236956301526179]], [[-11.565298770434771, -4.1921654553826446], [-0.42695317237583746, -9.9902988157275558]], [[15.804330417828238, 9.3275865669967502], [9.5618299006647014, 5.8600325626225302]]]),self.functionspace)
1611          fail("illegal substition was successful")        ref.setTaggedValue(1,numarray.array([[[12.209509252413918, 14.41598439909561], [4.6695753639655058, 15.60029124329226]], [[5.6005987611804535, 14.229924642760029], [-13.807575844248428, -13.340850673264026]], [[0.36996672076263859, 6.8720051543895364], [-9.0670670520514882, -14.932407848882294]], [[2.1715984144123999, 15.810257548976251], [3.0420349053536828, 11.456285683055723]], [[0.12437416819593333, -0.33272704048818802], [-6.5706903014356595, 3.4049367769580914]], [[-6.8916780268502658, 13.732270051265186], [12.6119670159636, -8.1850713646631412]]]))
1612        except TypeError:        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1613          pass        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1614          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1615        dsdarg=s.diff(Symbol(shape=()))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1616        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")     def test_mult_overloaded_taggedData_rank3_Symbol_rank3(self):
1617        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        arg0=Data(numarray.array([[[-3.0362430129414495, -1.6103362752021533], [3.0322276873410949, 2.889681860828258]], [[3.0356323227798061, 3.8849951306068178], [3.1682099248345352, 1.252560279633526]], [[-2.422448371330125, -4.3051891736441767], [3.2099062879412248, 3.0454833071508354]], [[-1.1376898513557334, 0.97676409380038631], [1.0009530341765513, -3.085670706338802]], [[3.7338110619145226, -3.4624334476005911], [-1.9009045069833541, 0.020021974502883566]], [[2.2281987737323306, -2.9210437430011229], [-1.3860392623437132, 0.463839486811219]]]),self.functionspace)
1618        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        arg0.setTaggedValue(1,numarray.array([[[4.1305451146381422, 2.3814888644055499], [-0.89220558616836776, 3.8418880701208664]], [[3.3492033714884197, 2.1415021426686387], [1.4787086763681101, 0.38743271004052637]], [[-4.99502836998282, 4.4948912080047858], [-3.7653670133834769, -4.0800035996907447]], [[-3.1718016142315641, 2.320405525041048], [-2.8237839197556944, 3.5858545025811086]], [[3.0016852702625556, -2.8784349824436584], [-3.7323763876968008, 0.63313826152617381]], [[1.7585155020491481, -3.655987828892715], [0.54081193002197825, 4.9685421412273278]]]))
1619        dsdarg=s.diff(Symbol(shape=(2,)))        arg1=Symbol(shape=(6, 2, 2))
1620        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        res=arg0*arg1
1621        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")        s1=numarray.array([[[-0.93345150384204523, -3.5420417816351479], [-3.5444663998891226, 2.3971219306415996]], [[0.8384895676298747, -4.3543886014540583], [1.9437605664303446, -3.0820690979415186]], [[4.9690708795309, -2.1112283314766356], [2.37080840790198, 4.7216280449696395]], [[-3.3735779321675219, 3.0438054138693342], [-0.47550686063032277, 2.7155331110677619]], [[-1.3378665576363566, -2.6741065199531286], [-0.22177834028631249, 0.61204525154245371]], [[4.0531432724462295, -4.0695297515588145], [3.928681336032259, -4.8729434946660577]]])
1622        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        sub=res.substitute({arg1:s1})
1623        dsdarg=s.diff(Symbol(shape=(4, 5)))        ref=Data(numarray.array([[[2.8341856064600983, 5.7038783692487431], [-10.74762915459401, 6.9269197611686435]], [[2.5453460338109117, -16.916778513418848], [6.1582415180666157, -3.8604773311674778]], [[-12.03731765914358, 9.0892373557640713], [7.6100728160284898, 14.379639393530271]], [[3.8380853761846505, 2.97307983678279], [-0.47596003491968808, -8.3792409729148645]], [[-4.9953409522681316, 9.2589158571325303], [0.4215794466015394, 0.012254354420993967]], [[9.0312088694261341, 11.88727441774779], [-5.4453065809776664, -2.2602636098259725]]]),self.functionspace)
1624        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        ref.setTaggedValue(1,numarray.array([[[-3.8556635489463869, -8.4353330602232983], [3.162392721967159, 9.2094741479570601]], [[2.8082720868638438, -9.3249325200257633], [2.8742556143627427, -1.1940943831476432]], [[-24.820650015712328, -9.4897416652449422], [-8.9269637741663139, -19.264259419876904]], [[10.700319930984929, 7.0628628994922567], [1.3427286267814176, 9.737506633230419]], [[-4.0158543396339219, 7.6972417538137563], [0.82776024058721887, 0.3875092665369389]], [[7.1275152766229084, 14.87815124101582], [2.1246777357809301, -24.211425105067871]]]))
1625        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1626        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1627        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1628        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1629        self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")     def test_mult_overloaded_taggedData_rank4_Symbol_rank0(self):
1630        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        arg0=Data(numarray.array([[[[0.083529595185620309, 4.372823949648037, 4.0009796310147365, 0.68196650279571092], [-3.6991633277760947, -2.7548332509536966, -1.0695165519831527, -4.9760591951223629], [2.4321680119150511, 3.8212450023110254, 0.8004705884830452, -2.0444757685121964]], [[-3.4279885095627494, 3.5526615517407674, -0.37278949561560104, 1.8208812052515633], [-1.3542092169449638, 4.6164533745863388, 0.70466827998486359, 4.8882907830017537], [-1.0014606132552197, 0.027094091914280583, -0.50731223435619732, 1.3858925949581025]]], [[[-0.92819420758339621, -0.63572501286400218, 1.5822275384230347, -4.1213856389411898], [0.019204126745418826, 1.2601369851282858, 3.1282675256554278, -1.2005085063042245], [0.31394545189514567, 4.3373088139034053, -4.2967881792088045, -3.2133421015779429]], [[-4.6394850485838566, 2.7899856599199682, 3.4214279590576524, 0.75816457866836107], [2.6716538166314328, -0.78329465377730312, 0.9411007620209233, -4.3621528303217216], [-0.21060811641931387, -1.0884058600082236, 3.3643361086045402, -0.59658223764974405]]], [[[-2.7722966748649869, 1.3359537198967564, 3.3994221388292836, 0.89269410005117322], [-2.5434807639867083, -2.2312407449400631, 2.1964509494368221, -3.8483462591031992], [-4.617770174657271, -4.0164566401957895, -2.0915606068178807, 1.3098480489351907]], [[-4.000475916402392, 3.4797401237531425, 4.727298203954307, -1.3658950385993265], [4.3822054513768176, 4.7641649434095044, 2.2480529159500593, -3.370947660818576], [-0.12763750951483388, -0.56331578609421484, 1.1108900947641267, 2.3086655633422826]]]]),self.functionspace)
1631          arg0.setTaggedValue(1,numarray.array([[[[-0.99642554217400114, -3.1989491729058739, -0.40653827121759534, -3.7494299986207311], [-4.962891998625155, 0.65199311462416087, -1.5646394746401904, -0.58561931277306201], [-1.9266349397638294, -2.1350741612611923, -1.3141253220586746, 3.0489459946325113]], [[-2.4730670458068271, -1.0264935833023214, -2.4514436230760808, -2.4564197681665032], [-0.48365426443540827, -0.92587219714034585, -4.1751007096042496, -4.5526966630634966], [-2.3782862353872791, -2.5275939067663735, -2.6938709700385766, -4.8403251647207153]]], [[[3.2867188889910004, -1.4242104085047957, 2.0936224809849646, -1.4601757832869966], [-0.21399139868108641, -0.98887005738367506, -2.261387321435977, -3.6513388135428149], [2.9334655428664806, -3.9524701563078288, 3.4584296338361185, 4.5958550113660674]], [[0.37781815561656451, -3.0593937474827717, -2.0739947527751279, -2.4165789597896401], [4.5330104520530448, 4.9794431912053145, 1.7661478112868867, 3.078941742057026], [4.9858586211966696, -3.1080213069928195, -4.2716128061474183, -1.5876111863601041]]], [[[0.90451414172461853, 0.1162545327223361, 3.2911315914907693, -1.4337863404739979], [2.0405912462551932, 4.8936580709384394, -1.1291930809589745, 2.111861338433255], [-2.0913683111797732, -1.55247331778124, 4.9769696268492716, -0.24856367420835213]], [[-2.1381113867577026, 1.6110287228762354, 0.19273167692598125, -1.1320874579780638], [1.2876584378472149, 0.79519349199575018, -3.7974642196600819, -4.2341641389677163], [-4.3323767453858073, -0.80301234928598664, 4.344905698376083, -0.27642913101571054]]]]))
1632        dsds=s.diff(s)        arg1=Symbol(shape=())
1633        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")        res=arg0*arg1
1634        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        s1=numarray.array(-1.40149736096)
1635        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        sub=res.substitute({arg1:s1})
1636        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        ref=Data(numarray.array([[[[-0.11706650721432915, -6.1285012253547855, -5.6073623941039141, -0.955774253928249], [5.1843676416216082, 3.8608915310841012, 1.4989246251026278, 6.9739338299224034], [-3.4086770500993597, -5.3554647863033438, -1.1218574172814939, 2.8653273941073367]], [[4.8043168495380142, -4.9790457891328019, 0.52246349429720151, -2.5519602037735591], [1.897920643729998, -6.4699472214569242, -0.98759073474784653, -6.8509266319601139], [1.4035444065780798, -0.037972298315350331, 0.71099675763065506, -1.9423248144015677]]], [[[1.3008617323823231, 0.89096692782230835, -2.2174877195310199, 5.7761110964560265], [-0.02691453295315966, -1.7660786590997284, -4.3842586815689133, 1.6825095033900148], [-0.43999372231503248, -6.0787268563347068, 6.0219372937459816, 4.5034904752087277]], [[6.5022260517828334, -3.9101575394815598, -4.7951222553187058, -1.0625656561736561], [-3.7443157733956758, 1.0977853901194523, -1.3189502343655459, 6.113545679780513], [0.29516671935747973, 1.5253979404500404, -4.7151081775766022, 0.83610843165905069]]], [[[3.8853664736090217, -1.8723356127940041, -4.7642811563429852, -1.2511084253622755], [3.5646815783684827, 3.1270780156899103, -3.0783202091039361, 5.3934471261761532], [6.4717927132812418, 5.6290533816266439, 2.9313166707337701, -1.8357485838353969]], [[5.6066564394040377, -4.8768466002510378, -6.6252959572916961, 1.914298291939184], [-6.1416493752694707, -6.676964595345189, -3.1506402289923527, 4.7243742505563926], [0.17888363274397381, 0.78948558759562215, -1.5569095361235428, -3.2355886943530807]]]]),self.functionspace)
1637        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        ref.setTaggedValue(1,numarray.array([[[[1.3964877677455285, 4.4833188236584016, 0.56976231423887624, 5.2548162481543859], [6.9554800387803839, -0.91376662950692644, 2.1928380945550465, 0.82074392137602725], [2.7001737836036899, 2.9923008024518656, 1.8417431708300456, -4.2730897651733448]], [[3.4659969381643139, 1.438628048035971, 3.4356917682723473, 3.4426658224843063], [0.67784017522110429, 1.2976074408742768, 5.851392626233844, 6.3805923585144591], [3.3331618824920928, 3.5424161899003064, 3.7754530552637315, 6.7837029445226396]]], [[[-4.6063278491235211, 1.9960271289648437, -2.9342063819375608, 2.0464325068078741], [0.29990838051872154, 1.3858987757511469, 3.1693283630907771, 5.1173417111346877], [-4.1112442167813024, 5.5393764933208445, -4.8469800048716598, -6.4410786697637112]], [[-0.52951114801769439, 4.2877322632209003, 2.9066981726499224, 3.3868290346857983], [-6.3530021857360977, -6.978676491502144, -2.4752514965759262, -4.3151287260286901], [-6.9876676997044234, 4.3558836595439399, 5.9866540748393779, 2.2250328879071364]]], [[[-1.2676741825739934, -0.16293042080947032, -4.612512240031629, 2.0094477723483699], [-2.8598832464155737, -6.858448871838867, 1.5825611229732273, -2.9597680925181833], [2.9310471689044393, 2.1757872578242567, -6.9752097975849967, 0.34836133343241132]], [[2.9965574659698517, -2.2578525035345738, -0.2701129365842932, 1.5866175847270911], [-1.8046499024549696, -1.1144615804810425, 5.3221360821765895, 5.9341698666157248], [6.0718145753232413, 1.1254196883389966, -6.0893738698746489, 0.38741469760974395]]]]))
1638        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1639          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1640        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1641        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1642        sa=s.getSubstitutedArguments({s2:-10})     def test_mult_overloaded_taggedData_rank4_Symbol_rank4(self):
1643        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        arg0=Data(numarray.array([[[[0.94895783352211716, -0.46506050687609246, -3.4973315286311935, -3.8305662019128084], [-0.067011552625391602, -2.0053313702353224, -4.2991620654185292, 1.0093244189118113], [0.87798040910337161, -3.1557405362751467, -2.7931609613797503, -4.9110293393501543]], [[-0.43377674574157687, 2.704453693295501, -2.5592027474361601, 2.6750943602438779], [3.4305357783522936, 1.1310936272574317, 2.5896451684195103, -2.5539402760310126], [4.5085098664567802, 0.11349764632152315, -1.3234736581612081, 2.9677015132450526]]], [[[-1.1465164843195783, 2.7375150894033169, -0.10912903641971639, -3.2522173068497242], [4.7360277602148102, -1.6692169008049049, 1.233494102169499, -1.3392318230236588], [4.3885022964524385, 4.7515889636089952, 2.7117463429070652, 2.1998096737486339]], [[-2.5131848249547706, 0.77921677989624794, -3.8934505794744254, 0.24453982436947097], [-3.4599112442822841, 0.95455762656251686, -2.8118915894259002, 0.78333576699382768], [3.9748218483200848, 2.0642803168106862, -3.4033833226648325, 1.1533845398716842]]], [[[0.49409552443598681, 4.2995599265190414, 1.6569894487618955, -3.0328627613000969], [-4.8050094221736783, -1.8954288851770262, -0.65657001508748358, -4.2826450941652627], [-0.74170635020795395, -0.84409250409421333, 3.6365860981881823, 1.6100686197509306]], [[2.2396538156436314, 4.3413750637744482, -4.4044991729772871, -2.290449250092359], [3.1707282757549784, 3.5745559429744826, 1.7312931654177177, 3.6613171235792787], [-0.8687074400525221, -3.7812204587391882, 0.42585417549408167, -2.1167068471762196]]]]),self.functionspace)
1644        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        arg0.setTaggedValue(1,numarray.array([[[[-1.6280796155619202, 3.2372833297254093, 1.0760799245326114, -0.6791544053399603], [-4.7288229986341772, 3.0364132365453695, -2.7881857643052821, -4.280550845421411], [-3.2543576320948486, -0.55086025606976641, 2.7326721039171273, -4.2151748027883897]], [[-0.090786768277823171, 2.6835858500949072, -4.3650061828137812, 3.7514613040027918], [4.6631405077073573, -1.4292251728385805, -1.3449901199338612, 1.8541088776332506], [-0.75859253853348552, 3.0321616898786914, -0.78197759748368689, -0.88789890229887547]]], [[[-2.062426285540877, 0.30001445848584307, -0.83075755338807511, 3.1138362566950235], [-2.3733111917258274, -2.9574688279506556, -1.7570853300314857, 4.3659538409493486], [-1.018783824996695, 0.89420512031921273, -1.8230865992410106, 3.1994892045316963]], [[0.3233781997620504, -1.3905319280411477, 4.9629769739530829, 1.1091529164244776], [2.7351448192501895, 2.0660484456167358, -4.0171925239278465, 4.3911761581077471], [2.1258515256453734, 1.5150132919784713, 2.3610249459029262, -4.5111733078663327]]], [[[-2.4852355463920439, 2.8830764355289409, 1.862859073381494, -2.1509811646634249], [-2.6325170393160802, -1.3580306364602079, 3.8152036772116542, -1.8416692569043969], [-3.1659556710428727, -2.074597485798928, 0.35812962834444573, 4.8712028428189775]], [[-3.0119309329000288, 0.64957909215262699, -1.0255988706704269, 4.4011917781031578], [3.4155148745532635, 0.92333362783500483, -4.4110812159393742, 3.9318582439553591], [-0.47136877672690947, 2.9648508900721211, 4.2958677743999178, -3.5373956917354246]]]]))
1645        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        arg1=Symbol(shape=(3, 2, 3, 4))
1646          res=arg0*arg1
1647        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")        s1=numarray.array([[[[-0.89769175763822151, 3.1729441493671864, -4.6066637580891037, 4.9743040690579683], [-2.6788549386226723, 4.5100260370904159, -1.4037388326608391, -1.3338419564469453], [-1.1381168569459419, -3.1452061025455782, -1.5160789869753852, 4.1456610012343731]], [[-2.5938250596030543, -0.93202167450854922, -0.77103273701479047, -2.7062810722150674], [-1.105689822011354, -1.8461034185063041, -2.0068461224928411, -4.7319124228070422], [-4.5218149557274483, 4.8904398898663093, -3.825654173472147, 0.88914553957591913]]], [[[2.5862303105862106, -2.0807587439433863, 2.3052217753786719, 4.1346828351021188], [0.68224921552396101, -2.8879458749312326, 0.54057865399082239, -0.0023583593457887631], [1.9450000139899339, 2.3035289835776487, 0.43188049217124025, 2.7210621624224993]], [[-0.54240954949206355, 2.4426743469776238, -0.12851500556720108, 2.8020215668130284], [0.52130307899069095, -2.6755785781541075, 0.43102203402703765, 2.8334377967823654], [-0.76961602631277248, -0.42105873518056569, -2.6486982753852963, 2.2122858679665658]]], [[[-3.480147294108944, 3.6715573223019664, 1.7695636383465487, 4.490486044765845], [-2.4274939795683825, 4.5761414724005753, -3.0218037175811974, 3.7714386247368186], [1.1400240440382881, -1.8970197325492588, 3.6790698826844643, 0.066641356768850635]], [[-2.2050658457593322, 2.6656171339669479, -3.3829610334860827, -3.4782484246680303], [-1.0395696415089963, 2.3867408856698438, -0.23958153915918956, 4.5415496456746567], [-4.7338880436477284, 0.94198626201791846, 4.0511716726168139, -3.3273461069241539]]]])
1648        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        sub=res.substitute({arg1:s1})
1649        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")        ref=Data(numarray.array([[[[-0.85187162549902817, -1.4756110143942358, 16.111030402967682, -19.05440104497081], [0.1795142286953034, -9.0440966927555042, 6.034900739130368, -1.3462792576110065], [-0.99924430366884154, 9.9254543927430472, 4.2346526407878047, -20.359462808061743]], [[1.1251409933775647, -2.5206094598561033, 1.973229098931474, -7.2395572335172815], [-3.7931084941699296, -2.0881158119306398, -5.1970193648750147, 12.085021719258394], [-20.386647342189029, 0.55505341697671495, 5.0631525238248756, 2.6387185632945438]]], [[[-2.9651556833340331, -5.6961084589529127, -0.25156663108082233, -13.446887074653596], [3.2311512241062563, 4.8206080630450217, 0.66680058145640564, 0.0031583898860055686], [8.5356370279948504, 10.945422895721002, 1.1711503452182641, 5.9858188677683906]], [[1.3631754486940078, 1.9033728389870741, 0.50036682289677803, 0.68520586182792786], [-1.8036623846788673, -2.5539939372442984, -1.2119872323378713, 2.2195331697718155], [-3.0590865962052933, -0.86918325925444495, 9.0145355372174212, 2.551616317889247]]], [[[-1.7195252023972392, 15.786080730887091, 2.9321482776529417, -13.619027905308091], [11.664131444095956, -8.6737507294445777, 1.9840257124437006, -16.15173312417452], [-0.8455630728529504, 1.6012601363636387, 13.37925438963315, 0.10729715731115268]], [[-4.9385841352003395, 11.572443754974021, 14.90024907420384, 7.966751495915819], [-3.2961928569490411, 8.5315388172113202, -0.41478588130656219, 16.628053485294025], [4.1123637638924597, -3.561857725793407, 1.7252083724272129, 7.0430162874514943]]]]),self.functionspace)
1650        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        ref.setTaggedValue(1,numarray.array([[[[1.4615136516687401, 10.271719200896161, -4.9571383891516385, -3.3783205220012094], [12.667830843763641, 13.694302756185596, 3.9138846300274661, 5.7095783143275201], [3.703839279617827, 1.7325690390404491, -4.1429467550425727, -17.474685793305618]], [[0.23548499463939337, -2.501160177692904, 3.3655626642213927, -10.15250872017001], [-5.1559869979808832, 2.6384974773925669, 2.6991882069804505, -8.7734808313096], [3.4302150860439653, 14.82860448070719, 2.9915758593751893, -0.78947134857339996]]], [[[-5.3339093730155467, -0.62425770780385803, -1.9150804021305003, 12.874725321875548], [-1.6191896987491827, 8.5410099019178034, -0.94984282265544051, -0.010296488044085244], [-1.9815345538712901, 2.0598274119188451, -0.78735553775100031, 8.7060090135304602]], [[-0.17540342364848829, -3.3966166692794464, -0.63781701343747121, 3.1078703927149545], [1.4258394157605607, -5.5278749625207295, -1.7314984927415895, 12.442124498712067], [-1.6360894036981373, -0.63790958050220026, -6.2536427023547434, -9.9800049569406735]]], [[[8.6489857619996346, 10.585380397622536, 3.296447679619837, -9.6589509024752935], [6.3904192640509674, -6.2145403162961061, -11.528796655127632, -6.9457425694795969], [-3.6092655873482475, 3.9355523676576474, 1.3175839297390308, 0.32462356654173891]], [[6.6415060299238959, 1.7315291579087375, 3.4695610154653864, -15.308438368849195], [-3.5506655737079806, 2.2037581206676693, 1.0568136270709447, 17.856729414678441], [2.2314070162963722, 2.7928488073795359, 17.403297836956384, 11.770139783546139]]]]))
1651        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1652        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1653        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1654     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1655     def test_Symbol_rank1_dd_nargs0(self):     def test_mult_overloaded_expandedData_rank0_Symbol_rank0(self):
1656        s2=Symbol(shape=())        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1657        s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[])        arg0=msk_arg0*(-0.0430204652553)+(1.-msk_arg0)*(1.78425217281)
1658        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        arg1=Symbol(shape=())
1659        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        res=arg0*arg1
1660        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        s1=numarray.array(2.5646949317)
1661        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        sub=res.substitute({arg1:s1})
1662          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1663        ss=s.substitute({s:numarray.zeros((2,))})        ref=msk_ref*(-0.1103343692)+(1.-msk_ref)*(4.57606250448)
1664        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1665        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1666        try:        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1667          s.substitute({s:numarray.zeros((5,))})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1668          fail("illegal substition was successful")     def test_mult_overloaded_expandedData_rank0_Symbol_rank1(self):
1669        except TypeError:        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1670          pass        arg0=msk_arg0*(2.57326660208)+(1.-msk_arg0)*(3.29535894632)
1671          arg1=Symbol(shape=(2,))
1672        dsdarg=s.diff(Symbol(shape=()))        res=arg0*arg1
1673        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        s1=numarray.array([4.0270481495052639, 2.7564226252917825])
1674        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        sub=res.substitute({arg1:s1})
1675        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1676        dsdarg=s.diff(Symbol(shape=(2,)))        ref=msk_ref*numarray.array([10.362668508083143, 7.0930102828763504])+(1.-msk_ref)*numarray.array([13.270569146744505, 9.0834019581016197])
1677        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1678        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1679        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1680        dsdarg=s.diff(Symbol(shape=(4, 5)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1681        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     def test_mult_overloaded_expandedData_rank0_Symbol_rank2(self):
1682        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1683        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        arg0=msk_arg0*(-3.02551699988)+(1.-msk_arg0)*(0.626618362726)
1684        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg1=Symbol(shape=(4, 5))
1685        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        res=arg0*arg1
1686        self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        s1=numarray.array([[-0.87644218701217369, -3.616282438617354, 0.79667729938717624, 3.9811287325297613, 0.065796525107652215], [-1.4217337078130887, 4.8515183472866479, -0.78214368357519071, 3.1809506063985502, 0.95738137909039533], [0.39346667195906182, 4.3285617066713939, -4.5910865330304649, -4.7275376371854012, -0.90249772270981055], [1.0196798908676152, -4.5635511009909653, -4.4978908227402012, 1.164740898313557, -1.7685582007909115]])
1687        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        sub=res.substitute({arg1:s1})
1688          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1689        dsds=s.diff(s)        ref=msk_ref*numarray.array([[2.6516907362186282, 10.941123994409631, -2.4103607127155628, -12.044972658985373, -0.19906850524632991], [4.3014795022930183, -14.678351234952618, 2.3663890110066546, -9.6240201354420911, -2.8965736378079594], [-1.1904401048989282, -13.096137028570261, 13.890410353610562, 14.30324548888392, 2.730522202412847], [-3.0850588442572544, 13.807101435875975, 13.608445147811342, -3.5239433883048839, 5.3508029017726937]])+(1.-msk_ref)*numarray.array([[-0.54919476824925706, -2.2660289808399305, 0.49921262496268565, 2.4946483681778449, 0.041229310835994216], [-0.89088444822170665, 3.0400504835102153, -0.49010559441809565, 1.9932420608926262, 0.59991275226964935], [0.24655344177009811, 2.7123562495913784, -2.8768591264593351, -2.9623618939370084, -0.56552164536805005], [0.63895014371973546, -2.8596049191178006, -2.8184609830641962, 0.72984803470084503, -1.108211044164624]])
1690        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1691        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1692        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1693        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1694        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")     def test_mult_overloaded_expandedData_rank0_Symbol_rank3(self):
1695        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1696          arg0=msk_arg0*(-3.56361070359)+(1.-msk_arg0)*(4.70518403887)
1697        sa=s.getSubstitutedArguments({s2:-10})        arg1=Symbol(shape=(6, 2, 2))
1698        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        res=arg0*arg1
1699          s1=numarray.array([[[4.2317874979104992, -1.1989677806745727], [1.3134595205642725, 4.4478340118436144]], [[-0.017162439223159964, -0.41900720330017371], [-4.4667032138911269, 2.0617117365888351]], [[2.9794518983997751, 0.52772381685170533], [-2.6894168529203224, 0.41500536076126604]], [[-4.6733566211583097, 2.4911601334345299], [-4.7318467145182375, -0.81771569841489722]], [[1.3136083167944523, 0.82585873482530836], [0.296465998582784, -1.7304343680929755]], [[-1.3066203047314175, 2.65896658854032], [3.9719908108129438, -2.8680613980844938]]])
1700        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")        sub=res.substitute({arg1:s1})
1701        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1702        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")        ref=msk_ref*numarray.array([[[-15.080443222871585, 4.2726544164712799], [-4.6806584062148398, -15.850348892396909]], [[0.061160252115363196, 1.4931785545617493], [15.917591382781623, -7.3471380122247991]], [[-10.617606675968551, -1.8806022422720292], [9.5840346834818018, -1.4789175456560166]], [[16.654023676852269, -8.8775249158636207], [16.862459599603678, 2.9140204153647811]], [[-4.6811886580533626, -2.9430390270766442], [-1.0564894058000638, 6.166594435995874]], [[4.6562861034687169, -9.475521795410085], [-14.154628967973551, 10.220654296766785]]])+(1.-msk_ref)*numarray.array([[[19.91133899106331, -5.6413640647508636], [6.1800687718624765, 20.927877600075174]], [[-0.080752435100909861, -1.971506005140051], [-21.016660668375366, 9.7007331557512781]], [[14.018869516935215, 2.4830376799828495], [-12.654201250232003, 1.9526765994999067]], [[-21.989002981827273, 11.72136689810848], [-22.264209635536492, -3.8475028525162167]], [[6.1807688855097629, 3.8858173374624307], [1.3949270845997368, -8.1420121690652945]], [[-6.1478890026873314, 12.510927152291805], [18.68894776558027, -13.494756712769872]]])
1703        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1704        self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1705        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1706        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1707        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")     def test_mult_overloaded_expandedData_rank0_Symbol_rank4(self):
1708     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1709     def test_Symbol_rank1_dd_nargs1(self):        arg0=msk_arg0*(2.51859660817)+(1.-msk_arg0)*(3.69262914568)
1710        s2=Symbol(shape=())        arg1=Symbol(shape=(3, 2, 3, 4))
1711        s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[s2])        res=arg0*arg1
1712        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        s1=numarray.array([[[[0.67581666027729526, 2.8108253236352603, -3.2853142689252701, 4.9303752145005504], [-1.3657702337917108, 4.3904435823590919, 3.3571499478699067, 0.015664424638796248], [-3.1193276566121941, 2.4614116251071474, 4.8836311348501411, 4.5339873643248207]], [[0.92904130460985179, -4.0289182883108268, 1.1622216990935978, -3.453322460119399], [-4.9809628080889743, -3.091966318347751, -0.82579662341565552, 0.19293706069789529], [-4.1200195632312617, -4.252279729557471, -4.2626018577200098, 2.8104051978786853]]], [[[4.553470024096578, -4.1556230388171853, -4.8792826237543903, -0.084660297479757673], [-1.3940013078624869, -4.391326436454821, 1.8581067287379591, -4.9713750706033011], [1.1291380851369173, 0.083960164404878412, 1.6804470605141759, -4.9497828740616505]], [[1.5580688980525261, -0.37196449698866818, 2.6938341003534481, -2.2283064145681664], [0.4008724735809448, 2.2505971863148471, -1.6587271003862281, -2.7339584931448382], [-4.8561801785490113, 2.7658580526343668, 2.6247408695536976, 1.2921000397940583]]], [[[-3.378532765195783, -4.7136195887628478, -2.2928079312088725, -3.2689147861576906], [2.1255291713840734, -2.9248168929356853, -4.2298230449258032, 0.73722628474508767], [-4.0600914026090829, 4.8210888962888614, -1.5990379796232492, -1.3511964372595688]], [[-2.5350622751408225, 3.9568471756339907, -2.5691428388833124, 3.4094397075929948], [0.80244721075126435, -1.8355785194219432, -4.4146407757484631, 4.8328210906719811], [-4.920522191727871, -2.4717933373462273, -4.5300856839069414, -2.5250375128130722]]]])
1713        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        sub=res.substitute({arg1:s1})
1714        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1715        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        ref=msk_ref*numarray.array([[[[1.7021095483176161, 7.0793351262596333, -8.2743813744801198, 12.417626292235164], [-3.4398242783642043, 11.057756314881239, 8.455306471815506, 0.039452366764170722], [-7.8563280557071602, 6.1993029702993985, 12.299896811775723, 11.419285197263687]], [[2.3398802786380641, -10.147219935524449, 2.9271676292760325, -8.6975262349660429], [-12.545036033862335, -7.7874158819594053, -2.0798485747710065, 0.48593062666356401], [-10.376667297538809, -10.709777303843696, -10.735774580822937, 7.0782769989541201]]], [[[11.468354158082919, -10.466338090388497, -12.288944666479384, -0.21322513807898585], [-3.510926965763792, -11.059979868212249, 4.6798213046129975, -12.520888390750915], [2.8438433513788075, 0.21146178529132892, 4.2323682668163789, -12.466506357778224]], [[3.9241470419266724, -0.93682852047446297, 6.7846814281166719, -5.6122049776897045], [1.009636052268762, 5.6683464398043348, -4.1776644489085921, -6.8857385877058555], [-12.230758926344738, 6.9660807100382254, 6.6106634513770723, 3.2542787776386608]]], [[[-8.5091611630055262, -11.87170630845092, -5.7746582787226588, -8.2330776928059901], [5.353350561609421, -7.3664339060593971, -10.653217974099684, 1.8567756202110501], [-10.22573243546206, 12.142378141868068, -4.0273316318104415, -3.4031187638502254]], [[-6.3847992476635591, 9.9657018755896978, -6.470634439909837, 8.587003283295978], [2.0210408232317629, -4.6230818330415877, -11.118699284078886, 12.171926806847758], [-12.392810502499694, -6.2254503155317185, -11.409458438197062, -6.3595509152671994]]]])+(1.-msk_ref)*numarray.array([[[[2.495540296879188, 10.379335513483992, -12.131447222167042, 18.206047216225837], [-5.0432829716077814, 16.212279934703215, 12.39670974393805, 0.057842910971599444], [-11.518520219746321, 9.0890803063976193, 18.033438665320531, 16.742333887671666]], [[3.43060499894721, -14.877301096998385, 4.2916537198201299, -12.751839165684238], [-18.392848438720499, -11.417484944606104, -3.0493606800326032, 0.7124450136157725], [-15.213704319978612, -15.70209206496787, -15.740207856266352, 10.377784144870411]]], [[[16.814276124980314, -15.345174751614865, -18.017381226508029, -0.31261908195608412], [-5.1475298585355107, -16.215539987468492, 6.8612990623305103, -18.357444479839728], [4.1694882026791129, 0.31003375015792717, 6.2052677934347074, -18.27771250557068]], [[5.753370623933491, -1.3735269427402785, 9.947330312604274, -8.2283092119504264], [1.4802733796476881, 8.3106207653820228, -6.1250640356231392, -10.095494814878659], [-17.932072464006065, 10.213288057984194, 9.6921946347836005, 4.7712462660838089]]], [[[-12.475668558412432, -17.405649075135688, -8.4664893922387598, -12.070890014125325], [7.8487909682557282, -10.80026410464507, -15.619167856781525, 2.7223032660145061], [-14.992411847417884, 17.802493372372791, -5.9046542486134737, -4.9894673457699161]], [[-9.3610448433105873, 14.611169205765981, -9.4868917262874675, 12.589796434712371], [2.9631399582934548, -6.7781107400101064, -16.301631196256576, 17.845816015294734], [-18.169663657162346, -9.1274161195937573, -16.727926428843457, -9.3240271137605752]]]])
1716          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1717        ss=s.substitute({s:numarray.zeros((2,))})        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1718        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1719        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1720        try:     def test_mult_overloaded_expandedData_rank1_Symbol_rank0(self):
1721          s.substitute({s:numarray.zeros((5,))})        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1722          fail("illegal substition was successful")        arg0=msk_arg0*numarray.array([1.8003466734301279, 3.110968541428603])+(1.-msk_arg0)*numarray.array([-0.057900815820612905, 0.54416620499792501])
1723        except TypeError:        arg1=Symbol(shape=())
1724          pass        res=arg0*arg1
1725          s1=numarray.array(-1.23860498141)
1726        dsdarg=s.diff(Symbol(shape=()))        sub=res.substitute({arg1:s1})
1727        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1728        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        ref=msk_ref*numarray.array([-2.2299183579697544, -3.8532611324133779])+(1.-msk_ref)*numarray.array([0.071716238902929969, -0.67400697222367489])
1729        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1730        dsdarg=s.diff(Symbol(shape=(2,)))        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1731        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1732        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1733        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")     def test_mult_overloaded_expandedData_rank1_Symbol_rank1(self):
1734        dsdarg=s.diff(Symbol(shape=(4, 5)))        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1735        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        arg0=msk_arg0*numarray.array([-0.79032144715843966, 1.1989835373509852])+(1.-msk_arg0)*numarray.array([3.3888677818436879, 2.0461382220071824])
1736        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        arg1=Symbol(shape=(2,))
1737        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        res=arg0*arg1
1738        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        s1=numarray.array([-0.92949574400567592, -1.2179599998896897])
1739        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        sub=res.substitute({arg1:s1})
1740        self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1741        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        ref=msk_ref*numarray.array([0.73460042153017635, -1.4603139890197456])+(1.-msk_ref)*numarray.array([-3.1499381802216635, -2.4921145086501579])
1742          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1743        dsds=s.diff(s)        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1744        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1745        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1746        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")     def test_mult_overloaded_expandedData_rank2_Symbol_rank0(self):
1747        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1748        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        arg0=msk_arg0*numarray.array([[2.9968239240536168, -0.22744917461103942, -3.368130646004337, 2.5739305354263671, -3.5520990533562147], [4.2529038750041668, 2.5566407005371827, -0.59374756248383598, 0.27167900571967607, 3.5828984462512263], [-3.506627820649574, 2.8671976480545798, -4.502344160444026, -3.4451554059919767, -0.53368053099846069], [3.3068381259500921, 0.9313565649084623, 2.680662417641706, 0.49678621396386813, -4.6856891442661137]])+(1.-msk_arg0)*numarray.array([[-0.85596724799322921, -0.13058599556778994, -0.39878828275994316, -4.0930080594310017, -4.4366277751460883], [2.6284949729177862, -0.28953336259360274, 4.6575690245651824, -0.75846368797438046, 2.8728013263404817], [3.9714952839792605, 4.7929536309489222, 1.8212316872876864, 2.7021824250061401, 3.4917451398394661], [-3.9528673242547518, -0.39076547693401587, 4.8178679551326944, -4.372708435816083, -4.6827874768603746]])
1749        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        arg1=Symbol(shape=())
1750          res=arg0*arg1
1751        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        s1=numarray.array(2.10607695069)
1752        sa=s.getSubstitutedArguments({s2:-10})        sub=res.substitute({arg1:s1})
1753        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1754        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        ref=msk_ref*numarray.array([[6.3115417917256531, -0.4790254641017731, -7.0935423204623218, 5.4208957733386178, -7.4809939428412591], [8.9569428246464202, 5.3844820505972715, -1.2504780558755719, 0.57217689193258392, 7.5458598343126875], [-7.385228027718342, 6.0385388796403019, -9.4822832603848397, -7.2557623921047183, -1.123972265367853], [6.9644555567263726, 1.9615085942275186, 5.6456813303761022, 1.0462699946498486, -9.8684219048371684]])+(1.-msk_ref)*numarray.array([[-1.8027328915440832, -0.27502415534822766, -0.83987881052595881, -8.6201899329560003, -9.3438794960261902], [5.5358126774666605, -0.60977954141415425, 9.8091987688843929, -1.5973828911781676, 6.0503406573173217], [8.3642746773627188, 10.094329167867425, 3.835654078462837, 5.6910041218650154, 7.3538839566996979], [-8.3250427607485502, -0.82298216409611202, 10.146800651772885, -9.2092604487599345, -9.8623107699953731]])
1755          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1756        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1757        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1758        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1759        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")     def test_mult_overloaded_expandedData_rank2_Symbol_rank2(self):
1760        self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1761        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        arg0=msk_arg0*numarray.array([[1.328567726345117, -2.6681448855288812, 3.2894830838559965, 2.8760842998618212, 2.8603604495641051], [4.0060721329760867, 2.9201617632829659, 2.1721464751857216, 3.3782152232970972, -0.56533591383663317], [2.812933639561118, -0.55158819240545931, -4.3300172419246827, 4.4161226276280559, 1.5663796584927505], [2.1573608096632757, 0.40478964915762283, -2.783180507622979, -1.5186696606391514, -3.5877444638062372]])+(1.-msk_arg0)*numarray.array([[1.9794332133759385, -4.6552748863866809, 3.6163220859074414, 4.9277135493827373, 4.7113876120438363], [2.5672843138256862, -3.4663513236737495, 0.70662767196765763, 0.51073573024771424, 0.77820357093096604], [-4.9550804650749072, -1.458958922255027, -0.59095436462229589, 1.6503086087766805, -0.60037112049808439], [2.0892995102876348, 4.3232658919201121, -0.56155298698416622, 2.2070902567073523, 1.8732215024796837]])
1762        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        arg1=Symbol(shape=(4, 5))
1763        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        res=arg0*arg1
1764     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        s1=numarray.array([[2.6575119197184351, 0.798780755830788, -4.7246974545048115, -3.594253030805985, 1.5756436650435841], [0.65656829496808733, 0.22663298200663462, 4.5542984252490282, 2.3375554718292921, 2.7227466581468063], [-1.0177447572471587, 1.532657082535188, 2.6217986442668364, 4.1467735088972546, 1.5155361075503855], [-2.6181643161762471, 0.56415045659076313, 3.6099145181301697, -1.4000081350932101, 0.95267578177457679]])
1765     def test_Symbol_rank1_dd_nargs2(self):        sub=res.substitute({arg1:s1})
1766        s2=Symbol(shape=())        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1767        s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[1, -1.0])        ref=msk_ref*numarray.array([[3.5306845689153685, -2.1312627883288111, -15.541812352931064, -10.33737471163186, 4.5069088220969], [2.6302599498672778, 0.66180496835457081, 9.892603271348559, 7.8967654802351435, -1.5392664701290637], [-2.8628484641474969, -0.84539554973300923, -11.35243333453016, 18.312660324289759, 2.3739049305782052], [-5.6483250889774848, 0.22836226539548773, -10.047043721045087, 2.1261498794140565, -3.417957261864017]])+(1.-msk_ref)*numarray.array([[5.260367358833121, -3.7185439923480388, -17.086027753956419, -17.711449359812622, 7.4234680444816901], [1.6855974846268469, -0.785589537166827, 3.2181932936796902, 1.1938731008992738, 2.1188511721101988], [5.0430071650677997, -2.2360837253220716, -1.5493633519903052, 6.8434560203802217, -0.90988411104533029], [-5.4701294236395936, 2.4389724268900039, -2.027158280413504, -3.0899443142752547, 1.7845727593117799]])
1768        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1769        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1770        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1771        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1772       def test_mult_overloaded_expandedData_rank3_Symbol_rank0(self):
1773        ss=s.substitute({s:numarray.zeros((2,))})        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1774        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        arg0=msk_arg0*numarray.array([[[-0.26449277327340059, 2.709494171087842], [0.49156618056888668, 1.1557293908754884]], [[2.9426463555847633, -2.2855487493843087], [-0.049194778717681409, 0.65490813497401845]], [[-2.5662834716418259, -0.6481573871774593], [-4.7039097421222928, -3.6194060480671544]], [[-1.2083023577871419, 3.399741798797292], [2.1299564643809319, -0.094074363510819659]], [[-4.6384172111976261, -4.5399938401719275], [0.25600785550817573, -2.5059486809113416]], [[0.78159444871409178, -3.8859384118790743], [-2.9903682045869107, 0.31191296888410847]]])+(1.-msk_arg0)*numarray.array([[[1.4148748264368773, 2.6806498611711493], [-4.0435092298014874, 4.2267476915751718]], [[3.125690778072709, -4.9216068996123754], [-0.39858451763556069, -4.7718632732732615]], [[-1.5015409161151947, -4.3392117282980625], [-4.3901880811233127, -2.8392130815499939]], [[1.5905393663877287, 4.6064612161951075], [-3.1305192294513895, 2.10516821140763]], [[-1.310377796147919, -2.266123007043912], [-3.9633905374201128, 2.6610704495417856]], [[-3.3823523217509011, 1.9759866351748991], [3.6164091081703162, 4.7947187843172081]]])
1775        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        arg1=Symbol(shape=())
1776        try:        res=arg0*arg1
1777          s.substitute({s:numarray.zeros((5,))})        s1=numarray.array(-0.422116691453)
1778          fail("illegal substition was successful")        sub=res.substitute({arg1:s1})
1779        except TypeError:        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1780          pass        ref=msk_ref*numarray.array([[[0.11164681436744017, -1.1437227150112377], [-0.2074982897720079, -0.48785266669154376]], [[-1.2421401437361563, 0.96476827624502515], [0.020765937229078289, -0.27644765514099601]], [[1.0832710883803918, 0.27359805181627767], [1.9855988172389765, 1.5278117060356851]], [[0.51004459354416765, -1.4350877599033474], [-0.89909017568376171, 0.039710359075749616]], [[1.9579533267701619, 1.9164071790311268], [-0.10806518895313126, 1.0578027661377205]], [[-0.32992406274935349, 1.6403194656131641], [1.2622843327469702, -0.13166367044669411]]])+(1.-msk_ref)*numarray.array([[[-0.59724228055590678, -1.1315470503419538], [1.7068327379441424, -1.7841807511750174]], [[-1.3194062497457233, 2.0774924210974488], [0.16824917784877888, 2.0142831369809828]], [[0.63382548359210156, 1.8316536982639513], [1.8531716676608954, 1.1984792323144307]], [[-0.67139321496560267, -1.9444641678876049], [1.3214444196665345, -0.88862664035176742]], [[0.55313233986365051, 0.95656834615927522], [1.6730133005925627, -1.123282253884367]], [[1.4277473713864239, -0.83409694079570218], [-1.5265466476819478, -2.0239308296843248]]])
1781          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1782        dsdarg=s.diff(Symbol(shape=()))        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1783        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1784        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1785        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     def test_mult_overloaded_expandedData_rank3_Symbol_rank3(self):
1786        dsdarg=s.diff(Symbol(shape=(2,)))        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1787        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        arg0=msk_arg0*numarray.array([[[3.8465426754336836, 0.6522330066175801], [1.1213564084832672, 2.2991484731703036]], [[-3.146805277366008, -2.9092773950846063], [-0.7507570800585075, -4.3691574327961602]], [[2.6060037046129327, -3.4798742840305676], [-2.2473704638275493, 0.50713868800830042]], [[-1.9023463196744839, -1.0711886388204297], [4.0144718529996783, -1.1676181449431819]], [[2.4659181377476571, -3.3224615922640091], [0.19896825249062911, -0.68785028874854248]], [[2.1633557767317377, 1.5521876431045971], [4.2492954867619375, -4.7770400998496516]]])+(1.-msk_arg0)*numarray.array([[[3.5872129335758469, -1.4939601669977023], [2.6202996623479304, -3.4258031677768743]], [[0.71987276551639834, 3.6960268147998683], [1.885662175199954, -0.80213652437160476]], [[2.0323879500914588, -3.054629290525348], [0.64860207732057251, -4.2079981974529375]], [[1.2861885512240159, 0.023168662849575306], [-2.5160035334539876, 2.6814734060795251]], [[-1.257956004629972, -4.3314818687128174], [-2.8595244901616734, -2.299231449232094]], [[-0.19237535961527463, -1.5019438253752684], [4.7223884225278852, -0.33487628154856086]]])
1788        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")        arg1=Symbol(shape=(6, 2, 2))
1789        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        res=arg0*arg1
1790        dsdarg=s.diff(Symbol(shape=(4, 5)))        s1=numarray.array([[[3.7703715218725122, 1.8825293253796147], [-3.5569112589449747, 3.7865091325165103]], [[1.3234025154170119, -1.0706127854081848], [-0.91030140341539401, -4.0779906813336346]], [[2.4564691769773113, -4.2202902733308969], [-1.8831049422439405, 0.41091633330696098]], [[2.5279194148611168, 0.406501938106687], [-0.33008527781400687, -3.1142412235060757]], [[-2.6625713201810175, 2.3132871914260473], [-4.863897694906, 4.1604892545389323]], [[-0.92121754594451399, -3.0027046624253173], [2.5790377788725909, -2.626459339743711]]])
1791        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        sub=res.substitute({arg1:s1})
1792        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1793        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        ref=msk_ref*numarray.array([[[14.502894961122463, 1.2278477619381107], [-3.9885652346242333, 8.705746690670745]], [[-4.1644900195937034, 3.1147095754765983], [0.68341522360130269, 17.817383296222328]], [[6.4015677754703555, 14.686079593308524], [4.232034427486715, 0.20839157015447368]], [[-4.8089781952947206, -0.43544025775836859], [-1.3251180568739098, 3.6362445602957494]], [[-6.5656829114810957, -7.6858078453893226], [-0.96776122464864589, -2.8617937350698126]], [[-1.9929212996456993, -4.6607610729091382], [10.959093593951833, 12.546701586580348]]])+(1.-msk_ref)*numarray.array([[[13.525125487647125, -2.8124238253222011], [-9.3201733708150698, -12.971834980991126]], [[0.95268142866460237, -3.9570135631362282], [-1.7165209244518427, 3.2711052715447542]], [[4.9924983550597704, 12.891422283435785], [-1.2213857773520564, -1.7291351898596623]], [[3.2513810098112819, 0.009418106351692759], [0.83049572532118243, -8.350755020948105]], [[3.3493975799772628, -10.019961526787521], [13.908434576224618, -9.5659277382281029]], [[0.17721955668497666, 4.5098937271552346], [12.179218148209955, 0.87953893733186228]]])
1794        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1795        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1796        self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1797        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1798       def test_mult_overloaded_expandedData_rank4_Symbol_rank0(self):
1799        dsds=s.diff(s)        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1800        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")        arg0=msk_arg0*numarray.array([[[[-0.71566615256646759, 3.7745591573508115, -1.8813261752186392, -4.2234672474302322], [-4.5183089034463952, 0.90004730988224502, -4.3059651797874992, 2.1824530065115431], [-3.2409114328950315, 1.425264269049185, -1.0363956947212296, -4.6538419691451374]], [[-0.021160056002790029, -0.67358505413946013, -0.23398482533746634, -3.2333582167367658], [-4.3340836442891923, 1.8672903891253885, 3.3960333447618343, 1.2033623796151725], [-4.0570605641925273, -0.94056101372721734, -1.7965062790901385, 1.9686802501306877]]], [[[1.5047353385318765, 0.5056728068922558, 2.409658435923566, -2.1000430599662478], [-4.064887735516467, -2.1275738111117271, -0.62603398290270729, 2.4810787925563362], [3.254883998023141, 3.9921703272954172, 1.7173288579737775, -2.2709735667109623]], [[-1.0333361509972105, 4.6923051335910078, -4.2187417938772569, -0.26001229923624436], [4.0524307618320652, 3.1529491855521723, 3.8891703598304161, 4.9134254224440408], [-2.2621317317299292, -1.4221931139149491, 2.8628397330646003, 2.486038796267632]]], [[[1.5100124197717211, -2.2988431057193734, -2.9336531752144488, -2.6131669437218363], [-2.8974794045596344, -0.85417257745919439, 4.3573210605245887, 4.2307931931872957], [-0.12423354634863593, -4.6765195903139816, -1.5778735854722301, 0.1126115177128213]], [[-4.1436398962257615, -0.76648956746585917, 2.1159176768980608, -3.2536216330349363], [-2.2856244596599904, 3.705073565316475, 2.2220301188746312, 0.98343571363908122], [2.4860129265223163, -3.1262241511848043, -3.8305865546189102, 3.1860325494154687]]]])+(1.-msk_arg0)*numarray.array([[[[2.4089227637145711, -2.6908075329445138, -0.26014840610314227, -3.9215812800091445], [4.009158789021523, 2.7447580688873892, 4.7131775334041954, -4.4290013383016644], [-1.7082394800006173, -0.49659550318463985, 3.9472706938122357, -1.6162682425555799]], [[-3.8246426595124583, -2.6800405903617683, 4.0143006613192842, 2.2139414823010402], [-2.5044774188651475, -1.6949103444811264, 0.41642158825732167, 3.2060207528109235], [-3.5084114918483778, -2.1345709077268706, 1.4430246021304205, 1.2294065151503952]]], [[[3.5126626365828901, 3.8348878052528992, -1.5523954598502341, -1.2410335237730994], [-2.1674583781546621, 3.3708587151697049, 0.56105884392031768, 2.2747443626383266], [-2.0719480048860914, 1.733990254553726, -0.050490856134826956, -3.7318225551204542]], [[1.4746408782374925, 4.0027176844782097, 2.8083560519562889, 2.9394382256580087], [-4.6069170484521784, -4.8378490055724885, 1.636720298987302, -1.5376228376365288], [-2.6819306123720734, 1.1516574074480923, -3.6392748736610949, 3.6118499182970254]]], [[[1.9375861833692003, 2.9438381921906851, 0.57660731138154819, 0.51102545141293199], [-3.0370737652416144, 4.5219314530432726, -2.0670940828628037, 2.8140667234989287], [-1.3644739955281162, -2.7108624230624456, -2.1786469944211206, 2.8077953462368104]], [[4.022901264470141, 4.7164854778488916, -0.17421287538805963, -3.832102145875953], [-4.8385573319832922, -4.2618026800252213, -4.5775319725945369, -2.3564870023253039], [-4.2941599674913693, -3.8000625353557038, 1.1131824136314092, 1.8132425713432623]]]])
1801        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        arg1=Symbol(shape=())
1802        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        res=arg0*arg1
1803        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        s1=numarray.array(0.717965207903)
1804        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        sub=res.substitute({arg1:s1})
1805        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1806          ref=msk_ref*numarray.array([[[[-0.51382339801631816, 2.7100021501484619, -1.350726738523665, -3.0323025403715427], [-3.2439885912315676, 0.64620265396188303, -3.0915331855279722, 1.5669253265579597], [-2.3268616507127589, 1.0232901572442055, -0.7440960504300036, -3.3412966169236569]], [[-0.015192184007276179, -0.48361063343539723, -0.16799296376949385, -2.3214387043033553], [-3.1117212647398351, 1.3406495324431462, 2.438233786416474, 0.86397232106270994], [-2.9128283314443832, -0.67529008376584743, -1.2898290041654794, 1.4134439250790429]]], [[[1.080347620167597, 0.36305548193114656, 1.7300509199223877, -1.5077578521533153], [-2.9184479681312658, -1.5275239736231971, -0.44947061868890531, 1.7813282511207205], [2.3368934663398959, 2.8662393990196935, 1.2329823705524707, -1.6304800089652003]], [[-0.74189940448410086, 3.3689118307816321, -3.0289098291289465, -0.18667978447841244], [2.9095042944301057, 2.2637078175116527, 2.7922890059647112, 3.5276685049395078], [-1.6241318790748014, -1.0210851747097522, 2.0554193241418712, 1.7848893612164991]]], [[[1.0841363808970814, -1.6504893683335269, -2.1062609118572939, -1.8761629480337436], [-2.0802894030884849, -0.61326619216028622, 3.1284049211184035, 3.037562314540097], [-0.089195363932689647, -3.3575783599208848, -1.1328583368377678, 0.08085115172692571]], [[-2.9749892795677022, -0.55031284166088568, 1.5191552747991404, -2.3359871321986905], [-1.6409988403673095, 2.6601139126172866, 1.5953403162639133, 0.70607262660183523], [1.7848707876394252, -2.2445201726558786, -2.7502278720763003, 2.2874605217258854]]]])+(1.-msk_ref)*numarray.array([[[[1.7295227328719085, -1.9319061898166923, -0.18677750447340177, -2.8155589190091503], [2.8784365234748241, 1.9706407975713816, 3.383897487652936, -3.1798688666551458], [-1.2264565134062644, -0.356538293687512, 2.8340030243311856, -1.1604243647929684]], [[-2.7459603621904449, -1.924175899646795, 2.8821282088880955, 1.5895329566247054], [-1.7981276507231641, -1.2168866578518498, 0.29897621218834564, 2.3018113563323048], [-2.5189173861531855, -1.532547645549204, 1.0360414584772961, 0.88267110424690254]]], [[[2.5219695601663243, 2.7533160203819742, -1.1145659290786001, -0.89101889190998895], [-1.5561597050922877, 2.4201592782474872, 0.40282072952090631, 1.6331873092471489], [-1.4875865800916528, 1.2449446736119429, -0.036250678022026972, -2.6793187566430881]], [[1.0587408447256197, 2.8738120345122611, 2.0163019367076376, 2.1104143768017321], [-3.3076061564825183, -3.473407267087782, 1.1751082297410078, -1.1039597002996688], [-1.9255328696923644, 0.82684994997116834, -2.6128727412832053, 2.5931825775035184]]], [[[1.3911194669720908, 2.1135733996881303, 0.41398398819427723, 0.36689849446726314], [-2.1805132972775692, 3.2465894558060273, -1.4841016329570593, 2.0204020001890131], [-0.97964485587718853, -1.9463049031696793, -1.5641927422961792, 2.0158993695091798]], [[2.8883031427173891, 3.386272476673903, -0.12507878329731756, -2.7513160138682586], [-3.4739158208065777, -3.0598260472046448, -3.2865086943851498, -1.6918756805445263], [-3.0830574538274456, -2.7283126882399662, 0.7992262430365179, 1.3018450797125141]]]])
1807        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1808        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")