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

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

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

trunk/escript/py_src/test_util.py revision 341 by gross, Mon Dec 12 05:26:10 2005 UTC trunk/escript/test/python/test_util.py revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
1    #
2  # $Id$  # $Id$
3    #
4    #######################################################
5    #
6    #           Copyright 2003-2007 by ACceSS MNRF
7    #       Copyright 2007 by University of Queensland
8    #
9    #                http://esscc.uq.edu.au
10    #        Primary Business: Queensland, Australia
11    #  Licensed under the Open Software License version 3.0
12    #     http://www.opensource.org/licenses/osl-3.0.php
13    #
14    #######################################################
15    #
16    
17  """  """
18  Test suite for the util.py module.  Test suite for the util.py module.
19    
20  The tests must be linked with a function space class object in the setUp method:  The tests must be linked with a function space class object in the setUp method:
21    
 The test are grouped as  
   
    Test_util_basic: some basic tests  
   
    Test_util_unary_no_tagged_data: test for unary operations with no  
    Test_util_unary_tagged_data: test for unary operations  
    Test_util_unary: test for unary operations  
   
    Test_util_reduction_no_tagged_data: test for unary operations with no  
    Test_util_reduction_tagged_data: test for unary operations  
    Test_util_reduction: test for unary operations  
   
    Test_util_binary_no_tagged_data: test for unary operations with no  
    Test_util_binary_tagged_data: test for unary operations  
    Test_util_binary: test for unary operations  
   
    Test_util_overloaded_operations_no_tagged_data: test for unary operations with no  
    Test_util_overloaded_operations_tagged_data: test for unary operations  
    Test_util_overloaded_operations test for unary operations  
   
    Test_util_no_tagged_data: all test withour tagged data  
    Test_util_tagged_data: all test with tagged data only  
    Test_util: all test  
   
   
22  to run the use:  to run the use:
23    
24     from esys.bruce import Brick     from esys.bruce import Brick
# Line 41  to run the use: Line 31  to run the use:
31     unittest.TextTestRunner(verbosity=2).run(suite)     unittest.TextTestRunner(verbosity=2).run(suite)
32    
33  For function spaces which support tagging there is the extended test case Test_util_with_tagged_data available.  For function spaces which support tagging there is the extended test case Test_util_with_tagged_data available.
34  This test assumes that the functionspace has samples with tags equal to 1 and different from 1.  This test assumes that samples with x_0 coordinate 0 are tagged with 1 and all samples tagged with 1 have x_0
35    coordinate 0.
36    
37  @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.  @note: at this stage this test will not pass as it tests for functionlity that has not been implemented yet. It also does not test the full functionalitu of util.py yet.
38    
39  @var __author__: name of author  @var __author__: name of author
40  @var __licence__: licence agreement  @var __copyright__: copyrights
41    @var __license__: licence agreement
42  @var __url__: url entry point on documentation  @var __url__: url entry point on documentation
43  @var __version__: version  @var __version__: version
44  @var __date__: date of the version  @var __date__: date of the version
45  """  """
46    
47  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
48  __licence__="contact: esys@access.uq.edu.au"  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
49                        http://www.access.edu.au
50                    Primary Business: Queensland, Australia"""
51    __license__="""Licensed under the Open Software License version 3.0
52                 http://www.opensource.org/licenses/osl-3.0.php"""
53  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys/escript"
54  __version__="$Revision: 313 $"  __version__="$Revision$"
55  __date__="$Date$"  __date__="$Date$"
56    
57  import unittest  import unittest
58  import numarray  import numarray
59  from esys.escript import *  from esys.escript import *
60    from test_util_base import Test_util_base
61  class Test_util_base(unittest.TestCase):  from test_util_reduction_no_tagged_data import Test_util_reduction_no_tagged_data
62     """  from test_util_reduction_with_tagged_data import Test_util_reduction_with_tagged_data
63     basic tests on util.py  from test_util_overloaded_binary_no_tagged_data import Test_util_overloaded_binary_no_tagged_data
64     """  from test_util_overloaded_binary_with_tagged_data import Test_util_overloaded_binary_with_tagged_data
65     RES_TOL=1.e-7 # RES_TOLerance to compare results  from test_util_unary_no_tagged_data import Test_util_unary_no_tagged_data
66     DIFF_TOL=1.e-7 # RES_TOLerance to derivatices  from test_util_unary_with_tagged_data import Test_util_unary_with_tagged_data
67  #=========================================================  from test_util_binary_no_tagged_data import Test_util_binary_no_tagged_data
68  #  constants  from test_util_binary_with_tagged_data import Test_util_binary_with_tagged_data
69  #=========================================================  from test_util_spatial_functions import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
70     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  from test_util_slicing_no_tagged_data import Test_util_slicing_no_tagged_data
71     def test_kronecker_1(self):  from test_util_slicing_with_tagged_data import Test_util_slicing_with_tagged_data
       val=kronecker(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_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).")  
       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).")