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

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

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

revision 394 by gross, Mon Dec 12 05:26:10 2005 UTC revision 395 by gross, Wed Dec 21 02:41:59 2005 UTC
# Line 4  Test suite for the util.py module. Line 4  Test suite for the util.py module.
4    
5  The tests must be linked with a function space class object in the setUp method:  The tests must be linked with a function space class object in the setUp method:
6    
7  The test are grouped as  to run the use:
8    
9     Test_util_basic: some basic tests     from esys.bruce import Brick
10       class Test_utilOnBruce(Test_util_no_tagged_data):
11     Test_util_unary_no_tagged_data: test for unary operations with no         def setUp(self):
12     Test_util_unary_tagged_data: test for unary operations             self.domain = Brick(10,10,13)
13     Test_util_unary: test for unary operations             self.functionspace = ContinuousFunction(self.domain)
14       suite = unittest.TestSuite()
15     Test_util_reduction_no_tagged_data: test for unary operations with no     suite.addTest(unittest.makeSuite(Test_utilOnBruce))
16     Test_util_reduction_tagged_data: test for unary operations     unittest.TextTestRunner(verbosity=2).run(suite)
17     Test_util_reduction: test for unary operations  
18    For function spaces which support tagging there is the extended test case Test_util_with_tagged_data available.
19     Test_util_binary_no_tagged_data: test for unary operations with no  This test assumes that the functionspace has samples with tags equal to 1 and different from 1.
20     Test_util_binary_tagged_data: test for unary operations  
21     Test_util_binary: test for unary operations  @note: at this stage thsi test will not pass as it tests for functionlity that has not been implemented yet. It also does not test the full functionalitu of util.py yet.
22    
23     Test_util_overloaded_operations_no_tagged_data: test for unary operations with no  @var __author__: name of author
24     Test_util_overloaded_operations_tagged_data: test for unary operations  @var __licence__: licence agreement
25     Test_util_overloaded_operations test for unary operations  @var __url__: url entry point on documentation
26    @var __version__: version
27     Test_util_no_tagged_data: all test withour tagged data  @var __date__: date of the version
28     Test_util_tagged_data: all test with tagged data only  """
29     Test_util: all test  
30    __author__="Lutz Gross, l.gross@uq.edu.au"
31    __licence__="contact: esys@access.uq.edu.au"
32  to run the use:  __url__="http://www.iservo.edu.au/esys/escript"
33    __version__="$Revision$"
34     from esys.bruce import Brick  __date__="$Date$"
35     class Test_utilOnBruce(Test_util_no_tagged_data):  
36         def setUp(self):  import unittest
37             self.domain = Brick(10,10,13)  import numarray
38             self.functionspace = ContinuousFunction(self.domain)  from esys.escript import *
39     suite = unittest.TestSuite()  from esys.escript.test_util_base import Test_util_base
40     suite.addTest(unittest.makeSuite(Test_utilOnBruce))  from esys.escript.test_util_reduction_no_tagged_data import Test_util_reduction_no_tagged_data
41     unittest.TextTestRunner(verbosity=2).run(suite)  from esys.escript.test_util_reduction_with_tagged_data import Test_util_reduction_with_tagged_data
42    from esys.escript.test_util_overloaded_binary_no_tagged_data import Test_util_overloaded_binary_no_tagged_data
43  For function spaces which support tagging there is the extended test case Test_util_with_tagged_data available.  from esys.escript.test_util_overloaded_binary_with_tagged_data import Test_util_overloaded_binary_with_tagged_data
44  This test assumes that the functionspace has samples with tags equal to 1 and different from 1.  from esys.escript.test_util_unary_no_tagged_data import Test_util_unary_no_tagged_data
45    from esys.escript.test_util_unary_with_tagged_data import Test_util_unary_with_tagged_data
46  @note: at this stage thsi test will not pass as it tests for functionlity that has not been implemented yet. It also does not test the full functionalitu of util.py yet.  from esys.escript.test_util_binary_no_tagged_data import Test_util_binary_no_tagged_data
47    from esys.escript.test_util_binary_with_tagged_data import Test_util_binary_with_tagged_data
48  @var __author__: name of author  
49  @var __licence__: licence agreement  class Test_util_reduction(Test_util_reduction_no_tagged_data,Test_util_reduction_with_tagged_data):
50  @var __url__: url entry point on documentation     """ test for reduction operation Lsup,sup,inf for all data types"""
51  @var __version__: version     pass
52  @var __date__: date of the version  class Test_util_unary(Test_util_unary_no_tagged_data,Test_util_unary_with_tagged_data):
53  """     """ all unary tests """
54       pass
55  __author__="Lutz Gross, l.gross@uq.edu.au"  class Test_util_binary(Test_util_binary_no_tagged_data,Test_util_binary_with_tagged_data):
56  __licence__="contact: esys@access.uq.edu.au"     """
57  __url__="http://www.iservo.edu.au/esys/escript"     test for all binary operation
58  __version__="$Revision: 313 $"     """
59  __date__="$Date$"     pass
60    class Test_util_overloaded_binary(Test_util_overloaded_binary_no_tagged_data,Test_util_overloaded_binary_with_tagged_data):
61  import unittest     """test for all overloaded operation"""
62  import numarray     pass
63  from esys.escript import *  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):
64       """test for all operations without tagged data"""
65  class Test_util_base(unittest.TestCase):     pass
66     """  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):
67     basic tests on util.py     """all tests without tagged data"""
68     """     pass
69     RES_TOL=1.e-7 # RES_TOLerance to compare results  
70     DIFF_TOL=1.e-7 # RES_TOLerance to derivatices  class Test_util(Test_util_unary,Test_util_reduction,Test_util_binary,Test_util_overloaded_binary):
71  #=========================================================     """all tests"""
72  #  constants     pass
73  #=========================================================  
74     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  class Test_util_binary_still_failing(Test_util_base):
75     def test_kronecker_1(self):     """
76        val=kronecker(d=1)     these binary opereations still fail! (see Mantis 0000053)
77        self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")     """
       self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_kronecker_2(self):  
       val=kronecker(d=2)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  
       self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")  
       self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")  
       self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_kronecker_3(self):  
       val=kronecker(d=3)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  
       self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")  
       self.failUnlessEqual(val[0,2],0.0,"wrong value for (0,2)")  
       self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")  
       self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")  
       self.failUnlessEqual(val[1,2],0.0,"wrong value for (1,2)")  
       self.failUnlessEqual(val[2,0],0.0,"wrong value for (2,0)")  
       self.failUnlessEqual(val[2,1],0.0,"wrong value for (2,1)")  
       self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_kronecker_domain(self):  
       val=kronecker(d=self.functionspace)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_identityTensor_1(self):  
       val=identityTensor(d=1)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_identityTensor_2(self):  
       val=identityTensor(d=2)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  
       self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")  
       self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")  
       self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_identityTensor_3(self):  
       val=identityTensor(d=3)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val[0,0],1.0,"wrong value for (0,0)")  
       self.failUnlessEqual(val[0,1],0.0,"wrong value for (0,1)")  
       self.failUnlessEqual(val[0,2],0.0,"wrong value for (0,2)")  
       self.failUnlessEqual(val[1,0],0.0,"wrong value for (1,0)")  
       self.failUnlessEqual(val[1,1],1.0,"wrong value for (1,1)")  
       self.failUnlessEqual(val[1,2],0.0,"wrong value for (1,2)")  
       self.failUnlessEqual(val[2,0],0.0,"wrong value for (2,0)")  
       self.failUnlessEqual(val[2,1],0.0,"wrong value for (2,1)")  
       self.failUnlessEqual(val[2,2],1.0,"wrong value for (2,2)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_identityTensor_domain(self):  
       val=identityTensor(d=self.functionspace)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_identityTensor4_1(self):  
       val=identityTensor4(d=1)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_identityTensor4_2(self):  
       val=identityTensor4(d=2)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")  
       self.failUnlessEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")  
       self.failUnlessEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")  
       self.failUnlessEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")  
       self.failUnlessEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")  
       self.failUnlessEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")  
       self.failUnlessEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")  
       self.failUnlessEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")  
       self.failUnlessEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")  
       self.failUnlessEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")  
       self.failUnlessEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")  
       self.failUnlessEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")  
       self.failUnlessEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")  
       self.failUnlessEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")  
       self.failUnlessEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")  
       self.failUnlessEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_identityTensor4_3(self):  
       val=identityTensor4(d=3)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")  
       self.failUnlessEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")  
       self.failUnlessEqual(val[0,0,0,2],0.0,"wrong value for (0,0,0,2)")  
       self.failUnlessEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")  
       self.failUnlessEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")  
       self.failUnlessEqual(val[0,0,1,2],0.0,"wrong value for (0,0,1,2)")  
       self.failUnlessEqual(val[0,0,2,0],0.0,"wrong value for (0,0,2,0)")  
       self.failUnlessEqual(val[0,0,2,1],0.0,"wrong value for (0,0,2,1)")  
       self.failUnlessEqual(val[0,0,2,2],0.0,"wrong value for (0,0,2,2)")  
       self.failUnlessEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")  
       self.failUnlessEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")  
       self.failUnlessEqual(val[0,1,0,2],0.0,"wrong value for (0,1,0,2)")  
       self.failUnlessEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")  
       self.failUnlessEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")  
       self.failUnlessEqual(val[0,1,1,2],0.0,"wrong value for (0,1,1,2)")  
       self.failUnlessEqual(val[0,1,2,0],0.0,"wrong value for (0,1,2,0)")  
       self.failUnlessEqual(val[0,1,2,1],0.0,"wrong value for (0,1,2,1)")  
       self.failUnlessEqual(val[0,1,2,2],0.0,"wrong value for (0,1,2,2)")  
       self.failUnlessEqual(val[0,2,0,0],0.0,"wrong value for (0,2,0,0)")  
       self.failUnlessEqual(val[0,2,0,1],0.0,"wrong value for (0,2,0,1)")  
       self.failUnlessEqual(val[0,2,0,2],1.0,"wrong value for (0,2,0,2)")  
       self.failUnlessEqual(val[0,2,1,0],0.0,"wrong value for (0,2,1,0)")  
       self.failUnlessEqual(val[0,2,1,1],0.0,"wrong value for (0,2,1,1)")  
       self.failUnlessEqual(val[0,2,1,2],0.0,"wrong value for (0,2,1,2)")  
       self.failUnlessEqual(val[0,2,2,0],0.0,"wrong value for (0,2,2,0)")  
       self.failUnlessEqual(val[0,2,2,1],0.0,"wrong value for (0,2,2,1)")  
       self.failUnlessEqual(val[0,2,2,2],0.0,"wrong value for (0,2,2,2)")  
       self.failUnlessEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")  
       self.failUnlessEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")  
       self.failUnlessEqual(val[1,0,0,2],0.0,"wrong value for (1,0,0,2)")  
       self.failUnlessEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")  
       self.failUnlessEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")  
       self.failUnlessEqual(val[1,0,1,2],0.0,"wrong value for (1,0,1,2)")  
       self.failUnlessEqual(val[1,0,2,0],0.0,"wrong value for (1,0,2,0)")  
       self.failUnlessEqual(val[1,0,2,1],0.0,"wrong value for (1,0,2,1)")  
       self.failUnlessEqual(val[1,0,2,2],0.0,"wrong value for (1,0,2,2)")  
       self.failUnlessEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")  
       self.failUnlessEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")  
       self.failUnlessEqual(val[1,1,0,2],0.0,"wrong value for (1,1,0,2)")  
       self.failUnlessEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")  
       self.failUnlessEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")  
       self.failUnlessEqual(val[1,1,1,2],0.0,"wrong value for (1,1,1,2)")  
       self.failUnlessEqual(val[1,1,2,0],0.0,"wrong value for (1,1,2,0)")  
       self.failUnlessEqual(val[1,1,2,1],0.0,"wrong value for (1,1,2,1)")  
       self.failUnlessEqual(val[1,1,2,2],0.0,"wrong value for (1,1,2,2)")  
       self.failUnlessEqual(val[1,2,0,0],0.0,"wrong value for (1,2,0,0)")  
       self.failUnlessEqual(val[1,2,0,1],0.0,"wrong value for (1,2,0,1)")  
       self.failUnlessEqual(val[1,2,0,2],0.0,"wrong value for (1,2,0,2)")  
       self.failUnlessEqual(val[1,2,1,0],0.0,"wrong value for (1,2,1,0)")  
       self.failUnlessEqual(val[1,2,1,1],0.0,"wrong value for (1,2,1,1)")  
       self.failUnlessEqual(val[1,2,1,2],1.0,"wrong value for (1,2,1,2)")  
       self.failUnlessEqual(val[1,2,2,0],0.0,"wrong value for (1,2,2,0)")  
       self.failUnlessEqual(val[1,2,2,1],0.0,"wrong value for (1,2,2,1)")  
       self.failUnlessEqual(val[1,2,2,2],0.0,"wrong value for (1,2,2,2)")  
       self.failUnlessEqual(val[2,0,0,0],0.0,"wrong value for (2,0,0,0)")  
       self.failUnlessEqual(val[2,0,0,1],0.0,"wrong value for (2,0,0,1)")  
       self.failUnlessEqual(val[2,0,0,2],0.0,"wrong value for (2,0,0,2)")  
       self.failUnlessEqual(val[2,0,1,0],0.0,"wrong value for (2,0,1,0)")  
       self.failUnlessEqual(val[2,0,1,1],0.0,"wrong value for (2,0,1,1)")  
       self.failUnlessEqual(val[2,0,1,2],0.0,"wrong value for (2,0,1,2)")  
       self.failUnlessEqual(val[2,0,2,0],1.0,"wrong value for (2,0,2,0)")  
       self.failUnlessEqual(val[2,0,2,1],0.0,"wrong value for (2,0,2,1)")  
       self.failUnlessEqual(val[2,0,2,2],0.0,"wrong value for (2,0,2,2)")  
       self.failUnlessEqual(val[2,1,0,0],0.0,"wrong value for (2,1,0,0)")  
       self.failUnlessEqual(val[2,1,0,1],0.0,"wrong value for (2,1,0,1)")  
       self.failUnlessEqual(val[2,1,0,2],0.0,"wrong value for (2,1,0,2)")  
       self.failUnlessEqual(val[2,1,1,0],0.0,"wrong value for (2,1,1,0)")  
       self.failUnlessEqual(val[2,1,1,1],0.0,"wrong value for (2,1,1,1)")  
       self.failUnlessEqual(val[2,1,1,2],0.0,"wrong value for (2,1,1,2)")  
       self.failUnlessEqual(val[2,1,2,0],0.0,"wrong value for (2,1,2,0)")  
       self.failUnlessEqual(val[2,1,2,1],1.0,"wrong value for (2,1,2,1)")  
       self.failUnlessEqual(val[2,1,2,2],0.0,"wrong value for (2,1,2,2)")  
       self.failUnlessEqual(val[2,2,0,0],0.0,"wrong value for (2,2,0,0)")  
       self.failUnlessEqual(val[2,2,0,1],0.0,"wrong value for (2,2,0,1)")  
       self.failUnlessEqual(val[2,2,0,2],0.0,"wrong value for (2,2,0,2)")  
       self.failUnlessEqual(val[2,2,1,0],0.0,"wrong value for (2,2,1,0)")  
       self.failUnlessEqual(val[2,2,1,1],0.0,"wrong value for (2,2,1,1)")  
       self.failUnlessEqual(val[2,2,1,2],0.0,"wrong value for (2,2,1,2)")  
       self.failUnlessEqual(val[2,2,2,0],0.0,"wrong value for (2,2,2,0)")  
       self.failUnlessEqual(val[2,2,2,1],0.0,"wrong value for (2,2,2,1)")  
       self.failUnlessEqual(val[2,2,2,2],1.0,"wrong value for (2,2,2,2)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_identityTensor4_domain(self):  
       val=identityTensor4(d=self.functionspace)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val.shape,(self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_unitVector_1(self):  
       val=unitVector(i=0,d=1)  
       self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_unitVector_2(self):  
       val=unitVector(i=0,d=2)  
       self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")  
       self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 0 vector")  
       val=unitVector(i=1,d=2)  
       self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 1 vector")  
       self.failUnlessEqual(val[1],1.0,"wrong value for 1 in the 1 vector")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_unitVector_3(self):  
       val=unitVector(i=0,d=3)  
       self.failUnlessEqual(val[0],1.0,"wrong value for 0 in the 0 vector")  
       self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 0 vector")  
       self.failUnlessEqual(val[2],0.0,"wrong value for 2 in the 0 vector")  
       val=unitVector(i=1,d=3)  
       self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 1 vector")  
       self.failUnlessEqual(val[1],1.0,"wrong value for 1 in the 1 vector")  
       self.failUnlessEqual(val[2],0.0,"wrong value for 2 in the 1 vector")  
       val=unitVector(i=2,d=3)  
       self.failUnlessEqual(val[0],0.0,"wrong value for 0 in the 2 vector")  
       self.failUnlessEqual(val[1],0.0,"wrong value for 1 in the 2 vector")  
       self.failUnlessEqual(val[2],1.0,"wrong value for 2 in the 2 vector")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_unitVector_domain(self):  
       val=unitVector(i=0,d=self.functionspace)  
       self.failUnless(isinstance(val,numarray.ArrayType),"wrong type of result.")  
       self.failUnlessEqual(val.shape,(self.functionspace.getDim(),),"wrong shape.")  
 #=========================================================  
 #  Symbols  
 #=========================================================  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_dNone_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=None,args=[])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_dNone_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=None,args=[s2])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_dNone_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=None,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_dd_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_dd_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[s2])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_dd_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=self.functionspace.getDim(),args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d1_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=1,args=[])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d1_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=1,args=[s2])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d1_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=1,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=1)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d2_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=2,args=[])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d2_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=2,args=[s2])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d2_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=2,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=2)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d3_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=3,args=[])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d3_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=3,args=[s2])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank0_d3_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(),dim=3,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),0,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros(())})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,float),"ds/ds() has wrong type.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(3, 2, 3, 4)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(3, 2, 3, 4) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(3, 2, 3, 4),"ds/ds(3, 2, 3, 4) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(3, 2, 3, 4) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,float),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds,1.,"ds/ds has wrong value.")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failUnless(s.isAppropriateValue(10.),"10. is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(10),"10 is appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(),dim=3)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(),dim=4)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros(())),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_dNone_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=None,args=[])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_dNone_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=None,args=[s2])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_dNone_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=None,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_dd_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_dd_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[s2])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_dd_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=self.functionspace.getDim(),args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(2,),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d1_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=1,args=[])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d1_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=1,args=[s2])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d1_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=1,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=1)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d2_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=2,args=[])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d2_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=2,args=[s2])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d2_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=2,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),2,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=2)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d3_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=3,args=[])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d3_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=3,args=[s2])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank1_d3_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(2,),dim=3,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),1,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(2,),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),3,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((2,))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(2,),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2,),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(6, 2, 2)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(6, 2, 2) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(2, 6, 2, 2),"ds/ds(6, 2, 2) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(6, 2, 2) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(2, 2),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0],1.0,"ds/ds has wrong value at (0,0).")  
       self.failUnlessEqual(dsds[0,1],0.0,"ds/ds has wrong value at (0,1).")  
       self.failUnlessEqual(dsds[1,0],0.0,"ds/ds has wrong value at (1,0).")  
       self.failUnlessEqual(dsds[1,1],1.0,"ds/ds has wrong value at (1,1).")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(2,),dim=3)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(2,),dim=4)),"Symbol is not appropriate substitute (dim)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((2,))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank2_dNone_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(4, 5),dim=None,args=[])  
       self.failUnlessEqual(s.getRank(),2,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((4, 5))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")  
       self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")  
       self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")  
       self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")  
       self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")  
       self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")  
       self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")  
       self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")  
       self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")  
       self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")  
       self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")  
       self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")  
       self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")  
       self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")  
       self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")  
       self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")  
       self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")  
       self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")  
       self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")  
       self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")  
       self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")  
       self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")  
       self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).")  
       self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).")  
       self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).")  
       self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).")  
       self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).")  
       self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).")  
       self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).")  
       self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).")  
       self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).")  
       self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).")  
       self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).")  
       self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).")  
       self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).")  
       self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).")  
       self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).")  
       self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).")  
       self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).")  
       self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).")  
       self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).")  
       self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).")  
       self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).")  
       self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).")  
       self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).")  
       self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).")  
       self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).")  
       self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).")  
       self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).")  
       self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).")  
       self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).")  
       self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).")  
       self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).")  
       self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).")  
       self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).")  
       self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).")  
       self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).")  
       self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).")  
       self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).")  
       self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).")  
       self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).")  
       self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).")  
       self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).")  
       self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).")  
       self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).")  
       self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).")  
       self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).")  
       self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).")  
       self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).")  
       self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).")  
       self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).")  
       self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).")  
       self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).")  
       self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).")  
       self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).")  
       self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).")  
       self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).")  
       self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).")  
       self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).")  
       self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).")  
       self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).")  
       self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).")  
       self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).")  
       self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).")  
       self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).")  
       self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).")  
       self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).")  
       self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).")  
       self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).")  
       self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).")  
       self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).")  
       self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).")  
       self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).")  
       self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).")  
       self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).")  
       self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).")  
       self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).")  
       self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).")  
       self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).")  
       self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).")  
       self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).")  
       self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).")  
       self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).")  
       self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).")  
       self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).")  
       self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).")  
       self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).")  
       self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).")  
       self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).")  
       self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).")  
       self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).")  
       self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).")  
       self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).")  
       self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).")  
       self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).")  
       self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).")  
       self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).")  
       self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).")  
       self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).")  
       self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).")  
       self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).")  
       self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).")  
       self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).")  
       self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).")  
       self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).")  
       self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).")  
       self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).")  
       self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).")  
       self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).")  
       self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).")  
       self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).")  
       self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).")  
       self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).")  
       self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).")  
       self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).")  
       self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).")  
       self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).")  
       self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).")  
       self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).")  
       self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).")  
       self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).")  
       self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).")  
       self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).")  
       self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).")  
       self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).")  
       self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).")  
       self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).")  
       self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).")  
       self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).")  
       self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).")  
       self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).")  
       self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).")  
       self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).")  
       self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).")  
       self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).")  
       self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).")  
       self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).")  
       self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).")  
       self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).")  
       self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).")  
       self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).")  
       self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).")  
       self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).")  
       self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).")  
       self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).")  
       self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).")  
       self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).")  
       self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).")  
       self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).")  
       self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).")  
       self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).")  
       self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).")  
       self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).")  
       self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).")  
       self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).")  
       self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).")  
       self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).")  
       self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).")  
       self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).")  
       self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).")  
       self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).")  
       self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).")  
       self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).")  
       self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).")  
       self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).")  
       self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).")  
       self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).")  
       self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).")  
       self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).")  
       self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).")  
       self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).")  
       self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).")  
       self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).")  
       self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).")  
       self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).")  
       self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).")  
       self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).")  
       self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).")  
       self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).")  
       self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).")  
       self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).")  
       self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).")  
       self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).")  
       self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).")  
       self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).")  
       self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).")  
       self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).")  
       self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).")  
       self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).")  
       self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).")  
       self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).")  
       self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).")  
       self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).")  
       self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).")  
       self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).")  
       self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).")  
       self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).")  
       self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).")  
       self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).")  
       self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).")  
       self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).")  
       self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).")  
       self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).")  
       self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).")  
       self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).")  
       self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).")  
       self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).")  
       self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).")  
       self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).")  
       self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).")  
       self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).")  
       self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).")  
       self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).")  
       self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).")  
       self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).")  
       self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).")  
       self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).")  
       self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).")  
       self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).")  
       self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).")  
       self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).")  
       self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).")  
       self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).")  
       self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).")  
       self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).")  
       self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).")  
       self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).")  
       self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).")  
       self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).")  
       self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).")  
       self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).")  
       self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).")  
       self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).")  
       self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).")  
       self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).")  
       self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).")  
       self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).")  
       self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).")  
       self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).")  
       self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).")  
       self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).")  
       self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).")  
       self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).")  
       self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).")  
       self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).")  
       self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).")  
       self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).")  
       self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).")  
       self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).")  
       self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).")  
       self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).")  
       self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).")  
       self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).")  
       self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).")  
       self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).")  
       self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).")  
       self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).")  
       self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).")  
       self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).")  
       self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).")  
       self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).")  
       self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).")  
       self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).")  
       self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).")  
       self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).")  
       self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).")  
       self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).")  
       self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).")  
       self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).")  
       self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).")  
       self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).")  
       self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).")  
       self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).")  
       self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).")  
       self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).")  
       self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).")  
       self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).")  
       self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).")  
       self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).")  
       self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).")  
       self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).")  
       self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).")  
       self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).")  
       self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).")  
       self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).")  
       self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).")  
       self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).")  
       self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).")  
       self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).")  
       self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).")  
       self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).")  
       self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).")  
       self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).")  
       self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).")  
       self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).")  
       self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).")  
       self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).")  
       self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).")  
       self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).")  
       self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).")  
       self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).")  
       self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).")  
       self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).")  
       self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).")  
       self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).")  
       self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).")  
       self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).")  
       self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).")  
       self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).")  
       self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).")  
       self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).")  
       self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).")  
       self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).")  
       self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).")  
       self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).")  
       self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).")  
       self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).")  
       self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).")  
       self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).")  
       self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).")  
       self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).")  
       self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).")  
       self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).")  
       self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).")  
       self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).")  
       self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).")  
       self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).")  
       self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).")  
       self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).")  
       self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).")  
       self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).")  
       self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).")  
       self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).")  
       self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).")  
       self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).")  
       self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).")  
       self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).")  
       self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).")  
       self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).")  
       self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).")  
       self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).")  
       self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).")  
       self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).")  
       self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).")  
       self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).")  
       self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).")  
       self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).")  
       self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).")  
       self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).")  
       self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).")  
       self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).")  
       self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).")  
       self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).")  
       self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).")  
       self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).")  
       self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).")  
       self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).")  
       self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).")  
       self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).")  
       self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).")  
       self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).")  
       self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).")  
       self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).")  
       self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).")  
       self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).")  
       self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).")  
       self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).")  
       self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).")  
       self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).")  
       self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).")  
       self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).")  
       self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).")  
       self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).")  
       self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).")  
       self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).")  
       self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).")  
       self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).")  
       self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).")  
       self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).")  
       self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank2_dNone_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(4, 5),dim=None,args=[s2])  
       self.failUnlessEqual(s.getRank(),2,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((4, 5))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")  
       self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")  
       self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")  
       self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")  
       self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")  
       self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")  
       self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")  
       self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")  
       self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")  
       self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")  
       self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")  
       self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")  
       self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")  
       self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")  
       self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")  
       self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")  
       self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")  
       self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")  
       self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")  
       self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")  
       self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")  
       self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")  
       self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).")  
       self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).")  
       self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).")  
       self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).")  
       self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).")  
       self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).")  
       self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).")  
       self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).")  
       self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).")  
       self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).")  
       self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).")  
       self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).")  
       self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).")  
       self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).")  
       self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).")  
       self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).")  
       self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).")  
       self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).")  
       self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).")  
       self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).")  
       self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).")  
       self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).")  
       self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).")  
       self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).")  
       self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).")  
       self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).")  
       self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).")  
       self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).")  
       self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).")  
       self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).")  
       self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).")  
       self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).")  
       self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).")  
       self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).")  
       self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).")  
       self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).")  
       self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).")  
       self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).")  
       self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).")  
       self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).")  
       self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).")  
       self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).")  
       self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).")  
       self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).")  
       self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).")  
       self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).")  
       self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).")  
       self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).")  
       self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).")  
       self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).")  
       self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).")  
       self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).")  
       self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).")  
       self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).")  
       self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).")  
       self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).")  
       self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).")  
       self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).")  
       self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).")  
       self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).")  
       self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).")  
       self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).")  
       self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).")  
       self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).")  
       self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).")  
       self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).")  
       self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).")  
       self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).")  
       self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).")  
       self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).")  
       self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).")  
       self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).")  
       self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).")  
       self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).")  
       self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).")  
       self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).")  
       self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).")  
       self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).")  
       self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).")  
       self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).")  
       self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).")  
       self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).")  
       self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).")  
       self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).")  
       self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).")  
       self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).")  
       self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).")  
       self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).")  
       self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).")  
       self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).")  
       self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).")  
       self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).")  
       self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).")  
       self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).")  
       self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).")  
       self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).")  
       self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).")  
       self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).")  
       self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).")  
       self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).")  
       self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).")  
       self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).")  
       self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).")  
       self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).")  
       self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).")  
       self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).")  
       self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).")  
       self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).")  
       self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).")  
       self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).")  
       self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).")  
       self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).")  
       self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).")  
       self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).")  
       self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).")  
       self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).")  
       self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).")  
       self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).")  
       self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).")  
       self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).")  
       self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).")  
       self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).")  
       self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).")  
       self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).")  
       self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).")  
       self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).")  
       self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).")  
       self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).")  
       self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).")  
       self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).")  
       self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).")  
       self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).")  
       self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).")  
       self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).")  
       self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).")  
       self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).")  
       self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).")  
       self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).")  
       self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).")  
       self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).")  
       self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).")  
       self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).")  
       self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).")  
       self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).")  
       self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).")  
       self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).")  
       self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).")  
       self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).")  
       self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).")  
       self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).")  
       self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).")  
       self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).")  
       self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).")  
       self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).")  
       self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).")  
       self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).")  
       self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).")  
       self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).")  
       self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).")  
       self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).")  
       self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).")  
       self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).")  
       self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).")  
       self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).")  
       self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).")  
       self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).")  
       self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).")  
       self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).")  
       self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).")  
       self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).")  
       self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).")  
       self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).")  
       self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).")  
       self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).")  
       self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).")  
       self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).")  
       self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).")  
       self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).")  
       self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).")  
       self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).")  
       self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).")  
       self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).")  
       self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).")  
       self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).")  
       self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).")  
       self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).")  
       self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).")  
       self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).")  
       self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).")  
       self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).")  
       self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).")  
       self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).")  
       self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).")  
       self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).")  
       self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).")  
       self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).")  
       self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).")  
       self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).")  
       self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).")  
       self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).")  
       self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).")  
       self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).")  
       self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).")  
       self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).")  
       self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).")  
       self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).")  
       self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).")  
       self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).")  
       self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).")  
       self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).")  
       self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).")  
       self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).")  
       self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).")  
       self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).")  
       self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).")  
       self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).")  
       self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).")  
       self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).")  
       self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).")  
       self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).")  
       self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).")  
       self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).")  
       self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).")  
       self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).")  
       self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).")  
       self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).")  
       self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).")  
       self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).")  
       self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).")  
       self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).")  
       self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).")  
       self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).")  
       self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).")  
       self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).")  
       self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).")  
       self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).")  
       self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).")  
       self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).")  
       self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).")  
       self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).")  
       self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).")  
       self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).")  
       self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).")  
       self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).")  
       self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).")  
       self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).")  
       self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).")  
       self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).")  
       self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).")  
       self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).")  
       self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).")  
       self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).")  
       self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).")  
       self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).")  
       self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).")  
       self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).")  
       self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).")  
       self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).")  
       self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).")  
       self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).")  
       self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).")  
       self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).")  
       self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).")  
       self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).")  
       self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).")  
       self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).")  
       self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).")  
       self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).")  
       self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).")  
       self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).")  
       self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).")  
       self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).")  
       self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).")  
       self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).")  
       self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).")  
       self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).")  
       self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).")  
       self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).")  
       self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).")  
       self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).")  
       self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).")  
       self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).")  
       self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).")  
       self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).")  
       self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).")  
       self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).")  
       self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).")  
       self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).")  
       self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).")  
       self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).")  
       self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).")  
       self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).")  
       self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).")  
       self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).")  
       self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).")  
       self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).")  
       self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).")  
       self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).")  
       self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).")  
       self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).")  
       self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).")  
       self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).")  
       self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).")  
       self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).")  
       self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).")  
       self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).")  
       self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).")  
       self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).")  
       self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).")  
       self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).")  
       self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).")  
       self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).")  
       self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).")  
       self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).")  
       self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).")  
       self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).")  
       self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).")  
       self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).")  
       self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).")  
       self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).")  
       self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).")  
       self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).")  
       self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).")  
       self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).")  
       self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).")  
       self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).")  
       self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).")  
       self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).")  
       self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).")  
       self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).")  
       self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).")  
       self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).")  
       self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).")  
       self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).")  
       self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).")  
       self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).")  
       self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).")  
       self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).")  
       self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).")  
       self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).")  
       self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).")  
       self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).")  
       self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).")  
       self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).")  
       self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).")  
       self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).")  
       self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).")  
       self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).")  
       self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).")  
       self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).")  
       self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).")  
       self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).")  
       self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).")  
       self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).")  
       self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).")  
       self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).")  
       self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).")  
       self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).")  
       self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).")  
       self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).")  
       self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).")  
       self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).")  
       self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).")  
       self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).")  
       self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).")  
       self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).")  
       self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).")  
       self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).")  
       self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).")  
       self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).")  
       self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).")  
       self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).")  
       self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).")  
       self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).")  
       self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).")  
       self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).")  
       self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).")  
       self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank2_dNone_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(4, 5),dim=None,args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),2,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),None,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((4, 5))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")  
       self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")  
       self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")  
       self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")  
       self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")  
       self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")  
       self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")  
       self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")  
       self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")  
       self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")  
       self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")  
       self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")  
       self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")  
       self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")  
       self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")  
       self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")  
       self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")  
       self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")  
       self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")  
       self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")  
       self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")  
       self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")  
       self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).")  
       self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).")  
       self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).")  
       self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).")  
       self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).")  
       self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).")  
       self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).")  
       self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).")  
       self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).")  
       self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).")  
       self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).")  
       self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).")  
       self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).")  
       self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).")  
       self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).")  
       self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).")  
       self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).")  
       self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).")  
       self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).")  
       self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).")  
       self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).")  
       self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).")  
       self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).")  
       self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).")  
       self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).")  
       self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).")  
       self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).")  
       self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).")  
       self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).")  
       self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).")  
       self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).")  
       self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).")  
       self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).")  
       self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).")  
       self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).")  
       self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).")  
       self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).")  
       self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).")  
       self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).")  
       self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).")  
       self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).")  
       self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).")  
       self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).")  
       self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).")  
       self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).")  
       self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).")  
       self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).")  
       self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).")  
       self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).")  
       self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).")  
       self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).")  
       self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).")  
       self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).")  
       self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).")  
       self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).")  
       self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).")  
       self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).")  
       self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).")  
       self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).")  
       self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).")  
       self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).")  
       self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).")  
       self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).")  
       self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).")  
       self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).")  
       self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).")  
       self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).")  
       self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).")  
       self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).")  
       self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).")  
       self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).")  
       self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).")  
       self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).")  
       self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).")  
       self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).")  
       self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).")  
       self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).")  
       self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).")  
       self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).")  
       self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).")  
       self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).")  
       self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).")  
       self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).")  
       self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).")  
       self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).")  
       self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).")  
       self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).")  
       self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).")  
       self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).")  
       self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).")  
       self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).")  
       self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).")  
       self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).")  
       self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).")  
       self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).")  
       self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).")  
       self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).")  
       self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).")  
       self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).")  
       self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).")  
       self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).")  
       self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).")  
       self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).")  
       self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).")  
       self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).")  
       self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).")  
       self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).")  
       self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).")  
       self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).")  
       self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).")  
       self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).")  
       self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).")  
       self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).")  
       self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).")  
       self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).")  
       self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).")  
       self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).")  
       self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).")  
       self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).")  
       self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).")  
       self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).")  
       self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).")  
       self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).")  
       self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).")  
       self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).")  
       self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).")  
       self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).")  
       self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).")  
       self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).")  
       self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).")  
       self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).")  
       self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).")  
       self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).")  
       self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).")  
       self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).")  
       self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).")  
       self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).")  
       self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).")  
       self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).")  
       self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).")  
       self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).")  
       self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).")  
       self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).")  
       self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).")  
       self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).")  
       self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).")  
       self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).")  
       self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).")  
       self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).")  
       self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).")  
       self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).")  
       self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).")  
       self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).")  
       self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).")  
       self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).")  
       self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).")  
       self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).")  
       self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).")  
       self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).")  
       self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).")  
       self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).")  
       self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).")  
       self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).")  
       self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).")  
       self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).")  
       self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).")  
       self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).")  
       self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).")  
       self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).")  
       self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).")  
       self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).")  
       self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).")  
       self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).")  
       self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).")  
       self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).")  
       self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).")  
       self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).")  
       self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).")  
       self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).")  
       self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).")  
       self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).")  
       self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).")  
       self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).")  
       self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).")  
       self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).")  
       self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).")  
       self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).")  
       self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).")  
       self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).")  
       self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).")  
       self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).")  
       self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).")  
       self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).")  
       self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).")  
       self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).")  
       self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).")  
       self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).")  
       self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).")  
       self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).")  
       self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).")  
       self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).")  
       self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).")  
       self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).")  
       self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).")  
       self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).")  
       self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).")  
       self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).")  
       self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).")  
       self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).")  
       self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).")  
       self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).")  
       self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).")  
       self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).")  
       self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).")  
       self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).")  
       self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).")  
       self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).")  
       self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).")  
       self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).")  
       self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).")  
       self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).")  
       self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).")  
       self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).")  
       self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).")  
       self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).")  
       self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).")  
       self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).")  
       self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).")  
       self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).")  
       self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).")  
       self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).")  
       self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).")  
       self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).")  
       self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).")  
       self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).")  
       self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).")  
       self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).")  
       self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).")  
       self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).")  
       self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).")  
       self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).")  
       self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).")  
       self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).")  
       self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).")  
       self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).")  
       self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).")  
       self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).")  
       self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).")  
       self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).")  
       self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).")  
       self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).")  
       self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).")  
       self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).")  
       self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).")  
       self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).")  
       self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).")  
       self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).")  
       self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).")  
       self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).")  
       self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).")  
       self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).")  
       self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).")  
       self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).")  
       self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).")  
       self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).")  
       self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).")  
       self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).")  
       self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).")  
       self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).")  
       self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).")  
       self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).")  
       self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).")  
       self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).")  
       self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).")  
       self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).")  
       self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).")  
       self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).")  
       self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).")  
       self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).")  
       self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).")  
       self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).")  
       self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).")  
       self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).")  
       self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).")  
       self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).")  
       self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).")  
       self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).")  
       self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).")  
       self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).")  
       self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).")  
       self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).")  
       self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).")  
       self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).")  
       self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).")  
       self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).")  
       self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).")  
       self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).")  
       self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).")  
       self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).")  
       self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).")  
       self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).")  
       self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).")  
       self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).")  
       self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).")  
       self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).")  
       self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).")  
       self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).")  
       self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).")  
       self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).")  
       self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).")  
       self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).")  
       self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).")  
       self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).")  
       self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).")  
       self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).")  
       self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).")  
       self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).")  
       self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).")  
       self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).")  
       self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).")  
       self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).")  
       self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).")  
       self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).")  
       self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).")  
       self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).")  
       self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).")  
       self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).")  
       self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).")  
       self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).")  
       self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).")  
       self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).")  
       self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).")  
       self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).")  
       self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).")  
       self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).")  
       self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).")  
       self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).")  
       self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).")  
       self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).")  
       self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).")  
       self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).")  
       self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).")  
       self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).")  
       self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).")  
       self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).")  
       self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).")  
       self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).")  
       self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).")  
       self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).")  
       self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).")  
       self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).")  
       self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).")  
       self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).")  
       self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).")  
       self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).")  
       self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).")  
       self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).")  
       self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).")  
       self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).")  
       self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).")  
       self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).")  
       self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).")  
       self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).")  
       self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).")  
       self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).")  
       self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).")  
       self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).")  
       self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).")  
       self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).")  
       self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).")  
       self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).")  
       self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).")  
       self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).")  
       self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).")  
       self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).")  
       self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).")  
       self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).")  
       self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=None)),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank2_dd_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(4, 5),dim=self.functionspace.getDim(),args=[])  
       self.failUnlessEqual(s.getRank(),2,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((4, 5))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")  
       self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")  
       self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")  
       self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")  
       self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")  
       self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")  
       self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")  
       self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")  
       self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")  
       self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")  
       self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")  
       self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")  
       self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")  
       self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")  
       self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")  
       self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")  
       self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")  
       self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")  
       self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")  
       self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")  
       self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")  
       self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")  
       self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).")  
       self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).")  
       self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).")  
       self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).")  
       self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).")  
       self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).")  
       self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).")  
       self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).")  
       self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).")  
       self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).")  
       self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).")  
       self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).")  
       self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).")  
       self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).")  
       self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).")  
       self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).")  
       self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).")  
       self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).")  
       self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).")  
       self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).")  
       self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).")  
       self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).")  
       self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).")  
       self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).")  
       self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).")  
       self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).")  
       self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).")  
       self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).")  
       self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).")  
       self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).")  
       self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).")  
       self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).")  
       self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).")  
       self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).")  
       self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).")  
       self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).")  
       self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).")  
       self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).")  
       self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).")  
       self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).")  
       self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).")  
       self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).")  
       self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).")  
       self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).")  
       self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).")  
       self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).")  
       self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).")  
       self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).")  
       self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).")  
       self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).")  
       self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).")  
       self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).")  
       self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).")  
       self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).")  
       self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).")  
       self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).")  
       self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).")  
       self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).")  
       self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).")  
       self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).")  
       self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).")  
       self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).")  
       self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).")  
       self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).")  
       self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).")  
       self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).")  
       self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).")  
       self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).")  
       self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).")  
       self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).")  
       self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).")  
       self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).")  
       self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).")  
       self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).")  
       self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).")  
       self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).")  
       self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).")  
       self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).")  
       self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).")  
       self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).")  
       self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).")  
       self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).")  
       self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).")  
       self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).")  
       self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).")  
       self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).")  
       self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).")  
       self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).")  
       self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).")  
       self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).")  
       self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).")  
       self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).")  
       self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).")  
       self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).")  
       self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).")  
       self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).")  
       self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).")  
       self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).")  
       self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).")  
       self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).")  
       self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).")  
       self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).")  
       self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).")  
       self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).")  
       self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).")  
       self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).")  
       self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).")  
       self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).")  
       self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).")  
       self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).")  
       self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).")  
       self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).")  
       self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).")  
       self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).")  
       self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).")  
       self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).")  
       self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).")  
       self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).")  
       self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).")  
       self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).")  
       self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).")  
       self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).")  
       self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).")  
       self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).")  
       self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).")  
       self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).")  
       self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).")  
       self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).")  
       self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).")  
       self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).")  
       self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).")  
       self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).")  
       self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).")  
       self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).")  
       self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).")  
       self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).")  
       self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).")  
       self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).")  
       self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).")  
       self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).")  
       self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).")  
       self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).")  
       self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).")  
       self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).")  
       self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).")  
       self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).")  
       self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).")  
       self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).")  
       self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).")  
       self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).")  
       self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).")  
       self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).")  
       self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).")  
       self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).")  
       self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).")  
       self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).")  
       self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).")  
       self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).")  
       self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).")  
       self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).")  
       self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).")  
       self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).")  
       self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).")  
       self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).")  
       self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).")  
       self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).")  
       self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).")  
       self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).")  
       self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).")  
       self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).")  
       self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).")  
       self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).")  
       self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).")  
       self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).")  
       self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).")  
       self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).")  
       self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).")  
       self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).")  
       self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).")  
       self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).")  
       self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).")  
       self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).")  
       self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).")  
       self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).")  
       self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).")  
       self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).")  
       self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).")  
       self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).")  
       self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).")  
       self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).")  
       self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).")  
       self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).")  
       self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).")  
       self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).")  
       self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).")  
       self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).")  
       self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).")  
       self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).")  
       self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).")  
       self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).")  
       self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).")  
       self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).")  
       self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).")  
       self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).")  
       self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).")  
       self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).")  
       self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).")  
       self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).")  
       self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).")  
       self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).")  
       self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).")  
       self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).")  
       self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).")  
       self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).")  
       self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).")  
       self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).")  
       self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).")  
       self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).")  
       self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).")  
       self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).")  
       self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).")  
       self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).")  
       self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).")  
       self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).")  
       self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).")  
       self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).")  
       self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).")  
       self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).")  
       self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).")  
       self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).")  
       self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).")  
       self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).")  
       self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).")  
       self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).")  
       self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).")  
       self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).")  
       self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).")  
       self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).")  
       self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).")  
       self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).")  
       self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).")  
       self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).")  
       self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).")  
       self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).")  
       self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).")  
       self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).")  
       self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).")  
       self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).")  
       self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).")  
       self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).")  
       self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).")  
       self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).")  
       self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).")  
       self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).")  
       self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).")  
       self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).")  
       self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).")  
       self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).")  
       self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).")  
       self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).")  
       self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).")  
       self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).")  
       self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).")  
       self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).")  
       self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).")  
       self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).")  
       self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).")  
       self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).")  
       self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).")  
       self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).")  
       self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).")  
       self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).")  
       self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).")  
       self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).")  
       self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).")  
       self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).")  
       self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).")  
       self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).")  
       self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).")  
       self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).")  
       self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).")  
       self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).")  
       self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).")  
       self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).")  
       self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).")  
       self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).")  
       self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).")  
       self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).")  
       self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).")  
       self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).")  
       self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).")  
       self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).")  
       self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).")  
       self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).")  
       self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).")  
       self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).")  
       self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).")  
       self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).")  
       self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).")  
       self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).")  
       self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).")  
       self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).")  
       self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).")  
       self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).")  
       self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).")  
       self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).")  
       self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).")  
       self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).")  
       self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).")  
       self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).")  
       self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).")  
       self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).")  
       self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).")  
       self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).")  
       self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).")  
       self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).")  
       self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).")  
       self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).")  
       self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).")  
       self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).")  
       self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).")  
       self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).")  
       self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).")  
       self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).")  
       self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).")  
       self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).")  
       self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).")  
       self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).")  
       self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).")  
       self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).")  
       self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).")  
       self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).")  
       self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).")  
       self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).")  
       self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).")  
       self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).")  
       self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).")  
       self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).")  
       self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).")  
       self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).")  
       self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).")  
       self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).")  
       self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).")  
       self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).")  
       self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).")  
       self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).")  
       self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).")  
       self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).")  
       self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).")  
       self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).")  
       self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).")  
       self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).")  
       self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).")  
       self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).")  
       self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).")  
       self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).")  
       self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).")  
       self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).")  
       self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).")  
       self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).")  
       self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).")  
       self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).")  
       self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).")  
       self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).")  
       self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).")  
       self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).")  
       self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).")  
       self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).")  
       self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).")  
       self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).")  
       self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).")  
       self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).")  
       self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).")  
       self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).")  
       self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).")  
       self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).")  
       self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).")  
       self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).")  
   
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),0,"wrong number of substituted arguments")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(4, 5),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank2_dd_nargs1(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(4, 5),dim=self.functionspace.getDim(),args=[s2])  
       self.failUnlessEqual(s.getRank(),2,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[s2],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((4, 5))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")  
       self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")  
       self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")  
       self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")  
       self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")  
       self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")  
       self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")  
       self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")  
       self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")  
       self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")  
       self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")  
       self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")  
       self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")  
       self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")  
       self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")  
       self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")  
       self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")  
       self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")  
       self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")  
       self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")  
       self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")  
       self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")  
       self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).")  
       self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).")  
       self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).")  
       self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).")  
       self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).")  
       self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).")  
       self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).")  
       self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).")  
       self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).")  
       self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).")  
       self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).")  
       self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).")  
       self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).")  
       self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).")  
       self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).")  
       self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).")  
       self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).")  
       self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).")  
       self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).")  
       self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).")  
       self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).")  
       self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).")  
       self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).")  
       self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).")  
       self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).")  
       self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).")  
       self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).")  
       self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).")  
       self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).")  
       self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).")  
       self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).")  
       self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).")  
       self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).")  
       self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).")  
       self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).")  
       self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).")  
       self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).")  
       self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).")  
       self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).")  
       self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).")  
       self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).")  
       self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).")  
       self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).")  
       self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).")  
       self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).")  
       self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).")  
       self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).")  
       self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).")  
       self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).")  
       self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).")  
       self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).")  
       self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).")  
       self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).")  
       self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).")  
       self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).")  
       self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).")  
       self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).")  
       self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).")  
       self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).")  
       self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).")  
       self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).")  
       self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).")  
       self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).")  
       self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).")  
       self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).")  
       self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).")  
       self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).")  
       self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).")  
       self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).")  
       self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).")  
       self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).")  
       self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).")  
       self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).")  
       self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).")  
       self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).")  
       self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).")  
       self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).")  
       self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).")  
       self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).")  
       self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).")  
       self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).")  
       self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).")  
       self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).")  
       self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).")  
       self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).")  
       self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).")  
       self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).")  
       self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).")  
       self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).")  
       self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).")  
       self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).")  
       self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).")  
       self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).")  
       self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).")  
       self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).")  
       self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).")  
       self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).")  
       self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).")  
       self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).")  
       self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).")  
       self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).")  
       self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).")  
       self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).")  
       self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).")  
       self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).")  
       self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).")  
       self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).")  
       self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).")  
       self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).")  
       self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).")  
       self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).")  
       self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).")  
       self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).")  
       self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).")  
       self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).")  
       self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).")  
       self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).")  
       self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).")  
       self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).")  
       self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).")  
       self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).")  
       self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).")  
       self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).")  
       self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).")  
       self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).")  
       self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).")  
       self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).")  
       self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).")  
       self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).")  
       self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).")  
       self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).")  
       self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).")  
       self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).")  
       self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).")  
       self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).")  
       self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).")  
       self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).")  
       self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).")  
       self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).")  
       self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).")  
       self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).")  
       self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).")  
       self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).")  
       self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).")  
       self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).")  
       self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).")  
       self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).")  
       self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).")  
       self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).")  
       self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).")  
       self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).")  
       self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).")  
       self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).")  
       self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).")  
       self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).")  
       self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).")  
       self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).")  
       self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).")  
       self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).")  
       self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).")  
       self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).")  
       self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).")  
       self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).")  
       self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).")  
       self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).")  
       self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).")  
       self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).")  
       self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).")  
       self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).")  
       self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).")  
       self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).")  
       self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).")  
       self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).")  
       self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).")  
       self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).")  
       self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).")  
       self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).")  
       self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).")  
       self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).")  
       self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).")  
       self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).")  
       self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).")  
       self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).")  
       self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).")  
       self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).")  
       self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).")  
       self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).")  
       self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).")  
       self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).")  
       self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).")  
       self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).")  
       self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).")  
       self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).")  
       self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).")  
       self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).")  
       self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).")  
       self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).")  
       self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).")  
       self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).")  
       self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).")  
       self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).")  
       self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).")  
       self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).")  
       self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).")  
       self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).")  
       self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).")  
       self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).")  
       self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).")  
       self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).")  
       self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).")  
       self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).")  
       self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).")  
       self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).")  
       self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).")  
       self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).")  
       self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).")  
       self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).")  
       self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).")  
       self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).")  
       self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).")  
       self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).")  
       self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).")  
       self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).")  
       self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).")  
       self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).")  
       self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).")  
       self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).")  
       self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).")  
       self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).")  
       self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).")  
       self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).")  
       self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).")  
       self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).")  
       self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).")  
       self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).")  
       self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).")  
       self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).")  
       self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).")  
       self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).")  
       self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).")  
       self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).")  
       self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).")  
       self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).")  
       self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).")  
       self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).")  
       self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).")  
       self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).")  
       self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).")  
       self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).")  
       self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).")  
       self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).")  
       self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).")  
       self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).")  
       self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).")  
       self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).")  
       self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).")  
       self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).")  
       self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).")  
       self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).")  
       self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).")  
       self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).")  
       self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).")  
       self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).")  
       self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).")  
       self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).")  
       self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).")  
       self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).")  
       self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).")  
       self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).")  
       self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).")  
       self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).")  
       self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).")  
       self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).")  
       self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).")  
       self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).")  
       self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).")  
       self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).")  
       self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).")  
       self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).")  
       self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).")  
       self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).")  
       self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).")  
       self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).")  
       self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).")  
       self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).")  
       self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).")  
       self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).")  
       self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).")  
       self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).")  
       self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).")  
       self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).")  
       self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).")  
       self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).")  
       self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).")  
       self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).")  
       self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).")  
       self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).")  
       self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).")  
       self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).")  
       self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).")  
       self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).")  
       self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).")  
       self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).")  
       self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).")  
       self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).")  
       self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).")  
       self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).")  
       self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).")  
       self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).")  
       self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).")  
       self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).")  
       self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).")  
       self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).")  
       self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).")  
       self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).")  
       self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).")  
       self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).")  
       self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).")  
       self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).")  
       self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).")  
       self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).")  
       self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).")  
       self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).")  
       self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).")  
       self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).")  
       self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).")  
       self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).")  
       self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).")  
       self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).")  
       self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).")  
       self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).")  
       self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).")  
       self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).")  
       self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).")  
       self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).")  
       self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).")  
       self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).")  
       self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).")  
       self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).")  
       self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).")  
       self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).")  
       self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).")  
       self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).")  
       self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).")  
       self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).")  
       self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).")  
       self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).")  
       self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).")  
       self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).")  
       self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).")  
       self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).")  
       self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).")  
       self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).")  
       self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).")  
       self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).")  
       self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).")  
       self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).")  
       self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).")  
       self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).")  
       self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).")  
       self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).")  
       self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).")  
       self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).")  
       self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).")  
       self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).")  
       self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).")  
       self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).")  
       self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).")  
       self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).")  
       self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).")  
       self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).")  
       self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).")  
       self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).")  
       self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).")  
       self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).")  
       self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).")  
       self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).")  
       self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).")  
   
       self.failUnlessEqual(s.getArgument(0),s2,"wrong argument 0.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),1,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],-10,"wrongly substituted argument 0.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(4, 5),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank2_dd_nargs2(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(4, 5),dim=self.functionspace.getDim(),args=[1, -1.0])  
       self.failUnlessEqual(s.getRank(),2,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),self.functionspace.getDim(),"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[1, -1.0],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((4, 5))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")  
       self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")  
       self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")  
       self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")  
       self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")  
       self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")  
       self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")  
       self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")  
       self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")  
       self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")  
       self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")  
       self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")  
       self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")  
       self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")  
       self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")  
       self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")  
       self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")  
       self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")  
       self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")  
       self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")  
       self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")  
       self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")  
       self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).")  
       self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).")  
       self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).")  
       self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).")  
       self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).")  
       self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).")  
       self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).")  
       self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).")  
       self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).")  
       self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).")  
       self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).")  
       self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).")  
       self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).")  
       self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).")  
       self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).")  
       self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).")  
       self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).")  
       self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).")  
       self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).")  
       self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).")  
       self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).")  
       self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).")  
       self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).")  
       self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).")  
       self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).")  
       self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).")  
       self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).")  
       self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).")  
       self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).")  
       self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).")  
       self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).")  
       self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).")  
       self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).")  
       self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).")  
       self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).")  
       self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).")  
       self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).")  
       self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).")  
       self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).")  
       self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).")  
       self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).")  
       self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).")  
       self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).")  
       self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).")  
       self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).")  
       self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).")  
       self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).")  
       self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).")  
       self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).")  
       self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).")  
       self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).")  
       self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).")  
       self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).")  
       self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).")  
       self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).")  
       self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).")  
       self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).")  
       self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).")  
       self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).")  
       self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).")  
       self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).")  
       self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).")  
       self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).")  
       self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).")  
       self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).")  
       self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).")  
       self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).")  
       self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).")  
       self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).")  
       self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).")  
       self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).")  
       self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).")  
       self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).")  
       self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).")  
       self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).")  
       self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).")  
       self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).")  
       self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).")  
       self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).")  
       self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).")  
       self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).")  
       self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).")  
       self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).")  
       self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).")  
       self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).")  
       self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).")  
       self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).")  
       self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).")  
       self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).")  
       self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).")  
       self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).")  
       self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).")  
       self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).")  
       self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).")  
       self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).")  
       self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).")  
       self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).")  
       self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).")  
       self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).")  
       self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).")  
       self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).")  
       self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).")  
       self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).")  
       self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).")  
       self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).")  
       self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).")  
       self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).")  
       self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).")  
       self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).")  
       self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).")  
       self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).")  
       self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).")  
       self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).")  
       self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).")  
       self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).")  
       self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).")  
       self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).")  
       self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).")  
       self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).")  
       self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).")  
       self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).")  
       self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).")  
       self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).")  
       self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).")  
       self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).")  
       self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).")  
       self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).")  
       self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).")  
       self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).")  
       self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).")  
       self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).")  
       self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).")  
       self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).")  
       self.failUnlessEqual(dsds[1,2,3,0],0.0,"ds/ds has wrong value at (1,2,3,0).")  
       self.failUnlessEqual(dsds[1,2,3,1],0.0,"ds/ds has wrong value at (1,2,3,1).")  
       self.failUnlessEqual(dsds[1,2,3,2],0.0,"ds/ds has wrong value at (1,2,3,2).")  
       self.failUnlessEqual(dsds[1,2,3,3],0.0,"ds/ds has wrong value at (1,2,3,3).")  
       self.failUnlessEqual(dsds[1,2,3,4],0.0,"ds/ds has wrong value at (1,2,3,4).")  
       self.failUnlessEqual(dsds[1,3,0,0],0.0,"ds/ds has wrong value at (1,3,0,0).")  
       self.failUnlessEqual(dsds[1,3,0,1],0.0,"ds/ds has wrong value at (1,3,0,1).")  
       self.failUnlessEqual(dsds[1,3,0,2],0.0,"ds/ds has wrong value at (1,3,0,2).")  
       self.failUnlessEqual(dsds[1,3,0,3],0.0,"ds/ds has wrong value at (1,3,0,3).")  
       self.failUnlessEqual(dsds[1,3,0,4],0.0,"ds/ds has wrong value at (1,3,0,4).")  
       self.failUnlessEqual(dsds[1,3,1,0],0.0,"ds/ds has wrong value at (1,3,1,0).")  
       self.failUnlessEqual(dsds[1,3,1,1],0.0,"ds/ds has wrong value at (1,3,1,1).")  
       self.failUnlessEqual(dsds[1,3,1,2],0.0,"ds/ds has wrong value at (1,3,1,2).")  
       self.failUnlessEqual(dsds[1,3,1,3],1.0,"ds/ds has wrong value at (1,3,1,3).")  
       self.failUnlessEqual(dsds[1,3,1,4],0.0,"ds/ds has wrong value at (1,3,1,4).")  
       self.failUnlessEqual(dsds[1,3,2,0],0.0,"ds/ds has wrong value at (1,3,2,0).")  
       self.failUnlessEqual(dsds[1,3,2,1],0.0,"ds/ds has wrong value at (1,3,2,1).")  
       self.failUnlessEqual(dsds[1,3,2,2],0.0,"ds/ds has wrong value at (1,3,2,2).")  
       self.failUnlessEqual(dsds[1,3,2,3],0.0,"ds/ds has wrong value at (1,3,2,3).")  
       self.failUnlessEqual(dsds[1,3,2,4],0.0,"ds/ds has wrong value at (1,3,2,4).")  
       self.failUnlessEqual(dsds[1,3,3,0],0.0,"ds/ds has wrong value at (1,3,3,0).")  
       self.failUnlessEqual(dsds[1,3,3,1],0.0,"ds/ds has wrong value at (1,3,3,1).")  
       self.failUnlessEqual(dsds[1,3,3,2],0.0,"ds/ds has wrong value at (1,3,3,2).")  
       self.failUnlessEqual(dsds[1,3,3,3],0.0,"ds/ds has wrong value at (1,3,3,3).")  
       self.failUnlessEqual(dsds[1,3,3,4],0.0,"ds/ds has wrong value at (1,3,3,4).")  
       self.failUnlessEqual(dsds[1,4,0,0],0.0,"ds/ds has wrong value at (1,4,0,0).")  
       self.failUnlessEqual(dsds[1,4,0,1],0.0,"ds/ds has wrong value at (1,4,0,1).")  
       self.failUnlessEqual(dsds[1,4,0,2],0.0,"ds/ds has wrong value at (1,4,0,2).")  
       self.failUnlessEqual(dsds[1,4,0,3],0.0,"ds/ds has wrong value at (1,4,0,3).")  
       self.failUnlessEqual(dsds[1,4,0,4],0.0,"ds/ds has wrong value at (1,4,0,4).")  
       self.failUnlessEqual(dsds[1,4,1,0],0.0,"ds/ds has wrong value at (1,4,1,0).")  
       self.failUnlessEqual(dsds[1,4,1,1],0.0,"ds/ds has wrong value at (1,4,1,1).")  
       self.failUnlessEqual(dsds[1,4,1,2],0.0,"ds/ds has wrong value at (1,4,1,2).")  
       self.failUnlessEqual(dsds[1,4,1,3],0.0,"ds/ds has wrong value at (1,4,1,3).")  
       self.failUnlessEqual(dsds[1,4,1,4],1.0,"ds/ds has wrong value at (1,4,1,4).")  
       self.failUnlessEqual(dsds[1,4,2,0],0.0,"ds/ds has wrong value at (1,4,2,0).")  
       self.failUnlessEqual(dsds[1,4,2,1],0.0,"ds/ds has wrong value at (1,4,2,1).")  
       self.failUnlessEqual(dsds[1,4,2,2],0.0,"ds/ds has wrong value at (1,4,2,2).")  
       self.failUnlessEqual(dsds[1,4,2,3],0.0,"ds/ds has wrong value at (1,4,2,3).")  
       self.failUnlessEqual(dsds[1,4,2,4],0.0,"ds/ds has wrong value at (1,4,2,4).")  
       self.failUnlessEqual(dsds[1,4,3,0],0.0,"ds/ds has wrong value at (1,4,3,0).")  
       self.failUnlessEqual(dsds[1,4,3,1],0.0,"ds/ds has wrong value at (1,4,3,1).")  
       self.failUnlessEqual(dsds[1,4,3,2],0.0,"ds/ds has wrong value at (1,4,3,2).")  
       self.failUnlessEqual(dsds[1,4,3,3],0.0,"ds/ds has wrong value at (1,4,3,3).")  
       self.failUnlessEqual(dsds[1,4,3,4],0.0,"ds/ds has wrong value at (1,4,3,4).")  
       self.failUnlessEqual(dsds[2,0,0,0],0.0,"ds/ds has wrong value at (2,0,0,0).")  
       self.failUnlessEqual(dsds[2,0,0,1],0.0,"ds/ds has wrong value at (2,0,0,1).")  
       self.failUnlessEqual(dsds[2,0,0,2],0.0,"ds/ds has wrong value at (2,0,0,2).")  
       self.failUnlessEqual(dsds[2,0,0,3],0.0,"ds/ds has wrong value at (2,0,0,3).")  
       self.failUnlessEqual(dsds[2,0,0,4],0.0,"ds/ds has wrong value at (2,0,0,4).")  
       self.failUnlessEqual(dsds[2,0,1,0],0.0,"ds/ds has wrong value at (2,0,1,0).")  
       self.failUnlessEqual(dsds[2,0,1,1],0.0,"ds/ds has wrong value at (2,0,1,1).")  
       self.failUnlessEqual(dsds[2,0,1,2],0.0,"ds/ds has wrong value at (2,0,1,2).")  
       self.failUnlessEqual(dsds[2,0,1,3],0.0,"ds/ds has wrong value at (2,0,1,3).")  
       self.failUnlessEqual(dsds[2,0,1,4],0.0,"ds/ds has wrong value at (2,0,1,4).")  
       self.failUnlessEqual(dsds[2,0,2,0],1.0,"ds/ds has wrong value at (2,0,2,0).")  
       self.failUnlessEqual(dsds[2,0,2,1],0.0,"ds/ds has wrong value at (2,0,2,1).")  
       self.failUnlessEqual(dsds[2,0,2,2],0.0,"ds/ds has wrong value at (2,0,2,2).")  
       self.failUnlessEqual(dsds[2,0,2,3],0.0,"ds/ds has wrong value at (2,0,2,3).")  
       self.failUnlessEqual(dsds[2,0,2,4],0.0,"ds/ds has wrong value at (2,0,2,4).")  
       self.failUnlessEqual(dsds[2,0,3,0],0.0,"ds/ds has wrong value at (2,0,3,0).")  
       self.failUnlessEqual(dsds[2,0,3,1],0.0,"ds/ds has wrong value at (2,0,3,1).")  
       self.failUnlessEqual(dsds[2,0,3,2],0.0,"ds/ds has wrong value at (2,0,3,2).")  
       self.failUnlessEqual(dsds[2,0,3,3],0.0,"ds/ds has wrong value at (2,0,3,3).")  
       self.failUnlessEqual(dsds[2,0,3,4],0.0,"ds/ds has wrong value at (2,0,3,4).")  
       self.failUnlessEqual(dsds[2,1,0,0],0.0,"ds/ds has wrong value at (2,1,0,0).")  
       self.failUnlessEqual(dsds[2,1,0,1],0.0,"ds/ds has wrong value at (2,1,0,1).")  
       self.failUnlessEqual(dsds[2,1,0,2],0.0,"ds/ds has wrong value at (2,1,0,2).")  
       self.failUnlessEqual(dsds[2,1,0,3],0.0,"ds/ds has wrong value at (2,1,0,3).")  
       self.failUnlessEqual(dsds[2,1,0,4],0.0,"ds/ds has wrong value at (2,1,0,4).")  
       self.failUnlessEqual(dsds[2,1,1,0],0.0,"ds/ds has wrong value at (2,1,1,0).")  
       self.failUnlessEqual(dsds[2,1,1,1],0.0,"ds/ds has wrong value at (2,1,1,1).")  
       self.failUnlessEqual(dsds[2,1,1,2],0.0,"ds/ds has wrong value at (2,1,1,2).")  
       self.failUnlessEqual(dsds[2,1,1,3],0.0,"ds/ds has wrong value at (2,1,1,3).")  
       self.failUnlessEqual(dsds[2,1,1,4],0.0,"ds/ds has wrong value at (2,1,1,4).")  
       self.failUnlessEqual(dsds[2,1,2,0],0.0,"ds/ds has wrong value at (2,1,2,0).")  
       self.failUnlessEqual(dsds[2,1,2,1],1.0,"ds/ds has wrong value at (2,1,2,1).")  
       self.failUnlessEqual(dsds[2,1,2,2],0.0,"ds/ds has wrong value at (2,1,2,2).")  
       self.failUnlessEqual(dsds[2,1,2,3],0.0,"ds/ds has wrong value at (2,1,2,3).")  
       self.failUnlessEqual(dsds[2,1,2,4],0.0,"ds/ds has wrong value at (2,1,2,4).")  
       self.failUnlessEqual(dsds[2,1,3,0],0.0,"ds/ds has wrong value at (2,1,3,0).")  
       self.failUnlessEqual(dsds[2,1,3,1],0.0,"ds/ds has wrong value at (2,1,3,1).")  
       self.failUnlessEqual(dsds[2,1,3,2],0.0,"ds/ds has wrong value at (2,1,3,2).")  
       self.failUnlessEqual(dsds[2,1,3,3],0.0,"ds/ds has wrong value at (2,1,3,3).")  
       self.failUnlessEqual(dsds[2,1,3,4],0.0,"ds/ds has wrong value at (2,1,3,4).")  
       self.failUnlessEqual(dsds[2,2,0,0],0.0,"ds/ds has wrong value at (2,2,0,0).")  
       self.failUnlessEqual(dsds[2,2,0,1],0.0,"ds/ds has wrong value at (2,2,0,1).")  
       self.failUnlessEqual(dsds[2,2,0,2],0.0,"ds/ds has wrong value at (2,2,0,2).")  
       self.failUnlessEqual(dsds[2,2,0,3],0.0,"ds/ds has wrong value at (2,2,0,3).")  
       self.failUnlessEqual(dsds[2,2,0,4],0.0,"ds/ds has wrong value at (2,2,0,4).")  
       self.failUnlessEqual(dsds[2,2,1,0],0.0,"ds/ds has wrong value at (2,2,1,0).")  
       self.failUnlessEqual(dsds[2,2,1,1],0.0,"ds/ds has wrong value at (2,2,1,1).")  
       self.failUnlessEqual(dsds[2,2,1,2],0.0,"ds/ds has wrong value at (2,2,1,2).")  
       self.failUnlessEqual(dsds[2,2,1,3],0.0,"ds/ds has wrong value at (2,2,1,3).")  
       self.failUnlessEqual(dsds[2,2,1,4],0.0,"ds/ds has wrong value at (2,2,1,4).")  
       self.failUnlessEqual(dsds[2,2,2,0],0.0,"ds/ds has wrong value at (2,2,2,0).")  
       self.failUnlessEqual(dsds[2,2,2,1],0.0,"ds/ds has wrong value at (2,2,2,1).")  
       self.failUnlessEqual(dsds[2,2,2,2],1.0,"ds/ds has wrong value at (2,2,2,2).")  
       self.failUnlessEqual(dsds[2,2,2,3],0.0,"ds/ds has wrong value at (2,2,2,3).")  
       self.failUnlessEqual(dsds[2,2,2,4],0.0,"ds/ds has wrong value at (2,2,2,4).")  
       self.failUnlessEqual(dsds[2,2,3,0],0.0,"ds/ds has wrong value at (2,2,3,0).")  
       self.failUnlessEqual(dsds[2,2,3,1],0.0,"ds/ds has wrong value at (2,2,3,1).")  
       self.failUnlessEqual(dsds[2,2,3,2],0.0,"ds/ds has wrong value at (2,2,3,2).")  
       self.failUnlessEqual(dsds[2,2,3,3],0.0,"ds/ds has wrong value at (2,2,3,3).")  
       self.failUnlessEqual(dsds[2,2,3,4],0.0,"ds/ds has wrong value at (2,2,3,4).")  
       self.failUnlessEqual(dsds[2,3,0,0],0.0,"ds/ds has wrong value at (2,3,0,0).")  
       self.failUnlessEqual(dsds[2,3,0,1],0.0,"ds/ds has wrong value at (2,3,0,1).")  
       self.failUnlessEqual(dsds[2,3,0,2],0.0,"ds/ds has wrong value at (2,3,0,2).")  
       self.failUnlessEqual(dsds[2,3,0,3],0.0,"ds/ds has wrong value at (2,3,0,3).")  
       self.failUnlessEqual(dsds[2,3,0,4],0.0,"ds/ds has wrong value at (2,3,0,4).")  
       self.failUnlessEqual(dsds[2,3,1,0],0.0,"ds/ds has wrong value at (2,3,1,0).")  
       self.failUnlessEqual(dsds[2,3,1,1],0.0,"ds/ds has wrong value at (2,3,1,1).")  
       self.failUnlessEqual(dsds[2,3,1,2],0.0,"ds/ds has wrong value at (2,3,1,2).")  
       self.failUnlessEqual(dsds[2,3,1,3],0.0,"ds/ds has wrong value at (2,3,1,3).")  
       self.failUnlessEqual(dsds[2,3,1,4],0.0,"ds/ds has wrong value at (2,3,1,4).")  
       self.failUnlessEqual(dsds[2,3,2,0],0.0,"ds/ds has wrong value at (2,3,2,0).")  
       self.failUnlessEqual(dsds[2,3,2,1],0.0,"ds/ds has wrong value at (2,3,2,1).")  
       self.failUnlessEqual(dsds[2,3,2,2],0.0,"ds/ds has wrong value at (2,3,2,2).")  
       self.failUnlessEqual(dsds[2,3,2,3],1.0,"ds/ds has wrong value at (2,3,2,3).")  
       self.failUnlessEqual(dsds[2,3,2,4],0.0,"ds/ds has wrong value at (2,3,2,4).")  
       self.failUnlessEqual(dsds[2,3,3,0],0.0,"ds/ds has wrong value at (2,3,3,0).")  
       self.failUnlessEqual(dsds[2,3,3,1],0.0,"ds/ds has wrong value at (2,3,3,1).")  
       self.failUnlessEqual(dsds[2,3,3,2],0.0,"ds/ds has wrong value at (2,3,3,2).")  
       self.failUnlessEqual(dsds[2,3,3,3],0.0,"ds/ds has wrong value at (2,3,3,3).")  
       self.failUnlessEqual(dsds[2,3,3,4],0.0,"ds/ds has wrong value at (2,3,3,4).")  
       self.failUnlessEqual(dsds[2,4,0,0],0.0,"ds/ds has wrong value at (2,4,0,0).")  
       self.failUnlessEqual(dsds[2,4,0,1],0.0,"ds/ds has wrong value at (2,4,0,1).")  
       self.failUnlessEqual(dsds[2,4,0,2],0.0,"ds/ds has wrong value at (2,4,0,2).")  
       self.failUnlessEqual(dsds[2,4,0,3],0.0,"ds/ds has wrong value at (2,4,0,3).")  
       self.failUnlessEqual(dsds[2,4,0,4],0.0,"ds/ds has wrong value at (2,4,0,4).")  
       self.failUnlessEqual(dsds[2,4,1,0],0.0,"ds/ds has wrong value at (2,4,1,0).")  
       self.failUnlessEqual(dsds[2,4,1,1],0.0,"ds/ds has wrong value at (2,4,1,1).")  
       self.failUnlessEqual(dsds[2,4,1,2],0.0,"ds/ds has wrong value at (2,4,1,2).")  
       self.failUnlessEqual(dsds[2,4,1,3],0.0,"ds/ds has wrong value at (2,4,1,3).")  
       self.failUnlessEqual(dsds[2,4,1,4],0.0,"ds/ds has wrong value at (2,4,1,4).")  
       self.failUnlessEqual(dsds[2,4,2,0],0.0,"ds/ds has wrong value at (2,4,2,0).")  
       self.failUnlessEqual(dsds[2,4,2,1],0.0,"ds/ds has wrong value at (2,4,2,1).")  
       self.failUnlessEqual(dsds[2,4,2,2],0.0,"ds/ds has wrong value at (2,4,2,2).")  
       self.failUnlessEqual(dsds[2,4,2,3],0.0,"ds/ds has wrong value at (2,4,2,3).")  
       self.failUnlessEqual(dsds[2,4,2,4],1.0,"ds/ds has wrong value at (2,4,2,4).")  
       self.failUnlessEqual(dsds[2,4,3,0],0.0,"ds/ds has wrong value at (2,4,3,0).")  
       self.failUnlessEqual(dsds[2,4,3,1],0.0,"ds/ds has wrong value at (2,4,3,1).")  
       self.failUnlessEqual(dsds[2,4,3,2],0.0,"ds/ds has wrong value at (2,4,3,2).")  
       self.failUnlessEqual(dsds[2,4,3,3],0.0,"ds/ds has wrong value at (2,4,3,3).")  
       self.failUnlessEqual(dsds[2,4,3,4],0.0,"ds/ds has wrong value at (2,4,3,4).")  
       self.failUnlessEqual(dsds[3,0,0,0],0.0,"ds/ds has wrong value at (3,0,0,0).")  
       self.failUnlessEqual(dsds[3,0,0,1],0.0,"ds/ds has wrong value at (3,0,0,1).")  
       self.failUnlessEqual(dsds[3,0,0,2],0.0,"ds/ds has wrong value at (3,0,0,2).")  
       self.failUnlessEqual(dsds[3,0,0,3],0.0,"ds/ds has wrong value at (3,0,0,3).")  
       self.failUnlessEqual(dsds[3,0,0,4],0.0,"ds/ds has wrong value at (3,0,0,4).")  
       self.failUnlessEqual(dsds[3,0,1,0],0.0,"ds/ds has wrong value at (3,0,1,0).")  
       self.failUnlessEqual(dsds[3,0,1,1],0.0,"ds/ds has wrong value at (3,0,1,1).")  
       self.failUnlessEqual(dsds[3,0,1,2],0.0,"ds/ds has wrong value at (3,0,1,2).")  
       self.failUnlessEqual(dsds[3,0,1,3],0.0,"ds/ds has wrong value at (3,0,1,3).")  
       self.failUnlessEqual(dsds[3,0,1,4],0.0,"ds/ds has wrong value at (3,0,1,4).")  
       self.failUnlessEqual(dsds[3,0,2,0],0.0,"ds/ds has wrong value at (3,0,2,0).")  
       self.failUnlessEqual(dsds[3,0,2,1],0.0,"ds/ds has wrong value at (3,0,2,1).")  
       self.failUnlessEqual(dsds[3,0,2,2],0.0,"ds/ds has wrong value at (3,0,2,2).")  
       self.failUnlessEqual(dsds[3,0,2,3],0.0,"ds/ds has wrong value at (3,0,2,3).")  
       self.failUnlessEqual(dsds[3,0,2,4],0.0,"ds/ds has wrong value at (3,0,2,4).")  
       self.failUnlessEqual(dsds[3,0,3,0],1.0,"ds/ds has wrong value at (3,0,3,0).")  
       self.failUnlessEqual(dsds[3,0,3,1],0.0,"ds/ds has wrong value at (3,0,3,1).")  
       self.failUnlessEqual(dsds[3,0,3,2],0.0,"ds/ds has wrong value at (3,0,3,2).")  
       self.failUnlessEqual(dsds[3,0,3,3],0.0,"ds/ds has wrong value at (3,0,3,3).")  
       self.failUnlessEqual(dsds[3,0,3,4],0.0,"ds/ds has wrong value at (3,0,3,4).")  
       self.failUnlessEqual(dsds[3,1,0,0],0.0,"ds/ds has wrong value at (3,1,0,0).")  
       self.failUnlessEqual(dsds[3,1,0,1],0.0,"ds/ds has wrong value at (3,1,0,1).")  
       self.failUnlessEqual(dsds[3,1,0,2],0.0,"ds/ds has wrong value at (3,1,0,2).")  
       self.failUnlessEqual(dsds[3,1,0,3],0.0,"ds/ds has wrong value at (3,1,0,3).")  
       self.failUnlessEqual(dsds[3,1,0,4],0.0,"ds/ds has wrong value at (3,1,0,4).")  
       self.failUnlessEqual(dsds[3,1,1,0],0.0,"ds/ds has wrong value at (3,1,1,0).")  
       self.failUnlessEqual(dsds[3,1,1,1],0.0,"ds/ds has wrong value at (3,1,1,1).")  
       self.failUnlessEqual(dsds[3,1,1,2],0.0,"ds/ds has wrong value at (3,1,1,2).")  
       self.failUnlessEqual(dsds[3,1,1,3],0.0,"ds/ds has wrong value at (3,1,1,3).")  
       self.failUnlessEqual(dsds[3,1,1,4],0.0,"ds/ds has wrong value at (3,1,1,4).")  
       self.failUnlessEqual(dsds[3,1,2,0],0.0,"ds/ds has wrong value at (3,1,2,0).")  
       self.failUnlessEqual(dsds[3,1,2,1],0.0,"ds/ds has wrong value at (3,1,2,1).")  
       self.failUnlessEqual(dsds[3,1,2,2],0.0,"ds/ds has wrong value at (3,1,2,2).")  
       self.failUnlessEqual(dsds[3,1,2,3],0.0,"ds/ds has wrong value at (3,1,2,3).")  
       self.failUnlessEqual(dsds[3,1,2,4],0.0,"ds/ds has wrong value at (3,1,2,4).")  
       self.failUnlessEqual(dsds[3,1,3,0],0.0,"ds/ds has wrong value at (3,1,3,0).")  
       self.failUnlessEqual(dsds[3,1,3,1],1.0,"ds/ds has wrong value at (3,1,3,1).")  
       self.failUnlessEqual(dsds[3,1,3,2],0.0,"ds/ds has wrong value at (3,1,3,2).")  
       self.failUnlessEqual(dsds[3,1,3,3],0.0,"ds/ds has wrong value at (3,1,3,3).")  
       self.failUnlessEqual(dsds[3,1,3,4],0.0,"ds/ds has wrong value at (3,1,3,4).")  
       self.failUnlessEqual(dsds[3,2,0,0],0.0,"ds/ds has wrong value at (3,2,0,0).")  
       self.failUnlessEqual(dsds[3,2,0,1],0.0,"ds/ds has wrong value at (3,2,0,1).")  
       self.failUnlessEqual(dsds[3,2,0,2],0.0,"ds/ds has wrong value at (3,2,0,2).")  
       self.failUnlessEqual(dsds[3,2,0,3],0.0,"ds/ds has wrong value at (3,2,0,3).")  
       self.failUnlessEqual(dsds[3,2,0,4],0.0,"ds/ds has wrong value at (3,2,0,4).")  
       self.failUnlessEqual(dsds[3,2,1,0],0.0,"ds/ds has wrong value at (3,2,1,0).")  
       self.failUnlessEqual(dsds[3,2,1,1],0.0,"ds/ds has wrong value at (3,2,1,1).")  
       self.failUnlessEqual(dsds[3,2,1,2],0.0,"ds/ds has wrong value at (3,2,1,2).")  
       self.failUnlessEqual(dsds[3,2,1,3],0.0,"ds/ds has wrong value at (3,2,1,3).")  
       self.failUnlessEqual(dsds[3,2,1,4],0.0,"ds/ds has wrong value at (3,2,1,4).")  
       self.failUnlessEqual(dsds[3,2,2,0],0.0,"ds/ds has wrong value at (3,2,2,0).")  
       self.failUnlessEqual(dsds[3,2,2,1],0.0,"ds/ds has wrong value at (3,2,2,1).")  
       self.failUnlessEqual(dsds[3,2,2,2],0.0,"ds/ds has wrong value at (3,2,2,2).")  
       self.failUnlessEqual(dsds[3,2,2,3],0.0,"ds/ds has wrong value at (3,2,2,3).")  
       self.failUnlessEqual(dsds[3,2,2,4],0.0,"ds/ds has wrong value at (3,2,2,4).")  
       self.failUnlessEqual(dsds[3,2,3,0],0.0,"ds/ds has wrong value at (3,2,3,0).")  
       self.failUnlessEqual(dsds[3,2,3,1],0.0,"ds/ds has wrong value at (3,2,3,1).")  
       self.failUnlessEqual(dsds[3,2,3,2],1.0,"ds/ds has wrong value at (3,2,3,2).")  
       self.failUnlessEqual(dsds[3,2,3,3],0.0,"ds/ds has wrong value at (3,2,3,3).")  
       self.failUnlessEqual(dsds[3,2,3,4],0.0,"ds/ds has wrong value at (3,2,3,4).")  
       self.failUnlessEqual(dsds[3,3,0,0],0.0,"ds/ds has wrong value at (3,3,0,0).")  
       self.failUnlessEqual(dsds[3,3,0,1],0.0,"ds/ds has wrong value at (3,3,0,1).")  
       self.failUnlessEqual(dsds[3,3,0,2],0.0,"ds/ds has wrong value at (3,3,0,2).")  
       self.failUnlessEqual(dsds[3,3,0,3],0.0,"ds/ds has wrong value at (3,3,0,3).")  
       self.failUnlessEqual(dsds[3,3,0,4],0.0,"ds/ds has wrong value at (3,3,0,4).")  
       self.failUnlessEqual(dsds[3,3,1,0],0.0,"ds/ds has wrong value at (3,3,1,0).")  
       self.failUnlessEqual(dsds[3,3,1,1],0.0,"ds/ds has wrong value at (3,3,1,1).")  
       self.failUnlessEqual(dsds[3,3,1,2],0.0,"ds/ds has wrong value at (3,3,1,2).")  
       self.failUnlessEqual(dsds[3,3,1,3],0.0,"ds/ds has wrong value at (3,3,1,3).")  
       self.failUnlessEqual(dsds[3,3,1,4],0.0,"ds/ds has wrong value at (3,3,1,4).")  
       self.failUnlessEqual(dsds[3,3,2,0],0.0,"ds/ds has wrong value at (3,3,2,0).")  
       self.failUnlessEqual(dsds[3,3,2,1],0.0,"ds/ds has wrong value at (3,3,2,1).")  
       self.failUnlessEqual(dsds[3,3,2,2],0.0,"ds/ds has wrong value at (3,3,2,2).")  
       self.failUnlessEqual(dsds[3,3,2,3],0.0,"ds/ds has wrong value at (3,3,2,3).")  
       self.failUnlessEqual(dsds[3,3,2,4],0.0,"ds/ds has wrong value at (3,3,2,4).")  
       self.failUnlessEqual(dsds[3,3,3,0],0.0,"ds/ds has wrong value at (3,3,3,0).")  
       self.failUnlessEqual(dsds[3,3,3,1],0.0,"ds/ds has wrong value at (3,3,3,1).")  
       self.failUnlessEqual(dsds[3,3,3,2],0.0,"ds/ds has wrong value at (3,3,3,2).")  
       self.failUnlessEqual(dsds[3,3,3,3],1.0,"ds/ds has wrong value at (3,3,3,3).")  
       self.failUnlessEqual(dsds[3,3,3,4],0.0,"ds/ds has wrong value at (3,3,3,4).")  
       self.failUnlessEqual(dsds[3,4,0,0],0.0,"ds/ds has wrong value at (3,4,0,0).")  
       self.failUnlessEqual(dsds[3,4,0,1],0.0,"ds/ds has wrong value at (3,4,0,1).")  
       self.failUnlessEqual(dsds[3,4,0,2],0.0,"ds/ds has wrong value at (3,4,0,2).")  
       self.failUnlessEqual(dsds[3,4,0,3],0.0,"ds/ds has wrong value at (3,4,0,3).")  
       self.failUnlessEqual(dsds[3,4,0,4],0.0,"ds/ds has wrong value at (3,4,0,4).")  
       self.failUnlessEqual(dsds[3,4,1,0],0.0,"ds/ds has wrong value at (3,4,1,0).")  
       self.failUnlessEqual(dsds[3,4,1,1],0.0,"ds/ds has wrong value at (3,4,1,1).")  
       self.failUnlessEqual(dsds[3,4,1,2],0.0,"ds/ds has wrong value at (3,4,1,2).")  
       self.failUnlessEqual(dsds[3,4,1,3],0.0,"ds/ds has wrong value at (3,4,1,3).")  
       self.failUnlessEqual(dsds[3,4,1,4],0.0,"ds/ds has wrong value at (3,4,1,4).")  
       self.failUnlessEqual(dsds[3,4,2,0],0.0,"ds/ds has wrong value at (3,4,2,0).")  
       self.failUnlessEqual(dsds[3,4,2,1],0.0,"ds/ds has wrong value at (3,4,2,1).")  
       self.failUnlessEqual(dsds[3,4,2,2],0.0,"ds/ds has wrong value at (3,4,2,2).")  
       self.failUnlessEqual(dsds[3,4,2,3],0.0,"ds/ds has wrong value at (3,4,2,3).")  
       self.failUnlessEqual(dsds[3,4,2,4],0.0,"ds/ds has wrong value at (3,4,2,4).")  
       self.failUnlessEqual(dsds[3,4,3,0],0.0,"ds/ds has wrong value at (3,4,3,0).")  
       self.failUnlessEqual(dsds[3,4,3,1],0.0,"ds/ds has wrong value at (3,4,3,1).")  
       self.failUnlessEqual(dsds[3,4,3,2],0.0,"ds/ds has wrong value at (3,4,3,2).")  
       self.failUnlessEqual(dsds[3,4,3,3],0.0,"ds/ds has wrong value at (3,4,3,3).")  
       self.failUnlessEqual(dsds[3,4,3,4],1.0,"ds/ds has wrong value at (3,4,3,4).")  
   
       self.failUnlessEqual(s.getArgument(0),1,"wrong argument 0.")  
       self.failUnlessEqual(s.getArgument(1),-1.0,"wrong argument 1.")  
       sa=s.getSubstitutedArguments({s2:-10})  
       self.failUnlessEqual(len(sa),2,"wrong number of substituted arguments")  
       self.failUnlessEqual(sa[0],1,"wrongly substituted argument 0.")  
       self.failUnlessEqual(sa[1],-1.0,"wrongly substituted argument 1.")  
   
       self.failIf(s.isAppropriateValue(10.)," 10. is not appropriate substitute")  
       self.failIf(s.isAppropriateValue(10)," 10 is not appropriate substitute")  
       self.failUnless(s.isAppropriateValue(Symbol(shape=(4, 5),dim=self.functionspace.getDim())),"Symbol is appropriate substitute")  
       self.failIf(s.isAppropriateValue(Symbol(shape=(5,))),"Symbol is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(escript.Data(0.,(4, 5),self.functionspace)),"Data is appropriate substitute")  
       self.failIf(s.isAppropriateValue(escript.Data(0.,(5,),self.functionspace)),"Data is not appropriate substitute (shape)")  
       self.failUnless(s.isAppropriateValue(numarray.zeros((4, 5))),"NumArray is appropriate substitute")  
       self.failIf(s.isAppropriateValue(numarray.zeros((5,))),"NumArray is not appropriate substitute (shape)")  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_Symbol_rank2_d1_nargs0(self):  
       s2=Symbol(shape=())  
       s=Symbol(shape=(4, 5),dim=1,args=[])  
       self.failUnlessEqual(s.getRank(),2,"wrong rank.")  
       self.failUnlessEqual(s.getShape(),(4, 5),"wrong shape.")  
       self.failUnlessEqual(s.getDim(),1,"wrong spatial dimension.")  
       self.failUnlessEqual(s.getArgument(),[],"wrong arguments.")  
   
       ss=s.substitute({s:numarray.zeros((4, 5))})  
       self.failUnless(isinstance(ss,numarray.NumArray),"value after substitution is not numarray.")  
       self.failUnlessEqual(ss.shape,(4, 5),"value after substitution has not expected shape")  
       try:  
         s.substitute({s:numarray.zeros((5,))})  
         fail("illegal substition was successful")  
       except TypeError:  
         pass  
   
       dsdarg=s.diff(Symbol(shape=()))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds() has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5),"ds/ds() has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds() has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(2,)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(2,) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 2),"ds/ds(2,) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(2,) has wrong value.")  
       dsdarg=s.diff(Symbol(shape=(4, 5)))  
       self.failUnless(isinstance(dsdarg,numarray.NumArray),"ds/ds(4, 5) has wrong type.")  
       self.failUnlessEqual(dsdarg.shape,(4, 5, 4, 5),"ds/ds(4, 5) has wrong shape.")  
       self.failIf(Lsup(dsdarg)>0.,"ds/ds(4, 5) has wrong value.")  
   
       dsds=s.diff(s)  
       self.failUnless(isinstance(dsds,numarray.NumArray),"ds/ds has wrong type.")  
       self.failUnlessEqual(dsds.shape,(4, 5, 4, 5),"ds/ds has wrong shape.")  
       self.failUnlessEqual(dsds[0,0,0,0],1.0,"ds/ds has wrong value at (0,0,0,0).")  
       self.failUnlessEqual(dsds[0,0,0,1],0.0,"ds/ds has wrong value at (0,0,0,1).")  
       self.failUnlessEqual(dsds[0,0,0,2],0.0,"ds/ds has wrong value at (0,0,0,2).")  
       self.failUnlessEqual(dsds[0,0,0,3],0.0,"ds/ds has wrong value at (0,0,0,3).")  
       self.failUnlessEqual(dsds[0,0,0,4],0.0,"ds/ds has wrong value at (0,0,0,4).")  
       self.failUnlessEqual(dsds[0,0,1,0],0.0,"ds/ds has wrong value at (0,0,1,0).")  
       self.failUnlessEqual(dsds[0,0,1,1],0.0,"ds/ds has wrong value at (0,0,1,1).")  
       self.failUnlessEqual(dsds[0,0,1,2],0.0,"ds/ds has wrong value at (0,0,1,2).")  
       self.failUnlessEqual(dsds[0,0,1,3],0.0,"ds/ds has wrong value at (0,0,1,3).")  
       self.failUnlessEqual(dsds[0,0,1,4],0.0,"ds/ds has wrong value at (0,0,1,4).")  
       self.failUnlessEqual(dsds[0,0,2,0],0.0,"ds/ds has wrong value at (0,0,2,0).")  
       self.failUnlessEqual(dsds[0,0,2,1],0.0,"ds/ds has wrong value at (0,0,2,1).")  
       self.failUnlessEqual(dsds[0,0,2,2],0.0,"ds/ds has wrong value at (0,0,2,2).")  
       self.failUnlessEqual(dsds[0,0,2,3],0.0,"ds/ds has wrong value at (0,0,2,3).")  
       self.failUnlessEqual(dsds[0,0,2,4],0.0,"ds/ds has wrong value at (0,0,2,4).")  
       self.failUnlessEqual(dsds[0,0,3,0],0.0,"ds/ds has wrong value at (0,0,3,0).")  
       self.failUnlessEqual(dsds[0,0,3,1],0.0,"ds/ds has wrong value at (0,0,3,1).")  
       self.failUnlessEqual(dsds[0,0,3,2],0.0,"ds/ds has wrong value at (0,0,3,2).")  
       self.failUnlessEqual(dsds[0,0,3,3],0.0,"ds/ds has wrong value at (0,0,3,3).")  
       self.failUnlessEqual(dsds[0,0,3,4],0.0,"ds/ds has wrong value at (0,0,3,4).")  
       self.failUnlessEqual(dsds[0,1,0,0],0.0,"ds/ds has wrong value at (0,1,0,0).")  
       self.failUnlessEqual(dsds[0,1,0,1],1.0,"ds/ds has wrong value at (0,1,0,1).")  
       self.failUnlessEqual(dsds[0,1,0,2],0.0,"ds/ds has wrong value at (0,1,0,2).")  
       self.failUnlessEqual(dsds[0,1,0,3],0.0,"ds/ds has wrong value at (0,1,0,3).")  
       self.failUnlessEqual(dsds[0,1,0,4],0.0,"ds/ds has wrong value at (0,1,0,4).")  
       self.failUnlessEqual(dsds[0,1,1,0],0.0,"ds/ds has wrong value at (0,1,1,0).")  
       self.failUnlessEqual(dsds[0,1,1,1],0.0,"ds/ds has wrong value at (0,1,1,1).")  
       self.failUnlessEqual(dsds[0,1,1,2],0.0,"ds/ds has wrong value at (0,1,1,2).")  
       self.failUnlessEqual(dsds[0,1,1,3],0.0,"ds/ds has wrong value at (0,1,1,3).")  
       self.failUnlessEqual(dsds[0,1,1,4],0.0,"ds/ds has wrong value at (0,1,1,4).")  
       self.failUnlessEqual(dsds[0,1,2,0],0.0,"ds/ds has wrong value at (0,1,2,0).")  
       self.failUnlessEqual(dsds[0,1,2,1],0.0,"ds/ds has wrong value at (0,1,2,1).")  
       self.failUnlessEqual(dsds[0,1,2,2],0.0,"ds/ds has wrong value at (0,1,2,2).")  
       self.failUnlessEqual(dsds[0,1,2,3],0.0,"ds/ds has wrong value at (0,1,2,3).")  
       self.failUnlessEqual(dsds[0,1,2,4],0.0,"ds/ds has wrong value at (0,1,2,4).")  
       self.failUnlessEqual(dsds[0,1,3,0],0.0,"ds/ds has wrong value at (0,1,3,0).")  
       self.failUnlessEqual(dsds[0,1,3,1],0.0,"ds/ds has wrong value at (0,1,3,1).")  
       self.failUnlessEqual(dsds[0,1,3,2],0.0,"ds/ds has wrong value at (0,1,3,2).")  
       self.failUnlessEqual(dsds[0,1,3,3],0.0,"ds/ds has wrong value at (0,1,3,3).")  
       self.failUnlessEqual(dsds[0,1,3,4],0.0,"ds/ds has wrong value at (0,1,3,4).")  
       self.failUnlessEqual(dsds[0,2,0,0],0.0,"ds/ds has wrong value at (0,2,0,0).")  
       self.failUnlessEqual(dsds[0,2,0,1],0.0,"ds/ds has wrong value at (0,2,0,1).")  
       self.failUnlessEqual(dsds[0,2,0,2],1.0,"ds/ds has wrong value at (0,2,0,2).")  
       self.failUnlessEqual(dsds[0,2,0,3],0.0,"ds/ds has wrong value at (0,2,0,3).")  
       self.failUnlessEqual(dsds[0,2,0,4],0.0,"ds/ds has wrong value at (0,2,0,4).")  
       self.failUnlessEqual(dsds[0,2,1,0],0.0,"ds/ds has wrong value at (0,2,1,0).")  
       self.failUnlessEqual(dsds[0,2,1,1],0.0,"ds/ds has wrong value at (0,2,1,1).")  
       self.failUnlessEqual(dsds[0,2,1,2],0.0,"ds/ds has wrong value at (0,2,1,2).")  
       self.failUnlessEqual(dsds[0,2,1,3],0.0,"ds/ds has wrong value at (0,2,1,3).")  
       self.failUnlessEqual(dsds[0,2,1,4],0.0,"ds/ds has wrong value at (0,2,1,4).")  
       self.failUnlessEqual(dsds[0,2,2,0],0.0,"ds/ds has wrong value at (0,2,2,0).")  
       self.failUnlessEqual(dsds[0,2,2,1],0.0,"ds/ds has wrong value at (0,2,2,1).")  
       self.failUnlessEqual(dsds[0,2,2,2],0.0,"ds/ds has wrong value at (0,2,2,2).")  
       self.failUnlessEqual(dsds[0,2,2,3],0.0,"ds/ds has wrong value at (0,2,2,3).")  
       self.failUnlessEqual(dsds[0,2,2,4],0.0,"ds/ds has wrong value at (0,2,2,4).")  
       self.failUnlessEqual(dsds[0,2,3,0],0.0,"ds/ds has wrong value at (0,2,3,0).")  
       self.failUnlessEqual(dsds[0,2,3,1],0.0,"ds/ds has wrong value at (0,2,3,1).")  
       self.failUnlessEqual(dsds[0,2,3,2],0.0,"ds/ds has wrong value at (0,2,3,2).")  
       self.failUnlessEqual(dsds[0,2,3,3],0.0,"ds/ds has wrong value at (0,2,3,3).")  
       self.failUnlessEqual(dsds[0,2,3,4],0.0,"ds/ds has wrong value at (0,2,3,4).")  
       self.failUnlessEqual(dsds[0,3,0,0],0.0,"ds/ds has wrong value at (0,3,0,0).")  
       self.failUnlessEqual(dsds[0,3,0,1],0.0,"ds/ds has wrong value at (0,3,0,1).")  
       self.failUnlessEqual(dsds[0,3,0,2],0.0,"ds/ds has wrong value at (0,3,0,2).")  
       self.failUnlessEqual(dsds[0,3,0,3],1.0,"ds/ds has wrong value at (0,3,0,3).")  
       self.failUnlessEqual(dsds[0,3,0,4],0.0,"ds/ds has wrong value at (0,3,0,4).")  
       self.failUnlessEqual(dsds[0,3,1,0],0.0,"ds/ds has wrong value at (0,3,1,0).")  
       self.failUnlessEqual(dsds[0,3,1,1],0.0,"ds/ds has wrong value at (0,3,1,1).")  
       self.failUnlessEqual(dsds[0,3,1,2],0.0,"ds/ds has wrong value at (0,3,1,2).")  
       self.failUnlessEqual(dsds[0,3,1,3],0.0,"ds/ds has wrong value at (0,3,1,3).")  
       self.failUnlessEqual(dsds[0,3,1,4],0.0,"ds/ds has wrong value at (0,3,1,4).")  
       self.failUnlessEqual(dsds[0,3,2,0],0.0,"ds/ds has wrong value at (0,3,2,0).")  
       self.failUnlessEqual(dsds[0,3,2,1],0.0,"ds/ds has wrong value at (0,3,2,1).")  
       self.failUnlessEqual(dsds[0,3,2,2],0.0,"ds/ds has wrong value at (0,3,2,2).")  
       self.failUnlessEqual(dsds[0,3,2,3],0.0,"ds/ds has wrong value at (0,3,2,3).")  
       self.failUnlessEqual(dsds[0,3,2,4],0.0,"ds/ds has wrong value at (0,3,2,4).")  
       self.failUnlessEqual(dsds[0,3,3,0],0.0,"ds/ds has wrong value at (0,3,3,0).")  
       self.failUnlessEqual(dsds[0,3,3,1],0.0,"ds/ds has wrong value at (0,3,3,1).")  
       self.failUnlessEqual(dsds[0,3,3,2],0.0,"ds/ds has wrong value at (0,3,3,2).")  
       self.failUnlessEqual(dsds[0,3,3,3],0.0,"ds/ds has wrong value at (0,3,3,3).")  
       self.failUnlessEqual(dsds[0,3,3,4],0.0,"ds/ds has wrong value at (0,3,3,4).")  
       self.failUnlessEqual(dsds[0,4,0,0],0.0,"ds/ds has wrong value at (0,4,0,0).")  
       self.failUnlessEqual(dsds[0,4,0,1],0.0,"ds/ds has wrong value at (0,4,0,1).")  
       self.failUnlessEqual(dsds[0,4,0,2],0.0,"ds/ds has wrong value at (0,4,0,2).")  
       self.failUnlessEqual(dsds[0,4,0,3],0.0,"ds/ds has wrong value at (0,4,0,3).")  
       self.failUnlessEqual(dsds[0,4,0,4],1.0,"ds/ds has wrong value at (0,4,0,4).")  
       self.failUnlessEqual(dsds[0,4,1,0],0.0,"ds/ds has wrong value at (0,4,1,0).")  
       self.failUnlessEqual(dsds[0,4,1,1],0.0,"ds/ds has wrong value at (0,4,1,1).")  
       self.failUnlessEqual(dsds[0,4,1,2],0.0,"ds/ds has wrong value at (0,4,1,2).")  
       self.failUnlessEqual(dsds[0,4,1,3],0.0,"ds/ds has wrong value at (0,4,1,3).")  
       self.failUnlessEqual(dsds[0,4,1,4],0.0,"ds/ds has wrong value at (0,4,1,4).")  
       self.failUnlessEqual(dsds[0,4,2,0],0.0,"ds/ds has wrong value at (0,4,2,0).")  
       self.failUnlessEqual(dsds[0,4,2,1],0.0,"ds/ds has wrong value at (0,4,2,1).")  
       self.failUnlessEqual(dsds[0,4,2,2],0.0,"ds/ds has wrong value at (0,4,2,2).")  
       self.failUnlessEqual(dsds[0,4,2,3],0.0,"ds/ds has wrong value at (0,4,2,3).")  
       self.failUnlessEqual(dsds[0,4,2,4],0.0,"ds/ds has wrong value at (0,4,2,4).")  
       self.failUnlessEqual(dsds[0,4,3,0],0.0,"ds/ds has wrong value at (0,4,3,0).")  
       self.failUnlessEqual(dsds[0,4,3,1],0.0,"ds/ds has wrong value at (0,4,3,1).")  
       self.failUnlessEqual(dsds[0,4,3,2],0.0,"ds/ds has wrong value at (0,4,3,2).")  
       self.failUnlessEqual(dsds[0,4,3,3],0.0,"ds/ds has wrong value at (0,4,3,3).")  
       self.failUnlessEqual(dsds[0,4,3,4],0.0,"ds/ds has wrong value at (0,4,3,4).")  
       self.failUnlessEqual(dsds[1,0,0,0],0.0,"ds/ds has wrong value at (1,0,0,0).")  
       self.failUnlessEqual(dsds[1,0,0,1],0.0,"ds/ds has wrong value at (1,0,0,1).")  
       self.failUnlessEqual(dsds[1,0,0,2],0.0,"ds/ds has wrong value at (1,0,0,2).")  
       self.failUnlessEqual(dsds[1,0,0,3],0.0,"ds/ds has wrong value at (1,0,0,3).")  
       self.failUnlessEqual(dsds[1,0,0,4],0.0,"ds/ds has wrong value at (1,0,0,4).")  
       self.failUnlessEqual(dsds[1,0,1,0],1.0,"ds/ds has wrong value at (1,0,1,0).")  
       self.failUnlessEqual(dsds[1,0,1,1],0.0,"ds/ds has wrong value at (1,0,1,1).")  
       self.failUnlessEqual(dsds[1,0,1,2],0.0,"ds/ds has wrong value at (1,0,1,2).")  
       self.failUnlessEqual(dsds[1,0,1,3],0.0,"ds/ds has wrong value at (1,0,1,3).")  
       self.failUnlessEqual(dsds[1,0,1,4],0.0,"ds/ds has wrong value at (1,0,1,4).")  
       self.failUnlessEqual(dsds[1,0,2,0],0.0,"ds/ds has wrong value at (1,0,2,0).")  
       self.failUnlessEqual(dsds[1,0,2,1],0.0,"ds/ds has wrong value at (1,0,2,1).")  
       self.failUnlessEqual(dsds[1,0,2,2],0.0,"ds/ds has wrong value at (1,0,2,2).")  
       self.failUnlessEqual(dsds[1,0,2,3],0.0,"ds/ds has wrong value at (1,0,2,3).")  
       self.failUnlessEqual(dsds[1,0,2,4],0.0,"ds/ds has wrong value at (1,0,2,4).")  
       self.failUnlessEqual(dsds[1,0,3,0],0.0,"ds/ds has wrong value at (1,0,3,0).")  
       self.failUnlessEqual(dsds[1,0,3,1],0.0,"ds/ds has wrong value at (1,0,3,1).")  
       self.failUnlessEqual(dsds[1,0,3,2],0.0,"ds/ds has wrong value at (1,0,3,2).")  
       self.failUnlessEqual(dsds[1,0,3,3],0.0,"ds/ds has wrong value at (1,0,3,3).")  
       self.failUnlessEqual(dsds[1,0,3,4],0.0,"ds/ds has wrong value at (1,0,3,4).")  
       self.failUnlessEqual(dsds[1,1,0,0],0.0,"ds/ds has wrong value at (1,1,0,0).")  
       self.failUnlessEqual(dsds[1,1,0,1],0.0,"ds/ds has wrong value at (1,1,0,1).")  
       self.failUnlessEqual(dsds[1,1,0,2],0.0,"ds/ds has wrong value at (1,1,0,2).")  
       self.failUnlessEqual(dsds[1,1,0,3],0.0,"ds/ds has wrong value at (1,1,0,3).")  
       self.failUnlessEqual(dsds[1,1,0,4],0.0,"ds/ds has wrong value at (1,1,0,4).")  
       self.failUnlessEqual(dsds[1,1,1,0],0.0,"ds/ds has wrong value at (1,1,1,0).")  
       self.failUnlessEqual(dsds[1,1,1,1],1.0,"ds/ds has wrong value at (1,1,1,1).")  
       self.failUnlessEqual(dsds[1,1,1,2],0.0,"ds/ds has wrong value at (1,1,1,2).")  
       self.failUnlessEqual(dsds[1,1,1,3],0.0,"ds/ds has wrong value at (1,1,1,3).")  
       self.failUnlessEqual(dsds[1,1,1,4],0.0,"ds/ds has wrong value at (1,1,1,4).")  
       self.failUnlessEqual(dsds[1,1,2,0],0.0,"ds/ds has wrong value at (1,1,2,0).")  
       self.failUnlessEqual(dsds[1,1,2,1],0.0,"ds/ds has wrong value at (1,1,2,1).")  
       self.failUnlessEqual(dsds[1,1,2,2],0.0,"ds/ds has wrong value at (1,1,2,2).")  
       self.failUnlessEqual(dsds[1,1,2,3],0.0,"ds/ds has wrong value at (1,1,2,3).")  
       self.failUnlessEqual(dsds[1,1,2,4],0.0,"ds/ds has wrong value at (1,1,2,4).")  
       self.failUnlessEqual(dsds[1,1,3,0],0.0,"ds/ds has wrong value at (1,1,3,0).")  
       self.failUnlessEqual(dsds[1,1,3,1],0.0,"ds/ds has wrong value at (1,1,3,1).")  
       self.failUnlessEqual(dsds[1,1,3,2],0.0,"ds/ds has wrong value at (1,1,3,2).")  
       self.failUnlessEqual(dsds[1,1,3,3],0.0,"ds/ds has wrong value at (1,1,3,3).")  
       self.failUnlessEqual(dsds[1,1,3,4],0.0,"ds/ds has wrong value at (1,1,3,4).")  
       self.failUnlessEqual(dsds[1,2,0,0],0.0,"ds/ds has wrong value at (1,2,0,0).")  
       self.failUnlessEqual(dsds[1,2,0,1],0.0,"ds/ds has wrong value at (1,2,0,1).")  
       self.failUnlessEqual(dsds[1,2,0,2],0.0,"ds/ds has wrong value at (1,2,0,2).")  
       self.failUnlessEqual(dsds[1,2,0,3],0.0,"ds/ds has wrong value at (1,2,0,3).")  
       self.failUnlessEqual(dsds[1,2,0,4],0.0,"ds/ds has wrong value at (1,2,0,4).")  
       self.failUnlessEqual(dsds[1,2,1,0],0.0,"ds/ds has wrong value at (1,2,1,0).")  
       self.failUnlessEqual(dsds[1,2,1,1],0.0,"ds/ds has wrong value at (1,2,1,1).")  
       self.failUnlessEqual(dsds[1,2,1,2],1.0,"ds/ds has wrong value at (1,2,1,2).")  
       self.failUnlessEqual(dsds[1,2,1,3],0.0,"ds/ds has wrong value at (1,2,1,3).")  
       self.failUnlessEqual(dsds[1,2,1,4],0.0,"ds/ds has wrong value at (1,2,1,4).")  
       self.failUnlessEqual(dsds[1,2,2,0],0.0,"ds/ds has wrong value at (1,2,2,0).")  
       self.failUnlessEqual(dsds[1,2,2,1],0.0,"ds/ds has wrong value at (1,2,2,1).")  
       self.failUnlessEqual(dsds[1,2,2,2],0.0,"ds/ds has wrong value at (1,2,2,2).")  
       self.failUnlessEqual(dsds[1,2,2,3],0.0,"ds/ds has wrong value at (1,2,2,3).")  
       self.failUnlessEqual(dsds[1,2,2,4],0.0,"ds/ds has wrong value at (1,2,2,4).")