2015 |
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") |
2016 |
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") |
2017 |
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") |
2018 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2019 |
|
def test_swapaxes_taggedData_rank2_axes_01(self): |
2020 |
|
arg=Data(numarray.array([[-1.0, 0.0, -2.0, 0.0, 0.0], [4.0, 3.0, 0.0, 6.0, -4.0], [-1.0, 5.0, -2.0, 6.0, -6.0], [7.0, 7.0, 3.0, -2.0, -3.0]]),self.functionspace) |
2021 |
|
arg.setTaggedValue(1,numarray.array([[0.0, 4.0, 0.0, -6.0, -6.0], [-7.0, -6.0, -1.0, 0.0, 5.0], [-3.0, 3.0, 6.0, 3.0, 2.0], [-1.0, 3.0, 0.0, 0.0, 5.0]])) |
2022 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
2023 |
|
ref=Data(numarray.array([[-1.0, 4.0, -1.0, 7.0], [0.0, 3.0, 5.0, 7.0], [-2.0, 0.0, -2.0, 3.0], [0.0, 6.0, 6.0, -2.0], [0.0, -4.0, -6.0, -3.0]]),self.functionspace) |
2024 |
|
ref.setTaggedValue(1,numarray.array([[0.0, -7.0, -3.0, -1.0], [4.0, -6.0, 3.0, 3.0], [0.0, -1.0, 6.0, 0.0], [-6.0, 0.0, 3.0, 0.0], [-6.0, 5.0, 2.0, 5.0]])) |
2025 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2026 |
|
self.failUnlessEqual(res.getShape(),(5, 4),"wrong shape of result.") |
2027 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2028 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2029 |
|
def test_swapaxes_taggedData_rank3_axes_01(self): |
2030 |
|
arg=Data(numarray.array([[[-6.0, -4.0], [4.0, 0.0]], [[6.0, 5.0], [-2.0, 1.0]], [[-4.0, -3.0], [7.0, -2.0]], [[-2.0, 0.0], [3.0, 4.0]], [[5.0, -6.0], [1.0, 7.0]], [[4.0, 4.0], [-2.0, -1.0]]]),self.functionspace) |
2031 |
|
arg.setTaggedValue(1,numarray.array([[[6.0, 1.0], [-2.0, 6.0]], [[4.0, 1.0], [5.0, 5.0]], [[-3.0, 7.0], [6.0, 5.0]], [[0.0, 0.0], [6.0, 5.0]], [[-1.0, 3.0], [5.0, 2.0]], [[-1.0, -7.0], [2.0, -3.0]]])) |
2032 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
2033 |
|
ref=Data(numarray.array([[[-6.0, -4.0], [6.0, 5.0], [-4.0, -3.0], [-2.0, 0.0], [5.0, -6.0], [4.0, 4.0]], [[4.0, 0.0], [-2.0, 1.0], [7.0, -2.0], [3.0, 4.0], [1.0, 7.0], [-2.0, -1.0]]]),self.functionspace) |
2034 |
|
ref.setTaggedValue(1,numarray.array([[[6.0, 1.0], [4.0, 1.0], [-3.0, 7.0], [0.0, 0.0], [-1.0, 3.0], [-1.0, -7.0]], [[-2.0, 6.0], [5.0, 5.0], [6.0, 5.0], [6.0, 5.0], [5.0, 2.0], [2.0, -3.0]]])) |
2035 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2036 |
|
self.failUnlessEqual(res.getShape(),(2, 6, 2),"wrong shape of result.") |
2037 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2038 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2039 |
|
def test_swapaxes_taggedData_rank3_axes_02(self): |
2040 |
|
arg=Data(numarray.array([[[-7.0, 7.0], [-5.0, -7.0]], [[1.0, 1.0], [-3.0, 0.0]], [[2.0, 4.0], [0.0, -2.0]], [[0.0, -6.0], [-6.0, 1.0]], [[4.0, 3.0], [0.0, 2.0]], [[-5.0, -4.0], [-2.0, -1.0]]]),self.functionspace) |
2041 |
|
arg.setTaggedValue(1,numarray.array([[[0.0, 4.0], [-3.0, 0.0]], [[4.0, -1.0], [-5.0, 2.0]], [[2.0, 0.0], [-7.0, -7.0]], [[4.0, -6.0], [6.0, -1.0]], [[7.0, -5.0], [-4.0, 4.0]], [[-1.0, 6.0], [4.0, 1.0]]])) |
2042 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
2043 |
|
ref=Data(numarray.array([[[-7.0, 1.0, 2.0, 0.0, 4.0, -5.0], [-5.0, -3.0, 0.0, -6.0, 0.0, -2.0]], [[7.0, 1.0, 4.0, -6.0, 3.0, -4.0], [-7.0, 0.0, -2.0, 1.0, 2.0, -1.0]]]),self.functionspace) |
2044 |
|
ref.setTaggedValue(1,numarray.array([[[0.0, 4.0, 2.0, 4.0, 7.0, -1.0], [-3.0, -5.0, -7.0, 6.0, -4.0, 4.0]], [[4.0, -1.0, 0.0, -6.0, -5.0, 6.0], [0.0, 2.0, -7.0, -1.0, 4.0, 1.0]]])) |
2045 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2046 |
|
self.failUnlessEqual(res.getShape(),(2, 2, 6),"wrong shape of result.") |
2047 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2048 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2049 |
|
def test_swapaxes_taggedData_rank3_axes_12(self): |
2050 |
|
arg=Data(numarray.array([[[3.0, 0.0], [0.0, -1.0]], [[2.0, -3.0], [6.0, -7.0]], [[-3.0, 6.0], [0.0, -6.0]], [[-6.0, 2.0], [5.0, 0.0]], [[-7.0, 0.0], [-4.0, -4.0]], [[2.0, 5.0], [-1.0, -1.0]]]),self.functionspace) |
2051 |
|
arg.setTaggedValue(1,numarray.array([[[6.0, -2.0], [7.0, -3.0]], [[2.0, -6.0], [-5.0, 4.0]], [[2.0, -6.0], [-1.0, 4.0]], [[1.0, 5.0], [-7.0, 0.0]], [[-3.0, 7.0], [3.0, 7.0]], [[-7.0, 0.0], [-7.0, -3.0]]])) |
2052 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
2053 |
|
ref=Data(numarray.array([[[3.0, 0.0], [0.0, -1.0]], [[2.0, 6.0], [-3.0, -7.0]], [[-3.0, 0.0], [6.0, -6.0]], [[-6.0, 5.0], [2.0, 0.0]], [[-7.0, -4.0], [0.0, -4.0]], [[2.0, -1.0], [5.0, -1.0]]]),self.functionspace) |
2054 |
|
ref.setTaggedValue(1,numarray.array([[[6.0, 7.0], [-2.0, -3.0]], [[2.0, -5.0], [-6.0, 4.0]], [[2.0, -1.0], [-6.0, 4.0]], [[1.0, -7.0], [5.0, 0.0]], [[-3.0, 3.0], [7.0, 7.0]], [[-7.0, -7.0], [0.0, -3.0]]])) |
2055 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2056 |
|
self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
2057 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2058 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2059 |
|
def test_swapaxes_taggedData_rank4_axes_01(self): |
2060 |
|
arg=Data(numarray.array([[[[-5.0, -6.0, 0.0, 0.0], [0.0, 4.0, 2.0, 0.0], [-2.0, -7.0, 6.0, 5.0]], [[-4.0, 2.0, 7.0, -4.0], [6.0, 3.0, 0.0, -1.0], [6.0, 3.0, 5.0, -5.0]]], [[[0.0, -2.0, -5.0, 2.0], [-3.0, 7.0, -7.0, 3.0], [3.0, 1.0, 6.0, -4.0]], [[5.0, -4.0, -1.0, -7.0], [0.0, -3.0, 7.0, -6.0], [1.0, -4.0, 1.0, 7.0]]], [[[-2.0, 6.0, -5.0, -2.0], [-4.0, 7.0, 2.0, 6.0], [7.0, -1.0, 3.0, -4.0]], [[7.0, 5.0, -5.0, -7.0], [4.0, 1.0, 3.0, -3.0], [-1.0, 0.0, -6.0, 0.0]]]]),self.functionspace) |
2061 |
|
arg.setTaggedValue(1,numarray.array([[[[-4.0, 2.0, -2.0, -7.0], [-2.0, -4.0, 7.0, 7.0], [7.0, -2.0, -1.0, 3.0]], [[4.0, 0.0, 6.0, 2.0], [-5.0, 6.0, 4.0, 0.0], [-1.0, 6.0, -5.0, 0.0]]], [[[-2.0, -2.0, -4.0, 1.0], [4.0, 2.0, 7.0, -6.0], [-1.0, 0.0, 0.0, -4.0]], [[-2.0, 7.0, 0.0, -5.0], [1.0, -2.0, 6.0, 1.0], [-7.0, 2.0, 6.0, 2.0]]], [[[1.0, 0.0, 6.0, -6.0], [1.0, 1.0, 2.0, 5.0], [4.0, 0.0, 6.0, -3.0]], [[-1.0, -6.0, -3.0, 0.0], [-3.0, 6.0, 0.0, 7.0], [5.0, 0.0, -7.0, -4.0]]]])) |
2062 |
|
res=swap_axes(arg,axis0=0,axis1=1) |
2063 |
|
ref=Data(numarray.array([[[[-5.0, -6.0, 0.0, 0.0], [0.0, 4.0, 2.0, 0.0], [-2.0, -7.0, 6.0, 5.0]], [[0.0, -2.0, -5.0, 2.0], [-3.0, 7.0, -7.0, 3.0], [3.0, 1.0, 6.0, -4.0]], [[-2.0, 6.0, -5.0, -2.0], [-4.0, 7.0, 2.0, 6.0], [7.0, -1.0, 3.0, -4.0]]], [[[-4.0, 2.0, 7.0, -4.0], [6.0, 3.0, 0.0, -1.0], [6.0, 3.0, 5.0, -5.0]], [[5.0, -4.0, -1.0, -7.0], [0.0, -3.0, 7.0, -6.0], [1.0, -4.0, 1.0, 7.0]], [[7.0, 5.0, -5.0, -7.0], [4.0, 1.0, 3.0, -3.0], [-1.0, 0.0, -6.0, 0.0]]]]),self.functionspace) |
2064 |
|
ref.setTaggedValue(1,numarray.array([[[[-4.0, 2.0, -2.0, -7.0], [-2.0, -4.0, 7.0, 7.0], [7.0, -2.0, -1.0, 3.0]], [[-2.0, -2.0, -4.0, 1.0], [4.0, 2.0, 7.0, -6.0], [-1.0, 0.0, 0.0, -4.0]], [[1.0, 0.0, 6.0, -6.0], [1.0, 1.0, 2.0, 5.0], [4.0, 0.0, 6.0, -3.0]]], [[[4.0, 0.0, 6.0, 2.0], [-5.0, 6.0, 4.0, 0.0], [-1.0, 6.0, -5.0, 0.0]], [[-2.0, 7.0, 0.0, -5.0], [1.0, -2.0, 6.0, 1.0], [-7.0, 2.0, 6.0, 2.0]], [[-1.0, -6.0, -3.0, 0.0], [-3.0, 6.0, 0.0, 7.0], [5.0, 0.0, -7.0, -4.0]]]])) |
2065 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2066 |
|
self.failUnlessEqual(res.getShape(),(2, 3, 3, 4),"wrong shape of result.") |
2067 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2068 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2069 |
|
def test_swapaxes_taggedData_rank4_axes_02(self): |
2070 |
|
arg=Data(numarray.array([[[[-2.0, 2.0, -5.0, 2.0], [-7.0, -6.0, 5.0, 0.0], [3.0, 4.0, -3.0, 7.0]], [[-7.0, 6.0, 2.0, 0.0], [0.0, 3.0, -6.0, 1.0], [1.0, -4.0, -1.0, 2.0]]], [[[7.0, 0.0, 6.0, 5.0], [7.0, 5.0, 7.0, -3.0], [0.0, 6.0, 1.0, -2.0]], [[2.0, -4.0, 0.0, -4.0], [-7.0, -2.0, -5.0, -6.0], [-6.0, -4.0, -7.0, -2.0]]], [[[-3.0, -3.0, 0.0, -2.0], [-4.0, 1.0, -4.0, 3.0], [-2.0, 6.0, 6.0, 4.0]], [[2.0, -4.0, 0.0, 5.0], [-6.0, 1.0, 7.0, 2.0], [-6.0, 6.0, -2.0, -6.0]]]]),self.functionspace) |
2071 |
|
arg.setTaggedValue(1,numarray.array([[[[-2.0, -3.0, 2.0, -4.0], [6.0, 4.0, 0.0, -1.0], [-2.0, 7.0, 0.0, -2.0]], [[1.0, -1.0, -3.0, 3.0], [3.0, -4.0, 5.0, 4.0], [-5.0, -6.0, -7.0, 4.0]]], [[[-6.0, -1.0, -7.0, 5.0], [2.0, 2.0, -5.0, -6.0], [6.0, 6.0, -4.0, -4.0]], [[1.0, 7.0, 5.0, -2.0], [6.0, -5.0, 2.0, -3.0], [6.0, 0.0, -6.0, 3.0]]], [[[7.0, 6.0, 7.0, 2.0], [-4.0, -4.0, -4.0, -6.0], [-4.0, 1.0, -4.0, 0.0]], [[7.0, 2.0, 2.0, 2.0], [-1.0, 2.0, -2.0, 5.0], [6.0, -5.0, 7.0, -5.0]]]])) |
2072 |
|
res=swap_axes(arg,axis0=0,axis1=2) |
2073 |
|
ref=Data(numarray.array([[[[-2.0, 2.0, -5.0, 2.0], [7.0, 0.0, 6.0, 5.0], [-3.0, -3.0, 0.0, -2.0]], [[-7.0, 6.0, 2.0, 0.0], [2.0, -4.0, 0.0, -4.0], [2.0, -4.0, 0.0, 5.0]]], [[[-7.0, -6.0, 5.0, 0.0], [7.0, 5.0, 7.0, -3.0], [-4.0, 1.0, -4.0, 3.0]], [[0.0, 3.0, -6.0, 1.0], [-7.0, -2.0, -5.0, -6.0], [-6.0, 1.0, 7.0, 2.0]]], [[[3.0, 4.0, -3.0, 7.0], [0.0, 6.0, 1.0, -2.0], [-2.0, 6.0, 6.0, 4.0]], [[1.0, -4.0, -1.0, 2.0], [-6.0, -4.0, -7.0, -2.0], [-6.0, 6.0, -2.0, -6.0]]]]),self.functionspace) |
2074 |
|
ref.setTaggedValue(1,numarray.array([[[[-2.0, -3.0, 2.0, -4.0], [-6.0, -1.0, -7.0, 5.0], [7.0, 6.0, 7.0, 2.0]], [[1.0, -1.0, -3.0, 3.0], [1.0, 7.0, 5.0, -2.0], [7.0, 2.0, 2.0, 2.0]]], [[[6.0, 4.0, 0.0, -1.0], [2.0, 2.0, -5.0, -6.0], [-4.0, -4.0, -4.0, -6.0]], [[3.0, -4.0, 5.0, 4.0], [6.0, -5.0, 2.0, -3.0], [-1.0, 2.0, -2.0, 5.0]]], [[[-2.0, 7.0, 0.0, -2.0], [6.0, 6.0, -4.0, -4.0], [-4.0, 1.0, -4.0, 0.0]], [[-5.0, -6.0, -7.0, 4.0], [6.0, 0.0, -6.0, 3.0], [6.0, -5.0, 7.0, -5.0]]]])) |
2075 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2076 |
|
self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
2077 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2078 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2079 |
|
def test_swapaxes_taggedData_rank4_axes_03(self): |
2080 |
|
arg=Data(numarray.array([[[[-1.0, -1.0, 1.0, -2.0], [6.0, 7.0, 1.0, 5.0], [3.0, -2.0, 1.0, 6.0]], [[4.0, 1.0, -2.0, -7.0], [-3.0, -6.0, 6.0, -4.0], [0.0, 0.0, 2.0, 5.0]]], [[[-2.0, 0.0, 2.0, 1.0], [1.0, -7.0, -2.0, -1.0], [0.0, 6.0, 3.0, 2.0]], [[-5.0, 6.0, -4.0, -4.0], [7.0, 2.0, 0.0, -3.0], [0.0, 7.0, 0.0, 0.0]]], [[[-6.0, -2.0, 1.0, -1.0], [3.0, 0.0, -2.0, 2.0], [-3.0, 1.0, -6.0, -1.0]], [[-6.0, 1.0, 3.0, -7.0], [-6.0, -3.0, 5.0, 1.0], [-6.0, 1.0, 0.0, -6.0]]]]),self.functionspace) |
2081 |
|
arg.setTaggedValue(1,numarray.array([[[[-1.0, 2.0, 3.0, -1.0], [7.0, -2.0, -7.0, -3.0], [-5.0, 7.0, -4.0, -6.0]], [[-6.0, -3.0, -4.0, -3.0], [-1.0, -1.0, 6.0, 3.0], [4.0, -2.0, 1.0, -5.0]]], [[[-5.0, -4.0, -2.0, -5.0], [-4.0, -1.0, 4.0, 4.0], [4.0, 7.0, 1.0, 2.0]], [[-5.0, -2.0, 1.0, -3.0], [5.0, 1.0, -4.0, 0.0], [-3.0, -6.0, 4.0, -5.0]]], [[[-5.0, -1.0, 7.0, 0.0], [-7.0, -6.0, -2.0, 5.0], [0.0, 0.0, 2.0, 0.0]], [[3.0, 6.0, 6.0, -4.0], [4.0, 0.0, 7.0, -1.0], [7.0, 4.0, 0.0, 6.0]]]])) |
2082 |
|
res=swap_axes(arg,axis0=0,axis1=3) |
2083 |
|
ref=Data(numarray.array([[[[-1.0, -2.0, -6.0], [6.0, 1.0, 3.0], [3.0, 0.0, -3.0]], [[4.0, -5.0, -6.0], [-3.0, 7.0, -6.0], [0.0, 0.0, -6.0]]], [[[-1.0, 0.0, -2.0], [7.0, -7.0, 0.0], [-2.0, 6.0, 1.0]], [[1.0, 6.0, 1.0], [-6.0, 2.0, -3.0], [0.0, 7.0, 1.0]]], [[[1.0, 2.0, 1.0], [1.0, -2.0, -2.0], [1.0, 3.0, -6.0]], [[-2.0, -4.0, 3.0], [6.0, 0.0, 5.0], [2.0, 0.0, 0.0]]], [[[-2.0, 1.0, -1.0], [5.0, -1.0, 2.0], [6.0, 2.0, -1.0]], [[-7.0, -4.0, -7.0], [-4.0, -3.0, 1.0], [5.0, 0.0, -6.0]]]]),self.functionspace) |
2084 |
|
ref.setTaggedValue(1,numarray.array([[[[-1.0, -5.0, -5.0], [7.0, -4.0, -7.0], [-5.0, 4.0, 0.0]], [[-6.0, -5.0, 3.0], [-1.0, 5.0, 4.0], [4.0, -3.0, 7.0]]], [[[2.0, -4.0, -1.0], [-2.0, -1.0, -6.0], [7.0, 7.0, 0.0]], [[-3.0, -2.0, 6.0], [-1.0, 1.0, 0.0], [-2.0, -6.0, 4.0]]], [[[3.0, -2.0, 7.0], [-7.0, 4.0, -2.0], [-4.0, 1.0, 2.0]], [[-4.0, 1.0, 6.0], [6.0, -4.0, 7.0], [1.0, 4.0, 0.0]]], [[[-1.0, -5.0, 0.0], [-3.0, 4.0, 5.0], [-6.0, 2.0, 0.0]], [[-3.0, -3.0, -4.0], [3.0, 0.0, -1.0], [-5.0, -5.0, 6.0]]]])) |
2085 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2086 |
|
self.failUnlessEqual(res.getShape(),(4, 2, 3, 3),"wrong shape of result.") |
2087 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2088 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2089 |
|
def test_swapaxes_taggedData_rank4_axes_12(self): |
2090 |
|
arg=Data(numarray.array([[[[7.0, 7.0, 0.0, 5.0], [4.0, 0.0, 1.0, -1.0], [-1.0, 7.0, 3.0, 2.0]], [[-7.0, 7.0, 4.0, -5.0], [-6.0, -1.0, 6.0, 2.0], [-2.0, -1.0, 0.0, 2.0]]], [[[0.0, 2.0, 2.0, -7.0], [4.0, 0.0, 0.0, 6.0], [3.0, -5.0, -4.0, 1.0]], [[6.0, -4.0, 1.0, 4.0], [0.0, -5.0, 3.0, 6.0], [-1.0, -7.0, 7.0, 3.0]]], [[[0.0, 2.0, -2.0, -5.0], [2.0, -4.0, 5.0, -4.0], [1.0, -2.0, -2.0, -5.0]], [[5.0, -7.0, 6.0, -3.0], [1.0, 3.0, 2.0, -3.0], [7.0, 0.0, 0.0, -2.0]]]]),self.functionspace) |
2091 |
|
arg.setTaggedValue(1,numarray.array([[[[2.0, -2.0, -3.0, -6.0], [2.0, -7.0, -5.0, -7.0], [1.0, 7.0, -5.0, -4.0]], [[6.0, -2.0, 7.0, -2.0], [0.0, 6.0, 7.0, -3.0], [7.0, 1.0, -7.0, -3.0]]], [[[3.0, 6.0, 6.0, -2.0], [-1.0, 2.0, -6.0, 0.0], [-1.0, 0.0, 3.0, -5.0]], [[5.0, 1.0, -7.0, 0.0], [4.0, 2.0, 7.0, 0.0], [-7.0, 7.0, -2.0, 7.0]]], [[[-6.0, 6.0, 4.0, -1.0], [6.0, 3.0, -1.0, 3.0], [5.0, 0.0, 4.0, 0.0]], [[6.0, 6.0, 2.0, 0.0], [1.0, 1.0, -4.0, -3.0], [0.0, 0.0, -5.0, 1.0]]]])) |
2092 |
|
res=swap_axes(arg,axis0=1,axis1=2) |
2093 |
|
ref=Data(numarray.array([[[[7.0, 7.0, 0.0, 5.0], [-7.0, 7.0, 4.0, -5.0]], [[4.0, 0.0, 1.0, -1.0], [-6.0, -1.0, 6.0, 2.0]], [[-1.0, 7.0, 3.0, 2.0], [-2.0, -1.0, 0.0, 2.0]]], [[[0.0, 2.0, 2.0, -7.0], [6.0, -4.0, 1.0, 4.0]], [[4.0, 0.0, 0.0, 6.0], [0.0, -5.0, 3.0, 6.0]], [[3.0, -5.0, -4.0, 1.0], [-1.0, -7.0, 7.0, 3.0]]], [[[0.0, 2.0, -2.0, -5.0], [5.0, -7.0, 6.0, -3.0]], [[2.0, -4.0, 5.0, -4.0], [1.0, 3.0, 2.0, -3.0]], [[1.0, -2.0, -2.0, -5.0], [7.0, 0.0, 0.0, -2.0]]]]),self.functionspace) |
2094 |
|
ref.setTaggedValue(1,numarray.array([[[[2.0, -2.0, -3.0, -6.0], [6.0, -2.0, 7.0, -2.0]], [[2.0, -7.0, -5.0, -7.0], [0.0, 6.0, 7.0, -3.0]], [[1.0, 7.0, -5.0, -4.0], [7.0, 1.0, -7.0, -3.0]]], [[[3.0, 6.0, 6.0, -2.0], [5.0, 1.0, -7.0, 0.0]], [[-1.0, 2.0, -6.0, 0.0], [4.0, 2.0, 7.0, 0.0]], [[-1.0, 0.0, 3.0, -5.0], [-7.0, 7.0, -2.0, 7.0]]], [[[-6.0, 6.0, 4.0, -1.0], [6.0, 6.0, 2.0, 0.0]], [[6.0, 3.0, -1.0, 3.0], [1.0, 1.0, -4.0, -3.0]], [[5.0, 0.0, 4.0, 0.0], [0.0, 0.0, -5.0, 1.0]]]])) |
2095 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2096 |
|
self.failUnlessEqual(res.getShape(),(3, 3, 2, 4),"wrong shape of result.") |
2097 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2098 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2099 |
|
def test_swapaxes_taggedData_rank4_axes_13(self): |
2100 |
|
arg=Data(numarray.array([[[[-1.0, -6.0, -3.0, 0.0], [-2.0, 5.0, 7.0, 0.0], [2.0, -5.0, 7.0, 1.0]], [[0.0, 2.0, 1.0, -3.0], [-7.0, 7.0, 0.0, 4.0], [-6.0, 7.0, -2.0, -5.0]]], [[[3.0, 2.0, -7.0, 7.0], [3.0, -7.0, 0.0, -5.0], [4.0, 3.0, -4.0, 4.0]], [[5.0, 2.0, -6.0, 1.0], [-2.0, -2.0, 6.0, -6.0], [-1.0, -2.0, 2.0, 1.0]]], [[[-6.0, -5.0, 5.0, 6.0], [5.0, 4.0, -5.0, -3.0], [-3.0, 7.0, 7.0, -7.0]], [[1.0, 7.0, 7.0, -7.0], [6.0, 5.0, 0.0, -1.0], [0.0, 7.0, -1.0, 5.0]]]]),self.functionspace) |
2101 |
|
arg.setTaggedValue(1,numarray.array([[[[6.0, 1.0, 1.0, 5.0], [4.0, -1.0, -1.0, -2.0], [4.0, 3.0, -3.0, 6.0]], [[4.0, 7.0, 5.0, 2.0], [3.0, 0.0, -1.0, 1.0], [-5.0, -3.0, -7.0, -6.0]]], [[[-6.0, -2.0, -4.0, 7.0], [6.0, -1.0, -3.0, -6.0], [1.0, -1.0, 1.0, -1.0]], [[-1.0, 1.0, 1.0, -4.0], [-7.0, 5.0, 3.0, 0.0], [-5.0, 3.0, -6.0, 7.0]]], [[[-6.0, -7.0, -5.0, -7.0], [-5.0, 0.0, 0.0, -6.0], [-2.0, 5.0, -5.0, 3.0]], [[0.0, -1.0, 5.0, -7.0], [-4.0, 7.0, 0.0, -4.0], [-3.0, -3.0, -1.0, 1.0]]]])) |
2102 |
|
res=swap_axes(arg,axis0=1,axis1=3) |
2103 |
|
ref=Data(numarray.array([[[[-1.0, 0.0], [-2.0, -7.0], [2.0, -6.0]], [[-6.0, 2.0], [5.0, 7.0], [-5.0, 7.0]], [[-3.0, 1.0], [7.0, 0.0], [7.0, -2.0]], [[0.0, -3.0], [0.0, 4.0], [1.0, -5.0]]], [[[3.0, 5.0], [3.0, -2.0], [4.0, -1.0]], [[2.0, 2.0], [-7.0, -2.0], [3.0, -2.0]], [[-7.0, -6.0], [0.0, 6.0], [-4.0, 2.0]], [[7.0, 1.0], [-5.0, -6.0], [4.0, 1.0]]], [[[-6.0, 1.0], [5.0, 6.0], [-3.0, 0.0]], [[-5.0, 7.0], [4.0, 5.0], [7.0, 7.0]], [[5.0, 7.0], [-5.0, 0.0], [7.0, -1.0]], [[6.0, -7.0], [-3.0, -1.0], [-7.0, 5.0]]]]),self.functionspace) |
2104 |
|
ref.setTaggedValue(1,numarray.array([[[[6.0, 4.0], [4.0, 3.0], [4.0, -5.0]], [[1.0, 7.0], [-1.0, 0.0], [3.0, -3.0]], [[1.0, 5.0], [-1.0, -1.0], [-3.0, -7.0]], [[5.0, 2.0], [-2.0, 1.0], [6.0, -6.0]]], [[[-6.0, -1.0], [6.0, -7.0], [1.0, -5.0]], [[-2.0, 1.0], [-1.0, 5.0], [-1.0, 3.0]], [[-4.0, 1.0], [-3.0, 3.0], [1.0, -6.0]], [[7.0, -4.0], [-6.0, 0.0], [-1.0, 7.0]]], [[[-6.0, 0.0], [-5.0, -4.0], [-2.0, -3.0]], [[-7.0, -1.0], [0.0, 7.0], [5.0, -3.0]], [[-5.0, 5.0], [0.0, 0.0], [-5.0, -1.0]], [[-7.0, -7.0], [-6.0, -4.0], [3.0, 1.0]]]])) |
2105 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2106 |
|
self.failUnlessEqual(res.getShape(),(3, 4, 3, 2),"wrong shape of result.") |
2107 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
2108 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2109 |
|
def test_swapaxes_taggedData_rank4_axes_23(self): |
2110 |
|
arg=Data(numarray.array([[[[1.0, -4.0, -6.0, -1.0], [3.0, 0.0, 6.0, -2.0], [-2.0, 5.0, -2.0, 5.0]], [[0.0, -2.0, 2.0, -6.0], [-1.0, -5.0, 3.0, -7.0], [-5.0, -6.0, 0.0, 0.0]]], [[[2.0, -2.0, -5.0, -2.0], [5.0, -2.0, 2.0, 1.0], [6.0, -4.0, 0.0, -4.0]], [[-1.0, 0.0, 4.0, 0.0], [-7.0, -4.0, 6.0, -3.0], [-7.0, 7.0, -6.0, -5.0]]], [[[-4.0, -1.0, -6.0, 7.0], [1.0, -6.0, 5.0, 0.0], [-2.0, -6.0, 1.0, 4.0]], [[0.0, 7.0, 0.0, -2.0], [6.0, -7.0, 7.0, 7.0], [-7.0, 2.0, -5.0, 0.0]]]]),self.functionspace) |
2111 |
|
arg.setTaggedValue(1,numarray.array([[[[5.0, 4.0, 2.0, 2.0], [-6.0, -3.0, -3.0, -4.0], [4.0, -2.0, 7.0, 1.0]], [[-4.0, 4.0, 1.0, 7.0], [3.0, 6.0, -5.0, 2.0], [-5.0, -4.0, -3.0, 0.0]]], [[[-1.0, 2.0, -1.0, -6.0], [-3.0, 0.0, 5.0, 2.0], [-5.0, -4.0, 4.0, -1.0]], [[7.0, 5.0, -2.0, 5.0], [4.0, 2.0, -3.0, 2.0], [-7.0, -6.0, 7.0, -1.0]]], [[[-6.0, -1.0, 7.0, 5.0], [-6.0, 0.0, -3.0, 0.0], [4.0, 7.0, 3.0, 2.0]], [[-5.0, -2.0, 0.0, 1.0], [-7.0, 1.0, 0.0, 0.0], [5.0, -6.0, 5.0, -7.0]]]])) |
2112 |
|
res=swap_axes(arg,axis0=2,axis1=3) |
2113 |
|
ref=Data(numarray.array([[[[1.0, 3.0, -2.0], [-4.0, 0.0, 5.0], [-6.0, 6.0, -2.0], [-1.0, -2.0, 5.0]], [[0.0, -1.0, -5.0], [-2.0, -5.0, -6.0], [2.0, 3.0, 0.0], [-6.0, -7.0, 0.0]]], [[[2.0, 5.0, 6.0], [-2.0, -2.0, -4.0], [-5.0, 2.0, 0.0], [-2.0, 1.0, -4.0]], [[-1.0, -7.0, -7.0], [0.0, -4.0, 7.0], [4.0, 6.0, -6.0], [0.0, -3.0, -5.0]]], [[[-4.0, 1.0, -2.0], [-1.0, -6.0, -6.0], [-6.0, 5.0, 1.0], [7.0, 0.0, 4.0]], [[0.0, 6.0, -7.0], [7.0, -7.0, 2.0], [0.0, 7.0, -5.0], [-2.0, 7.0, 0.0]]]]),self.functionspace) |
2114 |
|
ref.setTaggedValue(1,numarray.array([[[[5.0, -6.0, 4.0], [4.0, -3.0, -2.0], [2.0, -3.0, 7.0], [2.0, -4.0, 1.0]], [[-4.0, 3.0, -5.0], [4.0, 6.0, -4.0], [1.0, -5.0, -3.0], [7.0, 2.0, 0.0]]], [[[-1.0, -3.0, -5.0], [2.0, 0.0, -4.0], [-1.0, 5.0, 4.0], [-6.0, 2.0, -1.0]], [[7.0, 4.0, -7.0], [5.0, 2.0, -6.0], [-2.0, -3.0, 7.0], [5.0, 2.0, -1.0]]], [[[-6.0, -6.0, 4.0], [-1.0, 0.0, 7.0], [7.0, -3.0, 3.0], [5.0, 0.0, 2.0]], [[-5.0, -7.0, 5.0], [-2.0, 1.0, -6.0], [0.0, 0.0, 5.0], [1.0, 0.0, -7.0]]]])) |
2115 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
2116 |
|
self.failUnlessEqual(res.getShape(),(3, 2, 4, 3),"wrong shape of result.") |
2117 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |