7174 |
self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues") |
self.failUnless(Lsup(res[0]-ref_ev)<=self.RES_TOL*Lsup(ref_ev),"wrong eigenvalues") |
7175 |
self.failUnless(Lsup(matrix_mult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0") |
self.failUnless(Lsup(matrix_mult(arg,res[1][:,0])-res[0][0]*res[1][:,0])<=self.RES_TOL*Lsup(res[0]),"wrong eigenvector 0") |
7176 |
self.failUnless(Lsup(matrix_mult(transpose(res[1]),res[1])-kronecker(1))<=self.RES_TOL,"eigenvectors are not orthonormal") |
self.failUnless(Lsup(matrix_mult(transpose(res[1]),res[1])-kronecker(1))<=self.RES_TOL,"eigenvectors are not orthonormal") |
7177 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7178 |
|
def test_swapaxes_array_rank2_axes_01(self): |
7179 |
|
arg=numarray.array([[1.0, 2.0, -1.0, 7.0, -3.0], [0.0, -5.0, 3.0, 7.0, 5.0], [-3.0, -3.0, 4.0, 6.0, -6.0], [-6.0, 7.0, 6.0, 4.0, -7.0]]) |
7180 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7181 |
|
ref=numarray.array([[1.0, 0.0, -3.0, -6.0], [2.0, -5.0, -3.0, 7.0], [-1.0, 3.0, 4.0, 6.0], [7.0, 7.0, 6.0, 4.0], [-3.0, 5.0, -6.0, -7.0]]) |
7182 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7183 |
|
self.failUnlessEqual(res.shape,(5, 4),"wrong shape of result.") |
7184 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7185 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7186 |
|
def test_swapaxes_array_rank3_axes_01(self): |
7187 |
|
arg=numarray.array([[[6.0, 3.0], [7.0, 0.0]], [[-5.0, 3.0], [5.0, 3.0]], [[-7.0, -4.0], [3.0, 4.0]], [[1.0, 3.0], [-7.0, -7.0]], [[-7.0, 3.0], [-6.0, -5.0]], [[-2.0, 7.0], [-1.0, 1.0]]]) |
7188 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7189 |
|
ref=numarray.array([[[6.0, 3.0], [-5.0, 3.0], [-7.0, -4.0], [1.0, 3.0], [-7.0, 3.0], [-2.0, 7.0]], [[7.0, 0.0], [5.0, 3.0], [3.0, 4.0], [-7.0, -7.0], [-6.0, -5.0], [-1.0, 1.0]]]) |
7190 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7191 |
|
self.failUnlessEqual(res.shape,(2, 6, 2),"wrong shape of result.") |
7192 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7193 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7194 |
|
def test_swapaxes_array_rank3_axes_02(self): |
7195 |
|
arg=numarray.array([[[0.0, 4.0], [-3.0, -1.0]], [[2.0, 3.0], [-6.0, 2.0]], [[-6.0, -2.0], [0.0, 5.0]], [[4.0, -7.0], [5.0, -1.0]], [[2.0, -7.0], [-3.0, 2.0]], [[6.0, -6.0], [2.0, -1.0]]]) |
7196 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
7197 |
|
ref=numarray.array([[[0.0, 2.0, -6.0, 4.0, 2.0, 6.0], [-3.0, -6.0, 0.0, 5.0, -3.0, 2.0]], [[4.0, 3.0, -2.0, -7.0, -7.0, -6.0], [-1.0, 2.0, 5.0, -1.0, 2.0, -1.0]]]) |
7198 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7199 |
|
self.failUnlessEqual(res.shape,(2, 2, 6),"wrong shape of result.") |
7200 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7201 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7202 |
|
def test_swapaxes_array_rank3_axes_12(self): |
7203 |
|
arg=numarray.array([[[7.0, 1.0], [-6.0, -3.0]], [[0.0, 1.0], [-3.0, 2.0]], [[-3.0, -6.0], [-3.0, 1.0]], [[-6.0, 1.0], [-7.0, -3.0]], [[2.0, 3.0], [5.0, -2.0]], [[-1.0, 0.0], [-2.0, 7.0]]]) |
7204 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
7205 |
|
ref=numarray.array([[[7.0, -6.0], [1.0, -3.0]], [[0.0, -3.0], [1.0, 2.0]], [[-3.0, -3.0], [-6.0, 1.0]], [[-6.0, -7.0], [1.0, -3.0]], [[2.0, 5.0], [3.0, -2.0]], [[-1.0, -2.0], [0.0, 7.0]]]) |
7206 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7207 |
|
self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") |
7208 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7209 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7210 |
|
def test_swapaxes_array_rank4_axes_01(self): |
7211 |
|
arg=numarray.array([[[[7.0, -5.0, 0.0, 1.0], [-6.0, 0.0, -6.0, 1.0], [0.0, 6.0, -6.0, -6.0]], [[7.0, -3.0, 4.0, 7.0], [5.0, 2.0, -4.0, -3.0], [-6.0, 6.0, -4.0, 1.0]]], [[[2.0, -1.0, -1.0, 1.0], [-2.0, 6.0, -6.0, -2.0], [1.0, 2.0, 0.0, 2.0]], [[-6.0, -7.0, 6.0, 1.0], [-5.0, 4.0, 2.0, -6.0], [-4.0, 0.0, 3.0, -7.0]]], [[[-5.0, 1.0, 6.0, 0.0], [-7.0, -6.0, 1.0, -2.0], [-1.0, -5.0, 0.0, -2.0]], [[6.0, 5.0, -1.0, 3.0], [2.0, 5.0, -3.0, 0.0], [3.0, 2.0, -4.0, -2.0]]]]) |
7212 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7213 |
|
ref=numarray.array([[[[7.0, -5.0, 0.0, 1.0], [-6.0, 0.0, -6.0, 1.0], [0.0, 6.0, -6.0, -6.0]], [[2.0, -1.0, -1.0, 1.0], [-2.0, 6.0, -6.0, -2.0], [1.0, 2.0, 0.0, 2.0]], [[-5.0, 1.0, 6.0, 0.0], [-7.0, -6.0, 1.0, -2.0], [-1.0, -5.0, 0.0, -2.0]]], [[[7.0, -3.0, 4.0, 7.0], [5.0, 2.0, -4.0, -3.0], [-6.0, 6.0, -4.0, 1.0]], [[-6.0, -7.0, 6.0, 1.0], [-5.0, 4.0, 2.0, -6.0], [-4.0, 0.0, 3.0, -7.0]], [[6.0, 5.0, -1.0, 3.0], [2.0, 5.0, -3.0, 0.0], [3.0, 2.0, -4.0, -2.0]]]]) |
7214 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7215 |
|
self.failUnlessEqual(res.shape,(2, 3, 3, 4),"wrong shape of result.") |
7216 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7217 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7218 |
|
def test_swapaxes_array_rank4_axes_02(self): |
7219 |
|
arg=numarray.array([[[[5.0, -7.0, 5.0, 1.0], [-3.0, -1.0, 7.0, -2.0], [-3.0, -6.0, -4.0, -6.0]], [[-2.0, 5.0, -4.0, 0.0], [-3.0, -1.0, -3.0, 0.0], [3.0, -2.0, 1.0, -5.0]]], [[[0.0, 6.0, -7.0, 6.0], [7.0, -5.0, 0.0, -2.0], [-5.0, -4.0, 4.0, -4.0]], [[-4.0, -4.0, -4.0, -4.0], [-7.0, 3.0, 0.0, 5.0], [-6.0, -7.0, 7.0, 0.0]]], [[[-7.0, -3.0, 1.0, 0.0], [0.0, 6.0, 2.0, 0.0], [7.0, -3.0, 4.0, 3.0]], [[3.0, -4.0, 2.0, 2.0], [1.0, -5.0, -4.0, -3.0], [1.0, 0.0, -3.0, -5.0]]]]) |
7220 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
7221 |
|
ref=numarray.array([[[[5.0, -7.0, 5.0, 1.0], [0.0, 6.0, -7.0, 6.0], [-7.0, -3.0, 1.0, 0.0]], [[-2.0, 5.0, -4.0, 0.0], [-4.0, -4.0, -4.0, -4.0], [3.0, -4.0, 2.0, 2.0]]], [[[-3.0, -1.0, 7.0, -2.0], [7.0, -5.0, 0.0, -2.0], [0.0, 6.0, 2.0, 0.0]], [[-3.0, -1.0, -3.0, 0.0], [-7.0, 3.0, 0.0, 5.0], [1.0, -5.0, -4.0, -3.0]]], [[[-3.0, -6.0, -4.0, -6.0], [-5.0, -4.0, 4.0, -4.0], [7.0, -3.0, 4.0, 3.0]], [[3.0, -2.0, 1.0, -5.0], [-6.0, -7.0, 7.0, 0.0], [1.0, 0.0, -3.0, -5.0]]]]) |
7222 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7223 |
|
self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") |
7224 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7225 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7226 |
|
def test_swapaxes_array_rank4_axes_03(self): |
7227 |
|
arg=numarray.array([[[[7.0, 0.0, -3.0, 5.0], [0.0, -5.0, -2.0, 4.0], [1.0, 4.0, 4.0, 1.0]], [[1.0, 3.0, -4.0, 2.0], [-3.0, 3.0, 7.0, -2.0], [-6.0, -2.0, 0.0, -6.0]]], [[[-2.0, -2.0, 4.0, -6.0], [3.0, -5.0, 7.0, -2.0], [7.0, -3.0, -1.0, 3.0]], [[-5.0, -6.0, -6.0, 1.0], [7.0, 1.0, 0.0, -1.0], [2.0, -7.0, 0.0, -3.0]]], [[[0.0, -6.0, -1.0, -1.0], [-7.0, 7.0, -2.0, 1.0], [-5.0, -3.0, -5.0, -3.0]], [[1.0, 0.0, 0.0, -2.0], [-6.0, -1.0, -4.0, -6.0], [-4.0, 0.0, 6.0, -6.0]]]]) |
7228 |
|
res=swap_axes(arg,axis0=0,axis1=3) |
7229 |
|
ref=numarray.array([[[[7.0, -2.0, 0.0], [0.0, 3.0, -7.0], [1.0, 7.0, -5.0]], [[1.0, -5.0, 1.0], [-3.0, 7.0, -6.0], [-6.0, 2.0, -4.0]]], [[[0.0, -2.0, -6.0], [-5.0, -5.0, 7.0], [4.0, -3.0, -3.0]], [[3.0, -6.0, 0.0], [3.0, 1.0, -1.0], [-2.0, -7.0, 0.0]]], [[[-3.0, 4.0, -1.0], [-2.0, 7.0, -2.0], [4.0, -1.0, -5.0]], [[-4.0, -6.0, 0.0], [7.0, 0.0, -4.0], [0.0, 0.0, 6.0]]], [[[5.0, -6.0, -1.0], [4.0, -2.0, 1.0], [1.0, 3.0, -3.0]], [[2.0, 1.0, -2.0], [-2.0, -1.0, -6.0], [-6.0, -3.0, -6.0]]]]) |
7230 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7231 |
|
self.failUnlessEqual(res.shape,(4, 2, 3, 3),"wrong shape of result.") |
7232 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7233 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7234 |
|
def test_swapaxes_array_rank4_axes_12(self): |
7235 |
|
arg=numarray.array([[[[6.0, 4.0, 7.0, -6.0], [6.0, -7.0, -2.0, 1.0], [-4.0, 0.0, -5.0, 2.0]], [[0.0, -4.0, -5.0, 7.0], [-7.0, 0.0, -6.0, 2.0], [7.0, -3.0, 2.0, -1.0]]], [[[0.0, -1.0, -7.0, 1.0], [4.0, 4.0, 1.0, -7.0], [-1.0, 3.0, 0.0, -6.0]], [[3.0, 3.0, -4.0, -3.0], [-6.0, 0.0, 6.0, 0.0], [-6.0, 6.0, 6.0, 2.0]]], [[[-1.0, 5.0, 4.0, 4.0], [-4.0, -4.0, 5.0, -3.0], [2.0, -1.0, 2.0, 2.0]], [[2.0, 0.0, 5.0, 3.0], [-7.0, 0.0, -4.0, 0.0], [0.0, 3.0, -6.0, -1.0]]]]) |
7236 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
7237 |
|
ref=numarray.array([[[[6.0, 4.0, 7.0, -6.0], [0.0, -4.0, -5.0, 7.0]], [[6.0, -7.0, -2.0, 1.0], [-7.0, 0.0, -6.0, 2.0]], [[-4.0, 0.0, -5.0, 2.0], [7.0, -3.0, 2.0, -1.0]]], [[[0.0, -1.0, -7.0, 1.0], [3.0, 3.0, -4.0, -3.0]], [[4.0, 4.0, 1.0, -7.0], [-6.0, 0.0, 6.0, 0.0]], [[-1.0, 3.0, 0.0, -6.0], [-6.0, 6.0, 6.0, 2.0]]], [[[-1.0, 5.0, 4.0, 4.0], [2.0, 0.0, 5.0, 3.0]], [[-4.0, -4.0, 5.0, -3.0], [-7.0, 0.0, -4.0, 0.0]], [[2.0, -1.0, 2.0, 2.0], [0.0, 3.0, -6.0, -1.0]]]]) |
7238 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7239 |
|
self.failUnlessEqual(res.shape,(3, 3, 2, 4),"wrong shape of result.") |
7240 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7241 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7242 |
|
def test_swapaxes_array_rank4_axes_13(self): |
7243 |
|
arg=numarray.array([[[[-1.0, 5.0, 4.0, -2.0], [-7.0, 1.0, 1.0, -2.0], [-5.0, -2.0, 6.0, -1.0]], [[7.0, -5.0, -2.0, 6.0], [4.0, 4.0, 0.0, -2.0], [1.0, 1.0, 3.0, -5.0]]], [[[0.0, 0.0, 3.0, 0.0], [3.0, 4.0, 4.0, 3.0], [7.0, -3.0, 4.0, -3.0]], [[1.0, 0.0, 4.0, 0.0], [5.0, -2.0, -5.0, -7.0], [-2.0, -5.0, -7.0, -1.0]]], [[[1.0, 4.0, -6.0, 0.0], [0.0, -3.0, 0.0, -2.0], [3.0, -3.0, 1.0, 1.0]], [[6.0, 0.0, -7.0, 1.0], [-4.0, 6.0, -7.0, 7.0], [-4.0, 0.0, 4.0, -5.0]]]]) |
7244 |
|
res=swap_axes(arg,axis0=1,axis1=3) |
7245 |
|
ref=numarray.array([[[[-1.0, 7.0], [-7.0, 4.0], [-5.0, 1.0]], [[5.0, -5.0], [1.0, 4.0], [-2.0, 1.0]], [[4.0, -2.0], [1.0, 0.0], [6.0, 3.0]], [[-2.0, 6.0], [-2.0, -2.0], [-1.0, -5.0]]], [[[0.0, 1.0], [3.0, 5.0], [7.0, -2.0]], [[0.0, 0.0], [4.0, -2.0], [-3.0, -5.0]], [[3.0, 4.0], [4.0, -5.0], [4.0, -7.0]], [[0.0, 0.0], [3.0, -7.0], [-3.0, -1.0]]], [[[1.0, 6.0], [0.0, -4.0], [3.0, -4.0]], [[4.0, 0.0], [-3.0, 6.0], [-3.0, 0.0]], [[-6.0, -7.0], [0.0, -7.0], [1.0, 4.0]], [[0.0, 1.0], [-2.0, 7.0], [1.0, -5.0]]]]) |
7246 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7247 |
|
self.failUnlessEqual(res.shape,(3, 4, 3, 2),"wrong shape of result.") |
7248 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7249 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7250 |
|
def test_swapaxes_array_rank4_axes_23(self): |
7251 |
|
arg=numarray.array([[[[1.0, 1.0, -2.0, -1.0], [2.0, 4.0, 5.0, 5.0], [6.0, -2.0, 0.0, 3.0]], [[7.0, 7.0, 1.0, 7.0], [-7.0, 7.0, -4.0, 6.0], [-3.0, 0.0, -4.0, 4.0]]], [[[0.0, 0.0, -1.0, 7.0], [-6.0, 6.0, -4.0, -4.0], [-7.0, -4.0, -5.0, -1.0]], [[-5.0, -5.0, -3.0, 0.0], [-1.0, 1.0, 7.0, 7.0], [-6.0, 6.0, 7.0, 0.0]]], [[[-3.0, -4.0, 0.0, 4.0], [3.0, -4.0, -7.0, 0.0], [4.0, 2.0, -4.0, 6.0]], [[4.0, 0.0, 0.0, 2.0], [4.0, 5.0, 2.0, -7.0], [3.0, -7.0, -4.0, 1.0]]]]) |
7252 |
|
res=swap_axes(arg,axis0=2,axis1=3) |
7253 |
|
ref=numarray.array([[[[1.0, 2.0, 6.0], [1.0, 4.0, -2.0], [-2.0, 5.0, 0.0], [-1.0, 5.0, 3.0]], [[7.0, -7.0, -3.0], [7.0, 7.0, 0.0], [1.0, -4.0, -4.0], [7.0, 6.0, 4.0]]], [[[0.0, -6.0, -7.0], [0.0, 6.0, -4.0], [-1.0, -4.0, -5.0], [7.0, -4.0, -1.0]], [[-5.0, -1.0, -6.0], [-5.0, 1.0, 6.0], [-3.0, 7.0, 7.0], [0.0, 7.0, 0.0]]], [[[-3.0, 3.0, 4.0], [-4.0, -4.0, 2.0], [0.0, -7.0, -4.0], [4.0, 0.0, 6.0]], [[4.0, 4.0, 3.0], [0.0, 5.0, -7.0], [0.0, 2.0, -4.0], [2.0, -7.0, 1.0]]]]) |
7254 |
|
self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
7255 |
|
self.failUnlessEqual(res.shape,(3, 2, 4, 3),"wrong shape of result.") |
7256 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7257 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7258 |
|
def test_swapaxes_Symbol_rank2_axes_01(self): |
7259 |
|
arg=Symbol(shape=(4, 5)) |
7260 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7261 |
|
s=numarray.array([[-4.0, 0.0, -3.0, -4.0, 0.0], [7.0, 6.0, 7.0, -4.0, 1.0], [4.0, 0.0, 6.0, 0.0, 1.0], [4.0, -7.0, -7.0, 5.0, 3.0]]) |
7262 |
|
sub=res.substitute({arg:s}) |
7263 |
|
ref=numarray.array([[-4.0, 7.0, 4.0, 4.0], [0.0, 6.0, 0.0, -7.0], [-3.0, 7.0, 6.0, -7.0], [-4.0, -4.0, 0.0, 5.0], [0.0, 1.0, 1.0, 3.0]]) |
7264 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7265 |
|
self.failUnlessEqual(res.getShape(),(5, 4),"wrong shape of result.") |
7266 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7267 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7268 |
|
def test_swapaxes_Symbol_rank3_axes_01(self): |
7269 |
|
arg=Symbol(shape=(6, 2, 2)) |
7270 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7271 |
|
s=numarray.array([[[0.0, 1.0], [2.0, -7.0]], [[5.0, 0.0], [-2.0, 3.0]], [[-7.0, -6.0], [-2.0, -4.0]], [[0.0, 0.0], [5.0, 6.0]], [[-1.0, 1.0], [-6.0, -1.0]], [[-5.0, 0.0], [-1.0, 3.0]]]) |
7272 |
|
sub=res.substitute({arg:s}) |
7273 |
|
ref=numarray.array([[[0.0, 1.0], [5.0, 0.0], [-7.0, -6.0], [0.0, 0.0], [-1.0, 1.0], [-5.0, 0.0]], [[2.0, -7.0], [-2.0, 3.0], [-2.0, -4.0], [5.0, 6.0], [-6.0, -1.0], [-1.0, 3.0]]]) |
7274 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7275 |
|
self.failUnlessEqual(res.getShape(),(2, 6, 2),"wrong shape of result.") |
7276 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7277 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7278 |
|
def test_swapaxes_Symbol_rank3_axes_02(self): |
7279 |
|
arg=Symbol(shape=(6, 2, 2)) |
7280 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
7281 |
|
s=numarray.array([[[-6.0, 1.0], [6.0, -7.0]], [[-7.0, -1.0], [5.0, -1.0]], [[0.0, -4.0], [1.0, 2.0]], [[7.0, 3.0], [4.0, 5.0]], [[-1.0, -2.0], [3.0, -6.0]], [[6.0, -6.0], [3.0, 1.0]]]) |
7282 |
|
sub=res.substitute({arg:s}) |
7283 |
|
ref=numarray.array([[[-6.0, -7.0, 0.0, 7.0, -1.0, 6.0], [6.0, 5.0, 1.0, 4.0, 3.0, 3.0]], [[1.0, -1.0, -4.0, 3.0, -2.0, -6.0], [-7.0, -1.0, 2.0, 5.0, -6.0, 1.0]]]) |
7284 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7285 |
|
self.failUnlessEqual(res.getShape(),(2, 2, 6),"wrong shape of result.") |
7286 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7287 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7288 |
|
def test_swapaxes_Symbol_rank3_axes_12(self): |
7289 |
|
arg=Symbol(shape=(6, 2, 2)) |
7290 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
7291 |
|
s=numarray.array([[[-1.0, 7.0], [-2.0, -6.0]], [[7.0, 7.0], [4.0, -3.0]], [[-7.0, 7.0], [-6.0, 1.0]], [[-2.0, 4.0], [0.0, 7.0]], [[5.0, -7.0], [0.0, -5.0]], [[5.0, 4.0], [7.0, -1.0]]]) |
7292 |
|
sub=res.substitute({arg:s}) |
7293 |
|
ref=numarray.array([[[-1.0, -2.0], [7.0, -6.0]], [[7.0, 4.0], [7.0, -3.0]], [[-7.0, -6.0], [7.0, 1.0]], [[-2.0, 0.0], [4.0, 7.0]], [[5.0, 0.0], [-7.0, -5.0]], [[5.0, 7.0], [4.0, -1.0]]]) |
7294 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7295 |
|
self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
7296 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7297 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7298 |
|
def test_swapaxes_Symbol_rank4_axes_01(self): |
7299 |
|
arg=Symbol(shape=(3, 2, 3, 4)) |
7300 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7301 |
|
s=numarray.array([[[[4.0, 6.0, -1.0, -2.0], [6.0, 3.0, 0.0, 0.0], [0.0, 0.0, 4.0, 0.0]], [[1.0, 1.0, 1.0, 5.0], [3.0, 0.0, 7.0, 0.0], [-1.0, -3.0, 0.0, -5.0]]], [[[-2.0, 2.0, 2.0, -7.0], [-1.0, 3.0, -2.0, 0.0], [-1.0, 0.0, -3.0, 3.0]], [[-2.0, -1.0, -7.0, 6.0], [2.0, -5.0, 0.0, -5.0], [5.0, 1.0, 1.0, -6.0]]], [[[5.0, -4.0, 0.0, 4.0], [-2.0, -2.0, -2.0, -1.0], [0.0, 5.0, -5.0, -6.0]], [[0.0, -6.0, -3.0, 2.0], [-5.0, -3.0, 3.0, -4.0], [-3.0, 2.0, 5.0, 4.0]]]]) |
7302 |
|
sub=res.substitute({arg:s}) |
7303 |
|
ref=numarray.array([[[[4.0, 6.0, -1.0, -2.0], [6.0, 3.0, 0.0, 0.0], [0.0, 0.0, 4.0, 0.0]], [[-2.0, 2.0, 2.0, -7.0], [-1.0, 3.0, -2.0, 0.0], [-1.0, 0.0, -3.0, 3.0]], [[5.0, -4.0, 0.0, 4.0], [-2.0, -2.0, -2.0, -1.0], [0.0, 5.0, -5.0, -6.0]]], [[[1.0, 1.0, 1.0, 5.0], [3.0, 0.0, 7.0, 0.0], [-1.0, -3.0, 0.0, -5.0]], [[-2.0, -1.0, -7.0, 6.0], [2.0, -5.0, 0.0, -5.0], [5.0, 1.0, 1.0, -6.0]], [[0.0, -6.0, -3.0, 2.0], [-5.0, -3.0, 3.0, -4.0], [-3.0, 2.0, 5.0, 4.0]]]]) |
7304 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7305 |
|
self.failUnlessEqual(res.getShape(),(2, 3, 3, 4),"wrong shape of result.") |
7306 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7307 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7308 |
|
def test_swapaxes_Symbol_rank4_axes_02(self): |
7309 |
|
arg=Symbol(shape=(3, 2, 3, 4)) |
7310 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
7311 |
|
s=numarray.array([[[[-2.0, 7.0, -6.0, 0.0], [4.0, 7.0, 7.0, 0.0], [7.0, 7.0, 4.0, 3.0]], [[0.0, 4.0, 2.0, 6.0], [-1.0, 1.0, -6.0, -3.0], [-6.0, -7.0, 0.0, 4.0]]], [[[3.0, -4.0, 1.0, 7.0], [2.0, 7.0, 2.0, -1.0], [5.0, -4.0, 4.0, 0.0]], [[6.0, 0.0, 7.0, 6.0], [-4.0, -1.0, 5.0, 0.0], [6.0, 0.0, 6.0, -3.0]]], [[[-1.0, -3.0, 0.0, 6.0], [-1.0, 7.0, 7.0, -7.0], [1.0, 2.0, -7.0, -7.0]], [[-3.0, 7.0, 1.0, 1.0], [1.0, 7.0, 3.0, -6.0], [-6.0, -5.0, 0.0, 3.0]]]]) |
7312 |
|
sub=res.substitute({arg:s}) |
7313 |
|
ref=numarray.array([[[[-2.0, 7.0, -6.0, 0.0], [3.0, -4.0, 1.0, 7.0], [-1.0, -3.0, 0.0, 6.0]], [[0.0, 4.0, 2.0, 6.0], [6.0, 0.0, 7.0, 6.0], [-3.0, 7.0, 1.0, 1.0]]], [[[4.0, 7.0, 7.0, 0.0], [2.0, 7.0, 2.0, -1.0], [-1.0, 7.0, 7.0, -7.0]], [[-1.0, 1.0, -6.0, -3.0], [-4.0, -1.0, 5.0, 0.0], [1.0, 7.0, 3.0, -6.0]]], [[[7.0, 7.0, 4.0, 3.0], [5.0, -4.0, 4.0, 0.0], [1.0, 2.0, -7.0, -7.0]], [[-6.0, -7.0, 0.0, 4.0], [6.0, 0.0, 6.0, -3.0], [-6.0, -5.0, 0.0, 3.0]]]]) |
7314 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7315 |
|
self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
7316 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7317 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7318 |
|
def test_swapaxes_Symbol_rank4_axes_03(self): |
7319 |
|
arg=Symbol(shape=(3, 2, 3, 4)) |
7320 |
|
res=swap_axes(arg,axis0=0,axis1=3) |
7321 |
|
s=numarray.array([[[[-3.0, 3.0, 0.0, -7.0], [1.0, 3.0, 3.0, -7.0], [-5.0, -3.0, -5.0, 7.0]], [[3.0, 4.0, -5.0, -5.0], [7.0, 7.0, 7.0, -1.0], [7.0, 2.0, 3.0, 2.0]]], [[[-7.0, 0.0, -6.0, 4.0], [1.0, -3.0, -3.0, 7.0], [-4.0, -2.0, 1.0, -5.0]], [[1.0, 0.0, -4.0, -4.0], [3.0, 5.0, 7.0, 5.0], [-6.0, -7.0, -2.0, 4.0]]], [[[-6.0, -1.0, -7.0, 6.0], [1.0, 6.0, -4.0, 4.0], [-5.0, -1.0, 7.0, 0.0]], [[2.0, 6.0, 4.0, -1.0], [-4.0, 7.0, 0.0, -2.0], [4.0, -6.0, 6.0, -3.0]]]]) |
7322 |
|
sub=res.substitute({arg:s}) |
7323 |
|
ref=numarray.array([[[[-3.0, -7.0, -6.0], [1.0, 1.0, 1.0], [-5.0, -4.0, -5.0]], [[3.0, 1.0, 2.0], [7.0, 3.0, -4.0], [7.0, -6.0, 4.0]]], [[[3.0, 0.0, -1.0], [3.0, -3.0, 6.0], [-3.0, -2.0, -1.0]], [[4.0, 0.0, 6.0], [7.0, 5.0, 7.0], [2.0, -7.0, -6.0]]], [[[0.0, -6.0, -7.0], [3.0, -3.0, -4.0], [-5.0, 1.0, 7.0]], [[-5.0, -4.0, 4.0], [7.0, 7.0, 0.0], [3.0, -2.0, 6.0]]], [[[-7.0, 4.0, 6.0], [-7.0, 7.0, 4.0], [7.0, -5.0, 0.0]], [[-5.0, -4.0, -1.0], [-1.0, 5.0, -2.0], [2.0, 4.0, -3.0]]]]) |
7324 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7325 |
|
self.failUnlessEqual(res.getShape(),(4, 2, 3, 3),"wrong shape of result.") |
7326 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7327 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7328 |
|
def test_swapaxes_Symbol_rank4_axes_12(self): |
7329 |
|
arg=Symbol(shape=(3, 2, 3, 4)) |
7330 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
7331 |
|
s=numarray.array([[[[4.0, -7.0, 0.0, -5.0], [-6.0, 2.0, 5.0, 0.0], [-4.0, -7.0, 0.0, 2.0]], [[0.0, -4.0, -1.0, 2.0], [4.0, 5.0, 6.0, 5.0], [-6.0, 7.0, 1.0, 6.0]]], [[[-7.0, -1.0, 4.0, 0.0], [6.0, 6.0, -4.0, 6.0], [-6.0, -6.0, -4.0, -2.0]], [[-3.0, -1.0, -6.0, -6.0], [4.0, 7.0, 2.0, -2.0], [-7.0, 5.0, 4.0, -5.0]]], [[[-7.0, 4.0, -2.0, -6.0], [-3.0, 6.0, -6.0, 2.0], [7.0, 3.0, 3.0, -5.0]], [[4.0, 0.0, 0.0, -7.0], [-3.0, -5.0, 3.0, 6.0], [0.0, 0.0, -7.0, -2.0]]]]) |
7332 |
|
sub=res.substitute({arg:s}) |
7333 |
|
ref=numarray.array([[[[4.0, -7.0, 0.0, -5.0], [0.0, -4.0, -1.0, 2.0]], [[-6.0, 2.0, 5.0, 0.0], [4.0, 5.0, 6.0, 5.0]], [[-4.0, -7.0, 0.0, 2.0], [-6.0, 7.0, 1.0, 6.0]]], [[[-7.0, -1.0, 4.0, 0.0], [-3.0, -1.0, -6.0, -6.0]], [[6.0, 6.0, -4.0, 6.0], [4.0, 7.0, 2.0, -2.0]], [[-6.0, -6.0, -4.0, -2.0], [-7.0, 5.0, 4.0, -5.0]]], [[[-7.0, 4.0, -2.0, -6.0], [4.0, 0.0, 0.0, -7.0]], [[-3.0, 6.0, -6.0, 2.0], [-3.0, -5.0, 3.0, 6.0]], [[7.0, 3.0, 3.0, -5.0], [0.0, 0.0, -7.0, -2.0]]]]) |
7334 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7335 |
|
self.failUnlessEqual(res.getShape(),(3, 3, 2, 4),"wrong shape of result.") |
7336 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7337 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7338 |
|
def test_swapaxes_Symbol_rank4_axes_13(self): |
7339 |
|
arg=Symbol(shape=(3, 2, 3, 4)) |
7340 |
|
res=swap_axes(arg,axis0=1,axis1=3) |
7341 |
|
s=numarray.array([[[[-1.0, 1.0, -3.0, 0.0], [0.0, 3.0, 6.0, 7.0], [5.0, 6.0, 4.0, 2.0]], [[-7.0, 1.0, 6.0, 7.0], [1.0, -5.0, 6.0, 2.0], [-6.0, -5.0, -3.0, 3.0]]], [[[4.0, 0.0, -3.0, 5.0], [0.0, 6.0, -2.0, 4.0], [7.0, 3.0, 0.0, -2.0]], [[-6.0, 7.0, -3.0, 6.0], [-2.0, -4.0, 4.0, -6.0], [0.0, -6.0, 7.0, -1.0]]], [[[-5.0, 1.0, -4.0, -2.0], [1.0, 4.0, -5.0, 1.0], [5.0, 1.0, 7.0, -3.0]], [[-7.0, 2.0, 3.0, -7.0], [6.0, 7.0, 0.0, 1.0], [7.0, -5.0, 0.0, -2.0]]]]) |
7342 |
|
sub=res.substitute({arg:s}) |
7343 |
|
ref=numarray.array([[[[-1.0, -7.0], [0.0, 1.0], [5.0, -6.0]], [[1.0, 1.0], [3.0, -5.0], [6.0, -5.0]], [[-3.0, 6.0], [6.0, 6.0], [4.0, -3.0]], [[0.0, 7.0], [7.0, 2.0], [2.0, 3.0]]], [[[4.0, -6.0], [0.0, -2.0], [7.0, 0.0]], [[0.0, 7.0], [6.0, -4.0], [3.0, -6.0]], [[-3.0, -3.0], [-2.0, 4.0], [0.0, 7.0]], [[5.0, 6.0], [4.0, -6.0], [-2.0, -1.0]]], [[[-5.0, -7.0], [1.0, 6.0], [5.0, 7.0]], [[1.0, 2.0], [4.0, 7.0], [1.0, -5.0]], [[-4.0, 3.0], [-5.0, 0.0], [7.0, 0.0]], [[-2.0, -7.0], [1.0, 1.0], [-3.0, -2.0]]]]) |
7344 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7345 |
|
self.failUnlessEqual(res.getShape(),(3, 4, 3, 2),"wrong shape of result.") |
7346 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7347 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7348 |
|
def test_swapaxes_Symbol_rank4_axes_23(self): |
7349 |
|
arg=Symbol(shape=(3, 2, 3, 4)) |
7350 |
|
res=swap_axes(arg,axis0=2,axis1=3) |
7351 |
|
s=numarray.array([[[[4.0, 7.0, 5.0, 0.0], [6.0, -5.0, -2.0, 7.0], [-2.0, 5.0, -7.0, -3.0]], [[-5.0, -2.0, -7.0, -1.0], [5.0, 4.0, 2.0, -2.0], [0.0, 6.0, 2.0, -1.0]]], [[[7.0, -5.0, 0.0, -2.0], [5.0, -7.0, 5.0, 2.0], [-6.0, 5.0, 4.0, 1.0]], [[4.0, -4.0, -3.0, 5.0], [-2.0, 4.0, -5.0, -5.0], [-3.0, 0.0, 7.0, -3.0]]], [[[-6.0, 7.0, -6.0, 6.0], [0.0, 5.0, 0.0, 6.0], [-4.0, 0.0, -5.0, 0.0]], [[-7.0, -2.0, 5.0, 0.0], [5.0, 4.0, -4.0, 6.0], [0.0, 6.0, 5.0, -7.0]]]]) |
7352 |
|
sub=res.substitute({arg:s}) |
7353 |
|
ref=numarray.array([[[[4.0, 6.0, -2.0], [7.0, -5.0, 5.0], [5.0, -2.0, -7.0], [0.0, 7.0, -3.0]], [[-5.0, 5.0, 0.0], [-2.0, 4.0, 6.0], [-7.0, 2.0, 2.0], [-1.0, -2.0, -1.0]]], [[[7.0, 5.0, -6.0], [-5.0, -7.0, 5.0], [0.0, 5.0, 4.0], [-2.0, 2.0, 1.0]], [[4.0, -2.0, -3.0], [-4.0, 4.0, 0.0], [-3.0, -5.0, 7.0], [5.0, -5.0, -3.0]]], [[[-6.0, 0.0, -4.0], [7.0, 5.0, 0.0], [-6.0, 0.0, -5.0], [6.0, 6.0, 0.0]], [[-7.0, 5.0, 0.0], [-2.0, 4.0, 6.0], [5.0, -4.0, 5.0], [0.0, 6.0, -7.0]]]]) |
7354 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
7355 |
|
self.failUnlessEqual(res.getShape(),(3, 2, 4, 3),"wrong shape of result.") |
7356 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7357 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7358 |
|
def test_swapaxes_constData_rank2_axes_01(self): |
7359 |
|
arg=Data(numarray.array([[-6.0, 4.0, 7.0, 7.0, -5.0], [-5.0, 2.0, 7.0, 6.0, 1.0], [0.0, 3.0, -6.0, 4.0, -7.0], [-4.0, 5.0, 0.0, 0.0, 3.0]]),self.functionspace) |
7360 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7361 |
|
ref=Data(numarray.array([[-6.0, -5.0, 0.0, -4.0], [4.0, 2.0, 3.0, 5.0], [7.0, 7.0, -6.0, 0.0], [7.0, 6.0, 4.0, 0.0], [-5.0, 1.0, -7.0, 3.0]]),self.functionspace) |
7362 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7363 |
|
self.failUnlessEqual(res.getShape(),(5, 4),"wrong shape of result.") |
7364 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7365 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7366 |
|
def test_swapaxes_constData_rank3_axes_01(self): |
7367 |
|
arg=Data(numarray.array([[[6.0, 1.0], [-2.0, -1.0]], [[0.0, 5.0], [-4.0, -1.0]], [[-7.0, -5.0], [3.0, 1.0]], [[0.0, 7.0], [1.0, -6.0]], [[-7.0, 0.0], [-3.0, 0.0]], [[0.0, -3.0], [6.0, -7.0]]]),self.functionspace) |
7368 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7369 |
|
ref=Data(numarray.array([[[6.0, 1.0], [0.0, 5.0], [-7.0, -5.0], [0.0, 7.0], [-7.0, 0.0], [0.0, -3.0]], [[-2.0, -1.0], [-4.0, -1.0], [3.0, 1.0], [1.0, -6.0], [-3.0, 0.0], [6.0, -7.0]]]),self.functionspace) |
7370 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7371 |
|
self.failUnlessEqual(res.getShape(),(2, 6, 2),"wrong shape of result.") |
7372 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7373 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7374 |
|
def test_swapaxes_constData_rank3_axes_02(self): |
7375 |
|
arg=Data(numarray.array([[[-1.0, 7.0], [7.0, 2.0]], [[0.0, -6.0], [4.0, 0.0]], [[-7.0, 0.0], [-1.0, -6.0]], [[-3.0, -4.0], [1.0, -7.0]], [[5.0, 2.0], [-1.0, -7.0]], [[0.0, 3.0], [-5.0, 0.0]]]),self.functionspace) |
7376 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
7377 |
|
ref=Data(numarray.array([[[-1.0, 0.0, -7.0, -3.0, 5.0, 0.0], [7.0, 4.0, -1.0, 1.0, -1.0, -5.0]], [[7.0, -6.0, 0.0, -4.0, 2.0, 3.0], [2.0, 0.0, -6.0, -7.0, -7.0, 0.0]]]),self.functionspace) |
7378 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7379 |
|
self.failUnlessEqual(res.getShape(),(2, 2, 6),"wrong shape of result.") |
7380 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7381 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7382 |
|
def test_swapaxes_constData_rank3_axes_12(self): |
7383 |
|
arg=Data(numarray.array([[[-1.0, 4.0], [-7.0, -2.0]], [[0.0, 1.0], [4.0, 1.0]], [[4.0, 3.0], [5.0, 6.0]], [[-3.0, 3.0], [-2.0, -5.0]], [[0.0, 3.0], [-5.0, -6.0]], [[1.0, -6.0], [1.0, 6.0]]]),self.functionspace) |
7384 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
7385 |
|
ref=Data(numarray.array([[[-1.0, -7.0], [4.0, -2.0]], [[0.0, 4.0], [1.0, 1.0]], [[4.0, 5.0], [3.0, 6.0]], [[-3.0, -2.0], [3.0, -5.0]], [[0.0, -5.0], [3.0, -6.0]], [[1.0, 1.0], [-6.0, 6.0]]]),self.functionspace) |
7386 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7387 |
|
self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
7388 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7389 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7390 |
|
def test_swapaxes_constData_rank4_axes_01(self): |
7391 |
|
arg=Data(numarray.array([[[[0.0, 0.0, 4.0, -7.0], [-5.0, 5.0, -3.0, -1.0], [0.0, 3.0, 7.0, -2.0]], [[2.0, 0.0, 2.0, -3.0], [0.0, -2.0, 2.0, 7.0], [3.0, -5.0, 4.0, -1.0]]], [[[5.0, -2.0, -2.0, -4.0], [-4.0, 0.0, -1.0, 4.0], [-2.0, -3.0, 4.0, 3.0]], [[-4.0, -1.0, -6.0, 0.0], [-3.0, 4.0, -6.0, -3.0], [1.0, -2.0, -5.0, -2.0]]], [[[-5.0, 6.0, 2.0, 6.0], [0.0, 6.0, -5.0, 0.0], [7.0, -6.0, 4.0, 3.0]], [[-6.0, -7.0, 4.0, 4.0], [3.0, -7.0, -6.0, 3.0], [3.0, 3.0, -6.0, 4.0]]]]),self.functionspace) |
7392 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7393 |
|
ref=Data(numarray.array([[[[0.0, 0.0, 4.0, -7.0], [-5.0, 5.0, -3.0, -1.0], [0.0, 3.0, 7.0, -2.0]], [[5.0, -2.0, -2.0, -4.0], [-4.0, 0.0, -1.0, 4.0], [-2.0, -3.0, 4.0, 3.0]], [[-5.0, 6.0, 2.0, 6.0], [0.0, 6.0, -5.0, 0.0], [7.0, -6.0, 4.0, 3.0]]], [[[2.0, 0.0, 2.0, -3.0], [0.0, -2.0, 2.0, 7.0], [3.0, -5.0, 4.0, -1.0]], [[-4.0, -1.0, -6.0, 0.0], [-3.0, 4.0, -6.0, -3.0], [1.0, -2.0, -5.0, -2.0]], [[-6.0, -7.0, 4.0, 4.0], [3.0, -7.0, -6.0, 3.0], [3.0, 3.0, -6.0, 4.0]]]]),self.functionspace) |
7394 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7395 |
|
self.failUnlessEqual(res.getShape(),(2, 3, 3, 4),"wrong shape of result.") |
7396 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7397 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7398 |
|
def test_swapaxes_constData_rank4_axes_02(self): |
7399 |
|
arg=Data(numarray.array([[[[-4.0, 0.0, 5.0, 0.0], [6.0, 4.0, 0.0, -7.0], [-3.0, 7.0, 2.0, -5.0]], [[4.0, -3.0, 5.0, -4.0], [-7.0, -6.0, 0.0, 3.0], [4.0, 6.0, -1.0, 7.0]]], [[[-3.0, -4.0, -4.0, 5.0], [0.0, 5.0, -3.0, 0.0], [-4.0, -7.0, 0.0, 4.0]], [[5.0, 4.0, 5.0, 5.0], [-2.0, 4.0, 2.0, 5.0], [6.0, 0.0, -5.0, -7.0]]], [[[6.0, 1.0, 7.0, -5.0], [2.0, 7.0, 5.0, -7.0], [-7.0, -6.0, 1.0, 6.0]], [[6.0, -4.0, 0.0, 2.0], [-6.0, -6.0, -1.0, 1.0], [-4.0, 4.0, 0.0, 1.0]]]]),self.functionspace) |
7400 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
7401 |
|
ref=Data(numarray.array([[[[-4.0, 0.0, 5.0, 0.0], [-3.0, -4.0, -4.0, 5.0], [6.0, 1.0, 7.0, -5.0]], [[4.0, -3.0, 5.0, -4.0], [5.0, 4.0, 5.0, 5.0], [6.0, -4.0, 0.0, 2.0]]], [[[6.0, 4.0, 0.0, -7.0], [0.0, 5.0, -3.0, 0.0], [2.0, 7.0, 5.0, -7.0]], [[-7.0, -6.0, 0.0, 3.0], [-2.0, 4.0, 2.0, 5.0], [-6.0, -6.0, -1.0, 1.0]]], [[[-3.0, 7.0, 2.0, -5.0], [-4.0, -7.0, 0.0, 4.0], [-7.0, -6.0, 1.0, 6.0]], [[4.0, 6.0, -1.0, 7.0], [6.0, 0.0, -5.0, -7.0], [-4.0, 4.0, 0.0, 1.0]]]]),self.functionspace) |
7402 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7403 |
|
self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
7404 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7405 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7406 |
|
def test_swapaxes_constData_rank4_axes_03(self): |
7407 |
|
arg=Data(numarray.array([[[[-4.0, 5.0, 7.0, -2.0], [4.0, 1.0, -1.0, 0.0], [-6.0, 7.0, -7.0, 3.0]], [[0.0, 0.0, -2.0, 0.0], [3.0, 3.0, 1.0, -3.0], [-4.0, 0.0, 0.0, 2.0]]], [[[6.0, -3.0, -3.0, -3.0], [3.0, 7.0, -7.0, 5.0], [6.0, 0.0, 5.0, 5.0]], [[4.0, -6.0, 4.0, 0.0], [0.0, 1.0, 5.0, 0.0], [-3.0, -4.0, 7.0, 7.0]]], [[[-3.0, -1.0, -2.0, -7.0], [-2.0, 7.0, -5.0, -7.0], [-2.0, -2.0, -2.0, -2.0]], [[5.0, 5.0, 1.0, 5.0], [-6.0, 2.0, -4.0, 3.0], [5.0, 4.0, -3.0, 2.0]]]]),self.functionspace) |
7408 |
|
res=swap_axes(arg,axis0=0,axis1=3) |
7409 |
|
ref=Data(numarray.array([[[[-4.0, 6.0, -3.0], [4.0, 3.0, -2.0], [-6.0, 6.0, -2.0]], [[0.0, 4.0, 5.0], [3.0, 0.0, -6.0], [-4.0, -3.0, 5.0]]], [[[5.0, -3.0, -1.0], [1.0, 7.0, 7.0], [7.0, 0.0, -2.0]], [[0.0, -6.0, 5.0], [3.0, 1.0, 2.0], [0.0, -4.0, 4.0]]], [[[7.0, -3.0, -2.0], [-1.0, -7.0, -5.0], [-7.0, 5.0, -2.0]], [[-2.0, 4.0, 1.0], [1.0, 5.0, -4.0], [0.0, 7.0, -3.0]]], [[[-2.0, -3.0, -7.0], [0.0, 5.0, -7.0], [3.0, 5.0, -2.0]], [[0.0, 0.0, 5.0], [-3.0, 0.0, 3.0], [2.0, 7.0, 2.0]]]]),self.functionspace) |
7410 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7411 |
|
self.failUnlessEqual(res.getShape(),(4, 2, 3, 3),"wrong shape of result.") |
7412 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7413 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7414 |
|
def test_swapaxes_constData_rank4_axes_12(self): |
7415 |
|
arg=Data(numarray.array([[[[2.0, 6.0, -7.0, -4.0], [0.0, 0.0, 0.0, 0.0], [3.0, -1.0, 0.0, -1.0]], [[-2.0, 3.0, 1.0, -1.0], [0.0, 0.0, 5.0, 4.0], [3.0, 0.0, 0.0, 5.0]]], [[[-2.0, 1.0, -3.0, 7.0], [-7.0, 7.0, 5.0, 2.0], [3.0, 3.0, 3.0, -1.0]], [[5.0, 4.0, -4.0, 3.0], [0.0, 0.0, 6.0, -1.0], [-6.0, 5.0, -7.0, -5.0]]], [[[-1.0, 0.0, 6.0, -3.0], [5.0, -6.0, 7.0, -5.0], [-3.0, -4.0, 4.0, 1.0]], [[-6.0, 5.0, -3.0, -6.0], [7.0, 0.0, 0.0, -2.0], [5.0, -5.0, 3.0, 0.0]]]]),self.functionspace) |
7416 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
7417 |
|
ref=Data(numarray.array([[[[2.0, 6.0, -7.0, -4.0], [-2.0, 3.0, 1.0, -1.0]], [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 5.0, 4.0]], [[3.0, -1.0, 0.0, -1.0], [3.0, 0.0, 0.0, 5.0]]], [[[-2.0, 1.0, -3.0, 7.0], [5.0, 4.0, -4.0, 3.0]], [[-7.0, 7.0, 5.0, 2.0], [0.0, 0.0, 6.0, -1.0]], [[3.0, 3.0, 3.0, -1.0], [-6.0, 5.0, -7.0, -5.0]]], [[[-1.0, 0.0, 6.0, -3.0], [-6.0, 5.0, -3.0, -6.0]], [[5.0, -6.0, 7.0, -5.0], [7.0, 0.0, 0.0, -2.0]], [[-3.0, -4.0, 4.0, 1.0], [5.0, -5.0, 3.0, 0.0]]]]),self.functionspace) |
7418 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7419 |
|
self.failUnlessEqual(res.getShape(),(3, 3, 2, 4),"wrong shape of result.") |
7420 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7421 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7422 |
|
def test_swapaxes_constData_rank4_axes_13(self): |
7423 |
|
arg=Data(numarray.array([[[[5.0, 0.0, 1.0, -2.0], [0.0, -1.0, -6.0, 0.0], [-2.0, -4.0, 7.0, -1.0]], [[-3.0, -1.0, 2.0, -3.0], [-1.0, 7.0, -6.0, 3.0], [3.0, -6.0, 0.0, -2.0]]], [[[2.0, -1.0, 3.0, -2.0], [-1.0, -5.0, 1.0, 6.0], [4.0, -5.0, -7.0, -6.0]], [[0.0, -5.0, -6.0, -7.0], [-1.0, -5.0, -4.0, 1.0], [-1.0, 0.0, 5.0, 6.0]]], [[[3.0, -5.0, 7.0, -5.0], [3.0, 3.0, -1.0, -1.0], [6.0, 5.0, 2.0, 3.0]], [[6.0, 1.0, -4.0, -3.0], [7.0, -2.0, -4.0, -4.0], [3.0, -4.0, -3.0, -3.0]]]]),self.functionspace) |
7424 |
|
res=swap_axes(arg,axis0=1,axis1=3) |
7425 |
|
ref=Data(numarray.array([[[[5.0, -3.0], [0.0, -1.0], [-2.0, 3.0]], [[0.0, -1.0], [-1.0, 7.0], [-4.0, -6.0]], [[1.0, 2.0], [-6.0, -6.0], [7.0, 0.0]], [[-2.0, -3.0], [0.0, 3.0], [-1.0, -2.0]]], [[[2.0, 0.0], [-1.0, -1.0], [4.0, -1.0]], [[-1.0, -5.0], [-5.0, -5.0], [-5.0, 0.0]], [[3.0, -6.0], [1.0, -4.0], [-7.0, 5.0]], [[-2.0, -7.0], [6.0, 1.0], [-6.0, 6.0]]], [[[3.0, 6.0], [3.0, 7.0], [6.0, 3.0]], [[-5.0, 1.0], [3.0, -2.0], [5.0, -4.0]], [[7.0, -4.0], [-1.0, -4.0], [2.0, -3.0]], [[-5.0, -3.0], [-1.0, -4.0], [3.0, -3.0]]]]),self.functionspace) |
7426 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7427 |
|
self.failUnlessEqual(res.getShape(),(3, 4, 3, 2),"wrong shape of result.") |
7428 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7429 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7430 |
|
def test_swapaxes_constData_rank4_axes_23(self): |
7431 |
|
arg=Data(numarray.array([[[[-1.0, -1.0, 0.0, -1.0], [3.0, 2.0, 1.0, -2.0], [2.0, 7.0, -7.0, 0.0]], [[-1.0, -5.0, 7.0, 1.0], [-5.0, 1.0, 3.0, -7.0], [-1.0, 4.0, -5.0, 4.0]]], [[[2.0, 1.0, 7.0, 7.0], [-1.0, 2.0, -3.0, 0.0], [2.0, 7.0, -6.0, -1.0]], [[-2.0, -6.0, 6.0, -1.0], [4.0, 0.0, 3.0, 5.0], [0.0, 4.0, 2.0, 6.0]]], [[[5.0, 6.0, -6.0, 3.0], [4.0, 3.0, -4.0, 4.0], [-6.0, 6.0, 4.0, 0.0]], [[3.0, 0.0, -6.0, -5.0], [-6.0, 0.0, -3.0, 2.0], [6.0, -2.0, 0.0, -2.0]]]]),self.functionspace) |
7432 |
|
res=swap_axes(arg,axis0=2,axis1=3) |
7433 |
|
ref=Data(numarray.array([[[[-1.0, 3.0, 2.0], [-1.0, 2.0, 7.0], [0.0, 1.0, -7.0], [-1.0, -2.0, 0.0]], [[-1.0, -5.0, -1.0], [-5.0, 1.0, 4.0], [7.0, 3.0, -5.0], [1.0, -7.0, 4.0]]], [[[2.0, -1.0, 2.0], [1.0, 2.0, 7.0], [7.0, -3.0, -6.0], [7.0, 0.0, -1.0]], [[-2.0, 4.0, 0.0], [-6.0, 0.0, 4.0], [6.0, 3.0, 2.0], [-1.0, 5.0, 6.0]]], [[[5.0, 4.0, -6.0], [6.0, 3.0, 6.0], [-6.0, -4.0, 4.0], [3.0, 4.0, 0.0]], [[3.0, -6.0, 6.0], [0.0, 0.0, -2.0], [-6.0, -3.0, 0.0], [-5.0, 2.0, -2.0]]]]),self.functionspace) |
7434 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7435 |
|
self.failUnlessEqual(res.getShape(),(3, 2, 4, 3),"wrong shape of result.") |
7436 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7437 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7438 |
|
def test_swapaxes_expandedData_rank2_axes_01(self): |
7439 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7440 |
|
arg=msk_arg*numarray.array([[6.0, 5.0, 1.0, 5.0, 7.0], [-4.0, -6.0, -4.0, -2.0, -7.0], [7.0, -1.0, 4.0, 5.0, -1.0], [1.0, -7.0, -7.0, 2.0, -7.0]])+(1.-msk_arg)*numarray.array([[4.0, -3.0, -6.0, 6.0, -4.0], [7.0, 6.0, 2.0, 7.0, -6.0], [-4.0, -5.0, 4.0, -3.0, 6.0], [5.0, -4.0, 4.0, -3.0, -7.0]]) |
7441 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7442 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7443 |
|
ref=msk_ref*numarray.array([[6.0, -4.0, 7.0, 1.0], [5.0, -6.0, -1.0, -7.0], [1.0, -4.0, 4.0, -7.0], [5.0, -2.0, 5.0, 2.0], [7.0, -7.0, -1.0, -7.0]])+(1.-msk_ref)*numarray.array([[4.0, 7.0, -4.0, 5.0], [-3.0, 6.0, -5.0, -4.0], [-6.0, 2.0, 4.0, 4.0], [6.0, 7.0, -3.0, -3.0], [-4.0, -6.0, 6.0, -7.0]]) |
7444 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7445 |
|
self.failUnlessEqual(res.getShape(),(5, 4),"wrong shape of result.") |
7446 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7447 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7448 |
|
def test_swapaxes_expandedData_rank3_axes_01(self): |
7449 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7450 |
|
arg=msk_arg*numarray.array([[[-6.0, 3.0], [3.0, -3.0]], [[0.0, -4.0], [4.0, -7.0]], [[5.0, -4.0], [6.0, 4.0]], [[6.0, 0.0], [1.0, -7.0]], [[3.0, 7.0], [5.0, -5.0]], [[-1.0, 2.0], [0.0, 0.0]]])+(1.-msk_arg)*numarray.array([[[0.0, -4.0], [-5.0, 4.0]], [[0.0, -4.0], [7.0, 0.0]], [[-5.0, 1.0], [4.0, 0.0]], [[-4.0, -2.0], [0.0, 2.0]], [[-6.0, 4.0], [-2.0, -3.0]], [[-2.0, 0.0], [-1.0, 3.0]]]) |
7451 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7452 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7453 |
|
ref=msk_ref*numarray.array([[[-6.0, 3.0], [0.0, -4.0], [5.0, -4.0], [6.0, 0.0], [3.0, 7.0], [-1.0, 2.0]], [[3.0, -3.0], [4.0, -7.0], [6.0, 4.0], [1.0, -7.0], [5.0, -5.0], [0.0, 0.0]]])+(1.-msk_ref)*numarray.array([[[0.0, -4.0], [0.0, -4.0], [-5.0, 1.0], [-4.0, -2.0], [-6.0, 4.0], [-2.0, 0.0]], [[-5.0, 4.0], [7.0, 0.0], [4.0, 0.0], [0.0, 2.0], [-2.0, -3.0], [-1.0, 3.0]]]) |
7454 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7455 |
|
self.failUnlessEqual(res.getShape(),(2, 6, 2),"wrong shape of result.") |
7456 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7457 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7458 |
|
def test_swapaxes_expandedData_rank3_axes_02(self): |
7459 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7460 |
|
arg=msk_arg*numarray.array([[[0.0, -6.0], [-3.0, -7.0]], [[4.0, -3.0], [-2.0, 6.0]], [[-2.0, 4.0], [5.0, -6.0]], [[-2.0, -4.0], [-4.0, -2.0]], [[2.0, -7.0], [-5.0, 4.0]], [[7.0, 4.0], [-6.0, 7.0]]])+(1.-msk_arg)*numarray.array([[[-4.0, -1.0], [0.0, 2.0]], [[5.0, 7.0], [-1.0, -3.0]], [[0.0, -3.0], [-1.0, -1.0]], [[7.0, 5.0], [4.0, -5.0]], [[-1.0, -6.0], [3.0, 3.0]], [[0.0, 7.0], [3.0, -4.0]]]) |
7461 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
7462 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7463 |
|
ref=msk_ref*numarray.array([[[0.0, 4.0, -2.0, -2.0, 2.0, 7.0], [-3.0, -2.0, 5.0, -4.0, -5.0, -6.0]], [[-6.0, -3.0, 4.0, -4.0, -7.0, 4.0], [-7.0, 6.0, -6.0, -2.0, 4.0, 7.0]]])+(1.-msk_ref)*numarray.array([[[-4.0, 5.0, 0.0, 7.0, -1.0, 0.0], [0.0, -1.0, -1.0, 4.0, 3.0, 3.0]], [[-1.0, 7.0, -3.0, 5.0, -6.0, 7.0], [2.0, -3.0, -1.0, -5.0, 3.0, -4.0]]]) |
7464 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7465 |
|
self.failUnlessEqual(res.getShape(),(2, 2, 6),"wrong shape of result.") |
7466 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7467 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7468 |
|
def test_swapaxes_expandedData_rank3_axes_12(self): |
7469 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7470 |
|
arg=msk_arg*numarray.array([[[3.0, -2.0], [-2.0, -7.0]], [[-5.0, -2.0], [2.0, 2.0]], [[1.0, 1.0], [7.0, -1.0]], [[-4.0, 0.0], [0.0, 3.0]], [[-6.0, -2.0], [-7.0, -1.0]], [[7.0, 3.0], [4.0, 2.0]]])+(1.-msk_arg)*numarray.array([[[3.0, 6.0], [3.0, 3.0]], [[2.0, -3.0], [6.0, 0.0]], [[4.0, -5.0], [2.0, -4.0]], [[-6.0, -7.0], [0.0, 0.0]], [[-2.0, -2.0], [5.0, 7.0]], [[-6.0, -3.0], [0.0, 4.0]]]) |
7471 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
7472 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7473 |
|
ref=msk_ref*numarray.array([[[3.0, -2.0], [-2.0, -7.0]], [[-5.0, 2.0], [-2.0, 2.0]], [[1.0, 7.0], [1.0, -1.0]], [[-4.0, 0.0], [0.0, 3.0]], [[-6.0, -7.0], [-2.0, -1.0]], [[7.0, 4.0], [3.0, 2.0]]])+(1.-msk_ref)*numarray.array([[[3.0, 3.0], [6.0, 3.0]], [[2.0, 6.0], [-3.0, 0.0]], [[4.0, 2.0], [-5.0, -4.0]], [[-6.0, 0.0], [-7.0, 0.0]], [[-2.0, 5.0], [-2.0, 7.0]], [[-6.0, 0.0], [-3.0, 4.0]]]) |
7474 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7475 |
|
self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
7476 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7477 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7478 |
|
def test_swapaxes_expandedData_rank4_axes_01(self): |
7479 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7480 |
|
arg=msk_arg*numarray.array([[[[-4.0, 5.0, 4.0, 0.0], [5.0, -5.0, 1.0, -7.0], [0.0, 4.0, -6.0, 0.0]], [[7.0, 0.0, -4.0, -4.0], [2.0, -7.0, -3.0, 2.0], [-3.0, 4.0, -4.0, 3.0]]], [[[-2.0, 3.0, -7.0, -5.0], [2.0, 6.0, -6.0, 6.0], [0.0, -7.0, -2.0, -7.0]], [[1.0, 0.0, -6.0, 0.0], [4.0, -1.0, 1.0, 2.0], [-1.0, -2.0, 1.0, 7.0]]], [[[4.0, 3.0, -7.0, -1.0], [0.0, 0.0, 2.0, -2.0], [-3.0, -1.0, 1.0, 3.0]], [[2.0, -7.0, 3.0, -4.0], [-5.0, 5.0, -2.0, -7.0], [2.0, 3.0, 0.0, 6.0]]]])+(1.-msk_arg)*numarray.array([[[[4.0, 7.0, -2.0, -1.0], [-6.0, -1.0, 5.0, -7.0], [2.0, 4.0, -5.0, -2.0]], [[5.0, -7.0, -5.0, -6.0], [-1.0, 0.0, -5.0, 1.0], [7.0, -3.0, 5.0, -7.0]]], [[[-5.0, -2.0, 7.0, -3.0], [-1.0, 0.0, -7.0, 2.0], [4.0, -4.0, 7.0, 2.0]], [[1.0, 6.0, 6.0, 3.0], [-1.0, 7.0, 4.0, 7.0], [4.0, 2.0, -6.0, -2.0]]], [[[0.0, 1.0, -5.0, 1.0], [4.0, -3.0, 0.0, -3.0], [-5.0, -4.0, -7.0, 1.0]], [[-4.0, 5.0, -2.0, -1.0], [3.0, 6.0, -5.0, -1.0], [0.0, -4.0, -6.0, 0.0]]]]) |
7481 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
7482 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7483 |
|
ref=msk_ref*numarray.array([[[[-4.0, 5.0, 4.0, 0.0], [5.0, -5.0, 1.0, -7.0], [0.0, 4.0, -6.0, 0.0]], [[-2.0, 3.0, -7.0, -5.0], [2.0, 6.0, -6.0, 6.0], [0.0, -7.0, -2.0, -7.0]], [[4.0, 3.0, -7.0, -1.0], [0.0, 0.0, 2.0, -2.0], [-3.0, -1.0, 1.0, 3.0]]], [[[7.0, 0.0, -4.0, -4.0], [2.0, -7.0, -3.0, 2.0], [-3.0, 4.0, -4.0, 3.0]], [[1.0, 0.0, -6.0, 0.0], [4.0, -1.0, 1.0, 2.0], [-1.0, -2.0, 1.0, 7.0]], [[2.0, -7.0, 3.0, -4.0], [-5.0, 5.0, -2.0, -7.0], [2.0, 3.0, 0.0, 6.0]]]])+(1.-msk_ref)*numarray.array([[[[4.0, 7.0, -2.0, -1.0], [-6.0, -1.0, 5.0, -7.0], [2.0, 4.0, -5.0, -2.0]], [[-5.0, -2.0, 7.0, -3.0], [-1.0, 0.0, -7.0, 2.0], [4.0, -4.0, 7.0, 2.0]], [[0.0, 1.0, -5.0, 1.0], [4.0, -3.0, 0.0, -3.0], [-5.0, -4.0, -7.0, 1.0]]], [[[5.0, -7.0, -5.0, -6.0], [-1.0, 0.0, -5.0, 1.0], [7.0, -3.0, 5.0, -7.0]], [[1.0, 6.0, 6.0, 3.0], [-1.0, 7.0, 4.0, 7.0], [4.0, 2.0, -6.0, -2.0]], [[-4.0, 5.0, -2.0, -1.0], [3.0, 6.0, -5.0, -1.0], [0.0, -4.0, -6.0, 0.0]]]]) |
7484 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7485 |
|
self.failUnlessEqual(res.getShape(),(2, 3, 3, 4),"wrong shape of result.") |
7486 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7487 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7488 |
|
def test_swapaxes_expandedData_rank4_axes_02(self): |
7489 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7490 |
|
arg=msk_arg*numarray.array([[[[-1.0, -7.0, 6.0, 1.0], [2.0, 4.0, 4.0, 3.0], [7.0, -7.0, 7.0, -1.0]], [[-6.0, -6.0, -2.0, 1.0], [0.0, 1.0, -2.0, 5.0], [6.0, 4.0, 4.0, 4.0]]], [[[-5.0, 2.0, -6.0, 0.0], [-7.0, -6.0, 3.0, 4.0], [7.0, 7.0, 6.0, 0.0]], [[-4.0, 4.0, 5.0, -3.0], [-2.0, -1.0, 6.0, 5.0], [-4.0, -2.0, 0.0, -7.0]]], [[[1.0, -3.0, -3.0, 6.0], [6.0, -6.0, 1.0, -7.0], [7.0, -3.0, -2.0, 0.0]], [[0.0, 7.0, -1.0, -7.0], [-2.0, 0.0, 4.0, -6.0], [-4.0, 7.0, -7.0, 6.0]]]])+(1.-msk_arg)*numarray.array([[[[-6.0, -5.0, 4.0, 7.0], [0.0, -1.0, 4.0, 7.0], [3.0, 2.0, 5.0, 2.0]], [[7.0, 7.0, 0.0, 5.0], [4.0, 3.0, -5.0, -3.0], [0.0, 0.0, -6.0, 6.0]]], [[[4.0, 1.0, 6.0, -3.0], [-2.0, 5.0, 3.0, 4.0], [0.0, -4.0, 1.0, 2.0]], [[-4.0, 7.0, 1.0, -6.0], [6.0, 0.0, 0.0, 5.0], [-4.0, 0.0, 0.0, 4.0]]], [[[-2.0, -1.0, -2.0, 0.0], [1.0, -3.0, 4.0, 7.0], [4.0, -6.0, -5.0, 3.0]], [[-4.0, 2.0, 7.0, 2.0], [4.0, 1.0, -6.0, 2.0], [4.0, 1.0, 3.0, 0.0]]]]) |
7491 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
7492 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7493 |
|
ref=msk_ref*numarray.array([[[[-1.0, -7.0, 6.0, 1.0], [-5.0, 2.0, -6.0, 0.0], [1.0, -3.0, -3.0, 6.0]], [[-6.0, -6.0, -2.0, 1.0], [-4.0, 4.0, 5.0, -3.0], [0.0, 7.0, -1.0, -7.0]]], [[[2.0, 4.0, 4.0, 3.0], [-7.0, -6.0, 3.0, 4.0], [6.0, -6.0, 1.0, -7.0]], [[0.0, 1.0, -2.0, 5.0], [-2.0, -1.0, 6.0, 5.0], [-2.0, 0.0, 4.0, -6.0]]], [[[7.0, -7.0, 7.0, -1.0], [7.0, 7.0, 6.0, 0.0], [7.0, -3.0, -2.0, 0.0]], [[6.0, 4.0, 4.0, 4.0], [-4.0, -2.0, 0.0, -7.0], [-4.0, 7.0, -7.0, 6.0]]]])+(1.-msk_ref)*numarray.array([[[[-6.0, -5.0, 4.0, 7.0], [4.0, 1.0, 6.0, -3.0], [-2.0, -1.0, -2.0, 0.0]], [[7.0, 7.0, 0.0, 5.0], [-4.0, 7.0, 1.0, -6.0], [-4.0, 2.0, 7.0, 2.0]]], [[[0.0, -1.0, 4.0, 7.0], [-2.0, 5.0, 3.0, 4.0], [1.0, -3.0, 4.0, 7.0]], [[4.0, 3.0, -5.0, -3.0], [6.0, 0.0, 0.0, 5.0], [4.0, 1.0, -6.0, 2.0]]], [[[3.0, 2.0, 5.0, 2.0], [0.0, -4.0, 1.0, 2.0], [4.0, -6.0, -5.0, 3.0]], [[0.0, 0.0, -6.0, 6.0], [-4.0, 0.0, 0.0, 4.0], [4.0, 1.0, 3.0, 0.0]]]]) |
7494 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7495 |
|
self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
7496 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7497 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7498 |
|
def test_swapaxes_expandedData_rank4_axes_03(self): |
7499 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7500 |
|
arg=msk_arg*numarray.array([[[[-6.0, -7.0, -7.0, -5.0], [7.0, -2.0, -2.0, 1.0], [4.0, -7.0, -4.0, 7.0]], [[7.0, 3.0, 2.0, 6.0], [-3.0, -3.0, 2.0, 2.0], [-5.0, 0.0, 1.0, -4.0]]], [[[-7.0, 5.0, 3.0, -1.0], [-3.0, 0.0, 0.0, 7.0], [2.0, -1.0, -2.0, -5.0]], [[-5.0, 2.0, -4.0, 1.0], [2.0, 1.0, -7.0, 0.0], [-6.0, -2.0, 7.0, -6.0]]], [[[0.0, -2.0, 0.0, 3.0], [-2.0, 2.0, -4.0, 0.0], [1.0, 0.0, 4.0, 5.0]], [[-2.0, -7.0, -4.0, -1.0], [-2.0, 0.0, -6.0, 1.0], [1.0, -5.0, -2.0, 5.0]]]])+(1.-msk_arg)*numarray.array([[[[-7.0, -2.0, 0.0, 7.0], [7.0, 0.0, 0.0, -5.0], [-2.0, -7.0, -3.0, -3.0]], [[6.0, -2.0, -6.0, 6.0], [3.0, 4.0, -6.0, -6.0], [7.0, -2.0, 5.0, -6.0]]], [[[-5.0, 5.0, 3.0, -6.0], [-4.0, -4.0, 6.0, 0.0], [1.0, 0.0, 4.0, 5.0]], [[0.0, -5.0, -4.0, -2.0], [5.0, -6.0, 5.0, -1.0], [-1.0, 3.0, 1.0, -4.0]]], [[[-1.0, -4.0, 2.0, -3.0], [-4.0, 5.0, -5.0, 0.0], [-6.0, 6.0, 4.0, 4.0]], [[-7.0, -2.0, 3.0, -1.0], [5.0, 1.0, -6.0, -6.0], [-5.0, -2.0, 3.0, -3.0]]]]) |
7501 |
|
res=swap_axes(arg,axis0=0,axis1=3) |
7502 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7503 |
|
ref=msk_ref*numarray.array([[[[-6.0, -7.0, 0.0], [7.0, -3.0, -2.0], [4.0, 2.0, 1.0]], [[7.0, -5.0, -2.0], [-3.0, 2.0, -2.0], [-5.0, -6.0, 1.0]]], [[[-7.0, 5.0, -2.0], [-2.0, 0.0, 2.0], [-7.0, -1.0, 0.0]], [[3.0, 2.0, -7.0], [-3.0, 1.0, 0.0], [0.0, -2.0, -5.0]]], [[[-7.0, 3.0, 0.0], [-2.0, 0.0, -4.0], [-4.0, -2.0, 4.0]], [[2.0, -4.0, -4.0], [2.0, -7.0, -6.0], [1.0, 7.0, -2.0]]], [[[-5.0, -1.0, 3.0], [1.0, 7.0, 0.0], [7.0, -5.0, 5.0]], [[6.0, 1.0, -1.0], [2.0, 0.0, 1.0], [-4.0, -6.0, 5.0]]]])+(1.-msk_ref)*numarray.array([[[[-7.0, -5.0, -1.0], [7.0, -4.0, -4.0], [-2.0, 1.0, -6.0]], [[6.0, 0.0, -7.0], [3.0, 5.0, 5.0], [7.0, -1.0, -5.0]]], [[[-2.0, 5.0, -4.0], [0.0, -4.0, 5.0], [-7.0, 0.0, 6.0]], [[-2.0, -5.0, -2.0], [4.0, -6.0, 1.0], [-2.0, 3.0, -2.0]]], [[[0.0, 3.0, 2.0], [0.0, 6.0, -5.0], [-3.0, 4.0, 4.0]], [[-6.0, -4.0, 3.0], [-6.0, 5.0, -6.0], [5.0, 1.0, 3.0]]], [[[7.0, -6.0, -3.0], [-5.0, 0.0, 0.0], [-3.0, 5.0, 4.0]], [[6.0, -2.0, -1.0], [-6.0, -1.0, -6.0], [-6.0, -4.0, -3.0]]]]) |
7504 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7505 |
|
self.failUnlessEqual(res.getShape(),(4, 2, 3, 3),"wrong shape of result.") |
7506 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7507 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7508 |
|
def test_swapaxes_expandedData_rank4_axes_12(self): |
7509 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7510 |
|
arg=msk_arg*numarray.array([[[[3.0, -4.0, 5.0, -6.0], [5.0, 0.0, 7.0, 2.0], [6.0, 0.0, 5.0, -6.0]], [[-1.0, 7.0, 0.0, 7.0], [-4.0, -5.0, 5.0, 1.0], [6.0, 3.0, 4.0, -3.0]]], [[[-5.0, -4.0, 7.0, 6.0], [0.0, 4.0, -1.0, -4.0], [2.0, -3.0, -7.0, -4.0]], [[5.0, 0.0, 7.0, -7.0], [2.0, 2.0, 6.0, -3.0], [-1.0, 4.0, -4.0, 5.0]]], [[[0.0, 6.0, -7.0, -3.0], [4.0, -6.0, -7.0, 0.0], [5.0, 6.0, 0.0, -6.0]], [[-2.0, 3.0, 0.0, 0.0], [-6.0, 0.0, 0.0, -5.0], [5.0, -1.0, 1.0, -2.0]]]])+(1.-msk_arg)*numarray.array([[[[0.0, 0.0, 6.0, -2.0], [-5.0, 5.0, 1.0, 6.0], [4.0, 4.0, 7.0, 1.0]], [[5.0, -7.0, 7.0, 7.0], [0.0, -6.0, 1.0, 0.0], [-4.0, -5.0, 5.0, -1.0]]], [[[-5.0, -6.0, 7.0, 7.0], [1.0, 5.0, 7.0, 7.0], [6.0, 0.0, 0.0, 7.0]], [[1.0, 6.0, 1.0, 0.0], [-3.0, 0.0, 1.0, -4.0], [-5.0, 1.0, 2.0, 6.0]]], [[[0.0, 0.0, 2.0, -4.0], [-3.0, 1.0, 0.0, 0.0], [0.0, 3.0, 1.0, -6.0]], [[1.0, 0.0, 0.0, -5.0], [-6.0, -7.0, 4.0, 5.0], [-7.0, -4.0, 2.0, -2.0]]]]) |
7511 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
7512 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7513 |
|
ref=msk_ref*numarray.array([[[[3.0, -4.0, 5.0, -6.0], [-1.0, 7.0, 0.0, 7.0]], [[5.0, 0.0, 7.0, 2.0], [-4.0, -5.0, 5.0, 1.0]], [[6.0, 0.0, 5.0, -6.0], [6.0, 3.0, 4.0, -3.0]]], [[[-5.0, -4.0, 7.0, 6.0], [5.0, 0.0, 7.0, -7.0]], [[0.0, 4.0, -1.0, -4.0], [2.0, 2.0, 6.0, -3.0]], [[2.0, -3.0, -7.0, -4.0], [-1.0, 4.0, -4.0, 5.0]]], [[[0.0, 6.0, -7.0, -3.0], [-2.0, 3.0, 0.0, 0.0]], [[4.0, -6.0, -7.0, 0.0], [-6.0, 0.0, 0.0, -5.0]], [[5.0, 6.0, 0.0, -6.0], [5.0, -1.0, 1.0, -2.0]]]])+(1.-msk_ref)*numarray.array([[[[0.0, 0.0, 6.0, -2.0], [5.0, -7.0, 7.0, 7.0]], [[-5.0, 5.0, 1.0, 6.0], [0.0, -6.0, 1.0, 0.0]], [[4.0, 4.0, 7.0, 1.0], [-4.0, -5.0, 5.0, -1.0]]], [[[-5.0, -6.0, 7.0, 7.0], [1.0, 6.0, 1.0, 0.0]], [[1.0, 5.0, 7.0, 7.0], [-3.0, 0.0, 1.0, -4.0]], [[6.0, 0.0, 0.0, 7.0], [-5.0, 1.0, 2.0, 6.0]]], [[[0.0, 0.0, 2.0, -4.0], [1.0, 0.0, 0.0, -5.0]], [[-3.0, 1.0, 0.0, 0.0], [-6.0, -7.0, 4.0, 5.0]], [[0.0, 3.0, 1.0, -6.0], [-7.0, -4.0, 2.0, -2.0]]]]) |
7514 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7515 |
|
self.failUnlessEqual(res.getShape(),(3, 3, 2, 4),"wrong shape of result.") |
7516 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7517 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7518 |
|
def test_swapaxes_expandedData_rank4_axes_13(self): |
7519 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7520 |
|
arg=msk_arg*numarray.array([[[[5.0, -4.0, -2.0, 6.0], [-7.0, 0.0, 3.0, 3.0], [-3.0, 7.0, -2.0, -3.0]], [[-1.0, -2.0, 6.0, 0.0], [4.0, -1.0, -1.0, -6.0], [5.0, -7.0, -3.0, -6.0]]], [[[-7.0, 0.0, 7.0, 4.0], [-5.0, 6.0, 1.0, 2.0], [-2.0, -3.0, -1.0, 2.0]], [[4.0, -4.0, 7.0, -2.0], [-2.0, -6.0, -4.0, -6.0], [-5.0, -2.0, 0.0, 2.0]]], [[[1.0, -6.0, -3.0, 0.0], [-5.0, 0.0, 6.0, -5.0], [0.0, 0.0, 0.0, -7.0]], [[-7.0, -4.0, -4.0, 0.0], [-1.0, -4.0, -1.0, 0.0], [7.0, 3.0, 1.0, 6.0]]]])+(1.-msk_arg)*numarray.array([[[[2.0, -5.0, 3.0, 2.0], [7.0, 4.0, 5.0, 3.0], [6.0, 6.0, -4.0, -3.0]], [[-4.0, 6.0, -4.0, -4.0], [6.0, -3.0, -6.0, -6.0], [2.0, 6.0, 1.0, -6.0]]], [[[1.0, -2.0, 5.0, -3.0], [-1.0, 0.0, -1.0, 4.0], [-2.0, 4.0, 0.0, -6.0]], [[-5.0, 4.0, 0.0, 0.0], [-4.0, 5.0, 1.0, 0.0], [7.0, 1.0, 2.0, 1.0]]], [[[-2.0, 2.0, 7.0, 6.0], [2.0, 7.0, 6.0, 2.0], [2.0, -2.0, 6.0, -5.0]], [[1.0, 4.0, -6.0, -5.0], [-5.0, -7.0, -4.0, 2.0], [-2.0, 5.0, 0.0, 2.0]]]]) |
7521 |
|
res=swap_axes(arg,axis0=1,axis1=3) |
7522 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7523 |
|
ref=msk_ref*numarray.array([[[[5.0, -1.0], [-7.0, 4.0], [-3.0, 5.0]], [[-4.0, -2.0], [0.0, -1.0], [7.0, -7.0]], [[-2.0, 6.0], [3.0, -1.0], [-2.0, -3.0]], [[6.0, 0.0], [3.0, -6.0], [-3.0, -6.0]]], [[[-7.0, 4.0], [-5.0, -2.0], [-2.0, -5.0]], [[0.0, -4.0], [6.0, -6.0], [-3.0, -2.0]], [[7.0, 7.0], [1.0, -4.0], [-1.0, 0.0]], [[4.0, -2.0], [2.0, -6.0], [2.0, 2.0]]], [[[1.0, -7.0], [-5.0, -1.0], [0.0, 7.0]], [[-6.0, -4.0], [0.0, -4.0], [0.0, 3.0]], [[-3.0, -4.0], [6.0, -1.0], [0.0, 1.0]], [[0.0, 0.0], [-5.0, 0.0], [-7.0, 6.0]]]])+(1.-msk_ref)*numarray.array([[[[2.0, -4.0], [7.0, 6.0], [6.0, 2.0]], [[-5.0, 6.0], [4.0, -3.0], [6.0, 6.0]], [[3.0, -4.0], [5.0, -6.0], [-4.0, 1.0]], [[2.0, -4.0], [3.0, -6.0], [-3.0, -6.0]]], [[[1.0, -5.0], [-1.0, -4.0], [-2.0, 7.0]], [[-2.0, 4.0], [0.0, 5.0], [4.0, 1.0]], [[5.0, 0.0], [-1.0, 1.0], [0.0, 2.0]], [[-3.0, 0.0], [4.0, 0.0], [-6.0, 1.0]]], [[[-2.0, 1.0], [2.0, -5.0], [2.0, -2.0]], [[2.0, 4.0], [7.0, -7.0], [-2.0, 5.0]], [[7.0, -6.0], [6.0, -4.0], [6.0, 0.0]], [[6.0, -5.0], [2.0, 2.0], [-5.0, 2.0]]]]) |
7524 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7525 |
|
self.failUnlessEqual(res.getShape(),(3, 4, 3, 2),"wrong shape of result.") |
7526 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
7527 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7528 |
|
def test_swapaxes_expandedData_rank4_axes_23(self): |
7529 |
|
msk_arg=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7530 |
|
arg=msk_arg*numarray.array([[[[2.0, 3.0, -1.0, 5.0], [-1.0, 3.0, 6.0, -2.0], [1.0, -5.0, 0.0, 3.0]], [[2.0, -3.0, 4.0, -6.0], [2.0, 6.0, 0.0, -2.0], [4.0, 0.0, -7.0, -2.0]]], [[[-2.0, 0.0, -5.0, 7.0], [6.0, -7.0, -1.0, 0.0], [-3.0, 0.0, -3.0, 7.0]], [[-7.0, 5.0, -1.0, 0.0], [-2.0, 0.0, -2.0, 3.0], [-4.0, 7.0, 4.0, 6.0]]], [[[3.0, -5.0, 1.0, 3.0], [7.0, -1.0, -5.0, 6.0], [-5.0, 6.0, -7.0, -1.0]], [[4.0, 2.0, -4.0, -7.0], [-6.0, 3.0, 0.0, 0.0], [-4.0, 6.0, 0.0, -4.0]]]])+(1.-msk_arg)*numarray.array([[[[1.0, -6.0, -4.0, -2.0], [1.0, -1.0, -4.0, -1.0], [-2.0, 6.0, -4.0, 0.0]], [[-7.0, -3.0, -3.0, 7.0], [-3.0, 7.0, 4.0, -3.0], [0.0, -7.0, -7.0, -1.0]]], [[[4.0, 0.0, 3.0, 4.0], [-5.0, 5.0, -6.0, 2.0], [-6.0, -5.0, -6.0, -2.0]], [[-5.0, -5.0, -5.0, 0.0], [-2.0, -1.0, -5.0, 6.0], [3.0, 3.0, 2.0, 4.0]]], [[[-3.0, 0.0, 0.0, 0.0], [-7.0, 4.0, -1.0, 0.0], [-6.0, 6.0, -3.0, 7.0]], [[-7.0, -6.0, -4.0, 7.0], [0.0, -1.0, 3.0, 6.0], [-1.0, 5.0, -7.0, 5.0]]]]) |
7531 |
|
res=swap_axes(arg,axis0=2,axis1=3) |
7532 |
|
msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
7533 |
|
ref=msk_ref*numarray.array([[[[2.0, -1.0, 1.0], [3.0, 3.0, -5.0], [-1.0, 6.0, 0.0], [5.0, -2.0, 3.0]], [[2.0, 2.0, 4.0], [-3.0, 6.0, 0.0], [4.0, 0.0, -7.0], [-6.0, -2.0, -2.0]]], [[[-2.0, 6.0, -3.0], [0.0, -7.0, 0.0], [-5.0, -1.0, -3.0], [7.0, 0.0, 7.0]], [[-7.0, -2.0, -4.0], [5.0, 0.0, 7.0], [-1.0, -2.0, 4.0], [0.0, 3.0, 6.0]]], [[[3.0, 7.0, -5.0], [-5.0, -1.0, 6.0], [1.0, -5.0, -7.0], [3.0, 6.0, -1.0]], [[4.0, -6.0, -4.0], [2.0, 3.0, 6.0], [-4.0, 0.0, 0.0], [-7.0, 0.0, -4.0]]]])+(1.-msk_ref)*numarray.array([[[[1.0, 1.0, -2.0], [-6.0, -1.0, 6.0], [-4.0, -4.0, -4.0], [-2.0, -1.0, 0.0]], [[-7.0, -3.0, 0.0], [-3.0, 7.0, -7.0], [-3.0, 4.0, -7.0], [7.0, -3.0, -1.0]]], [[[4.0, -5.0, -6.0], [0.0, 5.0, -5.0], [3.0, -6.0, -6.0], [4.0, 2.0, -2.0]], [[-5.0, -2.0, 3.0], [-5.0, -1.0, 3.0], [-5.0, -5.0, 2.0], [0.0, 6.0, 4.0]]], [[[-3.0, -7.0, -6.0], [0.0, 4.0, 6.0], [0.0, -1.0, -3.0], [0.0, 0.0, 7.0]], [[-7.0, 0.0, -1.0], [-6.0, -1.0, 5.0], [-4.0, 3.0, -7.0], [7.0, 6.0, 5.0]]]]) |
7534 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
7535 |
|
self.failUnlessEqual(res.getShape(),(3, 2, 4, 3),"wrong shape of result.") |
7536 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |