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

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

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

revision 341 by gross, Mon Dec 12 05:26:10 2005 UTC revision 395 by gross, Wed Dec 21 02:41:59 2005 UTC
# Line 4  Test suite for the util.py module. Line 4  Test suite for the util.py module.
4    
5  The tests must be linked with a function space class object in the setUp method:  The tests must be linked with a function space class object in the setUp method:
6    
 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  
   
   
7  to run the use:  to run the use:
8    
9     from esys.bruce import Brick     from esys.bruce import Brick
# Line 55  This test assumes that the functionspace Line 30  This test assumes that the functionspace
30  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
31  __licence__="contact: esys@access.uq.edu.au"  __licence__="contact: esys@access.uq.edu.au"
32  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys/escript"
33  __version__="$Revision: 313 $"  __version__="$Revision$"
34  __date__="$Date$"  __date__="$Date$"
35    
36  import unittest  import unittest
37  import numarray  import numarray
38  from esys.escript import *  from esys.escript import *
39    from esys.escript.test_util_base import Test_util_base
40  class Test_util_base(unittest.TestCase):  from esys.escript.test_util_reduction_no_tagged_data import Test_util_reduction_no_tagged_data
41     """  from esys.escript.test_util_reduction_with_tagged_data import Test_util_reduction_with_tagged_data
42     basic tests on util.py  from esys.escript.test_util_overloaded_binary_no_tagged_data import Test_util_overloaded_binary_no_tagged_data
43     """  from esys.escript.test_util_overloaded_binary_with_tagged_data import Test_util_overloaded_binary_with_tagged_data
44     RES_TOL=1.e-7 # RES_TOLerance to compare results  from esys.escript.test_util_unary_no_tagged_data import Test_util_unary_no_tagged_data
45     DIFF_TOL=1.e-7 # RES_TOLerance to derivatices  from esys.escript.test_util_unary_with_tagged_data import Test_util_unary_with_tagged_data
46  #=========================================================  from esys.escript.test_util_binary_no_tagged_data import Test_util_binary_no_tagged_data
47  #  constants  from esys.escript.test_util_binary_with_tagged_data import Test_util_binary_with_tagged_data
 #=========================================================  
    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
    def test_kronecker_1(self):  
       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).")  
       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).")