/[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

trunk/escript/py_src/test_util.py revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC trunk/escript/test/python/test_util.py revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
1    #
2  # $Id$  # $Id$
3    #
4    #######################################################
5    #
6    #           Copyright 2003-2007 by ACceSS MNRF
7    #       Copyright 2007 by University of Queensland
8    #
9    #                http://esscc.uq.edu.au
10    #        Primary Business: Queensland, Australia
11    #  Licensed under the Open Software License version 3.0
12    #     http://www.opensource.org/licenses/osl-3.0.php
13    #
14    #######################################################
15    #
16    
17  """  """
18  Test suite for the util.py module.  Test suite for the util.py module.
19    
20  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:
21    
22    to run the use:
23    
24     from esys.bruce import Brick     from esys.bruce import Brick
25     class Test_utilOnBruce(Test_util):     class Test_utilOnBruce(Test_util_no_tagged_data):
26         def setUp(self):         def setUp(self):
27             self.domain = Brick(10,10,13)             self.domain = Brick(10,10,13)
28             self.functionspace = ContinuousFunction(self.domain)             self.functionspace = ContinuousFunction(self.domain)
# Line 14  The tests must be linked with a function Line 30  The tests must be linked with a function
30     suite.addTest(unittest.makeSuite(Test_utilOnBruce))     suite.addTest(unittest.makeSuite(Test_utilOnBruce))
31     unittest.TextTestRunner(verbosity=2).run(suite)     unittest.TextTestRunner(verbosity=2).run(suite)
32    
33  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.
34  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
35    coordinate 0.
36    
37  @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.
38    
39  @var __author__: name of author  @var __author__: name of author
40  @var __licence__: licence agreement  @var __copyright__: copyrights
41    @var __license__: licence agreement
42  @var __url__: url entry point on documentation  @var __url__: url entry point on documentation
43  @var __version__: version  @var __version__: version
44  @var __date__: date of the version  @var __date__: date of the version
45  """  """
46    
47  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
48  __licence__="contact: esys@access.uq.edu.au"  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
49                        http://www.access.edu.au
50                    Primary Business: Queensland, Australia"""
51    __license__="""Licensed under the Open Software License version 3.0
52                 http://www.opensource.org/licenses/osl-3.0.php"""
53  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys/escript"
54  __version__="$Revision$"  __version__="$Revision$"
55  __date__="$Date$"  __date__="$Date$"
# Line 35  __date__="$Date$" Line 57  __date__="$Date$"
57  import unittest  import unittest
58  import numarray  import numarray
59  from esys.escript import *  from esys.escript import *
60    from test_util_base import Test_util_base
61  class Test_util(unittest.TestCase):  from test_util_reduction_no_tagged_data import Test_util_reduction_no_tagged_data
62     RES_TOL=1.e-7 # RES_TOLerance to compare results  from test_util_reduction_with_tagged_data import Test_util_reduction_with_tagged_data
63     DIFF_TOL=1.e-7 # RES_TOLerance to derivatices  from test_util_overloaded_binary_no_tagged_data import Test_util_overloaded_binary_no_tagged_data
64  #=========================================================  from test_util_overloaded_binary_with_tagged_data import Test_util_overloaded_binary_with_tagged_data
65  #  constants  from test_util_unary_no_tagged_data import Test_util_unary_no_tagged_data
66  #=========================================================  from test_util_unary_with_tagged_data import Test_util_unary_with_tagged_data
67     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  from test_util_binary_no_tagged_data import Test_util_binary_no_tagged_data
68     def test_kronecker_1(self):  from test_util_binary_with_tagged_data import Test_util_binary_with_tagged_data
69        val=kronecker(d=1)  from test_util_spatial_functions import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
70        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  from test_util_slicing_no_tagged_data import Test_util_slicing_no_tagged_data
71        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  from test_util_slicing_with_tagged_data import Test_util_slicing_with_tagged_data
72     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
73     def test_kronecker_2(self):  
74        val=kronecker(d=2)  class Test_util_reduction(Test_util_reduction_no_tagged_data,Test_util_reduction_with_tagged_data):
75        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     """ test for reduction operation Lsup,sup,inf for all data types"""
76        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")     pass
77        self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")  class Test_util_unary(Test_util_unary_no_tagged_data,Test_util_unary_with_tagged_data):
78        self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")     """ all unary tests """
79        self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")     pass
80     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  class Test_util_binary(Test_util_binary_no_tagged_data,Test_util_binary_with_tagged_data):
81     def test_kronecker_3(self):     """
82        val=kronecker(d=3)     test for all binary operation
83        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     """
84        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")     pass
85        self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")  class Test_util_overloaded_binary(Test_util_overloaded_binary_no_tagged_data,Test_util_overloaded_binary_with_tagged_data):
86        self.failUnlessEqual(val[0,2],0.0,"wrong value for (0,2)")     """test for all overloaded operation"""
87        self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")     pass
88        self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")  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):
89        self.failUnlessEqual(val[1,2],0.0,"wrong value for (1,2)")     """test for all operations without tagged data"""
90        self.failUnlessEqual(val[2,0],0.0,"wrong value for (2,0)")     pass
91        self.failUnlessEqual(val[2,1],0.0,"wrong value for (2,1)")  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):
92        self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")     """all tests without tagged data"""
93     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     pass
94     def test_kronecker_domain(self):  
95        val=kronecker(d=self.functionspace)  class Test_util(Test_util_unary,Test_util_reduction,Test_util_binary,Test_util_overloaded_binary):
96        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     """all tests"""
97        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")     pass
98     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
99     def test_identityTensor_1(self):  
100        val=identityTensor(d=1)  class Test_util_overloaded_binary_still_failing(Test_util_base):
101        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     """
102        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")     these overloaded operations still fail!
103     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
104     def test_identityTensor_2(self):          - wrong return value of Data binaries (Mantis 0000054)
105        val=identityTensor(d=2)     """
106        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
107        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")     def test_add_overloaded_constData_rank0_Symbol_rank1(self):
108        self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")        arg0=Data(-4.93686078973,self.functionspace)
109        self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")        arg1=Symbol(shape=(2,))
110        self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")        res=arg0+arg1
111     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        s1=numarray.array([0.51662736235119944, 2.8171396846123073])
112     def test_identityTensor_3(self):        sub=res.substitute({arg1:s1})
113        val=identityTensor(d=3)        ref=Data(numarray.array([-4.4202334273802917, -2.1197211051191838]),self.functionspace)
114        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
115        self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
116        self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
117        self.failUnlessEqual(val[0,2],0.0,"wrong value for (0,2)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
118        self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")     def test_add_overloaded_constData_rank0_Symbol_rank2(self):
119        self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")        arg0=Data(-2.22764991169,self.functionspace)
120        self.failUnlessEqual(val[1,2],0.0,"wrong value for (1,2)")        arg1=Symbol(shape=(4, 5))
121        self.failUnlessEqual(val[2,0],0.0,"wrong value for (2,0)")        res=arg0+arg1
122        self.failUnlessEqual(val[2,1],0.0,"wrong value for (2,1)")        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]])
123        self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")        sub=res.substitute({arg1:s1})
124     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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)
125     def test_identityTensor_domain(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
126        val=identityTensor(d=self.functionspace)        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
127        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
128        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
129     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_add_overloaded_constData_rank0_Symbol_rank3(self):
130     def test_identityTensor4_1(self):        arg0=Data(-4.67318656609,self.functionspace)
131        val=identityTensor4(d=1)        arg1=Symbol(shape=(6, 2, 2))
132        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        res=arg0+arg1
133        self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")        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]]])
134     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        sub=res.substitute({arg1:s1})
135     def test_identityTensor4_2(self):        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)
136        val=identityTensor4(d=2)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
137        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
138        self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
139        self.failUnlessEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
140        self.failUnlessEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")     def test_add_overloaded_constData_rank0_Symbol_rank4(self):
141        self.failUnlessEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")        arg0=Data(4.16645075056,self.functionspace)
142        self.failUnlessEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")        arg1=Symbol(shape=(3, 2, 3, 4))
143        self.failUnlessEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")        res=arg0+arg1
144        self.failUnlessEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")        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]]]])
145        self.failUnlessEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")        sub=res.substitute({arg1:s1})
146        self.failUnlessEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")        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)
147        self.failUnlessEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
148        self.failUnlessEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
149        self.failUnlessEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
150        self.failUnlessEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
151        self.failUnlessEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")     def test_add_overloaded_constData_rank1_Symbol_rank0(self):
152        self.failUnlessEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")        arg0=Data(numarray.array([3.8454947431609945, 3.4801848055393254]),self.functionspace)
153        self.failUnlessEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")        arg1=Symbol(shape=())
154     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
155     def test_identityTensor4_3(self):        s1=numarray.array(0.181985677208)
156        val=identityTensor4(d=3)        sub=res.substitute({arg1:s1})
157        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        ref=Data(numarray.array([4.0274804203691783, 3.6621704827475092]),self.functionspace)
158        self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
159        self.failUnlessEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
160        self.failUnlessEqual(val[0,0,0,2],0.0,"wrong value for (0,0,0,2)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
161        self.failUnlessEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
162        self.failUnlessEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")     def test_add_overloaded_constData_rank1_Symbol_rank1(self):
163        self.failUnlessEqual(val[0,0,1,2],0.0,"wrong value for (0,0,1,2)")        arg0=Data(numarray.array([2.6719646801005306, 4.0262173014652003]),self.functionspace)
164        self.failUnlessEqual(val[0,0,2,0],0.0,"wrong value for (0,0,2,0)")        arg1=Symbol(shape=(2,))
165        self.failUnlessEqual(val[0,0,2,1],0.0,"wrong value for (0,0,2,1)")        res=arg0+arg1
166        self.failUnlessEqual(val[0,0,2,2],0.0,"wrong value for (0,0,2,2)")        s1=numarray.array([3.7355891147806837, -3.0309968912239551])
167        self.failUnlessEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")        sub=res.substitute({arg1:s1})
168        self.failUnlessEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")        ref=Data(numarray.array([6.4075537948812142, 0.99522041024124519]),self.functionspace)
169        self.failUnlessEqual(val[0,1,0,2],0.0,"wrong value for (0,1,0,2)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
170        self.failUnlessEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
171        self.failUnlessEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
172        self.failUnlessEqual(val[0,1,1,2],0.0,"wrong value for (0,1,1,2)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
173        self.failUnlessEqual(val[0,1,2,0],0.0,"wrong value for (0,1,2,0)")     def test_add_overloaded_constData_rank2_Symbol_rank0(self):
174        self.failUnlessEqual(val[0,1,2,1],0.0,"wrong value for (0,1,2,1)")        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)
175        self.failUnlessEqual(val[0,1,2,2],0.0,"wrong value for (0,1,2,2)")        arg1=Symbol(shape=())
176        self.failUnlessEqual(val[0,2,0,0],0.0,"wrong value for (0,2,0,0)")        res=arg0+arg1
177        self.failUnlessEqual(val[0,2,0,1],0.0,"wrong value for (0,2,0,1)")        s1=numarray.array(4.82316401579)
178        self.failUnlessEqual(val[0,2,0,2],1.0,"wrong value for (0,2,0,2)")        sub=res.substitute({arg1:s1})
179        self.failUnlessEqual(val[0,2,1,0],0.0,"wrong value for (0,2,1,0)")        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)
180        self.failUnlessEqual(val[0,2,1,1],0.0,"wrong value for (0,2,1,1)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
181        self.failUnlessEqual(val[0,2,1,2],0.0,"wrong value for (0,2,1,2)")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
182        self.failUnlessEqual(val[0,2,2,0],0.0,"wrong value for (0,2,2,0)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
183        self.failUnlessEqual(val[0,2,2,1],0.0,"wrong value for (0,2,2,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
184        self.failUnlessEqual(val[0,2,2,2],0.0,"wrong value for (0,2,2,2)")     def test_add_overloaded_constData_rank2_Symbol_rank2(self):
185        self.failUnlessEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")        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)
186        self.failUnlessEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")        arg1=Symbol(shape=(4, 5))
187        self.failUnlessEqual(val[1,0,0,2],0.0,"wrong value for (1,0,0,2)")        res=arg0+arg1
188        self.failUnlessEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")        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]])
189        self.failUnlessEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")        sub=res.substitute({arg1:s1})
190        self.failUnlessEqual(val[1,0,1,2],0.0,"wrong value for (1,0,1,2)")        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)
191        self.failUnlessEqual(val[1,0,2,0],0.0,"wrong value for (1,0,2,0)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
192        self.failUnlessEqual(val[1,0,2,1],0.0,"wrong value for (1,0,2,1)")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
193        self.failUnlessEqual(val[1,0,2,2],0.0,"wrong value for (1,0,2,2)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
194        self.failUnlessEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
195        self.failUnlessEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")     def test_add_overloaded_constData_rank3_Symbol_rank0(self):
196        self.failUnlessEqual(val[1,1,0,2],0.0,"wrong value for (1,1,0,2)")        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)
197        self.failUnlessEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")        arg1=Symbol(shape=())
198        self.failUnlessEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")        res=arg0+arg1
199        self.failUnlessEqual(val[1,1,1,2],0.0,"wrong value for (1,1,1,2)")        s1=numarray.array(0.860178486532)
200        self.failUnlessEqual(val[1,1,2,0],0.0,"wrong value for (1,1,2,0)")        sub=res.substitute({arg1:s1})
201        self.failUnlessEqual(val[1,1,2,1],0.0,"wrong value for (1,1,2,1)")        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)
202        self.failUnlessEqual(val[1,1,2,2],0.0,"wrong value for (1,1,2,2)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
203        self.failUnlessEqual(val[1,2,0,0],0.0,"wrong value for (1,2,0,0)")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
204        self.failUnlessEqual(val[1,2,0,1],0.0,"wrong value for (1,2,0,1)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
205        self.failUnlessEqual(val[1,2,0,2],0.0,"wrong value for (1,2,0,2)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
206        self.failUnlessEqual(val[1,2,1,0],0.0,"wrong value for (1,2,1,0)")     def test_add_overloaded_constData_rank3_Symbol_rank3(self):
207        self.failUnlessEqual(val[1,2,1,1],0.0,"wrong value for (1,2,1,1)")        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)
208        self.failUnlessEqual(val[1,2,1,2],1.0,"wrong value for (1,2,1,2)")        arg1=Symbol(shape=(6, 2, 2))
209        self.failUnlessEqual(val[1,2,2,0],0.0,"wrong value for (1,2,2,0)")        res=arg0+arg1
210        self.failUnlessEqual(val[1,2,2,1],0.0,"wrong value for (1,2,2,1)")        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]]])
211        self.failUnlessEqual(val[1,2,2,2],0.0,"wrong value for (1,2,2,2)")        sub=res.substitute({arg1:s1})
212        self.failUnlessEqual(val[2,0,0,0],0.0,"wrong value for (2,0,0,0)")        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)
213        self.failUnlessEqual(val[2,0,0,1],0.0,"wrong value for (2,0,0,1)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
214        self.failUnlessEqual(val[2,0,0,2],0.0,"wrong value for (2,0,0,2)")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
215        self.failUnlessEqual(val[2,0,1,0],0.0,"wrong value for (2,0,1,0)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
216        self.failUnlessEqual(val[2,0,1,1],0.0,"wrong value for (2,0,1,1)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
217        self.failUnlessEqual(val[2,0,1,2],0.0,"wrong value for (2,0,1,2)")     def test_add_overloaded_constData_rank4_Symbol_rank0(self):
218        self.failUnlessEqual(val[2,0,2,0],1.0,"wrong value for (2,0,2,0)")        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)
219        self.failUnlessEqual(val[2,0,2,1],0.0,"wrong value for (2,0,2,1)")        arg1=Symbol(shape=())
220        self.failUnlessEqual(val[2,0,2,2],0.0,"wrong value for (2,0,2,2)")        res=arg0+arg1
221        self.failUnlessEqual(val[2,1,0,0],0.0,"wrong value for (2,1,0,0)")        s1=numarray.array(0.33323555487)
222        self.failUnlessEqual(val[2,1,0,1],0.0,"wrong value for (2,1,0,1)")        sub=res.substitute({arg1:s1})
223        self.failUnlessEqual(val[2,1,0,2],0.0,"wrong value for (2,1,0,2)")        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)
224        self.failUnlessEqual(val[2,1,1,0],0.0,"wrong value for (2,1,1,0)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
225        self.failUnlessEqual(val[2,1,1,1],0.0,"wrong value for (2,1,1,1)")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
226        self.failUnlessEqual(val[2,1,1,2],0.0,"wrong value for (2,1,1,2)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
227        self.failUnlessEqual(val[2,1,2,0],0.0,"wrong value for (2,1,2,0)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
228        self.failUnlessEqual(val[2,1,2,1],1.0,"wrong value for (2,1,2,1)")     def test_add_overloaded_constData_rank4_Symbol_rank4(self):
229        self.failUnlessEqual(val[2,1,2,2],0.0,"wrong value for (2,1,2,2)")        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)
230        self.failUnlessEqual(val[2,2,0,0],0.0,"wrong value for (2,2,0,0)")        arg1=Symbol(shape=(3, 2, 3, 4))
231        self.failUnlessEqual(val[2,2,0,1],0.0,"wrong value for (2,2,0,1)")        res=arg0+arg1
232        self.failUnlessEqual(val[2,2,0,2],0.0,"wrong value for (2,2,0,2)")        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]]]])
233        self.failUnlessEqual(val[2,2,1,0],0.0,"wrong value for (2,2,1,0)")        sub=res.substitute({arg1:s1})
234        self.failUnlessEqual(val[2,2,1,1],0.0,"wrong value for (2,2,1,1)")        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)
235        self.failUnlessEqual(val[2,2,1,2],0.0,"wrong value for (2,2,1,2)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
236        self.failUnlessEqual(val[2,2,2,0],0.0,"wrong value for (2,2,2,0)")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
237        self.failUnlessEqual(val[2,2,2,1],0.0,"wrong value for (2,2,2,1)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
238        self.failUnlessEqual(val[2,2,2,2],1.0,"wrong value for (2,2,2,2)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
239     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_add_overloaded_taggedData_rank0_Symbol_rank0(self):
240     def test_identityTensor4_domain(self):        arg0=Data(3.50668349593,self.functionspace)
241        val=identityTensor4(d=self.functionspace)        arg0.setTaggedValue(1,-3.09146650776)
242        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        arg1=Symbol(shape=())
243        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")        res=arg0+arg1
244     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        s1=numarray.array(-4.32369560802)
245     def test_unitVector_1(self):        sub=res.substitute({arg1:s1})
246        val=unitVector(i=0,d=1)        ref=Data(-0.81701211209,self.functionspace)
247        self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")        ref.setTaggedValue(1,-7.41516211578)
248     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
249     def test_unitVector_2(self):        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
250        val=unitVector(i=0,d=2)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
251        self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
252        self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 0 vector")     def test_add_overloaded_taggedData_rank0_Symbol_rank1(self):
253        val=unitVector(i=1,d=2)        arg0=Data(3.83444600418,self.functionspace)
254        self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 1 vector")        arg0.setTaggedValue(1,-0.266863397142)
255        self.failUnlessEqual(val[1],1.0,"wrong value for 1 in the 1 vector")        arg1=Symbol(shape=(2,))
256     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
257     def test_unitVector_3(self):        s1=numarray.array([3.6938635924807581, -2.3199399928130826])
258        val=unitVector(i=0,d=3)        sub=res.substitute({arg1:s1})
259        self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")        ref=Data(numarray.array([7.5283095966592981, 1.5145060113654574]),self.functionspace)
260        self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 0 vector")        ref.setTaggedValue(1,numarray.array([3.4270001953384694, -2.5868033899553713]))
261        self.failUnlessEqual(val[2],0.0,"wrong value for 2 in the 0 vector")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
262        val=unitVector(i=1,d=3)        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
263        self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 1 vector")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
264        self.failUnlessEqual(val[1],1.0,"wrong value for 1 in the 1 vector")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
265        self.failUnlessEqual(val[2],0.0,"wrong value for 2 in the 1 vector")     def test_add_overloaded_taggedData_rank0_Symbol_rank2(self):
266        val=unitVector(i=2,d=3)        arg0=Data(-2.85642807584,self.functionspace)
267        self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 2 vector")        arg0.setTaggedValue(1,-0.357260114938)
268        self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 2 vector")        arg1=Symbol(shape=(4, 5))
269        self.failUnlessEqual(val[2],1.0,"wrong value for 2 in the 2 vector")        res=arg0+arg1
270     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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]])
271     def test_unitVector_domain(self):        sub=res.substitute({arg1:s1})
272        val=unitVector(i=0,d=self.functionspace)        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)
273        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")        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]]))
274        self.failUnlessEqual(val.shape,(self.functionspace.getDim(),),"wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
275  #=========================================================================        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
276  #   global reduction operations (these functions have no symbolic version)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
277  #=========================================================================     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
278     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_add_overloaded_taggedData_rank0_Symbol_rank3(self):
279     def test_Lsup_float_rank0(self):        arg0=Data(-2.98759917871,self.functionspace)
280        arg=0.479077251703        arg0.setTaggedValue(1,-4.26584239637)
281        ref=0.479077251703        arg1=Symbol(shape=(6, 2, 2))
282        res=Lsup(arg)        res=arg0+arg1
283        self.failUnless(isinstance(res,float),"wrong type of result.")        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]]])
284        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        sub=res.substitute({arg1:s1})
285     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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)
286     def test_Lsup_array_rank0(self):        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]]]))
287        arg=0.352800421569        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
288        ref=0.352800421569        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
289        res=Lsup(arg)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
290        self.failUnless(isinstance(res,float),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
291        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     def test_add_overloaded_taggedData_rank0_Symbol_rank4(self):
292     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=Data(-3.36894529378,self.functionspace)
293     def test_Lsup_array_rank1(self):        arg0.setTaggedValue(1,-4.62956527999)
294        arg=numarray.array([0.58364106865247445, 0.19224319360367659])        arg1=Symbol(shape=(3, 2, 3, 4))
295        ref=0.583641068652        res=arg0+arg1
296        res=Lsup(arg)        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]]]])
297        self.failUnless(isinstance(res,float),"wrong type of result.")        sub=res.substitute({arg1:s1})
298        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong 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)
299     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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]]]]))
300     def test_Lsup_array_rank2(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
301        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]])        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
302        ref=0.998093740073        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
303        res=Lsup(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
304        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_add_overloaded_taggedData_rank1_Symbol_rank0(self):
305        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0=Data(numarray.array([-4.9434811071655114, 1.7588416724781917]),self.functionspace)
306     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0.setTaggedValue(1,numarray.array([3.0524482361043965, -0.58828792238396233]))
307     def test_Lsup_array_rank3(self):        arg1=Symbol(shape=())
308        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]]])        res=arg0+arg1
309        ref=0.978865081668        s1=numarray.array(-4.86003727467)
310        res=Lsup(arg)        sub=res.substitute({arg1:s1})
311        self.failUnless(isinstance(res,float),"wrong type of result.")        ref=Data(numarray.array([-9.8035183818403411, -3.1011956021966389]),self.functionspace)
312        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        ref.setTaggedValue(1,numarray.array([-1.8075890385704341, -5.4483251970587929]))
313     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
314     def test_Lsup_array_rank4(self):        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
315        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]]]])        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
316        ref=0.987063544303     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
317        res=Lsup(arg)     def test_add_overloaded_taggedData_rank1_Symbol_rank1(self):
318        self.failUnless(isinstance(res,float),"wrong type of result.")        arg0=Data(numarray.array([0.47124983588436109, 3.3842142103059487]),self.functionspace)
319        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0.setTaggedValue(1,numarray.array([4.4506172428158504, -1.5976912605342894]))
320     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=(2,))
321     def test_Lsup_constData_rank0(self):        res=arg0+arg1
322        arg=Data(0.196366308048,self.functionspace)        s1=numarray.array([2.7380372395241483, -1.2414970456241372])
323        ref=0.196366308048        sub=res.substitute({arg1:s1})
324        res=Lsup(arg)        ref=Data(numarray.array([3.2092870754085094, 2.1427171646818115]),self.functionspace)
325        self.failUnless(isinstance(res,float),"wrong type of result.")        ref.setTaggedValue(1,numarray.array([7.1886544823399987, -2.8391883061584267]))
326        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
327     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
328     def test_Lsup_constData_rank1(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
329        arg=Data(numarray.array([-0.013183241788205846, 0.30081447346639489]),self.functionspace)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
330        ref=0.300814473466     def test_add_overloaded_taggedData_rank2_Symbol_rank0(self):
331        res=Lsup(arg)        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)
332        self.failUnless(isinstance(res,float),"wrong type of result.")        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]]))
333        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg1=Symbol(shape=())
334     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
335     def test_Lsup_constData_rank2(self):        s1=numarray.array(3.4845259086)
336        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)        sub=res.substitute({arg1:s1})
337        ref=0.96449976222        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)
338        res=Lsup(arg)        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]]))
339        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
340        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
341     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
342     def test_Lsup_constData_rank3(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
343        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)     def test_add_overloaded_taggedData_rank2_Symbol_rank2(self):
344        ref=0.898737574422        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)
345        res=Lsup(arg)        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]]))
346        self.failUnless(isinstance(res,float),"wrong type of result.")        arg1=Symbol(shape=(4, 5))
347        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        res=arg0+arg1
348     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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]])
349     def test_Lsup_constData_rank4(self):        sub=res.substitute({arg1:s1})
350        arg=Data(numarray.array([[[[-0.1675633776917147, 0.33827478137880718, -0.93890402023643449, 0.65020437341791437], [0.29507018847480526, 0.98622587753446878, 0.12652012726316597, -0.31134038684685694], [-0.046095794370747178, 0.52924578464459526, -0.6479404156998898, -0.50108997075395512]], [[-0.89461015899273821, -0.079360196866752331, 0.24950542226018069, 0.6689436082056277], [0.92392213781413735, 0.3873078097702356, 0.19593123983162242, -0.24092882483013001], [-0.64621424798001881, 0.9822743623774457, 0.89791841241748926, 0.61910184653693512]]], [[[-0.93993640130694156, 0.86452728798536005, 0.094496916350070848, 0.59825417382728907], [0.55042390382543216, 0.83625046124041091, -0.59865905280251042, 0.60081510989738351], [0.96300656863917622, 0.45676715577013183, 0.96765574240961594, 0.35217159943804499]], [[-0.44344990079738578, -0.62540931368504271, 0.47046830875624712, 0.56727920796684694], [0.68754074058706793, -0.20419202844112316, -0.0095491803785341389, 0.013299778291189002], [0.17824394120278897, -0.27714200037108694, -0.2616405339148673, -0.32155257707876661]]], [[[0.47113927793594357, -0.99306136743656892, 0.30468996581271934, -0.55558797016447881], [0.83216176170936151, 0.016003159554198287, 0.50607924358488665, -0.44441953149310631], [0.81919419287951278, -0.65849894919643503, 0.91897977494732008, -0.52338741357416407]], [[0.71408966944475138, -0.49347702658095161, 0.35676281330171133, 0.87268025092466872], [0.38401738326898771, -0.66323897612738114, 0.57309433517459518, 0.72101582669934583], [-0.0289954568811297, 0.55204032281174009, 0.51120867863750807, -0.67373936301915327]]]]),self.functionspace)        ref=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)
351        ref=0.993061367437        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]]))
352        res=Lsup(arg)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
353        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
354        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
355       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
356     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_add_overloaded_taggedData_rank3_Symbol_rank0(self):
357     def test_Lsup_expandedData_rank0(self):        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)
358        msk=whereNegative(self.functionspace.getX()[0]-0.5)        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]]]))
359        arg=msk*0.907507663119+(1.-msk)*0.907507663119        arg1=Symbol(shape=())
360          res=arg0+arg1
361        # arg=Data(0.907507663119,self.functionspace,True)        s1=numarray.array(4.49324308458)
362        # arg.setTaggedValue(1,0.907507663119)        sub=res.substitute({arg1:s1})
363        res=Lsup(arg)        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)
364        ref=0.907507663119        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]]]))
365        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
366        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
367     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
368     def test_Lsup_expandedData_rank1(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
369       def test_add_overloaded_taggedData_rank3_Symbol_rank3(self):
370        msk=whereNegative(self.functionspace.getX()[0]-0.5)        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)
371        arg=msk*numarray.array([0.64842023599463228, 0.7950449048151853])+(1.-msk)*numarray.array([-0.53356920308809608, -0.30392740367264159])        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]]]))
372          arg1=Symbol(shape=(6, 2, 2))
373        # arg=Data(numarray.array([0.64842023599463228, 0.7950449048151853]),self.functionspace,True)        res=arg0+arg1
374        # arg.setTaggedValue(1,[-0.53356920308809608, -0.30392740367264159])        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]]])
375        res=Lsup(arg)        sub=res.substitute({arg1:s1})
376        ref=0.795044904815        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)
377        self.failUnless(isinstance(res,float),"wrong type of result.")        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]]]))
378        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
379     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
380     def test_Lsup_expandedData_rank2(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
381       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
382        msk=whereNegative(self.functionspace.getX()[0]-0.5)     def test_add_overloaded_taggedData_rank4_Symbol_rank0(self):
383        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]])        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)
384          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]]]]))
385        # 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)        arg1=Symbol(shape=())
386        # arg.setTaggedValue(1,[[-0.25856012658041871, -0.64132706411711782, -0.90934384682634128, 0.13076992241789931, 0.23456684296051011], [0.54052140856785269, 0.78868044275368643, 0.20419986484049479, 0.64782383948156319, 0.12883249735345115], [-0.44575026820636654, -0.86972644697707824, 0.74937006939719653, 0.64390867433141019, 0.57227950445890885], [-0.59430616226417832, -0.77932115906125854, 0.60864641730739155, 0.909083762068297, -0.5444504332265574]])        res=arg0+arg1
387        res=Lsup(arg)        s1=numarray.array(4.83582066753)
388        ref=0.930747072265        sub=res.substitute({arg1:s1})
389        self.failUnless(isinstance(res,float),"wrong type of result.")        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)
390        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        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]]]]))
391     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
392     def test_Lsup_expandedData_rank3(self):        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
393          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
394        msk=whereNegative(self.functionspace.getX()[0]-0.5)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
395        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]]])     def test_add_overloaded_taggedData_rank4_Symbol_rank4(self):
396          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)
397        # 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)        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]]]]))
398        # 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]]])        arg1=Symbol(shape=(3, 2, 3, 4))
399        res=Lsup(arg)        res=arg0+arg1
400        ref=0.99924882354        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]]]])
401        self.failUnless(isinstance(res,float),"wrong type of result.")        sub=res.substitute({arg1:s1})
402        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        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)
403     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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]]]]))
404     def test_Lsup_expandedData_rank4(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
405          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
406        msk=whereNegative(self.functionspace.getX()[0]-0.5)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
407        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]]]])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
408       def test_add_overloaded_expandedData_rank0_Symbol_rank0(self):
409        # 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)        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
410        # 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]]]])        arg0=msk_arg0*(-0.481249850026)+(1.-msk_arg0)*(-1.48465416864)
411        res=Lsup(arg)        arg1=Symbol(shape=())
412        ref=0.998894848618        res=arg0+arg1
413        self.failUnless(isinstance(res,float),"wrong type of result.")        s1=numarray.array(-2.65110429185)
414        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        sub=res.substitute({arg1:s1})
415     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
416     def test_sup_float_rank0(self):        ref=msk_ref*(-3.13235414188)+(1.-msk_ref)*(-4.13575846049)
417        arg=0.870743835413        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
418        ref=0.870743835413        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
419        res=sup(arg)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
420        self.failUnless(isinstance(res,float),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
421        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     def test_add_overloaded_expandedData_rank0_Symbol_rank1(self):
422     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
423     def test_sup_array_rank0(self):        arg0=msk_arg0*(1.13411439983)+(1.-msk_arg0)*(-0.629637549331)
424        arg=0.469212543992        arg1=Symbol(shape=(2,))
425        ref=0.469212543992        res=arg0+arg1
426        res=sup(arg)        s1=numarray.array([-0.62992419613163175, 4.55886114005793])
427        self.failUnless(isinstance(res,float),"wrong type of result.")        sub=res.substitute({arg1:s1})
428        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
429     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=msk_ref*numarray.array([0.50419020369403444, 5.6929755398835962])+(1.-msk_ref)*numarray.array([-1.259561745462479, 3.9292235907270827])
430     def test_sup_array_rank1(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
431        arg=numarray.array([0.8163530200305178, 0.7844191729334391])        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
432        ref=0.816353020031        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
433        res=sup(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
434        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_add_overloaded_expandedData_rank0_Symbol_rank2(self):
435        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
436     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=msk_arg0*(3.01809294358)+(1.-msk_arg0)*(0.889743657807)
437     def test_sup_array_rank2(self):        arg1=Symbol(shape=(4, 5))
438        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]])        res=arg0+arg1
439        ref=0.773008977017        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]])
440        res=sup(arg)        sub=res.substitute({arg1:s1})
441        self.failUnless(isinstance(res,float),"wrong type of result.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
442        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        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]])
443     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
444     def test_sup_array_rank3(self):        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
445        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]]])        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
446        ref=0.911963051515     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
447        res=sup(arg)     def test_add_overloaded_expandedData_rank0_Symbol_rank3(self):
448        self.failUnless(isinstance(res,float),"wrong type of result.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
449        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0=msk_arg0*(-4.98444562132)+(1.-msk_arg0)*(4.30756765987)
450     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=(6, 2, 2))
451     def test_sup_array_rank4(self):        res=arg0+arg1
452        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]]]])        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]]])
453        ref=0.983949391382        sub=res.substitute({arg1:s1})
454        res=sup(arg)        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
455        self.failUnless(isinstance(res,float),"wrong type of result.")        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]]])
456        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
457     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
458     def test_sup_constData_rank0(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
459        arg=Data(0.165371505685,self.functionspace)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
460        ref=0.165371505685     def test_add_overloaded_expandedData_rank0_Symbol_rank4(self):
461        res=sup(arg)        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
462        self.failUnless(isinstance(res,float),"wrong type of result.")        arg0=msk_arg0*(-2.9697925334)+(1.-msk_arg0)*(-4.26135335725)
463        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg1=Symbol(shape=(3, 2, 3, 4))
464     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
465     def test_sup_constData_rank1(self):        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]]]])
466        arg=Data(numarray.array([-0.89603386749185288, -0.68712608295212729]),self.functionspace)        sub=res.substitute({arg1:s1})
467        ref=-0.687126082952        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
468        res=sup(arg)        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]]]])
469        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
470        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
471     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
472     def test_sup_constData_rank2(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
473        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)     def test_add_overloaded_expandedData_rank1_Symbol_rank0(self):
474        ref=0.996425639372        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
475        res=sup(arg)        arg0=msk_arg0*numarray.array([2.1945719955206853, -3.4851810549539852])+(1.-msk_arg0)*numarray.array([-3.159460740559509, 1.0507096466806898])
476        self.failUnless(isinstance(res,float),"wrong type of result.")        arg1=Symbol(shape=())
477        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        res=arg0+arg1
478     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        s1=numarray.array(2.92811762582)
479     def test_sup_constData_rank3(self):        sub=res.substitute({arg1:s1})
480        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)        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
481        ref=0.986762707603        ref=msk_ref*numarray.array([5.1226896213358133, -0.5570634291388572])+(1.-msk_ref)*numarray.array([-0.23134311474438096, 3.9788272724958178])
482        res=sup(arg)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
483        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
484        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
485     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
486     def test_sup_constData_rank4(self):     def test_add_overloaded_expandedData_rank1_Symbol_rank1(self):
487        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)        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
488        ref=0.912098525978        arg0=msk_arg0*numarray.array([1.9387192390641195, -2.294788495198282])+(1.-msk_arg0)*numarray.array([-3.9950296964046816, -4.9584579002903517])
489        res=sup(arg)        arg1=Symbol(shape=(2,))
490        self.failUnless(isinstance(res,float),"wrong type of result.")        res=arg0+arg1
491        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        s1=numarray.array([0.68148355985483988, 0.33396702170122339])
492     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        sub=res.substitute({arg1:s1})
493     def test_sup_expandedData_rank0(self):        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
494          ref=msk_ref*numarray.array([2.6202027989189594, -1.9608214734970586])+(1.-msk_ref)*numarray.array([-3.3135461365498418, -4.6244908785891283])
495        msk=whereNegative(self.functionspace.getX()[0]-0.5)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
496        arg=msk*0.842459260157+(1.-msk)*0.985691469761        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
497          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
498        # arg=Data(0.842459260157,self.functionspace,True)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
499        # arg.setTaggedValue(1,0.842459260157)     def test_add_overloaded_expandedData_rank2_Symbol_rank0(self):
500        res=sup(arg)        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
501        ref=0.985691469761        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]])
502        self.failUnless(isinstance(res,float),"wrong type of result.")        arg1=Symbol(shape=())
503        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        res=arg0+arg1
504     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        s1=numarray.array(3.22997214356)
505     def test_sup_expandedData_rank1(self):        sub=res.substitute({arg1:s1})
506          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
507        msk=whereNegative(self.functionspace.getX()[0]-0.5)        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]])
508        arg=msk*numarray.array([0.47024430020620023, -0.40410868427962021])+(1.-msk)*numarray.array([0.34568516056640197, -0.43342673126146103])        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
509          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
510        # arg=Data(numarray.array([0.47024430020620023, -0.40410868427962021]),self.functionspace,True)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
511        # arg.setTaggedValue(1,[0.34568516056640197, -0.43342673126146103])     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
512        res=sup(arg)     def test_add_overloaded_expandedData_rank2_Symbol_rank2(self):
513        ref=0.470244300206        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
514        self.failUnless(isinstance(res,float),"wrong type of result.")        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]])
515        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg1=Symbol(shape=(4, 5))
516     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0+arg1
517     def test_sup_expandedData_rank2(self):        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]])
518          sub=res.substitute({arg1:s1})
519        msk=whereNegative(self.functionspace.getX()[0]-0.5)        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
520        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]])        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]])
521          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
522        # 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)        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
523        # 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]])        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
524        res=sup(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
525        ref=0.989333342819     def test_add_overloaded_expandedData_rank3_Symbol_rank0(self):
526        self.failUnless(isinstance(res,float),"wrong type of result.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
527        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        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]]])
528     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=())
529     def test_sup_expandedData_rank3(self):        res=arg0+arg1
530          s1=numarray.array(2.24723235412)
531        msk=whereNegative(self.functionspace.getX()[0]-0.5)        sub=res.substitute({arg1:s1})
532        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]]])        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
533          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]]])
534        # 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)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
535        # 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]]])        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
536        res=sup(arg)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
537        ref=0.946515361836     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
538        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_add_overloaded_expandedData_rank3_Symbol_rank3(self):
539        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
540     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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]]])
541     def test_sup_expandedData_rank4(self):        arg1=Symbol(shape=(6, 2, 2))
542          res=arg0+arg1
543        msk=whereNegative(self.functionspace.getX()[0]-0.5)        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]]])
544        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]]]])        sub=res.substitute({arg1:s1})
545          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
546        # 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)        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]]])
547        # 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]]]])        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
548        res=sup(arg)        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
549        ref=0.990730927773        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
550        self.failUnless(isinstance(res,float),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
551        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     def test_add_overloaded_expandedData_rank4_Symbol_rank0(self):
552     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
553     def test_inf_float_rank0(self):        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]]]])
554        arg=0.857535693433        arg1=Symbol(shape=())
555        ref=0.857535693433        res=arg0+arg1
556        res=inf(arg)        s1=numarray.array(3.43950171094)
557        self.failUnless(isinstance(res,float),"wrong type of result.")        sub=res.substitute({arg1:s1})
558        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
559     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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]]]])
560     def test_inf_array_rank0(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
561        arg=0.170725403135        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
562        ref=0.170725403135        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
563        res=inf(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
564        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_add_overloaded_expandedData_rank4_Symbol_rank4(self):
565        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
566     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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]]]])
567     def test_inf_array_rank1(self):        arg1=Symbol(shape=(3, 2, 3, 4))
568        arg=numarray.array([-0.20582799927627726, 0.0065475369467946631])        res=arg0+arg1
569        ref=-0.205827999276        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]]]])
570        res=inf(arg)        sub=res.substitute({arg1:s1})
571        self.failUnless(isinstance(res,float),"wrong type of result.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
572        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        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]]]])
573     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
574     def test_inf_array_rank2(self):        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
575        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(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
576        ref=-0.788847536632     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
577        res=inf(arg)     def test_sub_overloaded_constData_rank0_Symbol_rank0(self):
578        self.failUnless(isinstance(res,float),"wrong type of result.")        arg0=Data(1.30830371112,self.functionspace)
579        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg1=Symbol(shape=())
580     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0-arg1
581     def test_inf_array_rank3(self):        s1=numarray.array(0.0412291309402)
582        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]]])        sub=res.substitute({arg1:s1})
583        ref=-0.976813524666        ref=Data(1.26707458018,self.functionspace)
584        res=inf(arg)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
585        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
586        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
587     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
588     def test_inf_array_rank4(self):     def test_sub_overloaded_constData_rank0_Symbol_rank1(self):
589        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]]]])        arg0=Data(-4.2604726935,self.functionspace)
590        ref=-0.978171335098        arg1=Symbol(shape=(2,))
591        res=inf(arg)        res=arg0-arg1
592        self.failUnless(isinstance(res,float),"wrong type of result.")        s1=numarray.array([-3.8546037299533653, -1.305392606117024])
593        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        sub=res.substitute({arg1:s1})
594     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=Data(numarray.array([-0.4058689635493371, -2.9550800873856784]),self.functionspace)
595     def test_inf_constData_rank0(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
596        arg=Data(0.0114629834279,self.functionspace)        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
597        ref=0.0114629834279        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
598        res=inf(arg)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
599        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_sub_overloaded_constData_rank0_Symbol_rank2(self):
600        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        arg0=Data(0.902009664206,self.functionspace)
601     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=(4, 5))
602     def test_inf_constData_rank1(self):        res=arg0-arg1
603        arg=Data(numarray.array([-0.13734485813185704, -0.54812466656634307]),self.functionspace)        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]])
604        ref=-0.548124666566        sub=res.substitute({arg1:s1})
605        res=inf(arg)        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)
606        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
607        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
608     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
609     def test_inf_constData_rank2(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
610        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)     def test_sub_overloaded_constData_rank0_Symbol_rank3(self):
611        ref=-0.930735007638        arg0=Data(4.30012329043,self.functionspace)
612        res=inf(arg)        arg1=Symbol(shape=(6, 2, 2))
613        self.failUnless(isinstance(res,float),"wrong type of result.")        res=arg0-arg1
614        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        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]]])
615     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        sub=res.substitute({arg1:s1})
616     def test_inf_constData_rank3(self):        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)
617        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)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
618        ref=-0.859092544977        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
619        res=inf(arg)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
620        self.failUnless(isinstance(res,float),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
621        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     def test_sub_overloaded_constData_rank0_Symbol_rank4(self):
622     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=Data(-3.5839426267,self.functionspace)
623     def test_inf_constData_rank4(self):        arg1=Symbol(shape=(3, 2, 3, 4))
624        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)        res=arg0-arg1
625        ref=-0.94417114371        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]]]])
626        res=inf(arg)        sub=res.substitute({arg1:s1})
627        self.failUnless(isinstance(res,float),"wrong type of result.")        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)
628        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
629     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
630     def test_inf_expandedData_rank0(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
631       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
632        msk=whereNegative(self.functionspace.getX()[0]-0.5)     def test_sub_overloaded_constData_rank1_Symbol_rank0(self):
633        arg=msk*0.97331285569+(1.-msk)*0.911344578019        arg0=Data(numarray.array([2.6649927252905226, 0.29496968217893382]),self.functionspace)
634          arg1=Symbol(shape=())
635        # arg=Data(0.97331285569,self.functionspace,True)        res=arg0-arg1
636        #arg.setTaggedValue(1,0.97331285569)        s1=numarray.array(1.03366663195)
637        res=inf(arg)        sub=res.substitute({arg1:s1})
638        ref=0.911344578019        ref=Data(numarray.array([1.6313260933372291, -0.73869694977435962]),self.functionspace)
639        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
640        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
641     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
642     def test_inf_expandedData_rank1(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
643       def test_sub_overloaded_constData_rank1_Symbol_rank1(self):
644        msk=whereNegative(self.functionspace.getX()[0]-0.5)        arg0=Data(numarray.array([3.9090880537794526, -3.9706193840215942]),self.functionspace)
645        arg=msk*numarray.array([-0.025782649803792301, 0.15017595667012174])+(1.-msk)*numarray.array([-0.69996944983865683, 0.23286168827412723])        arg1=Symbol(shape=(2,))
646          res=arg0-arg1
647        # arg=Data(numarray.array([-0.025782649803792301, 0.15017595667012174]),self.functionspace,True)        s1=numarray.array([-3.7233870114697742, 0.99043840493200186])
648        # arg.setTaggedValue(1,[-0.69996944983865683, 0.23286168827412723])        sub=res.substitute({arg1:s1})
649        res=inf(arg)        ref=Data(numarray.array([7.6324750652492268, -4.9610577889535961]),self.functionspace)
650        ref=-0.699969449839        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
651        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
652        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
653     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
654     def test_inf_expandedData_rank2(self):     def test_sub_overloaded_constData_rank2_Symbol_rank0(self):
655          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)
656        msk=whereNegative(self.functionspace.getX()[0]-0.5)        arg1=Symbol(shape=())
657        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]])        res=arg0-arg1
658          s1=numarray.array(4.86937457463)
659        # 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)        sub=res.substitute({arg1:s1})
660        # 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]])        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)
661        res=inf(arg)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
662        ref=-0.961574871167        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
663        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
664        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
665     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_sub_overloaded_constData_rank2_Symbol_rank2(self):
666     def test_inf_expandedData_rank3(self):        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)
667          arg1=Symbol(shape=(4, 5))
668        msk=whereNegative(self.functionspace.getX()[0]-0.5)        res=arg0-arg1
669        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]]])        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]])
670          sub=res.substitute({arg1:s1})
671        # 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)        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)
672        # 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]]])        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
673        res=inf(arg)        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
674        ref=-0.866630803474        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
675        self.failUnless(isinstance(res,float),"wrong type of result.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
676        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")     def test_sub_overloaded_constData_rank3_Symbol_rank0(self):
677     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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)
678     def test_inf_expandedData_rank4(self):        arg1=Symbol(shape=())
679          res=arg0-arg1
680        msk=whereNegative(self.functionspace.getX()[0]-0.5)        s1=numarray.array(-1.04145599079)
681        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]]]])        sub=res.substitute({arg1:s1})
682          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)
683        # 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)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
684        # 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]]]])        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
685        res=inf(arg)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
686        ref=-0.995075343007     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
687        self.failUnless(isinstance(res,float),"wrong type of result.")     def test_sub_overloaded_constData_rank3_Symbol_rank3(self):
688        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        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)
689  #=========================================================        arg1=Symbol(shape=(6, 2, 2))
690  #  Symbols        res=arg0-arg1
691  #=========================================================        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]]])
692     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        sub=res.substitute({arg1:s1})
693     def test_Symbol_rank0_dNone_nargs0(self):        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)
694        s2=Symbol(shape=())        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
695        s=Symbol(shape=(),dim=None,args=[])        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
696        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
697        self.failUnlessEqual(s.getShape(),(),"wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
698        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")     def test_sub_overloaded_constData_rank4_Symbol_rank0(self):
699        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        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)
700          arg1=Symbol(shape=())
701        ss=s.substitute({s:numarray.zeros(())})        res=arg0-arg1
702        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        s1=numarray.array(-2.59361652138)
703        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        sub=res.substitute({arg1:s1})
704        try:        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)
705          s.substitute({s:numarray.zeros((5,))})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
706          fail("illegal substition was successful")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
707        except TypeError:        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
708          pass     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
709       def test_sub_overloaded_constData_rank4_Symbol_rank4(self):
710        dsdarg=s.diff(Symbol(shape=()))        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)
711        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        arg1=Symbol(shape=(3, 2, 3, 4))
712        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        res=arg0-arg1
713        dsdarg=s.diff(Symbol(shape=(2,)))        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]]]])
714        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        sub=res.substitute({arg1:s1})
715        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong 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)
716        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
717        dsdarg=s.diff(Symbol(shape=(4, 5)))        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
718        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")
719        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
720        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")     def test_sub_overloaded_taggedData_rank0_Symbol_rank0(self):
721        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg0=Data(-2.29417952191,self.functionspace)
722        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        arg0.setTaggedValue(1,-4.27612309963)
723        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        arg1=Symbol(shape=())
724        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        res=arg0-arg1
725        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        s1=numarray.array(-2.86386679086)
726        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        sub=res.substitute({arg1:s1})
727        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        ref=Data(0.569687268944,self.functionspace)
728        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        ref.setTaggedValue(1,-1.41225630877)
729          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
730        dsds=s.diff(s)        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
731        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
732        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
733       def test_sub_overloaded_taggedData_rank0_Symbol_rank1(self):
734        sa=s.getSubstitutedArguments({s2:-10})        arg0=Data(-4.72691427991,self.functionspace)
735        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        arg0.setTaggedValue(1,0.483106242273)
736          arg1=Symbol(shape=(2,))
737        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        res=arg0-arg1
738        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        s1=numarray.array([-0.58516003749737244, 2.93231182282255])
739        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")        sub=res.substitute({arg1:s1})
740        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        ref=Data(numarray.array([-4.1417542424175267, -7.6592261027374491]),self.functionspace)
741        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        ref.setTaggedValue(1,numarray.array([1.0682662797700972, -2.4492055805498252]))
742        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
743        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
744     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
745     def test_Symbol_rank0_dNone_nargs1(self):     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
746        s2=Symbol(shape=())     def test_sub_overloaded_taggedData_rank0_Symbol_rank2(self):
747        s=Symbol(shape=(),dim=None,args=[s2])        arg0=Data(4.84060376911,self.functionspace)
748        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        arg0.setTaggedValue(1,-3.32867505476)
749        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        arg1=Symbol(shape=(4, 5))
750        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        res=arg0-arg1
751        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        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]])
752          sub=res.substitute({arg1:s1})
753        ss=s.substitute({s:numarray.zeros(())})        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)
754        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        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]]))
755        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
756        try:        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
757          s.substitute({s:numarray.zeros((5,))})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
758          fail("illegal substition was successful")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
759        except TypeError:     def test_sub_overloaded_taggedData_rank0_Symbol_rank3(self):
760          pass        arg0=Data(-3.20552188916,self.functionspace)
761          arg0.setTaggedValue(1,-0.473083670166)
762        dsdarg=s.diff(Symbol(shape=()))        arg1=Symbol(shape=(6, 2, 2))
763        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        res=arg0-arg1
764        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        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]]])
765        dsdarg=s.diff(Symbol(shape=(2,)))        sub=res.substitute({arg1:s1})
766        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        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)
767        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong 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]]]))
768        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
769        dsdarg=s.diff(Symbol(shape=(4, 5)))        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
770        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")
771        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
772        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")     def test_sub_overloaded_taggedData_rank0_Symbol_rank4(self):
773        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg0=Data(-0.215341183726,self.functionspace)
774        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        arg0.setTaggedValue(1,-3.01917111711)
775        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        arg1=Symbol(shape=(3, 2, 3, 4))
776        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        res=arg0-arg1
777        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        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]]]])
778        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        sub=res.substitute({arg1:s1})
779        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        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)
780        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        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]]]]))
781          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
782        dsds=s.diff(s)        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
783        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
784        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
785       def test_sub_overloaded_taggedData_rank1_Symbol_rank0(self):
786        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        arg0=Data(numarray.array([3.3101673523710691, 0.048409361416743124]),self.functionspace)
787        sa=s.getSubstitutedArguments({s2:-10})        arg0.setTaggedValue(1,numarray.array([0.70887806236646611, -0.73932065177372408]))
788        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        arg1=Symbol(shape=())
789        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        res=arg0-arg1
790          s1=numarray.array(1.15960287006)
791        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        sub=res.substitute({arg1:s1})
792        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        ref=Data(numarray.array([2.1505644823090515, -1.1111935086452744]),self.functionspace)
793        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")        ref.setTaggedValue(1,numarray.array([-0.45072480769555145, -1.8989235218357416]))
794        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
795        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
796        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
797        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
798     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_sub_overloaded_taggedData_rank1_Symbol_rank1(self):
799     def test_Symbol_rank0_dNone_nargs2(self):        arg0=Data(numarray.array([-2.0708546339036071, 2.2714034647505121]),self.functionspace)
800        s2=Symbol(shape=())        arg0.setTaggedValue(1,numarray.array([-0.16265022615439584, -0.29272834777410406]))
801        s=Symbol(shape=(),dim=None,args=[1, -1.0])        arg1=Symbol(shape=(2,))
802        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        res=arg0-arg1
803        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        s1=numarray.array([1.8495632665872739, -2.2808524667130694])
804        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        sub=res.substitute({arg1:s1})
805        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        ref=Data(numarray.array([-3.920417900490881, 4.5522559314635815]),self.functionspace)
806          ref.setTaggedValue(1,numarray.array([-2.0122134927416697, 1.9881241189389653]))
807        ss=s.substitute({s:numarray.zeros(())})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
808        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
809        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
810        try:     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
811          s.substitute({s:numarray.zeros((5,))})     def test_sub_overloaded_taggedData_rank2_Symbol_rank0(self):
812          fail("illegal substition was successful")        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)
813        except TypeError:        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]]))
814          pass        arg1=Symbol(shape=())
815          res=arg0-arg1
816        dsdarg=s.diff(Symbol(shape=()))        s1=numarray.array(0.0560012612314)
817        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        sub=res.substitute({arg1:s1})
818        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        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)
819        dsdarg=s.diff(Symbol(shape=(2,)))        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]]))
820        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
821        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
822        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
823        dsdarg=s.diff(Symbol(shape=(4, 5)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
824        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     def test_sub_overloaded_taggedData_rank2_Symbol_rank2(self):
825        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        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)
826        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        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]]))
827        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg1=Symbol(shape=(4, 5))
828        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        res=arg0-arg1
829        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has 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]])
830        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        sub=res.substitute({arg1:s1})
831        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        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)
832        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        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]]))
833        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.")
834        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
835          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
836        dsds=s.diff(s)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
837        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")     def test_sub_overloaded_taggedData_rank3_Symbol_rank0(self):
838        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        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)
839          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]]]))
840        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        arg1=Symbol(shape=())
841        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        res=arg0-arg1
842        sa=s.getSubstitutedArguments({s2:-10})        s1=numarray.array(3.40075496466)
843        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        sub=res.substitute({arg1:s1})
844        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        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)
845        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        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]]]))
846          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
847        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
848        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
849        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
850        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")     def test_sub_overloaded_taggedData_rank3_Symbol_rank3(self):
851        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (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)
852        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        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]]]))
853        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg1=Symbol(shape=(6, 2, 2))
854     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        res=arg0-arg1
855     def test_Symbol_rank0_dd_nargs0(self):        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]]])
856        s2=Symbol(shape=())        sub=res.substitute({arg1:s1})
857        s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[])        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)
858        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        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]]]))
859        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
860        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
861        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
862       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
863        ss=s.substitute({s:numarray.zeros(())})     def test_sub_overloaded_taggedData_rank4_Symbol_rank0(self):
864        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        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)
865        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        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]]]]))
866        try:        arg1=Symbol(shape=())
867          s.substitute({s:numarray.zeros((5,))})        res=arg0-arg1
868          fail("illegal substition was successful")        s1=numarray.array(-4.55573857649)
869        except TypeError:        sub=res.substitute({arg1:s1})
870          pass        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)
871          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]]]]))
872        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
873        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
874        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
875        dsdarg=s.diff(Symbol(shape=(2,)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
876        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")     def test_sub_overloaded_taggedData_rank4_Symbol_rank4(self):
877        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong 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)
878        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        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]]]]))
879        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg1=Symbol(shape=(3, 2, 3, 4))
880        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        res=arg0-arg1
881        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        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]]]])
882        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        sub=res.substitute({arg1:s1})
883        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        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)
884        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        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]]]]))
885        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
886        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
887        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
888        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
889        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")     def test_sub_overloaded_expandedData_rank0_Symbol_rank0(self):
890        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
891          arg0=msk_arg0*(2.42413566075)+(1.-msk_arg0)*(2.73592046896)
892        dsds=s.diff(s)        arg1=Symbol(shape=())
893        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        res=arg0-arg1
894        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        s1=numarray.array(0.0730314190245)
895          sub=res.substitute({arg1:s1})
896        sa=s.getSubstitutedArguments({s2:-10})        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
897        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        ref=msk_ref*(2.35110424173)+(1.-msk_ref)*(2.66288904994)
898          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
899        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
900        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
901        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
902        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")     def test_sub_overloaded_expandedData_rank0_Symbol_rank1(self):
903        self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
904        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        arg0=msk_arg0*(-2.38585027921)+(1.-msk_arg0)*(-2.14546935212)
905        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        arg1=Symbol(shape=(2,))
906        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        res=arg0-arg1
907     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        s1=numarray.array([1.0449404678521192, -2.9654578889240057])
908     def test_Symbol_rank0_dd_nargs1(self):        sub=res.substitute({arg1:s1})
909        s2=Symbol(shape=())        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
910        s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[s2])        ref=msk_ref*numarray.array([-3.4307907470591283, 0.57960760971699665])+(1.-msk_ref)*numarray.array([-3.1904098199744872, 0.81998853680163775])
911        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
912        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
913        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
914        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
915       def test_sub_overloaded_expandedData_rank0_Symbol_rank2(self):
916        ss=s.substitute({s:numarray.zeros(())})        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
917        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        arg0=msk_arg0*(2.15276640076)+(1.-msk_arg0)*(-2.04284766814)
918        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        arg1=Symbol(shape=(4, 5))
919        try:        res=arg0-arg1
920          s.substitute({s:numarray.zeros((5,))})        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]])
921          fail("illegal substition was successful")        sub=res.substitute({arg1:s1})
922        except TypeError:        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
923          pass        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]])
924          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
925        dsdarg=s.diff(Symbol(shape=()))        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
926        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
927        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
928        dsdarg=s.diff(Symbol(shape=(2,)))     def test_sub_overloaded_expandedData_rank0_Symbol_rank3(self):
929        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
930        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        arg0=msk_arg0*(3.30825297654)+(1.-msk_arg0)*(-3.92076322418)
931        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        arg1=Symbol(shape=(6, 2, 2))
932        dsdarg=s.diff(Symbol(shape=(4, 5)))        res=arg0-arg1
933        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        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]]])
934        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        sub=res.substitute({arg1:s1})
935        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
936        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        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]]])
937        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
938        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
939        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")
940        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
941        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")     def test_sub_overloaded_expandedData_rank0_Symbol_rank4(self):
942        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
943        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        arg0=msk_arg0*(4.28115160685)+(1.-msk_arg0)*(-2.99624588284)
944          arg1=Symbol(shape=(3, 2, 3, 4))
945        dsds=s.diff(s)        res=arg0-arg1
946        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        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]]]])
947        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        sub=res.substitute({arg1:s1})
948          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
949        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        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]]]])
950        sa=s.getSubstitutedArguments({s2:-10})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
951        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
952        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
953       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
954        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")     def test_sub_overloaded_expandedData_rank1_Symbol_rank0(self):
955        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
956        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")        arg0=msk_arg0*numarray.array([0.57185536765716005, -4.5016440600070959])+(1.-msk_arg0)*numarray.array([-0.4418100919929735, 1.7838290839713755])
957        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        arg1=Symbol(shape=())
958        self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")        res=arg0-arg1
959        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        s1=numarray.array(4.01685432532)
960        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        sub=res.substitute({arg1:s1})
961        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
962     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=msk_ref*numarray.array([-3.4449989576654145, -8.5184983853296714])+(1.-msk_ref)*numarray.array([-4.4586644173155481, -2.2330252413511991])
963     def test_Symbol_rank0_dd_nargs2(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
964        s2=Symbol(shape=())        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
965        s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[1, -1.0])        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
966        self.failUnlessEqual(s.getRank(),0,"wrong rank.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
967        self.failUnlessEqual(s.getShape(),(),"wrong shape.")     def test_sub_overloaded_expandedData_rank1_Symbol_rank1(self):
968        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
969        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        arg0=msk_arg0*numarray.array([-4.1734209340603439, 4.5527582003296185])+(1.-msk_arg0)*numarray.array([-1.7000682822887789, 0.76683988376374757])
970          arg1=Symbol(shape=(2,))
971        ss=s.substitute({s:numarray.zeros(())})        res=arg0-arg1
972        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        s1=numarray.array([-1.5016152385157842, 0.80809700227400683])
973        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        sub=res.substitute({arg1:s1})
974        try:        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
975          s.substitute({s:numarray.zeros((5,))})        ref=msk_ref*numarray.array([-2.6718056955445597, 3.7446611980556117])+(1.-msk_ref)*numarray.array([-0.19845304377299477, -0.041257118510259261])
976          fail("illegal substition was successful")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
977        except TypeError:        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
978          pass        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
979       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
980        dsdarg=s.diff(Symbol(shape=()))     def test_sub_overloaded_expandedData_rank2_Symbol_rank0(self):
981        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
982        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        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]])
983        dsdarg=s.diff(Symbol(shape=(2,)))        arg1=Symbol(shape=())
984        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        res=arg0-arg1
985        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        s1=numarray.array(-3.53998589595)
986        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        sub=res.substitute({arg1:s1})
987        dsdarg=s.diff(Symbol(shape=(4, 5)))        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
988        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        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]])
989        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
990        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
991        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
992        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
993        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")     def test_sub_overloaded_expandedData_rank2_Symbol_rank2(self):
994        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
995        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        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]])
996        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        arg1=Symbol(shape=(4, 5))
997        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        res=arg0-arg1
998        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        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]])
999          sub=res.substitute({arg1:s1})
1000        dsds=s.diff(s)        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1001        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        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]])
1002        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1003          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1004        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1005        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1006        sa=s.getSubstitutedArguments({s2:-10})     def test_sub_overloaded_expandedData_rank3_Symbol_rank0(self):
1007        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1008        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        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]]])
1009        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        arg1=Symbol(shape=())
1010          res=arg0-arg1
1011        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        s1=numarray.array(-4.30522721091)
1012        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        sub=res.substitute({arg1:s1})
1013        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1014        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        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]]])
1015        self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1016        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1017        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1018        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1019     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     def test_sub_overloaded_expandedData_rank3_Symbol_rank3(self):
1020     def test_Symbol_rank0_d1_nargs0(self):        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1021        s2=Symbol(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]]])
1022        s=Symbol(shape=(),dim=1,args=[])        arg1=Symbol(shape=(6, 2, 2))
1023        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        res=arg0-arg1
1024        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        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]]])
1025        self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")        sub=res.substitute({arg1:s1})
1026        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1027          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]]])
1028        ss=s.substitute({s:numarray.zeros(())})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1029        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1030        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1031        try:     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1032          s.substitute({s:numarray.zeros((5,))})     def test_sub_overloaded_expandedData_rank4_Symbol_rank0(self):
1033          fail("illegal substition was successful")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1034        except TypeError:        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]]]])
1035          pass        arg1=Symbol(shape=())
1036          res=arg0-arg1
1037        dsdarg=s.diff(Symbol(shape=()))        s1=numarray.array(3.09580908291)
1038        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        sub=res.substitute({arg1:s1})
1039        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1040        dsdarg=s.diff(Symbol(shape=(2,)))        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]]]])
1041        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1042        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1043        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1044        dsdarg=s.diff(Symbol(shape=(4, 5)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1045        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     def test_sub_overloaded_expandedData_rank4_Symbol_rank4(self):
1046        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1047        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        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]]]])
1048        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg1=Symbol(shape=(3, 2, 3, 4))
1049        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        res=arg0-arg1
1050        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        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]]]])
1051        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        sub=res.substitute({arg1:s1})
1052        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1053        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        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]]]])
1054        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.")
1055        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1056          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1057        dsds=s.diff(s)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1058        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")     def test_mult_overloaded_constData_rank0_Symbol_rank0(self):
1059        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        arg0=Data(4.62465145684,self.functionspace)
1060          arg1=Symbol(shape=())
1061        sa=s.getSubstitutedArguments({s2:-10})        res=arg0*arg1
1062        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        s1=numarray.array(-4.83968289402)
1063          sub=res.substitute({arg1:s1})
1064        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        ref=Data(-22.3818465465,self.functionspace)
1065        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1066        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1067        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1068        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1069        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")     def test_mult_overloaded_constData_rank0_Symbol_rank1(self):
1070        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg0=Data(3.61282962415,self.functionspace)
1071     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=(2,))
1072     def test_Symbol_rank0_d1_nargs1(self):        res=arg0*arg1
1073        s2=Symbol(shape=())        s1=numarray.array([-1.5808963858957537, 2.6509696096021864])
1074        s=Symbol(shape=(),dim=1,args=[s2])        sub=res.substitute({arg1:s1})
1075        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        ref=Data(numarray.array([-5.7115092956749542, 9.5775015382906385]),self.functionspace)
1076        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1077        self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1078        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1079       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1080        ss=s.substitute({s:numarray.zeros(())})     def test_mult_overloaded_constData_rank0_Symbol_rank2(self):
1081        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        arg0=Data(1.49025589385,self.functionspace)
1082        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        arg1=Symbol(shape=(4, 5))
1083        try:        res=arg0*arg1
1084          s.substitute({s:numarray.zeros((5,))})        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]])
1085          fail("illegal substition was successful")        sub=res.substitute({arg1:s1})
1086        except TypeError:        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)
1087          pass        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1088          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1089        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1090        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1091        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     def test_mult_overloaded_constData_rank0_Symbol_rank3(self):
1092        dsdarg=s.diff(Symbol(shape=(2,)))        arg0=Data(-4.8189372207,self.functionspace)
1093        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        arg1=Symbol(shape=(6, 2, 2))
1094        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        res=arg0*arg1
1095        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        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]]])
1096        dsdarg=s.diff(Symbol(shape=(4, 5)))        sub=res.substitute({arg1:s1})
1097        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        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)
1098        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1099        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1100        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1101        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1102        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")     def test_mult_overloaded_constData_rank0_Symbol_rank4(self):
1103        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        arg0=Data(-0.0961090764765,self.functionspace)
1104        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        arg1=Symbol(shape=(3, 2, 3, 4))
1105        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        res=arg0*arg1
1106        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        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]]]])
1107        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        sub=res.substitute({arg1:s1})
1108          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)
1109        dsds=s.diff(s)        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1110        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1111        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1112       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1113        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")     def test_mult_overloaded_constData_rank1_Symbol_rank0(self):
1114        sa=s.getSubstitutedArguments({s2:-10})        arg0=Data(numarray.array([0.27659058494851418, 4.1541405281225892]),self.functionspace)
1115        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        arg1=Symbol(shape=())
1116        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        res=arg0*arg1
1117          s1=numarray.array(3.8719303416)
1118        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        sub=res.substitute({arg1:s1})
1119        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        ref=Data(numarray.array([1.0709394780619239, 16.08454275409127]),self.functionspace)
1120        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1121        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1122        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")
1123        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1124        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")     def test_mult_overloaded_constData_rank1_Symbol_rank1(self):
1125     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg0=Data(numarray.array([3.7426337922420245, 3.9291817340183464]),self.functionspace)
1126     def test_Symbol_rank0_d1_nargs2(self):        arg1=Symbol(shape=(2,))
1127        s2=Symbol(shape=())        res=arg0*arg1
1128        s=Symbol(shape=(),dim=1,args=[1, -1.0])        s1=numarray.array([0.24137850302835329, -1.7566967446888535])
1129        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        sub=res.substitute({arg1:s1})
1130        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        ref=Data(numarray.array([0.90339134215470884, -6.9023807614409334]),self.functionspace)
1131        self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1132        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1133          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1134        ss=s.substitute({s:numarray.zeros(())})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1135        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")     def test_mult_overloaded_constData_rank2_Symbol_rank0(self):
1136        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        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)
1137        try:        arg1=Symbol(shape=())
1138          s.substitute({s:numarray.zeros((5,))})        res=arg0*arg1
1139          fail("illegal substition was successful")        s1=numarray.array(1.33330352327)
1140        except TypeError:        sub=res.substitute({arg1:s1})
1141          pass        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)
1142          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1143        dsdarg=s.diff(Symbol(shape=()))        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1144        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1145        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1146        dsdarg=s.diff(Symbol(shape=(2,)))     def test_mult_overloaded_constData_rank2_Symbol_rank2(self):
1147        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        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)
1148        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        arg1=Symbol(shape=(4, 5))
1149        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        res=arg0*arg1
1150        dsdarg=s.diff(Symbol(shape=(4, 5)))        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]])
1151        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        sub=res.substitute({arg1:s1})
1152        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        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)
1153        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1154        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1155        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1156        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1157        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")     def test_mult_overloaded_constData_rank3_Symbol_rank0(self):
1158        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        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)
1159        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        arg1=Symbol(shape=())
1160        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        res=arg0*arg1
1161        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        s1=numarray.array(-4.7863046684)
1162          sub=res.substitute({arg1:s1})
1163        dsds=s.diff(s)        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)
1164        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1165        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1166          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1167        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1168        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")     def test_mult_overloaded_constData_rank3_Symbol_rank3(self):
1169        sa=s.getSubstitutedArguments({s2:-10})        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)
1170        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        arg1=Symbol(shape=(6, 2, 2))
1171        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        res=arg0*arg1
1172        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        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]]])
1173          sub=res.substitute({arg1:s1})
1174        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        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)
1175        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1176        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1177        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1178        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1179        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")     def test_mult_overloaded_constData_rank4_Symbol_rank0(self):
1180        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        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)
1181     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=())
1182     def test_Symbol_rank0_d2_nargs0(self):        res=arg0*arg1
1183        s2=Symbol(shape=())        s1=numarray.array(-4.38997505647)
1184        s=Symbol(shape=(),dim=2,args=[])        sub=res.substitute({arg1:s1})
1185        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        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)
1186        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1187        self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1188        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1189       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1190        ss=s.substitute({s:numarray.zeros(())})     def test_mult_overloaded_constData_rank4_Symbol_rank4(self):
1191        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        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)
1192        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        arg1=Symbol(shape=(3, 2, 3, 4))
1193        try:        res=arg0*arg1
1194          s.substitute({s:numarray.zeros((5,))})        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]]]])
1195          fail("illegal substition was successful")        sub=res.substitute({arg1:s1})
1196        except TypeError:        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)
1197          pass        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1198          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1199        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1200        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1201        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     def test_mult_overloaded_taggedData_rank0_Symbol_rank0(self):
1202        dsdarg=s.diff(Symbol(shape=(2,)))        arg0=Data(3.142013671,self.functionspace)
1203        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        arg0.setTaggedValue(1,-2.04077395087)
1204        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        arg1=Symbol(shape=())
1205        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        res=arg0*arg1
1206        dsdarg=s.diff(Symbol(shape=(4, 5)))        s1=numarray.array(-0.905206509275)
1207        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        sub=res.substitute({arg1:s1})
1208        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        ref=Data(-2.84417122722,self.functionspace)
1209        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        ref.setTaggedValue(1,1.84732186428)
1210        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1211        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1212        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")
1213        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1214        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))     def test_mult_overloaded_taggedData_rank0_Symbol_rank1(self):
1215        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        arg0=Data(1.54368119889,self.functionspace)
1216        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        arg0.setTaggedValue(1,-0.973182859739)
1217        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        arg1=Symbol(shape=(2,))
1218          res=arg0*arg1
1219        dsds=s.diff(s)        s1=numarray.array([-0.97051483006179051, -4.8243289242685101])
1220        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        sub=res.substitute({arg1:s1})
1221        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        ref=Data(numarray.array([-1.4981654964063673, -7.4472258576349226]),self.functionspace)
1222          ref.setTaggedValue(1,numarray.array([0.94448839773843207, 4.6949542188401541]))
1223        sa=s.getSubstitutedArguments({s2:-10})        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1224        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1225          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1226        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1227        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")     def test_mult_overloaded_taggedData_rank0_Symbol_rank2(self):
1228        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")        arg0=Data(0.576275206322,self.functionspace)
1229        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")        arg0.setTaggedValue(1,-0.446417285252)
1230        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        arg1=Symbol(shape=(4, 5))
1231        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        res=arg0*arg1
1232        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (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]])
1233     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        sub=res.substitute({arg1:s1})
1234     def test_Symbol_rank0_d2_nargs1(self):        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)
1235        s2=Symbol(shape=())        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]]))
1236        s=Symbol(shape=(),dim=2,args=[s2])        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1237        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1238        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1239        self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1240        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")     def test_mult_overloaded_taggedData_rank0_Symbol_rank3(self):
1241          arg0=Data(4.6954921918,self.functionspace)
1242        ss=s.substitute({s:numarray.zeros(())})        arg0.setTaggedValue(1,3.80656545201)
1243        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        arg1=Symbol(shape=(6, 2, 2))
1244        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        res=arg0*arg1
1245        try:        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]]])
1246          s.substitute({s:numarray.zeros((5,))})        sub=res.substitute({arg1:s1})
1247          fail("illegal substition was successful")        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)
1248        except TypeError:        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]]]))
1249          pass        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1250          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1251        dsdarg=s.diff(Symbol(shape=()))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1252        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1253        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     def test_mult_overloaded_taggedData_rank0_Symbol_rank4(self):
1254        dsdarg=s.diff(Symbol(shape=(2,)))        arg0=Data(-1.72281700023,self.functionspace)
1255        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        arg0.setTaggedValue(1,1.23448641864)
1256        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        arg1=Symbol(shape=(3, 2, 3, 4))
1257        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        res=arg0*arg1
1258        dsdarg=s.diff(Symbol(shape=(4, 5)))        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]]]])
1259        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        sub=res.substitute({arg1:s1})
1260        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        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)
1261        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        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]]]]))
1262        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1263        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1264        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")
1265        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1266        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))     def test_mult_overloaded_taggedData_rank1_Symbol_rank0(self):
1267        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        arg0=Data(numarray.array([-0.099233059085104713, 4.771977048069223]),self.functionspace)
1268        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        arg0.setTaggedValue(1,numarray.array([3.9729085267773208, 4.512809517509826]))
1269        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        arg1=Symbol(shape=())
1270          res=arg0*arg1
1271        dsds=s.diff(s)        s1=numarray.array(0.26176969234)
1272        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        sub=res.substitute({arg1:s1})
1273        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        ref=Data(numarray.array([-0.025976207346631468, 1.249158963725014]),self.functionspace)
1274          ref.setTaggedValue(1,numarray.array([1.0399870427481233, 1.1813167589860505]))
1275        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1276        sa=s.getSubstitutedArguments({s2:-10})        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1277        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1278        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1279       def test_mult_overloaded_taggedData_rank1_Symbol_rank1(self):
1280        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        arg0=Data(numarray.array([0.84702689091359229, -3.3372769586299422]),self.functionspace)
1281        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        arg0.setTaggedValue(1,numarray.array([-2.152707415414048, 1.9005183627662312]))
1282        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")        arg1=Symbol(shape=(2,))
1283        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")        res=arg0*arg1
1284        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        s1=numarray.array([0.22148437875716098, 4.0581595354793194])
1285        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        sub=res.substitute({arg1:s1})
1286        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        ref=Data(numarray.array([0.18760322472460655, -13.543202312199522]),self.functionspace)
1287     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref.setTaggedValue(1,numarray.array([-0.47679106454891407, 7.7126067162133252]))
1288     def test_Symbol_rank0_d2_nargs2(self):        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1289        s2=Symbol(shape=())        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1290        s=Symbol(shape=(),dim=2,args=[1, -1.0])        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1291        self.failUnlessEqual(s.getRank(),0,"wrong rank.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1292        self.failUnlessEqual(s.getShape(),(),"wrong shape.")     def test_mult_overloaded_taggedData_rank2_Symbol_rank0(self):
1293        self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")        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)
1294        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        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]]))
1295          arg1=Symbol(shape=())
1296        ss=s.substitute({s:numarray.zeros(())})        res=arg0*arg1
1297        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        s1=numarray.array(-0.123633480243)
1298        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        sub=res.substitute({arg1:s1})
1299        try:        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)
1300          s.substitute({s:numarray.zeros((5,))})        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]]))
1301          fail("illegal substition was successful")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1302        except TypeError:        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1303          pass        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1304       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1305        dsdarg=s.diff(Symbol(shape=()))     def test_mult_overloaded_taggedData_rank2_Symbol_rank2(self):
1306        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        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)
1307        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        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]]))
1308        dsdarg=s.diff(Symbol(shape=(2,)))        arg1=Symbol(shape=(4, 5))
1309        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        res=arg0*arg1
1310        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        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]])
1311        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        sub=res.substitute({arg1:s1})
1312        dsdarg=s.diff(Symbol(shape=(4, 5)))        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)
1313        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        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]]))
1314        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1315        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1316        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1317        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1318        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")     def test_mult_overloaded_taggedData_rank3_Symbol_rank0(self):
1319        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        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)
1320        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        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]]]))
1321        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        arg1=Symbol(shape=())
1322        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        res=arg0*arg1
1323        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        s1=numarray.array(3.22032001333)
1324          sub=res.substitute({arg1:s1})
1325        dsds=s.diff(s)        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)
1326        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        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]]]))
1327        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1328          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1329        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1330        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1331        sa=s.getSubstitutedArguments({s2:-10})     def test_mult_overloaded_taggedData_rank3_Symbol_rank3(self):
1332        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        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)
1333        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        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]]]))
1334        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        arg1=Symbol(shape=(6, 2, 2))
1335          res=arg0*arg1
1336        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        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]]])
1337        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        sub=res.substitute({arg1:s1})
1338        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")        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)
1339        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")        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]]]))
1340        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.")
1341        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1342        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")
1343     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1344     def test_Symbol_rank0_d3_nargs0(self):     def test_mult_overloaded_taggedData_rank4_Symbol_rank0(self):
1345        s2=Symbol(shape=())        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)
1346        s=Symbol(shape=(),dim=3,args=[])        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]]]]))
1347        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        arg1=Symbol(shape=())
1348        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        res=arg0*arg1
1349        self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")        s1=numarray.array(-1.40149736096)
1350        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        sub=res.substitute({arg1:s1})
1351          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)
1352        ss=s.substitute({s:numarray.zeros(())})        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]]]]))
1353        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1354        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1355        try:        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1356          s.substitute({s:numarray.zeros((5,))})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1357          fail("illegal substition was successful")     def test_mult_overloaded_taggedData_rank4_Symbol_rank4(self):
1358        except TypeError:        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)
1359          pass        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]]]]))
1360          arg1=Symbol(shape=(3, 2, 3, 4))
1361        dsdarg=s.diff(Symbol(shape=()))        res=arg0*arg1
1362        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        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]]]])
1363        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        sub=res.substitute({arg1:s1})
1364        dsdarg=s.diff(Symbol(shape=(2,)))        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)
1365        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        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]]]]))
1366        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1367        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1368        dsdarg=s.diff(Symbol(shape=(4, 5)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1369        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1370        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")     def test_mult_overloaded_expandedData_rank0_Symbol_rank0(self):
1371        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1372        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg0=msk_arg0*(-0.0430204652553)+(1.-msk_arg0)*(1.78425217281)
1373        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        arg1=Symbol(shape=())
1374        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        res=arg0*arg1
1375        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        s1=numarray.array(2.5646949317)
1376        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        sub=res.substitute({arg1:s1})
1377        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1378        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        ref=msk_ref*(-0.1103343692)+(1.-msk_ref)*(4.57606250448)
1379        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1380          self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1381        dsds=s.diff(s)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1382        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1383        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")     def test_mult_overloaded_expandedData_rank0_Symbol_rank1(self):
1384          msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1385        sa=s.getSubstitutedArguments({s2:-10})        arg0=msk_arg0*(2.57326660208)+(1.-msk_arg0)*(3.29535894632)
1386        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        arg1=Symbol(shape=(2,))
1387          res=arg0*arg1
1388        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        s1=numarray.array([4.0270481495052639, 2.7564226252917825])
1389        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        sub=res.substitute({arg1:s1})
1390        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1391        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")        ref=msk_ref*numarray.array([10.362668508083143, 7.0930102828763504])+(1.-msk_ref)*numarray.array([13.270569146744505, 9.0834019581016197])
1392        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.")
1393        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1394        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")
1395     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1396     def test_Symbol_rank0_d3_nargs1(self):     def test_mult_overloaded_expandedData_rank0_Symbol_rank2(self):
1397        s2=Symbol(shape=())        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1398        s=Symbol(shape=(),dim=3,args=[s2])        arg0=msk_arg0*(-3.02551699988)+(1.-msk_arg0)*(0.626618362726)
1399        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        arg1=Symbol(shape=(4, 5))
1400        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        res=arg0*arg1
1401        self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")        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]])
1402        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        sub=res.substitute({arg1:s1})
1403          msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1404        ss=s.substitute({s:numarray.zeros(())})        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]])
1405        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1406        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1407        try:        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1408          s.substitute({s:numarray.zeros((5,))})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1409          fail("illegal substition was successful")     def test_mult_overloaded_expandedData_rank0_Symbol_rank3(self):
1410        except TypeError:        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1411          pass        arg0=msk_arg0*(-3.56361070359)+(1.-msk_arg0)*(4.70518403887)
1412          arg1=Symbol(shape=(6, 2, 2))
1413        dsdarg=s.diff(Symbol(shape=()))        res=arg0*arg1
1414        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        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]]])
1415        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        sub=res.substitute({arg1:s1})
1416        dsdarg=s.diff(Symbol(shape=(2,)))        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1417        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        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]]])
1418        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1419        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1420        dsdarg=s.diff(Symbol(shape=(4, 5)))        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1421        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1422        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")     def test_mult_overloaded_expandedData_rank0_Symbol_rank4(self):
1423        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1424        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        arg0=msk_arg0*(2.51859660817)+(1.-msk_arg0)*(3.69262914568)
1425        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        arg1=Symbol(shape=(3, 2, 3, 4))
1426        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        res=arg0*arg1
1427        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        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]]]])
1428        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        sub=res.substitute({arg1:s1})
1429        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1430        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        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]]]])
1431        self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1432          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1433        dsds=s.diff(s)        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1434        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1435        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")     def test_mult_overloaded_expandedData_rank1_Symbol_rank0(self):
1436          msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1437        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        arg0=msk_arg0*numarray.array([1.8003466734301279, 3.110968541428603])+(1.-msk_arg0)*numarray.array([-0.057900815820612905, 0.54416620499792501])
1438        sa=s.getSubstitutedArguments({s2:-10})        arg1=Symbol(shape=())
1439        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        res=arg0*arg1
1440        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        s1=numarray.array(-1.23860498141)
1441          sub=res.substitute({arg1:s1})
1442        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1443        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")        ref=msk_ref*numarray.array([-2.2299183579697544, -3.8532611324133779])+(1.-msk_ref)*numarray.array([0.071716238902929969, -0.67400697222367489])
1444        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1445        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1446        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")
1447        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1448        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")     def test_mult_overloaded_expandedData_rank1_Symbol_rank1(self):
1449     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1450     def test_Symbol_rank0_d3_nargs2(self):        arg0=msk_arg0*numarray.array([-0.79032144715843966, 1.1989835373509852])+(1.-msk_arg0)*numarray.array([3.3888677818436879, 2.0461382220071824])
1451        s2=Symbol(shape=())        arg1=Symbol(shape=(2,))
1452        s=Symbol(shape=(),dim=3,args=[1, -1.0])        res=arg0*arg1
1453        self.failUnlessEqual(s.getRank(),0,"wrong rank.")        s1=numarray.array([-0.92949574400567592, -1.2179599998896897])
1454        self.failUnlessEqual(s.getShape(),(),"wrong shape.")        sub=res.substitute({arg1:s1})
1455        self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1456        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        ref=msk_ref*numarray.array([0.73460042153017635, -1.4603139890197456])+(1.-msk_ref)*numarray.array([-3.1499381802216635, -2.4921145086501579])
1457          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1458        ss=s.substitute({s:numarray.zeros(())})        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1459        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1460        self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1461        try:     def test_mult_overloaded_expandedData_rank2_Symbol_rank0(self):
1462          s.substitute({s:numarray.zeros((5,))})        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1463          fail("illegal substition was successful")        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]])
1464        except TypeError:        arg1=Symbol(shape=())
1465          pass        res=arg0*arg1
1466          s1=numarray.array(2.10607695069)
1467        dsdarg=s.diff(Symbol(shape=()))        sub=res.substitute({arg1:s1})
1468        self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1469        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        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]])
1470        dsdarg=s.diff(Symbol(shape=(2,)))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1471        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1472        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1473        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1474        dsdarg=s.diff(Symbol(shape=(4, 5)))     def test_mult_overloaded_expandedData_rank2_Symbol_rank2(self):
1475        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1476        self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong 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]])
1477        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        arg1=Symbol(shape=(4, 5))
1478        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        res=arg0*arg1
1479        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        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]])
1480        self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        sub=res.substitute({arg1:s1})
1481        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1482        dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))        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]])
1483        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1484        self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1485        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")
1486       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1487        dsds=s.diff(s)     def test_mult_overloaded_expandedData_rank3_Symbol_rank0(self):
1488        self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1489        self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")        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]]])
1490          arg1=Symbol(shape=())
1491        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        res=arg0*arg1
1492        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        s1=numarray.array(-0.422116691453)
1493        sa=s.getSubstitutedArguments({s2:-10})        sub=res.substitute({arg1:s1})
1494        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1495        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")        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]]])
1496        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1497          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1498        self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1499        self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1500        self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")     def test_mult_overloaded_expandedData_rank3_Symbol_rank3(self):
1501        self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1502        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        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]]])
1503        self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")        arg1=Symbol(shape=(6, 2, 2))
1504        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        res=arg0*arg1
1505     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        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]]])
1506     def test_Symbol_rank1_dNone_nargs0(self):        sub=res.substitute({arg1:s1})
1507        s2=Symbol(shape=())        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1508        s=Symbol(shape=(2,),dim=None,args=[])        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]]])
1509        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1510        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1511        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1512        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1513       def test_mult_overloaded_expandedData_rank4_Symbol_rank0(self):
1514        ss=s.substitute({s:numarray.zeros((2,))})        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1515        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        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]]]])
1516        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        arg1=Symbol(shape=())
1517        try:        res=arg0*arg1
1518          s.substitute({s:numarray.zeros((5,))})        s1=numarray.array(0.717965207903)
1519          fail("illegal substition was successful")        sub=res.substitute({arg1:s1})
1520        except TypeError:        msk_ref=1.-whereZero(self.functionspace.getX()[0],1.e-8)
1521          pass        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]]]])
1522          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1523        dsdarg=s.diff(Symbol(shape=()))        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1524        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1525        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1526        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")     def test_mult_overloaded_expandedData_rank4_Symbol_rank4(self):
1527        dsdarg=s.diff(Symbol(shape=(2,)))        msk_arg0=whereNegative(self.functionspace.getX()[0]-0.5)
1528        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        arg0=msk_arg0*numarray.array([[[[2.9251174606479946, -4.9654026519140189, 0.30085621199683832, -0.30061228591591238], [-2.513978591770071, -3.8844686856929558, -2.1891972059679632, 4.5141042306447474], [-2.236512896721278, 1.8541668723658136, 0.26092160236246542, -1.1184332157429031]], [[1.8254032188716751, 3.8918830207374366, -3.02810273755754, 3.0709862855640271], [-3.2428568515005187, 2.0131925931621293, 1.9979305988685745, 4.1731959115852639], [-0.67035244538272032, -2.00829150675079, -4.7874365846650164, 4.1003641988688031]]], [[[-1.175586228847092, -1.8341477845829668, 2.4832839618398461, 0.89234831426067096], [-1.7369861501359631, 1.8284772242403307, -0.27353996503704359, 4.8231831031252348], [0.099524325829133176, 1.2133893916939442, -4.6692295366623551, -4.4818711372137141]], [[3.8966804335291769, -0.47007955430217407, 1.9640723963394606, 4.8351918103493343], [2.1596571322083662, 3.4394328531876912, 2.846261179352954, -1.8012535813987718], [0.41896290835312833, -4.2874267756908147, -0.37745703724418522, -2.6740921738817813]]], [[[0.48734325359850583, 4.9758075524770824, -2.053696707710202, -1.2492068717010851], [-0.81009221983657476, -0.032340552500626174, -2.7423954288910823, -4.1769441535542455], [-4.1686249915574001, 3.0106427920402847, -3.5225347400306015, 3.9203298909772801]], [[-3.7843028776929879, 4.7534900290748308, 4.7905989355194496, 4.9295960701557782], [0.2236860439332089, 1.1116309427796969, -4.6113096924535757, 4.4416902722827007], [-0.78621657417830626, 1.5380907655682377, 4.5160456196047676, -3.7405412441349561]]]])+(1.-msk_arg0)*numarray.array([[[[4.3843342392813938, -1.6479745021651206, 1.0928655318928948, -0.27867216892680435], [-1.8534416490446235, -0.60606977099904125, 3.7896814633860565, 1.6774705245027342], [-2.1712907977922269, -0.9731023323951602, -2.2363323585193129, 3.0179076547691572]], [[3.5949000961561293, -4.4826056152295042, 4.4507316837878168, -0.14917077276962942], [2.865875878248751, 0.65613479495564864, -3.5114334284145352, -2.2657040605205969], [-3.3885348683628269, -4.1955144800795416, 0.19874114120673436, 0.77237878029658802]]], [[[3.6482369572987956, 4.1192696915374132, 4.7177908974828782, 3.267869957103418], [-3.9817588302026605, 3.9472020063214721, -2.2489247733823725, 0.35633644710087964], [0.30626607261116678, 1.1534627023800335, 2.6743275744867319, 2.9389573367973432]], [[1.9302124685612068, -3.5741196455396427, 0.86533807292409826, 3.713340528874534], [-0.75399962875646054, -2.6842573138405124, -3.0230491895158327, 1.9153830313206104], [1.1778385254967532, 0.11792305960293703, 4.5139117168026992, 2.8139119131046897]]], [[[-4.417619341991335, -4.8560564315233137, 4.580720581716939, -0.80247960909749949], [-3.4934853556245651, 1.0770893472402108, 3.378803127896246, 2.2030520956731934], [3.9240010232090405, -0.580967720625301, -1.2967054817990578, 1.780069501914376]], [[-0.19831352998526164, -3.5200058893139854, 0.76880268223223958, -3.5461945196094549], [2.6005628531204348, 4.7941479926695827, 4.9792519595550839, -2.3841553080010258], [0.78378064155146721, 0.72888520432430148, -0.39840096436977745, 2.3135172058068862]]]])
1529        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")        arg1=Symbol(shape=(3, 2, 3, 4))
1530        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        res=arg0*arg1
1531        dsdarg=s.diff(Symbol(shape=(4, 5)))        s1=numarray.array([[[[0.6868381582863794, 0.54627711634776066, -3.2186962400562225, -1.0774604195563131], [-1.8950462499252776, -3.9532997580259446, 0.94174368416758636, -1.45380459144517], [2.0866672501914945, 4.3633150084832497, -4.2883759710766967, 1.1324613195015356]], [[-1.6473475256931112, -2.4240842974365195, 3.0575003656751942, -0.88291292348152517], [-0.26167034327218541, -0.11708643329371515, 2.69348684719085, -4.9379016274841749], [0.9686171163405044, 4.8295378077612252, 3.7003121978510229, 4.056897346655898]]], [[[-1.6908031207422525, 4.8230189206260157, 0.82952788955472112, 3.4446585748455014], [3.3176619789094879, 3.0037317679930418, 1.4804656022305664, 1.0055708904902172], [0.88162105416707792, -0.50313800229601746, 3.9994903610131427, 4.5365056130602301]], [[-4.8084467422206547, -0.19193357971699321, -3.9848748508964316, -3.0854097037447001], [-1.4115589742338477, 1.453415069972718, 3.991034445603626, -4.9809560423233554], [0.17116217177604565, 3.3177075206574909, 1.7537041099136621, -1.9103533234598826]]], [[[2.5308867325681046, -1.042247247233361, -1.1846149285407979, 3.7060742981010737], [-1.297359352173022, 4.2498337462445868, 1.493118867126439, 3.1157447558047586], [0.15917981571003992, -4.2811882943532051, -2.892893263308518, -0.15525299846753171]], [[0.70528939883089059, -3.5415574610175469, 0.91408910363181572, -4.9096466754450141], [3.8808985862028376, -2.4998339203436348, -0.7493422147604818, -2.7415281675633221], [-2.6740604084639994, 1.5889649415442406, -3.0729275401598812, -3.7916787182652412]]]])
1532        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        sub=res.substitute({arg1:s1})
1533        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)
1534        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        ref=msk_ref*numarray.array([[[[2.0090822894427993, -2.7124858421931139, -0.96836475835178126, 0.3238978397067413], [4.7641057027263036, 15.356469115209322, -2.061662642117656, -6.562625456773401], [-4.6668582162192029, 8.0903141424262, -1.1189299299060254, -1.2665823552745537]], [[-3.0070734760004947, -9.4342525180294281, -9.2584252273842349, -2.7114134793590052], [0.84855946551469918, -0.23571754026667907, 5.3813997896526438, -20.606830883627179], [-0.64931485257841604, -9.6991197608586983, -17.715009990674201, 16.634756638713682]]], [[[1.9876848644362788, -8.8461294682679377, 2.0599533040300941, 3.0738352724669484], [-5.7627329081984522, 5.4922551255024175, -0.40496650907269482, 4.8500525280070113], [0.087742741052748138, -0.61050231454407089, -18.674538525238951, -20.332033570982652]], [[-18.736980336078339, 0.090224051608984959, -7.8265826975130048, -14.918547731118739], [-3.0484834062368544, 4.9989235409822532, 11.35952640798204, 8.9719649100247967], [0.071710601287329825, -14.224428057977713, -0.66194795753096181, 5.108460871613123]]], [[[1.2334105747390316, -5.1860217243322069, 2.4328397786485927, -4.629653480222637], [1.050980717527584, -0.13744197138935588, -4.0947223559985781, -13.014291841725987], [-0.66356095792037362, -12.889128679761718, 10.190317019204748, -0.60864297055611438]], [[-2.6690287016020968, -16.834758078342482, 4.3790342868285039, -24.202574957127123], [0.86810285165369627, -2.7788927376642603, 3.4554490178896384, -12.177018993055025], [2.1023906134884078, 2.4439723034008711, -13.877480957101886, 14.182930630179902]]]])+(1.-msk_ref)*numarray.array([[[[3.0113280542199465, -0.90025075885739858, -3.5176021783907041, 0.30025823205054236], [3.5123576464773363, 2.3959754790373493, 3.5689085831507947, -2.4387143505360127], [-4.5307613983952022, -4.2459520117298588, 9.5902339496154969, 3.4176636848536646]], [[-5.922049778516727, 10.86621388347861, 13.608113750703422, 0.13170480308403179], [-0.74991472483682653, -0.076824482901260024, -9.4579997542208236, 11.187823767842159], [-3.282192872812852, -20.262395804553826, 0.73540426902211176, 3.1334614243985466]]], [[[-6.1684504326080232, 19.867315661446234, 3.9135391265494457, 11.25669626921629], [-13.210129880150486, 11.856336061073677, -3.3294557689967741, 0.35832155842535174], [0.27001061779106766, -0.58035091979845577, 10.695947356351342, 13.332596454925692]], [[-9.2813238562468232, 0.6859935779052545, -3.4482639243184217, -11.457176901097965], [1.0643149425401714, -3.9013400316202884, -12.065093446111812, -9.5404386832200192], [0.20160140002551957, 0.39123422170360572, 7.9160655295443281, -5.3755659751229006]]], [[[-11.180494182182111, 5.0612114481650323, -5.426389984575974, -2.9740490540264393], [4.5323058977990254, 4.5774506556220018, 5.0449546985677118, 6.8641480138584354], [0.62462175972042311, 2.4872322049381017, 3.7512305527917205, -0.27636112765281257]], [[-0.13986843034333699, 12.46630312012565, 0.70275415467140356, 17.410562133681889], [10.092520700006713, -11.98457377122277, -3.7311636912234754, 6.5362289327304204], [-2.095876782493292, 1.1581730360816256, 1.2242572954381448, -8.7721139535984367]]]])
1535        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1536        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1537        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")
1538        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1539       def test_quotient_overloaded_constData_rank0_Symbol_rank0(self):
1540        dsds=s.diff(s)        arg0=Data(3.43231999068,self.functionspace)
1541        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")        arg1=Symbol(shape=())
1542        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        res=arg0/arg1
1543        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        s1=numarray.array(-1.4540852929)
1544        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        sub=res.substitute({arg1:s1})
1545        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        ref=Data(-2.36046675352,self.functionspace)
1546        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1547          self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1548        sa=s.getSubstitutedArguments({s2:-10})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1549        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1550       def test_quotient_overloaded_constData_rank0_Symbol_rank1(self):
1551        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")        arg0=Data(-1.99888672106,self.functionspace)
1552        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        arg1=Symbol(shape=(2,))
1553        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")        res=arg0/arg1
1554        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        s1=numarray.array([-1.0166253896000677, 4.6638233509673803])
1555        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        sub=res.substitute({arg1:s1})
1556        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        ref=Data(numarray.array([1.966197914693572, -0.42859400338170606]),self.functionspace)
1557        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1558     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1559     def test_Symbol_rank1_dNone_nargs1(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1560        s2=Symbol(shape=())     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1561        s=Symbol(shape=(2,),dim=None,args=[s2])     def test_quotient_overloaded_constData_rank0_Symbol_rank2(self):
1562        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        arg0=Data(1.75603219348,self.functionspace)
1563        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        arg1=Symbol(shape=(4, 5))
1564        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        res=arg0/arg1
1565        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        s1=numarray.array([[-1.9661246795683085, -1.3570192095877909, -1.8523576170966627, 0.73214584413366701, 4.0725024727547723], [1.8898911955656281, 3.704542947914863, -3.7748480598358505, -2.2414248653554889, 4.3999361819787648], [-3.981378759357713, 0.34597746243312777, 2.0496740598398322, -2.7919624238592222, 3.7661073743193256], [-2.3423350580789757, -0.53058380320099552, -0.56646103984835783, 1.7717941659157441, -4.6013674001294715]])
1566          sub=res.substitute({arg1:s1})
1567        ss=s.substitute({s:numarray.zeros((2,))})        ref=Data(numarray.array([[-0.89314386403468715, -1.294036356358591, -0.94799847355391309, 2.3984732107050015, 0.43119241921436163], [0.92917105365848052, 0.47402128094425233, -0.46519281455793515, -0.78344459393917454, 0.39910401443456101], [-0.44106132564159456, 5.0755681631228065, 0.85673728710838137, -0.6289598235553272, 0.46627247153328438], [-0.74969299862837668, -3.3096226889880782, -3.1000052429972795, 0.99110394833928261, -0.38163268454377053]]),self.functionspace)
1568        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1569        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1570        try:        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1571          s.substitute({s:numarray.zeros((5,))})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1572          fail("illegal substition was successful")     def test_quotient_overloaded_constData_rank0_Symbol_rank3(self):
1573        except TypeError:        arg0=Data(2.14054149252,self.functionspace)
1574          pass        arg1=Symbol(shape=(6, 2, 2))
1575          res=arg0/arg1
1576        dsdarg=s.diff(Symbol(shape=()))        s1=numarray.array([[[-1.3253901188041395, -2.78253495112182], [-4.300977060645458, 1.3835241184212173]], [[-4.4915480214339922, 2.4570745420262323], [0.3669594834630967, 2.2625027935147521]], [[3.5861676332312769, -0.23287586841902996], [-0.090748090278614413, 3.6431882097617247]], [[-2.6410132226145535, -3.1196251341148207], [1.761434899422647, -2.1643804473513208]], [[1.5009114368679546, 3.1354061944070661], [4.4611923331014278, -2.1935651672343202]], [[-0.031809360087940775, -2.6612631796034103], [-4.8635727802285782, -4.7669299996057299]]])
1577        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        sub=res.substitute({arg1:s1})
1578        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        ref=Data(numarray.array([[[-1.6150275018307814, -0.76927748622185721], [-0.49768726090397136, 1.5471660117975328]], [[-0.47657099118358148, 0.8711748284031503], [5.8331821058896702, 0.94609451915777054]], [[0.59688829732556048, -9.1917703068822263], [-23.587730451975027, 0.58754622854454441]], [[-0.81050010435175179, -0.68615343206318313], [1.2152260030870663, -0.98898578350352317]], [[1.4261610911502236, 0.68269989908859252], [0.47981376562515166, -0.97582762732427908]], [[-67.292818422177291, -0.80433288557445193], [-0.44011708866066374, -0.44903984172213457]]]),self.functionspace)
1579        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1580        dsdarg=s.diff(Symbol(shape=(2,)))        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1581        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1582        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1583        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")     def test_quotient_overloaded_constData_rank0_Symbol_rank4(self):
1584        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg0=Data(-3.54974920415,self.functionspace)
1585        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        arg1=Symbol(shape=(3, 2, 3, 4))
1586        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        res=arg0/arg1
1587        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        s1=numarray.array([[[[-4.6125564005877369, -0.69438643429163349, -1.2362005816145647, -0.30244075141731752], [-1.1937784959185995, -0.0033389287251761601, -1.6183053769253828, -3.6545432537969038], [-4.6417500711286301, 1.7794083989940725, -4.5916358946296647, -4.2537071645246352]], [[0.99190852437837673, 4.9497457601229851, 2.1159345761594448, 4.5666165220115857], [3.2506291129568652, 0.42673325762989656, 2.0122314690593255, 4.7533864244368562], [2.9256051481580858, -2.1428797577186054, 1.0170937184162421, -0.51756150989596517]]], [[[2.7697508281062682, 3.2216955050655187, 4.1307453643983649, -0.6109132252804681], [1.1663708850914603, -1.2817940773962224, -0.0804200958300747, -0.059735834319028847], [-1.7817187949510171, -0.93987586758695407, 4.4482533799407129, 2.9112844484768345]], [[-1.2926950097177148, 4.8418522299498115, 4.081508190552551, 4.5792771623348134], [3.4344906345489221, 3.5115707226638531, -1.2336261997761913, -4.9918490638148807], [2.9678262816222762, -1.7062580143959103, 4.1797990849162208, 3.392276837834407]]], [[[-3.2392133388383293, -4.3004082192842166, 4.5627762584330434, -0.079623098707676476], [-1.9104374497872612, 4.7603569268729746, -1.5974727715246164, 2.6969700051872891], [0.14884820101978846, -1.787020268808436, -2.4205499696318755, 2.1558951788757899]], [[-2.1125147886516817, 1.5310662008239184, -1.5322830724155088, 2.2222574246117084], [1.1894588535421828, 3.3001015528617934, 1.1758339668590718, -0.75094141518856361], [-1.3255264932208934, -0.45235303559717899, -2.4004740260439119, 3.7531870834047236]]]])
1588        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        sub=res.substitute({arg1:s1})
1589        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        ref=Data(numarray.array([[[[0.76958391309789775, 5.1120658884563053, 2.8714993803941131, 11.737006959260613], [2.9735409175867016, 1063.1401555185284, 2.1934977506490343, 0.97132499402245065], [0.76474371729496249, -1.994904152501356, 0.77309030716063942, 0.83450718793092105]], [[-3.5787062182711575, -0.7171578857134806, -1.6776271082029788, -0.77732587946434517], [-1.0920191386953129, -8.3184264190342141, -1.7640859208948241, -0.74678321667685821], [-1.213338446025066, 1.6565321462218994, -3.4900905785521159, 6.858603540403533]]], [[[-1.2816131935507342, -1.1018264136283962, -0.85934834781714486, 5.8105620524410613], [-3.043413762742126, 2.7693599672108506, 44.140076774461704, 59.4241169411154], [1.992317314162168, 3.776827692429984, -0.79800966827936781, -1.2193068959669231]], [[2.7460067358999258, -0.73313869064233306, -0.8697150755119526, -0.77517675351608806], [-1.0335591451147692, -1.0108721949521922, 2.8774917432793443, 0.71110908177906096], [-1.1960771511898256, 2.0804293220599646, -0.84926311816258404, -1.046420847661474]]], [[[1.0958676792255069, 0.82544470737243281, -0.77798011629176977, 44.581902259059319], [1.8580818778151313, -0.74568971585096155, 2.2221031039929464, -1.3161989926923772], [-23.848116267640666, 1.9864067946559978, 1.4665052358695663, -1.6465314450028652]], [[1.6803428895353212, -2.3184818541737942, 2.3166406182071824, -1.597361837937973], [-2.9843396377924201, -1.0756484754448787, -3.0189204464226163, 4.7270654306071433], [2.6779918940160439, 7.8472982931634876, 1.478770095254565, -0.94579596627218787]]]]),self.functionspace)
1590        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.")
1591        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1592          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1593        dsds=s.diff(s)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1594        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")     def test_quotient_overloaded_constData_rank1_Symbol_rank0(self):
1595        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        arg0=Data(numarray.array([3.9883962094707375, 1.3750251611114059]),self.functionspace)
1596        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        arg1=Symbol(shape=())
1597        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        res=arg0/arg1
1598        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        s1=numarray.array(3.45871616654)
1599        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        sub=res.substitute({arg1:s1})
1600          ref=Data(numarray.array([1.1531435415409816, 0.39755362825459506]),self.functionspace)
1601        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1602        sa=s.getSubstitutedArguments({s2:-10})        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1603        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1604        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1605       def test_quotient_overloaded_constData_rank1_Symbol_rank1(self):
1606        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")        arg0=Data(numarray.array([-1.2334048137186624, 1.377686460692952]),self.functionspace)
1607        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        arg1=Symbol(shape=(2,))
1608        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")        res=arg0/arg1
1609        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        s1=numarray.array([1.4844200870995552, 1.9547802909252443])
1610        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        sub=res.substitute({arg1:s1})
1611        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        ref=Data(numarray.array([-0.83090011004138475, 0.70477816207204547]),self.functionspace)
1612        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1613     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1614     def test_Symbol_rank1_dNone_nargs2(self):        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1615        s2=Symbol(shape=())     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1616        s=Symbol(shape=(2,),dim=None,args=[1, -1.0])     def test_quotient_overloaded_constData_rank2_Symbol_rank0(self):
1617        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        arg0=Data(numarray.array([[-2.2020384928131884, -4.3740172257969014, 3.3041701150346512, -2.2405366435075358, 4.0852398702255694], [0.83572753098331365, -1.3774478891852282, -3.7695866211336106, 3.7407792775265367, -3.8975656101620961], [3.4429597608670139, -4.1953097446124099, -3.4659921023383311, -1.6700250836404607, 1.8624190364059556], [1.5519146057464788, -3.9581877480458152, 1.023175615935096, 0.66728877091972283, -2.159854941490873]]),self.functionspace)
1618        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        arg1=Symbol(shape=())
1619        self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")        res=arg0/arg1
1620        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        s1=numarray.array(0.937332179697)
1621          sub=res.substitute({arg1:s1})
1622        ss=s.substitute({s:numarray.zeros((2,))})        ref=Data(numarray.array([[-2.3492615963795287, -4.6664537082363049, 3.5250791412093454, -2.3903336426916342, 4.3583693793011333], [0.8916023039487998, -1.4695408085000394, -4.0216122979493001, 3.9908789632457138, -4.1581476605459811], [3.6731479356437879, -4.4757982660618616, -3.6977201651801295, -1.7816790245909124, 1.9869359835781315], [1.6556719585237416, -4.2228228516861241, 1.0915827260573738, 0.71190212538668518, -2.3042577522397214]]),self.functionspace)
1623        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1624        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1625        try:        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1626          s.substitute({s:numarray.zeros((5,))})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1627          fail("illegal substition was successful")     def test_quotient_overloaded_constData_rank2_Symbol_rank2(self):
1628        except TypeError:        arg0=Data(numarray.array([[3.5835048539727268, 3.8571075798310233, 3.9190114681880495, 2.1261827038253269, 3.3617327213332029], [0.75329476297362508, 4.5554315239695242, -4.0352341285409521, -0.2623106802883246, 1.1321991848119719], [3.601642681322538, 0.35254643689157916, 4.411383875853911, -4.8746220027908125, -2.380461998817911], [3.3624236591334427, 3.869796930431475, -3.0974921018602899, 3.9594635826095743, -2.2054920280196821]]),self.functionspace)
1629          pass        arg1=Symbol(shape=(4, 5))
1630          res=arg0/arg1
1631        dsdarg=s.diff(Symbol(shape=()))        s1=numarray.array([[-0.59646319056279751, -3.6970890099277609, -1.8190897467441278, 1.7073115435483661, -0.87921199151292839], [3.1618107337278349, -3.9520052671591479, -4.9928921272070461, -2.192093820543024, 4.5495573770272415], [1.8431133075959449, 3.1217428492223966, 4.9262597144433933, 3.4883151619796173, -3.9635009262862084], [1.1267839216226863, -1.8588755230890319, -1.9192169107766244, -2.7631759225358712, -2.8239106079831644]])
1632        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        sub=res.substitute({arg1:s1})
1633        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        ref=Data(numarray.array([[-6.0079228872304471, -1.0432823146734, -2.1543804945316398, 1.2453396170486881, -3.8235746939124522], [0.23824789856585635, -1.1526886266637346, 0.80819573620514118, 0.11966215945234733, 0.24885919463923109], [1.9541081204716173, 0.11293256809394019, 0.89548341572818257, -1.3974144469287193, 0.60059579727369927], [2.9840891359997417, -2.0817945485670526, 1.613935394414, -1.4329393761421547, 0.78100631860823788]]),self.functionspace)
1634        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1635        dsdarg=s.diff(Symbol(shape=(2,)))        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1636        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1637        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1638        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")     def test_quotient_overloaded_constData_rank3_Symbol_rank0(self):
1639        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg0=Data(numarray.array([[[4.0802610727283497, -2.8024539989346686], [1.8071267457266043, -0.13841814957606147]], [[-1.7988661169618148, 0.027850264656436252], [-0.50642743316112071, 1.8452982570747869]], [[2.7405547448954763, -3.706784288688544], [-3.7888483700042452, -0.58588961440206511]], [[0.7192047060638771, 3.626558913441384], [-3.4305483052647547, 0.32455136413554975]], [[-4.74732548737156, -3.237460084387326], [3.9516124747522348, 2.0449010242900272]], [[2.5313399910511016, -4.0403085459172958], [0.34682792129693585, 4.8072404359213934]]]),self.functionspace)
1640        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        arg1=Symbol(shape=())
1641        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        res=arg0/arg1
1642        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        s1=numarray.array(-3.09807610149)
1643        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        sub=res.substitute({arg1:s1})
1644        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        ref=Data(numarray.array([[[-1.3170306148280686, 0.9045788118592859], [-0.58330611854821657, 0.0446787441759516]], [[0.58063974480716518, -0.0089895353581049327], [0.16346513661097703, -0.59562715589453463]], [[-0.8845989107815041, 1.1964794173089723], [1.222968140835246, 0.1891140163149812]], [[-0.2321455905225138, -1.1705841931056031], [1.1073156994483895, -0.10475900316959676]], [[1.5323463116641085, 1.044990496789675], [-1.2755052959650881, -0.66005513011999017]], [[-0.81706837021672774, 1.3041346995883329], [-0.11194945183245521, -1.5516857166971336]]]),self.functionspace)
1645        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.")
1646        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1647          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1648        dsds=s.diff(s)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1649        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")     def test_quotient_overloaded_constData_rank3_Symbol_rank3(self):
1650        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        arg0=Data(numarray.array([[[1.1578386437899475, 4.996126396500328], [-0.91635300388975871, -1.4064554437689711]], [[1.9840437948610754, -4.7599852474548303], [3.8573711058777711, 3.2212451543838636]], [[-0.7067030968790311, -1.8450312080991926], [-3.4904314203564146, 4.1106376595074803]], [[-1.5537756306237585, -3.2824613533646483], [4.7975800514366824, -2.7680700289656945]], [[1.2578485281438132, 3.6884342068649723], [0.30686143258336962, -0.1053444702926134]], [[2.8155471322537089, 3.9876357168096845], [-1.6272658547215357, -4.1924212908247949]]]),self.functionspace)
1651        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        arg1=Symbol(shape=(6, 2, 2))
1652        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        res=arg0/arg1
1653        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        s1=numarray.array([[[-3.55725957171527, -1.1670775665522681], [2.7862539310451577, 1.0863835234493537]], [[4.9340858930189082, -1.5697941944512426], [-2.287640013757879, -2.7787914055587528]], [[3.7139854530312846, -0.35242947963774185], [-2.1390766886024091, 0.4158275961222877]], [[3.5822790102073565, -2.1203769144295173], [-0.76525921225763494, 0.97800877770561545]], [[1.6695611656178597, 2.611002263099742], [0.74990774985468001, -0.34139195816695178]], [[-2.9013746777617277, -2.2708713146155524], [-4.3105323025833497, -0.54392296428618003]]])
1654        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        sub=res.substitute({arg1:s1})
1655          ref=Data(numarray.array([[[-0.3254861278598376, -4.2808863263987469], [-0.32888352123240383, -1.2946214788893002]], [[0.40210969932003821, 3.0322352218398869], [-1.6861792426603492, -1.1592252473287548]], [[-0.19028160067300032, 5.2351784249027027], [1.6317467433282764, 9.8854373731814871]], [[-0.43373942291943912, 1.5480555985244666], [-6.2692222120176346, -2.8303120504291575]], [[0.75340068638834046, 1.4126507123307199], [0.40919890832283623, 0.30857337957883746]], [[-0.97041831716328664, -1.7559936977251271], [0.37750925883244102, 7.707748277050114]]]),self.functionspace)
1656        self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1657        self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1658        sa=s.getSubstitutedArguments({s2:-10})        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1659        self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1660        self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")     def test_quotient_overloaded_constData_rank4_Symbol_rank0(self):
1661        self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")        arg0=Data(numarray.array([[[[0.572941583844365, -2.332247190999662, 1.4999835530459045, 1.5952831694610961], [3.2104897575397366, -4.9371677957474267, 2.2024000914918265, 1.4710857974423694], [-0.87463651673330123, 0.53658487579484948, -1.7854982541271172, 3.5567809651315283]], [[1.0317521940803989, -0.36264412704591908, -3.5507235577725971, 1.3909848991573099], [1.5627242518273841, -3.3326845915707382, -4.9229613174667284, -4.9895568338934826], [4.1835909015322699, 1.6315284699855113, 0.71636527590831811, -4.6681291758637924]]], [[[-0.51377242935229006, -1.8235520070656133, -2.0006476650985006, 0.44472827017699412], [3.9164591306406944, -1.6610530974168092, 4.9476376200326353, -1.3836826771010848], [1.4986466482116088, -3.8631080673395788, -1.8710856814872723, -1.4352468456143597]], [[1.9960625823999054, -4.210241298814994, 2.6483546110070852, -0.86544321226839926], [-0.93317484961197739, -0.44349168612483147, -2.5628503186817273, -3.8695270931809622], [-4.9604568128480784, 2.1396464175683629, 1.7039271741506079, -3.8283222528970318]]], [[[-1.441363355020906, -3.3811365967582629, -3.351110695562276, 3.7482593597594853], [-2.3746596093071446, -2.8131334479206336, -1.2166137380924189, 0.66777797821446239], [-1.3602489200986803, 1.2310997543301729, 4.3550327489506273, 2.8106898161846896]], [[0.0025102013600246664, -4.1702593487397666, -0.76776964329102171, 1.6998502005468374], [-1.2721136787178864, 0.48196474656392496, 3.8101051719028369, 3.2695331075470051], [2.8814364694283192, 1.768178124165547, 2.7195217125632869, 1.3866661750201548]]]]),self.functionspace)
1662          arg1=Symbol(shape=())
1663        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")        res=arg0/arg1
1664        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        s1=numarray.array(-3.38430915471)
1665        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")        sub=res.substitute({arg1:s1})
1666        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        ref=Data(numarray.array([[[[-0.16929351239873056, 0.68913538461830237, -0.44321705981189319, -0.47137631242701161], [-0.94863962208351837, 1.4588406584763218, -0.65076799748788894, -0.43467831400514534], [0.25843871725357914, -0.15855078577787907, 0.52758130906604084, -1.0509621912582798]], [[-0.30486345866006281, 0.1071545507422134, 1.0491723407800817, -0.4110099980732112], [-0.46175576177832739, 0.98474590801808515, 1.4546429100936369, 1.4743206385109813], [-1.2361727934067384, -0.48208612020977609, -0.21167252847185297, 1.3793447827791936]]], [[[0.15181013490950382, 0.53882548068242941, 0.59115393235071689, -0.13140887839924492], [-1.1572403558900153, 0.49081009490641131, -1.4619342955545513, 0.40885232815524336], [-0.44282202946059263, 1.1414761154314166, 0.55287079163030139, 0.424088574655207]], [[-0.58979912624731723, 1.2440474869008653, -0.78253920961085932, 0.25572226788544083], [0.27573569876520421, 0.13104349096103143, 0.75727429189307016, 1.1433728174015798], [1.4657221270526268, -0.6322254616098969, -0.5034785819664972, 1.1311975584638549]]], [[[0.4258958886820684, 0.99906256851586073, 0.99019047680574546, -1.1075404723415438], [0.70166746025578719, 0.83122827121273091, 0.35948658425561852, -0.19731589157117033], [0.40192809164754195, -0.36376693087158457, -1.286830649879354, -0.83050622378023153]], [[-0.00074171751021319377, 1.2322335691269641, 0.22686155672925484, -0.50227391258867338], [0.37588577773597637, -0.14241156009429243, -1.1258147520589403, -0.96608582670258014], [-0.85141053541651612, -0.52246353490009168, -0.80356775585259854, -0.40973389593840998]]]]),self.functionspace)
1667        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.")
1668        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1669        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")
1670     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1671     def test_Symbol_rank1_dd_nargs0(self):     def test_quotient_overloaded_constData_rank4_Symbol_rank4(self):
1672        s2=Symbol(shape=())        arg0=Data(numarray.array([[[[-0.16841036162188416, -2.6003560333643625, 3.5545184910572907, 1.5139147914100795], [-0.94587340061535929, 0.16930195740283693, 2.4177976471661742, 2.0737743000066882], [4.6768686667116981, -3.6339789866072092, 2.5135388182835854, -3.8110207055172829]], [[-3.2003418240897084, 4.104104479479858, 3.4425399383215289, 0.8930435704987314], [-1.2104858360688286, -0.54602956579953776, 0.96613869262303176, -1.1447665449499578], [-0.73618243678854167, -0.75634063494127179, -3.4905332722260507, -1.9294737289274213]]], [[[-1.7695622917331444, -4.4618511183236436, 1.8912341467374274, -4.274667165997097], [1.0133441322095447, 2.2698437785116283, -1.3999716834553122, -0.82282963781866947], [-1.8934325312597222, -1.8347274000416256, 2.4812263519307525, -0.32095149255687971]], [[1.2294222774888874, -4.7301199904748072, -2.4933570004059069, 1.739157374421735], [-4.4527415960373729, -0.24978137738396544, -3.5733206736544734, -2.6055729246625714], [4.2634437530410096, 0.63371633316309506, 0.35411662272234246, -2.3278320513076158]]], [[[0.57519577741460104, -4.1358797158873672, -1.3160752022537814, 3.3667114590653], [4.242351859563227, -4.1169328622744894, -1.1012574518657403, -0.017794823889186517], [0.56080815754529567, -0.32077975391617564, 0.1045421322530995, -4.5192026724964922]], [[3.7259353163717144, -0.29314631925237755, 0.96174008183977833, 4.8927047445339618], [0.19844208500697569, -3.4269276368232626, -1.2296494241640721, 0.74453382811172109], [0.95832215119780528, -1.2319028512539818, 1.7600259249758201, 0.51820978084550617]]]]),self.functionspace)
1673        s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[])        arg1=Symbol(shape=(3, 2, 3, 4))
1674        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        res=arg0/arg1
1675        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        s1=numarray.array([[[[1.5896505942866401, 0.6891827619618871, 4.6694699071013428, -1.9615140167099101], [2.3734917018897859, -3.8358457650850006, -2.4207628518454594, -3.6880303333340336], [-3.955550166922265, -4.8219514951045745, 3.0332138878682766, -0.43173075751425927]], [[3.6491269792507204, 3.5362867736239174, -3.727772234197988, 0.50203076783315659], [3.0857009585880579, -2.4481643817771017, 3.9495322686066388, 3.9076676035973037], [-2.5661687086956961, 0.51956619090885425, 0.12707753474037187, -3.8065370519275588]]], [[[-2.7343322214319321, 2.1071856335550851, -2.4809811090224079, -3.7158191036172306], [4.1081487764099194, -3.9067998805821045, 3.9727737524493261, 0.18115530713208194], [-1.8658727247580997, 1.4129364110321907, -0.60367775527123779, -4.9370475380777705]], [[0.85946374601468811, 1.2407326725323173, -0.072139226735624007, -2.4294954216721942], [4.3152150682384747, -1.395544165290584, 3.1948762392822694, 3.0548315771279171], [1.108458866445222, 4.708696707365803, 3.5605248213884586, -4.016164807819588]]], [[[2.3052524453408676, -1.4229694054870725, -0.33634510639310111, 4.763489013156013], [1.6475037257860015, 4.4709813704960855, 3.9425928470200127, 4.19691117466847], [1.4825715910251436, 2.8996239189360375, -4.7982559296213081, -0.63001732867952054]], [[-2.2623123840312722, -3.1391124653197631, -1.6105305432525729, -3.7485403170057396], [1.8614704354355895, -1.3878572051796354, -1.1974399594213905, -1.1968610566940283], [-3.0520711866611725, 0.39756329287125247, 4.6967348695454127, 1.9766807360255321]]]])
1676        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        sub=res.substitute({arg1:s1})
1677        self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")        ref=Data(numarray.array([[[[-0.10594174734194262, -3.7731008041494896, 0.76122527005722196, -0.77180931592291213], [-0.39851557090435591, -0.044136800010019503, -0.9987750949346299, -0.56229860184798586], [-1.1823560489312861, 0.75363242253609575, 0.82867180199088575, 8.8273087779515276]], [[-0.87701574713271235, 1.160568908067954, -0.92348451623203176, 1.7788622286105038], [-0.39228877078960939, 0.22303631645975486, 0.24462104039572191, -0.29295392061907044], [0.28687998349209093, -1.4557156492770218, -27.467744628170902, 0.50688426320462898]]], [[[0.64716433426163888, -2.1174456807566329, -0.7622928444959578, 1.1503970044816891], [0.24666685345682601, -0.58099822051121464, -0.35239149538585995, -4.5421227279791312], [1.0147704643172784, -1.2985208574965552, -4.1101835048003634, 0.06500879120192582]], [[1.4304527482278198, -3.8123603054803912, 34.563123466010623, -0.71585126644309238], [-1.0318701445059233, 0.17898493189712508, -1.1184535506318147, -0.85293505022370875], [3.8462805270471452, 0.13458423265439332, 0.099456299418312022, 0.57961566885284688]]], [[[0.24951530951724002, 2.9065134499302072, 3.9128715632794941, 0.70677426771993568], [2.5750180671301726, -0.92081190260421242, -0.2793231496623142, -0.0042399810595448685], [0.37826716830417445, -0.11062805483887708, -0.021787527340449774, 7.1731402721389852]], [[-1.6469588119976495, 0.093385096103116669, -0.59715730686949942, -1.3052293241552109], [0.10660501570659631, 2.4692220669630798, 1.0268986052196265, -0.62207206421125749], [-0.3139907599095571, -3.0986332826580223, 0.37473393194667798, 0.26216159817870188]]]]),self.functionspace)
1678          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1679        ss=s.substitute({s:numarray.zeros((2,))})        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1680        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1681        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1682        try:     def test_quotient_overloaded_taggedData_rank0_Symbol_rank0(self):
1683          s.substitute({s:numarray.zeros((5,))})        arg0=Data(4.14743871401,self.functionspace)
1684          fail("illegal substition was successful")        arg0.setTaggedValue(1,-1.21319155942)
1685        except TypeError:        arg1=Symbol(shape=())
1686          pass        res=arg0/arg1
1687          s1=numarray.array(1.68574433632)
1688        dsdarg=s.diff(Symbol(shape=()))        sub=res.substitute({arg1:s1})
1689        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        ref=Data(2.46030114096,self.functionspace)
1690        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        ref.setTaggedValue(1,-0.719677078714)
1691        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1692        dsdarg=s.diff(Symbol(shape=(2,)))        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1693        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1694        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1695        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")     def test_quotient_overloaded_taggedData_rank0_Symbol_rank1(self):
1696        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg0=Data(4.5956316483,self.functionspace)
1697        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        arg0.setTaggedValue(1,-2.78021827332)
1698        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        arg1=Symbol(shape=(2,))
1699        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        res=arg0/arg1
1700        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        s1=numarray.array([-3.1585434961186776, -0.83641144105439835])
1701        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        sub=res.substitute({arg1:s1})
1702        self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")        ref=Data(numarray.array([-1.4549844426550103, -5.4944629194795436]),self.functionspace)
1703        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        ref.setTaggedValue(1,numarray.array([0.88022162010414895, 3.323984030895371]))
1704          self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1705        dsds=s.diff(s)        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1706        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1707        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1708        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")     def test_quotient_overloaded_taggedData_rank0_Symbol_rank2(self):
1709        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        arg0=Data(0.921054948699,self.functionspace)
1710        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        arg0.setTaggedValue(1,0.0394823576247)
1711        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        arg1=Symbol(shape=(4, 5))
1712          res=arg0/arg1
1713        sa=s.getSubstitutedArguments({s2:-10})        s1=numarray.array([[-3.4132432835484785, 1.7587931443963667, -3.0756623852847209, -2.3252904186343857, 1.7356444015043548], [2.2713204269584573, -0.88162393927914628, 4.5884799751444127, -0.28536103244470201, -0.96415679848996039], [-4.9028675399283088, -3.5992342473478436, 2.9789784497386043, -1.4541535741896947, -1.7122334747232371], [-3.706048617922951, -1.0579893940366314, -1.4083276675366196, 2.9524896646883523, -3.7595222430650335]])
1714        self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")        sub=res.substitute({arg1:s1})
1715          ref=Data(numarray.array([[-0.2698474360553203, 0.52368577375522674, -0.29946555678715542, -0.39610318836626168, 0.53067030775444735], [0.40551519625612281, -1.0447254295881458, 0.20073204060776384, -3.2276829839304844, -0.95529580887790655], [-0.18786045945513499, -0.25590302975620283, 0.30918483105489369, -0.63339592533191935, -0.53792602603303119], [-0.24852748672649719, -0.87057106043797383, -0.6540061449688519, 0.31195873764246379, -0.24499255201844189]]),self.functionspace)
1716        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")        ref.setTaggedValue(1,numarray.array([[-0.011567402128943166, 0.022448551013809145, -0.012837025875668295, -0.016979538258239214, 0.022747953204296133], [0.017382997641416348, -0.044783672341068809, 0.0086046703567616654, -0.13835931727073011, -0.040950141809460834], [-0.0080529113428377385, -0.010969654907516195, 0.013253656678242865, -0.027151435945629462, -0.023058980102641378], [-0.010653491547244584, -0.037318292458565619, -0.028034922933652444, 0.013372564211460894, -0.010501961438730782]]))
1717        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1718        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1719        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")
1720        self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1721        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")     def test_quotient_overloaded_taggedData_rank0_Symbol_rank3(self):
1722        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        arg0=Data(4.34795846919,self.functionspace)
1723        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        arg0.setTaggedValue(1,-3.37152427446)
1724     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        arg1=Symbol(shape=(6, 2, 2))
1725     def test_Symbol_rank1_dd_nargs1(self):        res=arg0/arg1
1726        s2=Symbol(shape=())        s1=numarray.array([[[-0.7964283399534855, -4.3563885775398905], [2.2670305253314744, 3.660342998126211]], [[0.98970416783162918, -0.36362420293442987], [-1.5082103582776121, -1.0358411207289953]], [[0.15017273952708887, 1.5640231629694314], [-1.220547262103826, 1.2530487741570369]], [[-0.17882026193937506, -3.7724811453653215], [-1.2436803428756193, -0.22774847919000152]], [[2.699497971812451, 1.4296834805633196], [-4.8957592859528791, -2.146219757066874]], [[-0.72865666362676773, 4.5771813067946603], [2.6396990597187395, 4.5439155054068241]]])
1727        s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[s2])        sub=res.substitute({arg1:s1})
1728        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        ref=Data(numarray.array([[[-5.459321637707057, -0.99806488604065802], [1.9179090976533884, 1.1878554745872083]], [[4.393190016282583, -11.95728566498973], [-2.8828594402153405, -4.1975148332894978]], [[28.953047556323426, 2.7799834248849646], [-3.5623024230104048, 3.4699036133818302]], [[-24.314685718698094, -1.1525461100137917], [-3.4960418037466843, -19.091053800468391]], [[1.6106544678275652, 3.0412035449119168], [-0.88810707700979552, -2.0258682527148579]], [[-5.9670880487799733, 0.94992052482972167], [1.6471417274567848, 0.95687485033943109]]]),self.functionspace)
1729        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")        ref.setTaggedValue(1,numarray.array([[[4.2333052521197194, 0.77392643343262635], [-1.4871984460681718, -0.92109517501174554]], [[-3.4065980361069386, 9.2720018284097723], [2.2354469692890762, 3.2548662212688542]], [[-22.450974025508192, -2.1556741321279111], [2.7623053847588577, -2.6906568555004609]], [[18.854263146114384, 0.89371534132229213], [2.7109251133345817, 14.803718059734445]], [[-1.2489449185243982, -2.358231259085152], [0.68866218241893562, 1.5709128868843167]], [[4.6270410232452646, -0.73659399715217178], [-1.2772381238114758, -0.74198656873137026]]]))
1730        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1731        self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")        self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1732          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1733        ss=s.substitute({s:numarray.zeros((2,))})     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1734        self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")     def test_quotient_overloaded_taggedData_rank0_Symbol_rank4(self):
1735        self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")        arg0=Data(3.7553962803,self.functionspace)
1736        try:        arg0.setTaggedValue(1,-2.45958468224)
1737          s.substitute({s:numarray.zeros((5,))})        arg1=Symbol(shape=(3, 2, 3, 4))
1738          fail("illegal substition was successful")        res=arg0/arg1
1739        except TypeError:        s1=numarray.array([[[[0.30209630840780743, 2.8852270658365136, -4.3903415927390474, 4.4845847234931409], [4.0134940566526396, -2.8333839823358611, 4.6472411139448848, -2.1676319616841253], [1.9906320590044926, -4.6737915213906014, -1.1957812424640659, 2.9170526831938375]], [[3.0964720689860776, -4.4876401431960087, 4.998637079152628, 2.8533787134807831], [3.7729255177559757, -0.73273448472817293, -0.90953567432588045, -3.0134320952733864], [1.2174883207447538, -4.969203447194892, 2.3012148245460748, 0.41593532301908454]]], [[[4.3069241488554848, 0.71234169023258431, 4.8556620140326565, 1.8082145124352156], [-3.5374500772725535, -1.7901952523193723, 4.6526679694301283, -4.4376188651696005], [2.7452568592588422, 0.53836096412756973, -2.8204068732647301, -4.8795271769078621]], [[-3.393174985031282, -0.64606900578155368, -4.4624221196219267, -2.3987951994472487], [1.4375945710104423, 3.8286850742584093, 1.170192112555676, 4.7719612212908586], [-2.396723494110776, -0.28740503184500277, -2.524991852119526, -3.3537880662496655]]], [[[0.024623766163323957, 4.327465668810266, 0.68752296336131913, -4.9843602135399125], [2.0216870258996078, 3.7344481342322595, 3.0194814105721566, -1.7317988533225126], [-1.6115633973347188, 4.7297708204656868, -2.137484390559826, 2.23042822074654]], [[-2.2883581231955787, 0.20442903998765516, -4.1920530024020906, 1.7748267430388616], [3.2690041254837414, 1.4972269287755724, -0.53465270543508492, -1.4714871726382519], [-3.1922247493051148, -2.1523014413616917, -3.9955444358316869, 3.5074148206456552]]]])
1740          pass        sub=res.substitute({arg1:s1})
1741          ref=Data(numarray.array([[[[12.431122710808555, 1.3015947080098942, -0.85537678583155596, 0.8374011222547626], [0.93569249817995759, -1.3254102880908314, 0.80809155114224152, -1.7324879622931901], [1.8865346126183558, -0.80350102547628632, -3.1405378734334621, 1.28739405425753]], [[1.2127983707372514, -0.83683097585119681, 0.75128404419717099, 1.3161226242269759], [0.99535394023185464, -5.1251802099813597, -4.1289158702687541, -1.2462189827307262], [3.0845439880708629, -0.75573405681742334, 1.6319190369549657, 9.0287986435992362]]], [[[0.87194390950620149, 5.2719029811010483, 0.77340561790478524, 2.0768533016816324], [-1.0616111035537803, -2.0977579263682209, 0.80714899601135559, -0.84626381724113975], [1.367958071986602, 6.9756102885086664, -1.3315086968117844, -0.76962298684838992]], [[-1.1067499603958972, -5.8126860237735665, -0.84156007200365257, -1.5655343487285083], [2.612277728386359, 0.98085797276682929, 3.2092134616238446, 0.78697124853915967], [-1.5668875819540604, -13.066564131434559, -1.4872904548770602, -1.1197476424022073]]], [[[152.5110438180339, 0.86780498511318693, 5.462212144798019, -0.75343597160138298], [1.8575557107454101, 1.0056094355349154, 1.2437222720268766, -2.1684944952439889], [-2.3302814437896617, 0.7939911726906822, -1.7569233707087559, 1.6837108880566276]], [[-1.6410876611635838, 18.370170307146662, -0.89583702261107834, 2.1159227485324705], [1.148789091767819, 2.5082345288638859, -7.0239919149828065, -2.552109423805994], [-1.1764197621477614, -1.7448282141760787, -0.93989601182298488, 1.0707020618702912]]]]),self.functionspace)
1742        dsdarg=s.diff(Symbol(shape=()))        ref.setTaggedValue(1,numarray.array([[[[-8.14172372777319, -0.85247525623201714, 0.56022626720078217, -0.54845316431455637], [-0.61282878397679552, 0.86807319359829038, -0.52925695524084293, 1.1346874034490511], [-1.2355797602629599, 0.52625040526085098, 2.0568851516421454, -0.84317458385549982]], [[-0.79431838151277434, 0.54807974876632271, -0.49205106177732016, -0.86199026810434565], [-0.65190385303429499, 3.3567202492850878, 2.7042201330470084, 0.8162071035529318], [-2.0202121370100472, 0.49496558319119838, -1.0688201101440833, -5.9133825528054009]]], [[[-0.57107685142078468, -3.4528158550336459, -0.50653951513273332, -1.3602283718672756], [0.69529876846570882, 1.373919788386156, -0.52863963179770801, 0.55425775781276576], [-0.89593972743977257, -4.5686534613860141, 0.87206732672207277, 0.50406209312172789]], [[0.72486231717691918, 3.8069999647501405, 0.55117705503954395, 1.0253416726877276], [-1.710902873337762, -0.64240976589408783, -2.101864006641482, -0.51542428116613925], [1.0262279684244842, 8.55790403684715, 0.97409608675446258, 0.73337510708806808]]], [[[-99.88661628455435, -0.5683660762380438, -3.5774582280300198, 0.49346045969051788], [-1.2166001219412634, -0.65862065660798974, -0.81457189092959847, 1.4202484760385075], [1.526210316208666, -0.52002195784918936, 1.1506912953840782, -1.1027410159889803]], [[1.0748250709997458, -12.031483796945189, 0.5867255687910351, -1.3858167800791799], [-0.75239571068836386, -1.6427601153607181, 4.6003408516094462, 1.671495836301927], [0.77049232914190546, 1.1427696116211459, 0.61558186168052509, -0.70125286229581629]]]]))
1743        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1744        self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")        self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1745        self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1746        dsdarg=s.diff(Symbol(shape=(2,)))     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1747        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")     def test_quotient_overloaded_taggedData_rank1_Symbol_rank0(self):
1748        self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")        arg0=Data(numarray.array([-0.24327728711711405, -3.6056280310023405]),self.functionspace)
1749        self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")        arg0.setTaggedValue(1,numarray.array([1.2730035138874616, -4.9781403275646703]))
1750        dsdarg=s.diff(Symbol(shape=(4, 5)))        arg1=Symbol(shape=())
1751        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")        res=arg0/arg1
1752        self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")        s1=numarray.array(3.2936567863)
1753        self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")        sub=res.substitute({arg1:s1})
1754        dsdarg=s.diff(Symbol(shape=(6, 2, 2)))        ref=Data(numarray.array([-0.073862367241458157, -1.0947188079822001]),self.functionspace)
1755        self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")        ref.setTaggedValue(1,numarray.array([0.38650156846396272, -1.5114326265776077]))
1756        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.")
1757        self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1758          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1759        dsds=s.diff(s)     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1760        self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")     def test_quotient_overloaded_taggedData_rank1_Symbol_rank1(self):
1761        self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")        arg0=Data(numarray.array([-0.60463512658968011, -0.5520360523301111]),self.functionspace)
1762        self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")        arg0.setTaggedValue(1,numarray.array([0.11065887825991361, 3.0681695057704825]))
1763        self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")        arg1=Symbol(shape=(2,))
1764        self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")        res=arg0/arg1
1765        self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")        s1=numarray.array([2.8726661800393423, -0.60963867151620033])
1766          sub=res.substitute({arg1:s1})
1767        self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")        ref=Data(numarray.array([-0.21047872906047141, 0.90551350844783396]),self.functionspace)
1768        sa=s.getSubstitutedArguments({s2:-10})        ref.setTaggedValue(1,numarray.array([0.038521314808112543, -5.032767193294676]))
1769        self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1770        self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")        self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1771          self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1772        self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1773        self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")     def test_quotient_overloaded_taggedData_rank2_Symbol_rank0(self):
1774        self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")        arg0=Data(numarray.array([[4.6512814709921759, 2.098614110043922, 1.895016528010288, 2.6977915277647391, 3.6655404112999896], [-0.48363850300250633, 2.3419850697805096, 2.1662412645385327, -1.9056051572421295, 2.497215246339004], [4.0815840480205914, -1.2641264348648407, 4.6318841341169641, -3.2591414662330562, 3.1161047733410481], [1.1685908100777258, -3.1575041951677232, -3.924192536790263, 3.2452072591922736, -2.7913771333657267]]),self.functionspace)
1775        self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")        arg0.setTaggedValue(1,numarray.array([[1.6044809956172026, -0.70199805786625014, 2.4770184375160351, 0.12526292043311571, 2.8453902277172185], [-2.6270109040291056, -2.5010942322759599, 4.1068958534289663, -2.6324008007168609, -0.32418555844239805], [3.1579467104423316, 1.086387193462234, 2.7518638232041726, 1.2174922150915348, -2.6071828689039336], [2.8178725134119729, 2.8056937296183913, 3.6699288938229007, 3.6037027182613244, 0.085370105743285407]]))
1776        self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")        arg1=Symbol(shape=())
1777        self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")        res=arg0/arg1
1778        self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")        s1=numarray.array(-1.90169499965)
1779        self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")        sub=res.substitute({arg1:s1})
1780     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        ref=Data(numarray.array([[-2.4458609145305559, -1.1035492602308241, -0.99648814786972451, -1.4186247154601728, -1.9275122519554746], [0.25431970063157006, -1.2315250711689083, -1.1391107748308005, 1.0020561433862574, -1.3131523439899424], [-2.1462874166364903, 0.66473668758670812, -2.4356608893536356, 1.7138087163503437, -1.6385933464205495], [-0.61449959656795783, 1.6603630948998709, 2.0635236131561041, -1.7064814598537041, 1.4678363953659475]]),self.functionspace)
1781     def test_Symbol_rank1_dd_nargs2(self):        ref.setTaggedValue(1,numarray.array([[-0.84371100303462776, 0.36914334738060162, -1.302531919144355, -0.065869090709308312, -1.4962390016522069], [1.3814049595325335, 1.3151920958627077, -2.1595975454495164, 1.3842392188058443, 0.17047189928077702], [-1.6605957900874224, -0.57127309777041291, -1.4470584524419186, -0.64021423799201049, 1.3709784531112286], [-1.4817689029716252, -1.4753647299597337, -1.9298199209159168, -1.8949951064352, -0.044891586589426921]]))
1782        s2=Symbol(shape=())        self.failUnless(isinstance(res,Symbol),"wrong type of result.")
1783        s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[1, -1.0])        self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1784        self.failUnlessEqual(s.getRank(),1,"wrong rank.")        self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1785        self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1786        self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")     def test_quotient_overloaded_taggedData_rank2_Symbol_rank2(self):
1787        self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")        arg0=Data(numarray.array([[-4.6443072321046044, 0.38417837617679673, 3.4279882680004921, 0.40710770023483178, 2.8688000401894911], [-0.63862918185682371, -1.0613480573447367, 2.5252641176738813, -2.3743507769422569, 2.2710813572310951], [2.0244163796382626, -0.45931604591878106, -4.2337337609916501, -3.5735365306689681, 1.5100285975528873], [1.9953319494326704, -1.458603065344283, -2.6914617917833263, 2.8267445415419745, -2.1176995723917171]]),self.functionspace)
1788   &nbs