Parent Directory
|
Revision Log
|
Patch
revision 784 by gross, Sat Apr 8 16:13:02 2006 UTC | revision 785 by gross, Tue Jul 25 03:48:10 2006 UTC | |
---|---|---|
# | Line 28384 class Test_util_binary_no_tagged_data(Te | Line 28384 class Test_util_binary_no_tagged_data(Te |
28384 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
28385 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
28386 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
28387 | def test_power_float_rank0_constData_rank0(self): | |
28388 | arg0=4.35251522982 | |
28389 | arg1=Data(2.94566651719,self.functionspace) | |
28390 | res=power(arg0,arg1) | |
28391 | ref=Data(76.1230031099,self.functionspace) | |
28392 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28393 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
28394 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28395 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28396 | def test_power_float_rank0_expandedData_rank0(self): | |
28397 | arg0=3.41819405792 | |
28398 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | |
28399 | arg1=msk_arg1*(3.18794922769)+(1.-msk_arg1)*(0.35955973515) | |
28400 | res=power(arg0,arg1) | |
28401 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | |
28402 | ref=msk_ref*(50.3172415941)+(1.-msk_ref)*(1.55572132713) | |
28403 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28404 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | |
28405 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28406 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28407 | def test_tensor_mult_array_rank2_array_rank1(self): | |
28408 | arg0=numarray.array([[1.0, -1.0, 5.0], [-1.0, -6.0, 6.0]]) | |
28409 | arg1=numarray.array([4.0, 0.0, -7.0]) | |
28410 | res=tensor_mult(arg0,arg1) | |
28411 | ref=numarray.array([-31.0, -46.0]) | |
28412 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
28413 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | |
28414 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28415 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28416 | def test_tensor_mult_array_rank2_array_rank2(self): | |
28417 | arg0=numarray.array([[-1.0, 5.0, -3.0], [5.0, 7.0, 0.0]]) | |
28418 | arg1=numarray.array([[6.0, -6.0], [-5.0, -2.0], [0.0, 2.0]]) | |
28419 | res=tensor_mult(arg0,arg1) | |
28420 | ref=numarray.array([[-31.0, -10.0], [-5.0, -44.0]]) | |
28421 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
28422 | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") | |
28423 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28424 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28425 | def test_tensor_mult_array_rank2_Symbol_rank1(self): | |
28426 | arg0=numarray.array([[-6.0, -2.0, 6.0], [-7.0, -1.0, -5.0]]) | |
28427 | arg1=Symbol(shape=(3,)) | |
28428 | res=tensor_mult(arg0,arg1) | |
28429 | s1=numarray.array([4.0, -1.0, -7.0]) | |
28430 | sub=res.substitute({arg1:s1}) | |
28431 | ref=numarray.array([-64.0, 8.0]) | |
28432 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28433 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28434 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28435 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28436 | def test_tensor_mult_array_rank2_Symbol_rank2(self): | |
28437 | arg0=numarray.array([[6.0, 2.0, 4.0], [0.0, -1.0, 3.0]]) | |
28438 | arg1=Symbol(shape=(3, 2)) | |
28439 | res=tensor_mult(arg0,arg1) | |
28440 | s1=numarray.array([[1.0, -3.0], [-3.0, -5.0], [1.0, 0.0]]) | |
28441 | sub=res.substitute({arg1:s1}) | |
28442 | ref=numarray.array([[4.0, -28.0], [6.0, 5.0]]) | |
28443 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28444 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28445 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28446 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28447 | def test_tensor_mult_array_rank2_constData_rank1(self): | |
28448 | arg0=numarray.array([[2.0, -4.0, 3.0], [-3.0, 3.0, 7.0]]) | |
28449 | arg1=Data(numarray.array([-5.0, 4.0, -4.0]),self.functionspace) | |
28450 | res=tensor_mult(arg0,arg1) | |
28451 | ref=Data(numarray.array([-38.0, -1.0]),self.functionspace) | |
28452 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28453 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28454 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28455 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28456 | def test_tensor_mult_array_rank2_constData_rank2(self): | |
28457 | arg0=numarray.array([[-5.0, 0.0, -6.0], [-6.0, 2.0, 4.0]]) | |
28458 | arg1=Data(numarray.array([[1.0, 4.0], [5.0, -6.0], [7.0, -3.0]]),self.functionspace) | |
28459 | res=tensor_mult(arg0,arg1) | |
28460 | ref=Data(numarray.array([[-47.0, -2.0], [32.0, -48.0]]),self.functionspace) | |
28461 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28462 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28463 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28464 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28465 | def test_tensor_mult_array_rank2_expandedData_rank1(self): | |
28466 | arg0=numarray.array([[3.0, 5.0, -3.0], [4.0, -5.0, -2.0]]) | |
28467 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28468 | arg1=msk_arg1*numarray.array([3.0, -4.0, 5.0])+(1.-msk_arg1)*numarray.array([-7.0, -3.0, -5.0]) | |
28469 | res=tensor_mult(arg0,arg1) | |
28470 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28471 | ref=msk_ref*numarray.array([-26.0, 22.0])+(1.-msk_ref)*numarray.array([-21.0, -3.0]) | |
28472 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28473 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28474 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28475 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28476 | def test_tensor_mult_array_rank2_expandedData_rank2(self): | |
28477 | arg0=numarray.array([[6.0, 7.0, 4.0], [-1.0, -4.0, 4.0]]) | |
28478 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28479 | arg1=msk_arg1*numarray.array([[3.0, -2.0], [-2.0, -3.0], [-5.0, -5.0]])+(1.-msk_arg1)*numarray.array([[-2.0, 7.0], [-6.0, -6.0], [-4.0, 4.0]]) | |
28480 | res=tensor_mult(arg0,arg1) | |
28481 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28482 | ref=msk_ref*numarray.array([[-16.0, -53.0], [-15.0, -6.0]])+(1.-msk_ref)*numarray.array([[-70.0, 16.0], [10.0, 33.0]]) | |
28483 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28484 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28485 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28486 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28487 | def test_tensor_mult_array_rank4_array_rank2(self): | |
28488 | arg0=numarray.array([[[[-7.0, 4.0, 2.0], [7.0, -2.0, 7.0]], [[3.0, 5.0, 0.0], [7.0, 0.0, -4.0]], [[0.0, -2.0, -4.0], [-3.0, -7.0, 0.0]], [[-1.0, -2.0, 5.0], [-5.0, 5.0, 4.0]], [[-5.0, -2.0, -1.0], [-5.0, 0.0, -2.0]]], [[[7.0, 0.0, -1.0], [5.0, -1.0, 7.0]], [[5.0, -6.0, -7.0], [-6.0, -2.0, 0.0]], [[-5.0, 4.0, 7.0], [-5.0, -4.0, 3.0]], [[0.0, -5.0, 1.0], [1.0, -4.0, -3.0]], [[-3.0, 4.0, -6.0], [-4.0, -6.0, -2.0]]], [[[0.0, 5.0, 0.0], [7.0, -7.0, -2.0]], [[1.0, -6.0, 3.0], [0.0, -5.0, -5.0]], [[-6.0, -4.0, 4.0], [0.0, 0.0, 2.0]], [[-5.0, -3.0, -7.0], [-1.0, 3.0, -4.0]], [[5.0, -3.0, 3.0], [-6.0, -1.0, 0.0]]], [[[2.0, -7.0, 0.0], [-4.0, 5.0, 1.0]], [[-2.0, -4.0, -6.0], [6.0, 2.0, 4.0]], [[0.0, 1.0, -1.0], [4.0, -4.0, -7.0]], [[-5.0, 6.0, 6.0], [0.0, 2.0, 1.0]], [[-5.0, 2.0, -7.0], [-7.0, -4.0, -3.0]]]]) | |
28489 | arg1=numarray.array([[0.0, 2.0, -5.0], [-2.0, -5.0, 1.0]]) | |
28490 | res=tensor_mult(arg0,arg1) | |
28491 | ref=numarray.array([[1.0, -8.0, 57.0, -40.0, 9.0], [7.0, 45.0, 6.0, 0.0, 74.0], [29.0, -7.0, -26.0, 12.0, -4.0], [-30.0, 4.0, 12.0, -27.0, 70.0]]) | |
28492 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
28493 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | |
28494 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28495 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28496 | def test_tensor_mult_array_rank4_array_rank3(self): | |
28497 | arg0=numarray.array([[[[6.0, 6.0, 2.0], [0.0, 5.0, 0.0]], [[-6.0, -2.0, -4.0], [-2.0, 4.0, -3.0]], [[-5.0, -6.0, 0.0], [5.0, 0.0, 7.0]], [[1.0, -7.0, -7.0], [2.0, 7.0, 4.0]], [[-6.0, -5.0, 2.0], [5.0, 0.0, 7.0]]], [[[-5.0, 7.0, 7.0], [-6.0, 0.0, -2.0]], [[0.0, -4.0, -4.0], [-2.0, 6.0, 4.0]], [[-7.0, -4.0, 0.0], [3.0, 0.0, 3.0]], [[-1.0, 1.0, 4.0], [0.0, 0.0, -4.0]], [[0.0, 6.0, 3.0], [2.0, 6.0, -7.0]]], [[[-6.0, 7.0, -1.0], [7.0, -1.0, 7.0]], [[-6.0, 2.0, 2.0], [-7.0, -2.0, 7.0]], [[-1.0, -5.0, 1.0], [3.0, 0.0, 0.0]], [[-2.0, 0.0, -7.0], [-5.0, -3.0, -2.0]], [[2.0, 6.0, -5.0], [-2.0, -3.0, -7.0]]], [[[-4.0, 1.0, 0.0], [-4.0, 3.0, 2.0]], [[1.0, 0.0, 6.0], [-6.0, -5.0, -7.0]], [[-4.0, -6.0, 2.0], [-1.0, 6.0, 0.0]], [[7.0, 4.0, -7.0], [-2.0, 2.0, 1.0]], [[-7.0, -1.0, -2.0], [0.0, -7.0, 3.0]]]]) | |
28498 | arg1=numarray.array([[[3.0, -4.0], [-1.0, -1.0], [-6.0, -7.0]], [[-2.0, 1.0], [1.0, 2.0], [3.0, 1.0]]]) | |
28499 | res=tensor_mult(arg0,arg1) | |
28500 | ref=numarray.array([[[5.0, -34.0], [7.0, 57.0], [2.0, 38.0], [67.0, 72.0], [-14.0, 27.0]], [[-58.0, -44.0], [50.0, 46.0], [-14.0, 38.0], [-40.0, -29.0], [-43.0, -20.0]], [[-13.0, 36.0], [1.0, 4.0], [-10.0, 5.0], [37.0, 44.0], [10.0, 6.0]], [[4.0, 19.0], [-47.0, -69.0], [-10.0, 19.0], [68.0, 20.0], [-6.0, 32.0]]]) | |
28501 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
28502 | self.failUnlessEqual(res.shape,(4, 5, 2),"wrong shape of result.") | |
28503 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28504 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28505 | def test_tensor_mult_array_rank4_array_rank4(self): | |
28506 | arg0=numarray.array([[[[-1.0, -6.0, -4.0], [-2.0, 3.0, 3.0]], [[3.0, -6.0, 2.0], [-2.0, -1.0, -3.0]], [[4.0, -4.0, -4.0], [3.0, 1.0, 1.0]], [[6.0, -6.0, -6.0], [-4.0, -5.0, 0.0]], [[-2.0, 1.0, 7.0], [2.0, -1.0, -6.0]]], [[[-4.0, 6.0, 0.0], [2.0, -6.0, 1.0]], [[0.0, -7.0, 1.0], [7.0, 6.0, 4.0]], [[3.0, 4.0, -3.0], [2.0, 1.0, 7.0]], [[1.0, -6.0, 0.0], [2.0, 4.0, 6.0]], [[-5.0, 6.0, 3.0], [-3.0, 0.0, 0.0]]], [[[-1.0, 5.0, -5.0], [0.0, -6.0, -5.0]], [[-5.0, -2.0, 6.0], [-5.0, 4.0, -6.0]], [[0.0, 4.0, -5.0], [6.0, 4.0, 0.0]], [[2.0, -2.0, -4.0], [7.0, -5.0, -4.0]], [[-7.0, 3.0, -7.0], [2.0, 0.0, -2.0]]], [[[6.0, -7.0, 1.0], [7.0, -6.0, -4.0]], [[6.0, 7.0, 4.0], [-6.0, 7.0, 0.0]], [[4.0, 0.0, -6.0], [0.0, 1.0, 7.0]], [[-5.0, 7.0, 1.0], [2.0, -1.0, -1.0]], [[-1.0, 0.0, 6.0], [7.0, -2.0, 4.0]]]]) | |
28507 | arg1=numarray.array([[[[-2.0, 2.0, -6.0, 0.0, 0.0], [-2.0, 1.0, -4.0, 4.0, -3.0], [0.0, -7.0, 2.0, 2.0, 0.0], [3.0, 5.0, -1.0, -1.0, 0.0]], [[-5.0, -3.0, -1.0, 2.0, -6.0], [-3.0, -7.0, 2.0, -5.0, 3.0], [2.0, 6.0, -3.0, -4.0, 0.0], [5.0, 5.0, -1.0, 2.0, 7.0]], [[-1.0, 2.0, -7.0, 5.0, 2.0], [2.0, 0.0, -2.0, 4.0, 1.0], [3.0, -6.0, -6.0, 5.0, 7.0], [0.0, -3.0, 0.0, -6.0, -2.0]]], [[[4.0, 5.0, -2.0, 3.0, 3.0], [2.0, -5.0, 4.0, 4.0, -6.0], [3.0, 0.0, 0.0, -2.0, 6.0], [-1.0, 0.0, 4.0, -7.0, 0.0]], [[0.0, -2.0, -1.0, 3.0, 0.0], [4.0, 3.0, -3.0, -1.0, -4.0], [2.0, 7.0, 6.0, -4.0, 0.0], [-2.0, 5.0, -4.0, -1.0, 6.0]], [[1.0, -1.0, 0.0, -4.0, 2.0], [-3.0, 7.0, -4.0, 7.0, -4.0], [-1.0, 4.0, 0.0, -7.0, -7.0], [-2.0, 6.0, -6.0, 1.0, -4.0]]]]) | |
28508 | res=tensor_mult(arg0,arg1) | |
28509 | ref=numarray.array([[[[31.0, -11.0, 41.0, -41.0, 28.0], [11.0, 81.0, -29.0, 20.0, -31.0], [-27.0, 28.0, 58.0, -27.0, -61.0], [-43.0, 10.0, -31.0, 27.0, -28.0]], [[11.0, 23.0, -21.0, 1.0, 28.0], [17.0, 31.0, -21.0, 22.0, 3.0], [-11.0, -88.0, 6.0, 69.0, 23.0], [-11.0, -44.0, 17.0, -15.0, -40.0]], [[29.0, 24.0, 1.0, -20.0, 27.0], [3.0, 27.0, -11.0, 38.0, -54.0], [-10.0, -17.0, 50.0, -13.0, -17.0], [-15.0, 23.0, 2.0, -9.0, -18.0]], [[8.0, 8.0, 25.0, -69.0, 12.0], [-34.0, 53.0, -25.0, 19.0, 2.0], [-52.0, -77.0, 36.0, 34.0, -66.0], [2.0, -7.0, 4.0, 51.0, -60.0]], [[-6.0, 25.0, -41.0, 64.0, 2.0], [33.0, -64.0, 31.0, -18.0, 32.0], [33.0, -53.0, -55.0, 69.0, 103.0], [11.0, -67.0, 49.0, -57.0, 11.0]]], [[[-13.0, -5.0, 20.0, -4.0, -28.0], [-33.0, -67.0, 50.0, -25.0, 38.0], [5.0, 26.0, -62.0, -19.0, 5.0], [26.0, -14.0, 24.0, 9.0, 2.0]], [[66.0, 42.0, -20.0, 14.0, 73.0], [49.0, 60.0, -22.0, 89.0, -102.0], [18.0, 10.0, 51.0, -33.0, 21.0], [-62.0, 16.0, -13.0, -71.0, -31.0]], [[-8.0, -11.0, -6.0, -26.0, -10.0], [-37.0, 17.0, -21.0, 36.0, -44.0], [0.0, 56.0, 18.0, -82.0, -58.0], [11.0, 91.0, -45.0, 15.0, 12.0]], [[42.0, 16.0, -8.0, -18.0, 54.0], [18.0, 87.0, -44.0, 80.0, -73.0], [-4.0, 9.0, 44.0, -36.0, -30.0], [-49.0, 31.0, -39.0, -25.0, -42.0]], [[-35.0, -37.0, 9.0, 18.0, -39.0], [-8.0, -32.0, 14.0, -50.0, 54.0], [12.0, 53.0, -46.0, -13.0, 3.0], [18.0, -4.0, -13.0, 20.0, 36.0]]], [[[-23.0, -10.0, 42.0, -13.0, -50.0], [-32.0, -89.0, 62.0, -78.0, 57.0], [-12.0, 5.0, -23.0, 12.0, 0.0], [44.0, -25.0, 50.0, 42.0, 29.0]], [[-12.0, -19.0, -4.0, 47.0, -3.0], [52.0, 4.0, -4.0, -52.0, 53.0], [13.0, -9.0, -16.0, 64.0, 54.0], [-16.0, -69.0, 7.0, -10.0, 22.0]], [[9.0, 0.0, 15.0, 13.0, -16.0], [6.0, -46.0, 30.0, -20.0, -45.0], [19.0, 82.0, 42.0, -69.0, 1.0], [6.0, 55.0, 4.0, -8.0, 62.0]], [[34.0, 51.0, 9.0, -2.0, 17.0], [0.0, -62.0, 55.0, 7.0, -22.0], [-1.0, -53.0, 4.0, 26.0, 42.0], [7.0, -37.0, 72.0, -30.0, -20.0]], [[12.0, -25.0, 84.0, -15.0, -30.0], [1.0, -52.0, 64.0, -77.0, 19.0], [-7.0, 101.0, 19.0, -51.0, -23.0], [-4.0, -11.0, 24.0, 39.0, 43.0]]], [[[46.0, 86.0, -44.0, 10.0, 57.0], [13.0, -26.0, 22.0, 69.0, -40.0], [2.0, -148.0, -9.0, 83.0, 77.0], [-4.0, -62.0, 77.0, -73.0, -71.0]], [[-75.0, -45.0, -66.0, 37.0, -52.0], [-9.0, 8.0, -63.0, -26.0, 15.0], [22.0, 25.0, 9.0, -12.0, -8.0], [45.0, 88.0, -65.0, 19.0, 83.0]], [[5.0, -13.0, 17.0, -55.0, 2.0], [-37.0, 56.0, -35.0, 40.0, -50.0], [-23.0, 43.0, 50.0, -75.0, -91.0], [-4.0, 85.0, -50.0, 38.0, -10.0]], [[-19.0, -16.0, 13.0, 26.0, -36.0], [-6.0, -74.0, 47.0, -49.0, 33.0], [22.0, 60.0, -43.0, -26.0, 26.0], [22.0, -4.0, 16.0, -1.0, 45.0]], [[28.0, 45.0, -48.0, 29.0, 41.0], [8.0, -14.0, 10.0, 78.0, -41.0], [31.0, -27.0, -50.0, -6.0, 56.0], [-14.0, -9.0, 13.0, -78.0, -40.0]]]]) | |
28510 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | |
28511 | self.failUnlessEqual(res.shape,(4, 5, 4, 5),"wrong shape of result.") | |
28512 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28513 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28514 | def test_tensor_mult_array_rank4_Symbol_rank2(self): | |
28515 | arg0=numarray.array([[[[-1.0, -6.0, 7.0], [2.0, 2.0, 1.0]], [[-7.0, 0.0, -4.0], [-2.0, 6.0, -7.0]], [[0.0, -3.0, -7.0], [4.0, -3.0, 4.0]], [[-6.0, 0.0, 7.0], [-6.0, 0.0, -7.0]], [[2.0, -1.0, 0.0], [6.0, -4.0, -5.0]]], [[[6.0, -3.0, 2.0], [-4.0, -5.0, 0.0]], [[4.0, 4.0, 1.0], [-1.0, 7.0, 0.0]], [[3.0, -2.0, -3.0], [-7.0, 3.0, 0.0]], [[-7.0, 6.0, -2.0], [-2.0, 2.0, 0.0]], [[2.0, 1.0, 1.0], [-2.0, 7.0, -1.0]]], [[[-4.0, -2.0, 0.0], [7.0, -5.0, 1.0]], [[-2.0, 2.0, -3.0], [-7.0, 1.0, 3.0]], [[4.0, -1.0, 6.0], [1.0, -7.0, 1.0]], [[3.0, -6.0, 5.0], [2.0, -6.0, 7.0]], [[-6.0, -5.0, 7.0], [4.0, 7.0, -2.0]]], [[[4.0, 4.0, 7.0], [-2.0, 0.0, -6.0]], [[-3.0, 5.0, -3.0], [1.0, -1.0, 0.0]], [[1.0, 1.0, 1.0], [5.0, 6.0, 2.0]], [[4.0, -7.0, -1.0], [-7.0, 4.0, -2.0]], [[1.0, -7.0, 6.0], [-7.0, -1.0, -7.0]]]]) | |
28516 | arg1=Symbol(shape=(2, 3)) | |
28517 | res=tensor_mult(arg0,arg1) | |
28518 | s1=numarray.array([[-7.0, 3.0, 7.0], [0.0, 0.0, -7.0]]) | |
28519 | sub=res.substitute({arg1:s1}) | |
28520 | ref=numarray.array([[31.0, 70.0, -86.0, 140.0, 18.0], [-37.0, -9.0, -48.0, 53.0, 3.0], [15.0, -22.0, 4.0, -53.0, 90.0], [75.0, 15.0, -11.0, -42.0, 63.0]]) | |
28521 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28522 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28523 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28524 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28525 | def test_tensor_mult_array_rank4_Symbol_rank3(self): | |
28526 | arg0=numarray.array([[[[-7.0, -3.0, 6.0], [4.0, 5.0, -3.0]], [[-7.0, 3.0, -1.0], [0.0, 7.0, -1.0]], [[3.0, -1.0, 2.0], [6.0, -7.0, 4.0]], [[-4.0, 1.0, 0.0], [7.0, -2.0, -4.0]], [[6.0, -2.0, -5.0], [7.0, 5.0, 6.0]]], [[[-4.0, -4.0, -3.0], [-1.0, 0.0, 0.0]], [[4.0, -2.0, -1.0], [6.0, 3.0, -1.0]], [[1.0, -2.0, -6.0], [0.0, 7.0, 4.0]], [[-3.0, 6.0, -1.0], [-1.0, 1.0, 5.0]], [[-4.0, 2.0, 1.0], [0.0, 5.0, -2.0]]], [[[0.0, -7.0, -3.0], [-7.0, -2.0, -5.0]], [[7.0, -4.0, -6.0], [1.0, 0.0, -4.0]], [[-2.0, -1.0, -4.0], [-2.0, 7.0, 0.0]], [[-4.0, 4.0, -2.0], [-1.0, -3.0, -2.0]], [[-4.0, -4.0, 2.0], [-5.0, -7.0, -5.0]]], [[[6.0, 0.0, 1.0], [-5.0, 6.0, 7.0]], [[2.0, -1.0, 1.0], [0.0, -1.0, -3.0]], [[-1.0, 1.0, -4.0], [1.0, 6.0, 0.0]], [[7.0, 0.0, 1.0], [-5.0, 0.0, 6.0]], [[-3.0, -7.0, -2.0], [1.0, 0.0, 0.0]]]]) | |
28527 | arg1=Symbol(shape=(2, 3, 2)) | |
28528 | res=tensor_mult(arg0,arg1) | |
28529 | s1=numarray.array([[[2.0, -4.0], [-4.0, 6.0], [-5.0, 7.0]], [[-4.0, 0.0], [-1.0, 6.0], [-4.0, 4.0]]]) | |
28530 | sub=res.substitute({arg1:s1}) | |
28531 | ref=numarray.array([[[-41.0, 70.0], [-24.0, 77.0], [-33.0, -30.0], [-22.0, -6.0], [-12.0, -17.0]], [[27.0, -29.0], [-2.0, -21.0], [17.0, 0.0], [-42.0, 67.0], [-18.0, 57.0]], [[93.0, -95.0], [72.0, -110.0], [21.0, 16.0], [1.0, 0.0], [45.0, -56.0]], [[-7.0, 47.0], [16.0, -25.0], [4.0, 18.0], [5.0, 3.0], [28.0, -44.0]]]) | |
28532 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28533 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28534 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28535 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28536 | def test_tensor_mult_array_rank4_Symbol_rank4(self): | |
28537 | arg0=numarray.array([[[[0.0, 5.0, 4.0], [0.0, -4.0, -2.0]], [[7.0, 7.0, 1.0], [-2.0, 3.0, 7.0]], [[-1.0, -2.0, -5.0], [6.0, 0.0, 7.0]], [[6.0, -5.0, 0.0], [-1.0, 2.0, 0.0]], [[-5.0, -5.0, 7.0], [6.0, 5.0, 4.0]]], [[[4.0, -2.0, 2.0], [6.0, -7.0, 7.0]], [[-7.0, 5.0, 5.0], [-7.0, 3.0, -4.0]], [[7.0, -7.0, -5.0], [-3.0, -6.0, -7.0]], [[6.0, 4.0, -4.0], [-4.0, 1.0, 0.0]], [[-1.0, -4.0, 2.0], [5.0, 1.0, 6.0]]], [[[7.0, 5.0, 0.0], [3.0, -6.0, 7.0]], [[-6.0, -6.0, -1.0], [-6.0, 5.0, 4.0]], [[7.0, 4.0, 6.0], [7.0, -6.0, 2.0]], [[-4.0, -5.0, -1.0], [-1.0, 2.0, 4.0]], [[-2.0, -5.0, -3.0], [-1.0, -7.0, -4.0]]], [[[-4.0, 3.0, 0.0], [-6.0, -5.0, -7.0]], [[1.0, -4.0, -5.0], [3.0, 4.0, -2.0]], [[0.0, 6.0, -4.0], [-4.0, -5.0, -5.0]], [[-2.0, 3.0, -5.0], [3.0, -7.0, 1.0]], [[4.0, 7.0, -1.0], [-1.0, -2.0, 5.0]]]]) | |
28538 | arg1=Symbol(shape=(2, 3, 4, 5)) | |
28539 | res=tensor_mult(arg0,arg1) | |
28540 | s1=numarray.array([[[[0.0, 0.0, 6.0, 5.0, 4.0], [-2.0, -4.0, -4.0, 2.0, 7.0], [-5.0, -1.0, 0.0, -7.0, -7.0], [-4.0, -3.0, 5.0, -5.0, 2.0]], [[-3.0, -5.0, 1.0, 2.0, 4.0], [4.0, 2.0, -4.0, -6.0, 0.0], [4.0, 2.0, 0.0, -7.0, 0.0], [0.0, 0.0, 7.0, 2.0, 6.0]], [[4.0, -3.0, -3.0, 5.0, 2.0], [-6.0, 1.0, -4.0, 2.0, 2.0], [-7.0, -3.0, -7.0, -5.0, 0.0], [-5.0, -4.0, -6.0, 0.0, -5.0]]], [[[-5.0, 7.0, 7.0, 0.0, 0.0], [3.0, 5.0, 1.0, 0.0, 7.0], [0.0, -7.0, -1.0, -1.0, -5.0], [6.0, -6.0, 5.0, 0.0, 3.0]], [[3.0, 5.0, 6.0, 1.0, -7.0], [-7.0, 6.0, -4.0, 2.0, -7.0], [-1.0, 6.0, 6.0, 4.0, 6.0], [7.0, -7.0, -6.0, -4.0, -7.0]], [[0.0, 6.0, 7.0, 3.0, 4.0], [-3.0, 3.0, 6.0, -7.0, -1.0], [-7.0, 5.0, -1.0, -7.0, 1.0], [-5.0, -4.0, 4.0, -1.0, -2.0]]]]) | |
28541 | sub=res.substitute({arg1:s1}) | |
28542 | ref=numarray.array([[[[-11.0, -69.0, -45.0, 20.0, 48.0], [30.0, -16.0, -32.0, -16.0, 38.0], [10.0, -36.0, -50.0, -57.0, -26.0], [-38.0, 20.0, 27.0, 28.0, 42.0]], [[2.0, 5.0, 99.0, 78.0, 65.0], [-40.0, 16.0, -32.0, -69.0, 9.0], [-66.0, 71.0, 6.0, -138.0, -14.0], [-59.0, -62.0, 78.0, -40.0, 10.0]], [[-44.0, 109.0, 98.0, -13.0, 6.0], [21.0, 46.0, 80.0, -49.0, 18.0], [-17.0, 5.0, 22.0, -9.0, -16.0], [30.0, -41.0, 69.0, -6.0, 15.0]], [[26.0, 28.0, 36.0, 22.0, -10.0], [-49.0, -27.0, -13.0, 46.0, 21.0], [-52.0, 3.0, 13.0, 2.0, -25.0], [-16.0, -26.0, -22.0, -48.0, -35.0]], [[28.0, 95.0, 44.0, 17.0, -45.0], [-81.0, 89.0, 22.0, 16.0, -18.0], [-77.0, -18.0, -29.0, 21.0, 39.0], [36.0, -100.0, -86.0, -9.0, -100.0]]], [[[-37.0, 53.0, 65.0, 40.0, 89.0], [18.0, -9.0, 60.0, -39.0, 116.0], [-84.0, -63.0, -69.0, -107.0, -93.0], [-74.0, -35.0, 94.0, -3.0, 39.0]], [[49.0, -98.0, -111.0, -9.0, -35.0], [-26.0, 14.0, -55.0, 0.0, -105.0], [45.0, 49.0, -6.0, 36.0, 98.0], [2.0, 38.0, -99.0, 37.0, -43.0]], [[-2.0, -43.0, -56.0, -31.0, 4.0], [42.0, -119.0, -1.0, 83.0, 67.0], [27.0, -56.0, 9.0, 53.0, -77.0], [-28.0, 87.0, 9.0, -18.0, 44.0]], [[-5.0, -31.0, 30.0, 19.0, 25.0], [9.0, -34.0, -32.0, -18.0, -1.0], [13.0, 48.0, 38.0, -42.0, -16.0], [-21.0, 15.0, 56.0, -26.0, 37.0]], [[-2.0, 90.0, 67.0, 16.0, 1.0], [-36.0, 47.0, 49.0, -14.0, 19.0], [-68.0, -12.0, -19.0, -18.0, -6.0], [1.0, -66.0, -2.0, -13.0, -40.0]]], [[[-48.0, 8.0, 81.0, 60.0, 118.0], [36.0, -18.0, 21.0, -77.0, 105.0], [-58.0, -19.0, -46.0, -160.0, -93.0], [-87.0, -25.0, 149.0, -8.0, 81.0]], [[59.0, 40.0, -23.0, -30.0, -69.0], [-71.0, 23.0, 50.0, 4.0, -125.0], [-20.0, 89.0, 39.0, 87.0, 106.0], [8.0, 7.0, -110.0, -6.0, -104.0]], [[-41.0, -7.0, 55.0, 73.0, 106.0], [23.0, -9.0, -25.0, -24.0, 150.0], [-69.0, -92.0, -87.0, -152.0, -118.0], [-68.0, -53.0, 106.0, -5.0, 67.0]], [[22.0, 55.0, 7.0, -21.0, -36.0], [-35.0, 24.0, 55.0, -4.0, -55.0], [-23.0, 36.0, 16.0, 49.0, 49.0], [9.0, -8.0, -50.0, -2.0, -58.0]], [[-13.0, -32.0, -85.0, -54.0, -1.0], [60.0, -64.0, 43.0, 34.0, 26.0], [46.0, -54.0, -16.0, 65.0, -27.0], [-12.0, 89.0, -6.0, 32.0, 35.0]]], [[[6.0, -124.0, -142.0, -40.0, 3.0], [58.0, -59.0, -24.0, 13.0, -28.0], [86.0, -13.0, -17.0, 42.0, 21.0], [-20.0, 111.0, -27.0, 53.0, 41.0]], [[-11.0, 64.0, 48.0, -30.0, -58.0], [-1.0, 16.0, 7.0, 38.0, -8.0], [24.0, -1.0, 58.0, 73.0, 0.0], [77.0, -21.0, -10.0, -27.0, -12.0]], [[-29.0, -101.0, -75.0, -28.0, 31.0], [86.0, -57.0, -22.0, -19.0, 4.0], [92.0, -3.0, 7.0, -3.0, -15.0], [-14.0, 95.0, 56.0, 37.0, 89.0]], [[-65.0, -8.0, -8.0, -33.0, 47.0], [101.0, -15.0, 53.0, -53.0, 45.0], [57.0, -35.0, -11.0, -20.0, -42.0], [-3.0, 53.0, 102.0, 43.0, 95.0]], [[-26.0, -19.0, 50.0, 42.0, 76.0], [22.0, -5.0, -3.0, -75.0, 28.0], [-18.0, 33.0, -9.0, -114.0, -30.0], [-56.0, -8.0, 102.0, -3.0, 56.0]]]]) | |
28543 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28544 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28545 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28546 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28547 | def test_tensor_mult_array_rank4_constData_rank2(self): | |
28548 | arg0=numarray.array([[[[-1.0, -2.0, -5.0], [-5.0, 6.0, 0.0]], [[-6.0, 1.0, 7.0], [1.0, 3.0, 1.0]], [[-2.0, 3.0, 0.0], [6.0, -1.0, 1.0]], [[4.0, -2.0, 4.0], [7.0, 6.0, -5.0]], [[5.0, -2.0, 4.0], [-1.0, 3.0, 4.0]]], [[[-4.0, -5.0, -5.0], [0.0, 5.0, -5.0]], [[-3.0, 1.0, 0.0], [7.0, 6.0, -3.0]], [[3.0, 0.0, 6.0], [2.0, -5.0, -2.0]], [[-2.0, -6.0, -2.0], [3.0, -1.0, -1.0]], [[0.0, -5.0, 3.0], [-2.0, 2.0, 4.0]]], [[[0.0, -6.0, 7.0], [-5.0, 0.0, -7.0]], [[6.0, -5.0, -6.0], [-2.0, -6.0, -4.0]], [[4.0, 4.0, 0.0], [6.0, 0.0, -3.0]], [[0.0, -2.0, -5.0], [-7.0, -1.0, -6.0]], [[-2.0, 7.0, 3.0], [-2.0, -7.0, 0.0]]], [[[-7.0, -6.0, 2.0], [3.0, 4.0, 3.0]], [[5.0, 3.0, -2.0], [7.0, 4.0, 2.0]], [[5.0, 1.0, 1.0], [6.0, -6.0, -3.0]], [[-6.0, -6.0, 5.0], [7.0, 2.0, -2.0]], [[-5.0, 2.0, -1.0], [-6.0, 4.0, -1.0]]]]) | |
28549 | arg1=Data(numarray.array([[-1.0, 4.0, 5.0], [6.0, -5.0, 6.0]]),self.functionspace) | |
28550 | res=tensor_mult(arg0,arg1) | |
28551 | ref=Data(numarray.array([[-92.0, 42.0, 61.0, -10.0, 10.0], [-96.0, 1.0, 52.0, -15.0, -3.0], [-61.0, -62.0, 30.0, -106.0, 68.0], [9.0, 31.0, 52.0, 27.0, -54.0]]),self.functionspace) | |
28552 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28553 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28554 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28555 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28556 | def test_tensor_mult_array_rank4_constData_rank3(self): | |
28557 | arg0=numarray.array([[[[-3.0, -6.0, 5.0], [6.0, 2.0, -3.0]], [[2.0, 4.0, 3.0], [-5.0, -7.0, -3.0]], [[1.0, -7.0, 7.0], [0.0, 3.0, 5.0]], [[5.0, 3.0, -2.0], [-7.0, 0.0, 0.0]], [[7.0, -7.0, -4.0], [-5.0, -2.0, 5.0]]], [[[-6.0, 4.0, -2.0], [0.0, -5.0, -1.0]], [[5.0, -1.0, 4.0], [3.0, -1.0, 7.0]], [[-4.0, -1.0, -4.0], [7.0, 6.0, 7.0]], [[2.0, -4.0, 4.0], [3.0, 1.0, 1.0]], [[-5.0, 0.0, 5.0], [5.0, 6.0, 0.0]]], [[[0.0, 1.0, 1.0], [5.0, 2.0, 1.0]], [[0.0, 1.0, 6.0], [-6.0, 6.0, 4.0]], [[2.0, -4.0, -6.0], [6.0, 6.0, 5.0]], [[-4.0, -6.0, -4.0], [-2.0, 4.0, 7.0]], [[3.0, 5.0, 6.0], [-3.0, -1.0, 0.0]]], [[[-2.0, 2.0, -1.0], [0.0, 4.0, 3.0]], [[3.0, -5.0, -5.0], [7.0, 1.0, 7.0]], [[-1.0, 2.0, -6.0], [-6.0, 7.0, 5.0]], [[3.0, -4.0, 7.0], [0.0, -7.0, -3.0]], [[-4.0, 4.0, 4.0], [-2.0, 1.0, -1.0]]]]) | |
28558 | arg1=Data(numarray.array([[[7.0, 6.0], [7.0, -3.0], [-4.0, -3.0]], [[1.0, 7.0], [-4.0, 4.0], [-4.0, 5.0]]]),self.functionspace) | |
28559 | res=tensor_mult(arg0,arg1) | |
28560 | ref=Data(numarray.array([[[-73.0, 20.0], [65.0, -87.0], [-102.0, 43.0], [57.0, -22.0], [-1.0, 57.0]], [[18.0, -67.0], [-9.0, 73.0], [-64.0, 99.0], [-35.0, 42.0], [-74.0, 14.0]], [[-4.0, 42.0], [-63.0, -19.0], [-28.0, 133.0], [-100.0, 43.0], [33.0, -40.0]], [[-24.0, 16.0], [-19.0, 136.0], [-23.0, 17.0], [5.0, -34.0], [-18.0, -63.0]]]),self.functionspace) | |
28561 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28562 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28563 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28564 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28565 | def test_tensor_mult_array_rank4_constData_rank4(self): | |
28566 | arg0=numarray.array([[[[3.0, -7.0, -1.0], [2.0, 7.0, 0.0]], [[-3.0, 7.0, -6.0], [5.0, -5.0, 5.0]], [[5.0, 7.0, 3.0], [3.0, 0.0, -4.0]], [[4.0, 7.0, -5.0], [6.0, -3.0, 1.0]], [[-3.0, 3.0, 6.0], [-2.0, 4.0, -4.0]]], [[[3.0, 0.0, -1.0], [0.0, -4.0, 1.0]], [[-5.0, 6.0, -7.0], [-6.0, 1.0, -3.0]], [[3.0, 7.0, 1.0], [-6.0, -4.0, 7.0]], [[7.0, 3.0, 1.0], [-7.0, 6.0, -4.0]], [[-4.0, 6.0, 5.0], [1.0, 6.0, 5.0]]], [[[-4.0, -6.0, -4.0], [-5.0, 2.0, 1.0]], [[0.0, -7.0, 3.0], [4.0, 1.0, 3.0]], [[-7.0, -2.0, -1.0], [4.0, 7.0, 5.0]], [[-5.0, 6.0, 4.0], [-4.0, 3.0, -5.0]], [[6.0, -5.0, 5.0], [-5.0, 4.0, -1.0]]], [[[2.0, 6.0, -3.0], [-2.0, 3.0, -2.0]], [[-1.0, 0.0, -5.0], [-1.0, -6.0, -5.0]], [[-2.0, 5.0, 4.0], [-7.0, -5.0, -7.0]], [[2.0, 1.0, -5.0], [1.0, 0.0, 4.0]], [[-4.0, -1.0, -6.0], [0.0, 7.0, -2.0]]]]) | |
28567 | arg1=Data(numarray.array([[[[7.0, 7.0, -6.0, 0.0, 3.0], [2.0, 0.0, -2.0, -6.0, 1.0], [0.0, -3.0, -2.0, 1.0, -6.0], [0.0, -1.0, -3.0, 0.0, -1.0]], [[2.0, 3.0, 1.0, 7.0, -1.0], [6.0, 7.0, -3.0, -2.0, -4.0], [3.0, -1.0, -3.0, 6.0, 6.0], [4.0, 7.0, -6.0, -5.0, -6.0]], [[-7.0, 4.0, 4.0, -4.0, -7.0], [2.0, -2.0, 1.0, -1.0, 3.0], [-3.0, 4.0, 6.0, -5.0, -4.0], [3.0, -2.0, 5.0, 7.0, -6.0]]], [[[-6.0, -1.0, -3.0, 1.0, 3.0], [4.0, 0.0, 0.0, 0.0, 6.0], [6.0, 0.0, -4.0, -1.0, 6.0], [-2.0, -4.0, 0.0, -6.0, 3.0]], [[3.0, -1.0, 2.0, 7.0, 6.0], [5.0, -3.0, 5.0, -1.0, -7.0], [-5.0, -4.0, 1.0, -7.0, 1.0], [-5.0, 4.0, 1.0, -3.0, -2.0]], [[2.0, 2.0, 3.0, -2.0, -5.0], [5.0, 2.0, 4.0, 4.0, -5.0], [0.0, -1.0, -3.0, 0.0, 0.0], [0.0, 4.0, 4.0, 7.0, -1.0]]]]),self.functionspace) | |
28568 | res=tensor_mult(arg0,arg1) | |
28569 | ref=Data(numarray.array([[[[23.0, -13.0, -21.0, 6.0, 71.0], [5.0, -68.0, 49.0, -10.0, -9.0], [-41.0, -34.0, 8.0, -85.0, -37.0], [-70.0, -30.0, 35.0, -5.0, 37.0]], [[0.0, -14.0, -9.0, 33.0, -14.0], [44.0, 86.0, -26.0, 35.0, -9.0], [94.0, -7.0, -91.0, 99.0, 109.0], [25.0, 44.0, -48.0, -57.0, 17.0]], [[2.0, 57.0, -32.0, 48.0, 16.0], [50.0, 35.0, -44.0, -63.0, 24.0], [30.0, -6.0, -13.0, 29.0, 18.0], [31.0, 10.0, -58.0, -60.0, -52.0]], [[34.0, 28.0, -58.0, 52.0, 35.0], [54.0, 70.0, -45.0, -26.0, 13.0], [87.0, -28.0, -89.0, 86.0, 71.0], [16.0, 23.0, -78.0, -90.0, 7.0]], [[-41.0, 2.0, 47.0, 31.0, -16.0], [16.0, -11.0, 7.0, -14.0, -17.0], [-41.0, 18.0, 57.0, -41.0, 4.0], [14.0, 20.0, 9.0, -1.0, -61.0]]], [[[18.0, 23.0, -27.0, -26.0, -13.0], [-11.0, 16.0, -23.0, -9.0, 23.0], [23.0, 2.0, -19.0, 36.0, -18.0], [17.0, -13.0, -14.0, 12.0, 10.0]], [[59.0, -46.0, 19.0, 77.0, 31.0], [-22.0, 47.0, -22.0, 12.0, -78.0], [-2.0, -20.0, -16.0, 65.0, 59.0], [10.0, 77.0, -67.0, -67.0, -6.0]], [[66.0, 70.0, 24.0, -3.0, -82.0], [41.0, 73.0, -18.0, -1.0, -65.0], [2.0, -3.0, -22.0, 74.0, -20.0], [63.0, 80.0, -22.0, 69.0, -68.0]], [[100.0, 55.0, -14.0, 60.0, 46.0], [16.0, -7.0, -8.0, -71.0, -66.0], [-66.0, -40.0, 29.0, -15.0, -64.0], [-1.0, 48.0, -44.0, -12.0, -60.0]], [[-29.0, 13.0, 74.0, 55.0, -39.0], [97.0, 24.0, 45.0, 21.0, -74.0], [-21.0, -3.0, 7.0, -36.0, 52.0], [7.0, 76.0, 27.0, 16.0, -76.0]]], [[[26.0, -57.0, 24.0, -19.0, 14.0], [-57.0, -38.0, 36.0, 42.0, -41.0], [-46.0, -7.0, 21.0, -29.0, -24.0], [-36.0, 2.0, 34.0, 33.0, 44.0]], [[-50.0, -8.0, 4.0, -56.0, -11.0], [0.0, -52.0, 41.0, 22.0, 39.0], [-11.0, 12.0, 15.0, -68.0, -29.0], [-32.0, -55.0, 70.0, 50.0, 31.0]], [[-39.0, -60.0, 53.0, 33.0, 17.0], [48.0, -23.0, 74.0, 60.0, -52.0], [-14.0, -14.0, -10.0, -67.0, 65.0], [-54.0, 27.0, 55.0, -7.0, 18.0]], [[-28.0, -10.0, 55.0, 53.0, -18.0], [8.0, 15.0, -9.0, -9.0, -37.0], [-33.0, 18.0, 50.0, -6.0, 29.0], [29.0, 47.0, -18.0, -22.0, -68.0]], [[37.0, 46.0, -1.0, -30.0, 2.0], [-13.0, -59.0, 24.0, -39.0, -12.0], [-80.0, -8.0, 60.0, -72.0, -112.0], [-15.0, -19.0, 37.0, 71.0, -28.0]]], [[[64.0, 15.0, -12.0, 77.0, 43.0], [31.0, 35.0, -18.0, -32.0, -54.0], [0.0, -34.0, -23.0, 34.0, 27.0], [4.0, 58.0, -62.0, -62.0, -30.0]], [[6.0, -30.0, -38.0, -13.0, 18.0], [-71.0, 18.0, -53.0, -3.0, 45.0], [39.0, 12.0, -15.0, 67.0, 14.0], [17.0, -29.0, -48.0, -46.0, 45.0]], [[-19.0, 15.0, 23.0, -9.0, -55.0], [-54.0, 28.0, -60.0, -25.0, 18.0], [-14.0, 44.0, 57.0, 50.0, -21.0], [71.0, 9.0, -37.0, 11.0, -56.0]], [[53.0, 4.0, -22.0, 20.0, 23.0], [24.0, 25.0, 4.0, 7.0, -31.0], [24.0, -31.0, -53.0, 32.0, 20.0], [-13.0, 27.0, -21.0, -18.0, 21.0]], [[29.0, -66.0, 7.0, 70.0, 83.0], [-1.0, -20.0, 32.0, 17.0, -57.0], [-20.0, -37.0, -12.0, -29.0, 49.0], [-57.0, 29.0, -13.0, -72.0, 34.0]]]]),self.functionspace) | |
28570 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28571 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28572 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28573 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28574 | def test_tensor_mult_array_rank4_expandedData_rank2(self): | |
28575 | arg0=numarray.array([[[[6.0, -5.0, 2.0], [-7.0, -7.0, 6.0]], [[-4.0, 7.0, 0.0], [4.0, -4.0, 7.0]], [[-5.0, 0.0, 7.0], [2.0, -6.0, -1.0]], [[0.0, 5.0, 0.0], [5.0, 0.0, 5.0]], [[-5.0, 0.0, -2.0], [3.0, 3.0, 1.0]]], [[[7.0, 1.0, 2.0], [-6.0, -3.0, 0.0]], [[7.0, -7.0, 7.0], [-7.0, 6.0, -2.0]], [[0.0, -7.0, 7.0], [6.0, 1.0, 4.0]], [[5.0, 5.0, 0.0], [-2.0, 7.0, -6.0]], [[6.0, -5.0, 7.0], [0.0, -6.0, -1.0]]], [[[6.0, -4.0, 0.0], [-2.0, -1.0, -4.0]], [[0.0, 6.0, 6.0], [-4.0, -2.0, 4.0]], [[0.0, -6.0, 6.0], [5.0, -5.0, -6.0]], [[7.0, 2.0, 0.0], [0.0, 0.0, -2.0]], [[5.0, 3.0, 7.0], [-5.0, 4.0, 2.0]]], [[[0.0, 7.0, 1.0], [7.0, 2.0, 3.0]], [[6.0, -6.0, -7.0], [0.0, -7.0, 0.0]], [[-2.0, 4.0, 0.0], [-6.0, -3.0, -6.0]], [[-2.0, 0.0, 0.0], [-3.0, 5.0, -1.0]], [[-1.0, 0.0, -6.0], [5.0, 4.0, -1.0]]]]) | |
28576 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28577 | arg1=msk_arg1*numarray.array([[-2.0, -2.0, 1.0], [2.0, -5.0, 1.0]])+(1.-msk_arg1)*numarray.array([[-4.0, -5.0, 1.0], [2.0, -6.0, -3.0]]) | |
28578 | res=tensor_mult(arg0,arg1) | |
28579 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28580 | ref=msk_ref*numarray.array([[27.0, 29.0, 50.0, 5.0, 0.0], [-11.0, -39.0, 32.0, -65.0, 34.0], [-7.0, 0.0, 47.0, -20.0, -37.0], [-6.0, 28.0, -7.0, -28.0, -15.0]])+(1.-msk_ref)*numarray.array([[13.0, -8.0, 70.0, -30.0, 3.0], [-25.0, -30.0, 36.0, -73.0, 47.0], [10.0, -32.0, 94.0, -32.0, -68.0], [-41.0, 41.0, 12.0, -25.0, -13.0]]) | |
28581 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28582 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28583 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28584 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28585 | def test_tensor_mult_array_rank4_expandedData_rank3(self): | |
28586 | arg0=numarray.array([[[[-3.0, 1.0, -6.0], [-6.0, 7.0, -4.0]], [[5.0, 2.0, 5.0], [7.0, -3.0, -2.0]], [[-7.0, 6.0, 5.0], [0.0, 1.0, 7.0]], [[-6.0, 7.0, -1.0], [5.0, 4.0, -6.0]], [[-4.0, -4.0, 4.0], [-6.0, 7.0, -2.0]]], [[[5.0, 4.0, -1.0], [-4.0, 3.0, 0.0]], [[2.0, -2.0, 5.0], [-5.0, -3.0, 6.0]], [[-6.0, 0.0, -6.0], [-2.0, 0.0, 0.0]], [[-5.0, -3.0, -3.0], [4.0, -1.0, 2.0]], [[6.0, 6.0, -2.0], [-6.0, 2.0, 6.0]]], [[[-2.0, 5.0, 1.0], [5.0, 7.0, 5.0]], [[2.0, -1.0, 5.0], [0.0, -6.0, 3.0]], [[-3.0, -2.0, 6.0], [-7.0, -6.0, 1.0]], [[5.0, 3.0, -5.0], [0.0, 0.0, 4.0]], [[-4.0, -2.0, 2.0], [4.0, 0.0, -7.0]]], [[[7.0, 0.0, 6.0], [4.0, -5.0, 1.0]], [[-2.0, 2.0, -3.0], [3.0, 2.0, 3.0]], [[4.0, 3.0, -4.0], [4.0, -5.0, 3.0]], [[-5.0, -3.0, 1.0], [-3.0, 0.0, 6.0]], [[0.0, -4.0, 4.0], [-2.0, -1.0, 4.0]]]]) | |
28587 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28588 | arg1=msk_arg1*numarray.array([[[5.0, 6.0], [4.0, 3.0], [-5.0, -6.0]], [[-6.0, -3.0], [0.0, -7.0], [7.0, 6.0]]])+(1.-msk_arg1)*numarray.array([[[-6.0, -2.0], [3.0, -6.0], [-3.0, 7.0]], [[2.0, -5.0], [3.0, -3.0], [5.0, -1.0]]]) | |
28589 | res=tensor_mult(arg0,arg1) | |
28590 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28591 | ref=msk_ref*numarray.array([[[27.0, -34.0], [-48.0, -6.0], [13.0, -19.0], [-69.0, -88.0], [-34.0, -103.0]], [[70.0, 39.0], [49.0, 48.0], [12.0, 6.0], [-32.0, -14.0], [142.0, 106.0]], [[10.0, -37.0], [2.0, 39.0], [-4.0, 9.0], [90.0, 93.0], [-111.0, -96.0]], [[-12.0, 35.0], [16.0, 7.0], [49.0, 98.0], [18.0, 0.0], [4.0, 1.0]]])+(1.-msk_ref)*numarray.array([[[28.0, -29.0], [-44.0, -11.0], [83.0, 3.0], [52.0, -68.0], [-1.0, 71.0]], [[-14.0, -30.0], [-22.0, 71.0], [50.0, -20.0], [45.0, -12.0], [12.0, -44.0]], [[80.0, -70.0], [-33.0, 52.0], [-33.0, 112.0], [14.0, -67.0], [-15.0, 21.0]], [[-62.0, 22.0], [54.0, -53.0], [5.0, -62.0], [42.0, 44.0], [-11.0, 61.0]]]) | |
28592 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28593 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28594 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28595 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28596 | def test_tensor_mult_array_rank4_expandedData_rank4(self): | |
28597 | arg0=numarray.array([[[[-5.0, -7.0, 4.0], [-7.0, 3.0, -7.0]], [[3.0, -2.0, 7.0], [-6.0, 2.0, 6.0]], [[-1.0, 6.0, -4.0], [0.0, -1.0, 0.0]], [[7.0, -7.0, 0.0], [-1.0, -1.0, -5.0]], [[2.0, -1.0, 7.0], [7.0, -4.0, 0.0]]], [[[1.0, 2.0, -5.0], [1.0, 0.0, -4.0]], [[0.0, 6.0, 7.0], [0.0, 3.0, -6.0]], [[0.0, -2.0, -5.0], [-4.0, 0.0, -5.0]], [[4.0, 0.0, 7.0], [-6.0, -2.0, -6.0]], [[3.0, -3.0, 0.0], [-5.0, -1.0, -1.0]]], [[[5.0, -4.0, -7.0], [0.0, 7.0, -3.0]], [[6.0, 5.0, -4.0], [-2.0, -6.0, 2.0]], [[5.0, 0.0, 5.0], [3.0, 3.0, 0.0]], [[-1.0, -3.0, 7.0], [4.0, -3.0, -7.0]], [[-6.0, 1.0, -2.0], [-6.0, -1.0, -1.0]]], [[[-6.0, -1.0, 2.0], [6.0, 0.0, -5.0]], [[5.0, 7.0, 2.0], [2.0, 3.0, 1.0]], [[3.0, -6.0, 1.0], [2.0, -3.0, 0.0]], [[-1.0, 7.0, 7.0], [1.0, 0.0, -7.0]], [[-6.0, 0.0, -6.0], [3.0, 0.0, 6.0]]]]) | |
28598 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28599 | arg1=msk_arg1*numarray.array([[[[3.0, -5.0, -6.0, -7.0, 0.0], [7.0, 3.0, 6.0, 5.0, 3.0], [2.0, -1.0, -3.0, -5.0, -3.0], [5.0, 4.0, 0.0, 4.0, -7.0]], [[4.0, -7.0, 6.0, 0.0, -1.0], [4.0, 4.0, 1.0, -7.0, 7.0], [0.0, 7.0, -4.0, -5.0, -4.0], [4.0, 4.0, -7.0, 6.0, 2.0]], [[-2.0, -5.0, -2.0, -6.0, 2.0], [-5.0, 5.0, 1.0, 0.0, -2.0], [-5.0, 3.0, 4.0, -4.0, -2.0], [-7.0, 7.0, -7.0, -1.0, -6.0]]], [[[2.0, 5.0, 3.0, 6.0, -7.0], [-1.0, 5.0, 1.0, -5.0, -1.0], [-7.0, -3.0, 6.0, 0.0, -5.0], [-4.0, 0.0, 7.0, -2.0, 4.0]], [[-7.0, -6.0, 0.0, 1.0, 0.0], [-2.0, 7.0, 4.0, 5.0, 0.0], [0.0, -5.0, -4.0, 3.0, -3.0], [-6.0, 0.0, -3.0, 2.0, -1.0]], [[5.0, 3.0, 1.0, -1.0, 0.0], [-2.0, 5.0, -5.0, -2.0, 1.0], [0.0, 0.0, -5.0, 2.0, -4.0], [2.0, 0.0, -2.0, -3.0, 4.0]]]])+(1.-msk_arg1)*numarray.array([[[[-4.0, -1.0, -2.0, 3.0, 4.0], [-4.0, 0.0, 6.0, 7.0, -5.0], [-1.0, 1.0, -5.0, 0.0, 4.0], [-4.0, -5.0, 3.0, -1.0, 3.0]], [[7.0, 6.0, -3.0, 1.0, -1.0], [-7.0, -2.0, 0.0, 0.0, 6.0], [4.0, 5.0, -7.0, 5.0, 1.0], [-2.0, 0.0, -5.0, -5.0, -4.0]], [[2.0, 2.0, -2.0, 1.0, 3.0], [0.0, 0.0, 7.0, 6.0, -2.0], [1.0, -6.0, 2.0, -6.0, -4.0], [2.0, -2.0, -6.0, -7.0, -6.0]]], [[[4.0, 7.0, -5.0, -7.0, 0.0], [7.0, 0.0, -7.0, 6.0, 0.0], [3.0, 5.0, -6.0, -6.0, -6.0], [0.0, -6.0, -1.0, -2.0, 4.0]], [[0.0, 2.0, 0.0, 0.0, 7.0], [3.0, 2.0, -2.0, 2.0, 0.0], [-3.0, -3.0, -7.0, -5.0, 6.0], [-3.0, -2.0, -1.0, 1.0, 0.0]], [[-1.0, 7.0, 6.0, -1.0, 6.0], [2.0, -1.0, 5.0, 0.0, 5.0], [5.0, 0.0, -4.0, 0.0, -6.0], [0.0, 6.0, 6.0, 2.0, 3.0]]]]) | |
28600 | res=tensor_mult(arg0,arg1) | |
28601 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28602 | ref=msk_ref*numarray.array([[[[-121.0, -20.0, -48.0, -21.0, 64.0], [-68.0, -72.0, 7.0, 88.0, -72.0], [19.0, -26.0, 40.0, 39.0, 89.0], [-85.0, -20.0, -23.0, -25.0, -62.0]], [[-9.0, -60.0, -56.0, -103.0, 58.0], [-32.0, 50.0, -5.0, 57.0, -7.0], [13.0, 12.0, -47.0, -15.0, -15.0], [-18.0, 53.0, -95.0, -9.0, -69.0]], [[36.0, -11.0, 50.0, 30.0, -14.0], [39.0, -6.0, -8.0, -52.0, 47.0], [18.0, 36.0, -33.0, -12.0, -10.0], [53.0, -8.0, -11.0, 34.0, 44.0]], [[-27.0, 0.0, -92.0, -51.0, 14.0], [34.0, -44.0, 55.0, 94.0, -32.0], [21.0, -48.0, 30.0, -13.0, 35.0], [7.0, 0.0, 55.0, 1.0, -86.0]], [[30.0, 21.0, -11.0, -18.0, -34.0], [-24.0, 44.0, 9.0, -38.0, -22.0], [-80.0, 11.0, 84.0, -45.0, -39.0], [-47.0, 53.0, 19.0, -27.0, -26.0]]], [[[3.0, -1.0, 15.0, 33.0, -19.0], [47.0, -29.0, 24.0, -6.0, 22.0], [20.0, -5.0, -5.0, -3.0, 10.0], [36.0, -23.0, 36.0, 31.0, 15.0]], [[-41.0, -113.0, 16.0, -33.0, 8.0], [-5.0, 50.0, 55.0, -15.0, 22.0], [-35.0, 48.0, 22.0, -61.0, -23.0], [-55.0, 73.0, -88.0, 53.0, -57.0]], [[-31.0, 4.0, -19.0, 11.0, 20.0], [31.0, -78.0, 14.0, 44.0, -5.0], [53.0, -17.0, -11.0, 20.0, 58.0], [33.0, -43.0, 31.0, 16.0, -10.0]], [[-30.0, -91.0, -62.0, -102.0, 56.0], [15.0, -27.0, 47.0, 52.0, -2.0], [15.0, 45.0, 18.0, -66.0, 34.0], [-5.0, 65.0, -73.0, 35.0, -116.0]], [[-11.0, -16.0, -52.0, -51.0, 38.0], [18.0, -40.0, 11.0, 58.0, -8.0], [41.0, -4.0, -18.0, -5.0, 35.0], [27.0, 0.0, -9.0, 5.0, -50.0]]], [[[-51.0, -13.0, -43.0, 17.0, -10.0], [46.0, -2.0, 62.0, 94.0, -2.0], [45.0, -89.0, -40.0, 38.0, 6.0], [10.0, -45.0, 62.0, 26.0, -20.0]], [[94.0, -13.0, -2.0, -38.0, 1.0], [92.0, -24.0, 1.0, -29.0, 65.0], [46.0, 53.0, -52.0, -53.0, -10.0], [126.0, 16.0, -7.0, 44.0, -2.0]], [[-10.0, -53.0, -31.0, -44.0, -11.0], [1.0, 76.0, 50.0, 25.0, 2.0], [-36.0, -14.0, 11.0, -36.0, -49.0], [-40.0, 55.0, -23.0, 15.0, -56.0]], [[-35.0, 8.0, -21.0, -7.0, -11.0], [-38.0, -16.0, 25.0, -5.0, -49.0], [-65.0, 4.0, 114.0, -31.0, 18.0], [-78.0, 33.0, 23.0, -22.0, -50.0]], [[-20.0, 6.0, 27.0, 18.0, 37.0], [-18.0, -66.0, -42.0, -10.0, -2.0], [40.0, 30.0, -21.0, 28.0, 55.0], [16.0, -34.0, -30.0, -3.0, 29.0]]], [[[-39.0, 42.0, 39.0, 71.0, -37.0], [-52.0, -7.0, -4.0, -43.0, -40.0], [-64.0, -13.0, 91.0, 17.0, 8.0], [-82.0, -14.0, 45.0, -29.0, 32.0]], [[27.0, -89.0, 15.0, -33.0, -17.0], [43.0, 89.0, 48.0, -21.0, 59.0], [-14.0, 29.0, -40.0, -57.0, -70.0], [15.0, 62.0, -60.0, 59.0, -24.0]], [[8.0, 50.0, -50.0, -18.0, -6.0], [-4.0, -21.0, 3.0, 32.0, -37.0], [-13.0, -33.0, 43.0, 2.0, 12.0], [-6.0, -5.0, 58.0, -35.0, -28.0]], [[-22.0, -95.0, 30.0, -22.0, 0.0], [-1.0, 30.0, 44.0, -45.0, 24.0], [-44.0, 68.0, 44.0, -72.0, -16.0], [-44.0, 73.0, -77.0, 50.0, -45.0]], [[30.0, 93.0, 63.0, 90.0, -33.0], [-27.0, -3.0, -69.0, -57.0, -3.0], [-3.0, -21.0, -18.0, 66.0, -9.0], [12.0, -66.0, 51.0, -42.0, 114.0]]]])+(1.-msk_ref)*numarray.array([[[[-42.0, -121.0, 16.0, 38.0, -22.0], [15.0, 27.0, 6.0, -47.0, -60.0], [-84.0, -108.0, 131.0, -32.0, 59.0], [33.0, 11.0, -42.0, 15.0, -60.0]], [[-42.0, 3.0, 52.0, 50.0, 85.0], [-22.0, 2.0, 135.0, 31.0, -11.0], [2.0, -85.0, 11.0, -26.0, -6.0], [0.0, 39.0, 17.0, -16.0, -31.0]], [[38.0, 27.0, -8.0, -1.0, -29.0], [-41.0, -14.0, -32.0, -33.0, 49.0], [24.0, 56.0, -38.0, 59.0, 12.0], [-13.0, 15.0, -8.0, -2.0, -3.0]], [[-76.0, -93.0, -18.0, 26.0, -2.0], [1.0, 17.0, 26.0, 41.0, -102.0], [-60.0, -30.0, 47.0, -24.0, 51.0], [-11.0, -57.0, 28.0, 19.0, 30.0]], [[27.0, 47.0, -50.0, -37.0, 2.0], [36.0, -6.0, 20.0, 90.0, -30.0], [34.0, 2.0, -3.0, -69.0, -87.0], [20.0, -58.0, -34.0, -64.0, -4.0]]], [[[8.0, -20.0, -27.0, -3.0, -37.0], [-19.0, 0.0, -56.0, -17.0, -3.0], [-15.0, 46.0, -19.0, 34.0, 44.0], [-18.0, -25.0, -2.0, 14.0, 17.0]], [[62.0, 14.0, -68.0, 19.0, 0.0], [-45.0, 0.0, 13.0, 48.0, -8.0], [-8.0, -21.0, -25.0, -27.0, 32.0], [-7.0, -56.0, -111.0, -88.0, -84.0]], [[-35.0, -85.0, 6.0, 26.0, -43.0], [-24.0, 9.0, -32.0, -54.0, -27.0], [-50.0, 0.0, 48.0, 44.0, 72.0], [-6.0, 4.0, 14.0, 43.0, 7.0]], [[-20.0, -78.0, -28.0, 67.0, -13.0], [-76.0, 2.0, 89.0, 30.0, -64.0], [-39.0, -62.0, 68.0, 4.0, 48.0], [4.0, -30.0, -58.0, -55.0, -72.0]], [[-52.0, -65.0, 22.0, 42.0, 2.0], [-31.0, 5.0, 50.0, -11.0, -38.0], [-32.0, -34.0, 47.0, 20.0, 39.0], [-3.0, 11.0, 24.0, 19.0, -2.0]]], [[[-59.0, -50.0, -2.0, 7.0, 34.0], [23.0, 25.0, -48.0, 7.0, -50.0], [-64.0, 6.0, -48.0, -13.0, 104.0], [-47.0, -43.0, 52.0, 65.0, 64.0]], [[-7.0, 4.0, 3.0, 31.0, -23.0], [-87.0, -24.0, 44.0, -6.0, 18.0], [32.0, 63.0, -27.0, 91.0, 9.0], [-24.0, 14.0, 37.0, -1.0, 20.0]], [[2.0, 32.0, -35.0, -1.0, 56.0], [10.0, 6.0, 38.0, 89.0, -35.0], [0.0, -19.0, -54.0, -63.0, 0.0], [-19.0, -59.0, -21.0, -43.0, -3.0]], [[20.0, -30.0, -65.0, -20.0, -43.0], [30.0, 7.0, -14.0, 53.0, -62.0], [-18.0, -29.0, 65.0, -66.0, -35.0], [33.0, -69.0, -73.0, -58.0, -38.0]], [[4.0, -43.0, 37.0, 24.0, -44.0], [-30.0, -3.0, -11.0, -92.0, 35.0], [-12.0, -16.0, 66.0, 58.0, 21.0], [21.0, 66.0, -10.0, 24.0, -37.0]]], [[[50.0, 11.0, -49.0, -54.0, -47.0], [63.0, 7.0, -89.0, 6.0, -5.0], [-3.0, 7.0, 25.0, -53.0, -39.0], [30.0, -40.0, -61.0, -25.0, -17.0]], [[40.0, 68.0, -39.0, 9.0, 46.0], [-44.0, -9.0, 29.0, 65.0, 18.0], [27.0, 29.0, -107.0, -4.0, 19.0], [-39.0, -41.0, -31.0, -53.0, -14.0]], [[-44.0, -29.0, 0.0, -10.0, 0.0], [35.0, 6.0, 17.0, 33.0, -53.0], [-11.0, -14.0, 38.0, -33.0, -28.0], [11.0, -23.0, 34.0, 13.0, 35.0]], [[78.0, 15.0, -80.0, 11.0, -32.0], [-52.0, -7.0, 1.0, 41.0, -2.0], [4.0, -3.0, -8.0, -13.0, 11.0], [4.0, -57.0, -123.0, -99.0, -90.0]], [[18.0, 57.0, 45.0, -51.0, -6.0], [57.0, -6.0, -69.0, -60.0, 72.0], [39.0, 45.0, -24.0, 18.0, -54.0], [12.0, 60.0, 51.0, 54.0, 48.0]]]]) | |
28603 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28604 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28605 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28606 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28607 | def test_tensor_mult_Symbol_rank2_array_rank1(self): | |
28608 | arg0=Symbol(shape=(2, 3)) | |
28609 | arg1=numarray.array([-2.0, -1.0, -4.0]) | |
28610 | res=tensor_mult(arg0,arg1) | |
28611 | s0=numarray.array([[-5.0, -2.0, 4.0], [-7.0, 6.0, 4.0]]) | |
28612 | sub=res.substitute({arg0:s0}) | |
28613 | ref=numarray.array([-4.0, -8.0]) | |
28614 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28615 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28616 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28617 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28618 | def test_tensor_mult_Symbol_rank2_array_rank2(self): | |
28619 | arg0=Symbol(shape=(2, 3)) | |
28620 | arg1=numarray.array([[6.0, -5.0], [2.0, 0.0], [1.0, -6.0]]) | |
28621 | res=tensor_mult(arg0,arg1) | |
28622 | s0=numarray.array([[-1.0, 0.0, 0.0], [1.0, -4.0, 0.0]]) | |
28623 | sub=res.substitute({arg0:s0}) | |
28624 | ref=numarray.array([[-6.0, 5.0], [-2.0, -5.0]]) | |
28625 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28626 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28627 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28628 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28629 | def test_tensor_mult_Symbol_rank2_Symbol_rank1(self): | |
28630 | arg0=Symbol(shape=(2, 3)) | |
28631 | arg1=Symbol(shape=(3,)) | |
28632 | res=tensor_mult(arg0,arg1) | |
28633 | s0=numarray.array([[-5.0, -5.0, 2.0], [2.0, -7.0, -2.0]]) | |
28634 | s1=numarray.array([4.0, 2.0, 5.0]) | |
28635 | sub=res.substitute({arg0:s0,arg1:s1}) | |
28636 | ref=numarray.array([-20.0, -16.0]) | |
28637 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28638 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28639 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28640 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28641 | def test_tensor_mult_Symbol_rank2_Symbol_rank2(self): | |
28642 | arg0=Symbol(shape=(2, 3)) | |
28643 | arg1=Symbol(shape=(3, 2)) | |
28644 | res=tensor_mult(arg0,arg1) | |
28645 | s0=numarray.array([[0.0, -5.0, 0.0], [-7.0, -5.0, -7.0]]) | |
28646 | s1=numarray.array([[-6.0, 6.0], [-3.0, -5.0], [1.0, -3.0]]) | |
28647 | sub=res.substitute({arg0:s0,arg1:s1}) | |
28648 | ref=numarray.array([[15.0, 25.0], [50.0, 4.0]]) | |
28649 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28650 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28651 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28652 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28653 | def test_tensor_mult_Symbol_rank2_constData_rank1(self): | |
28654 | arg0=Symbol(shape=(2, 3)) | |
28655 | arg1=Data(numarray.array([-6.0, 6.0, -2.0]),self.functionspace) | |
28656 | res=tensor_mult(arg0,arg1) | |
28657 | s0=numarray.array([[0.0, -7.0, -1.0], [-4.0, 6.0, 2.0]]) | |
28658 | sub=res.substitute({arg0:s0}) | |
28659 | ref=Data(numarray.array([-40.0, 56.0]),self.functionspace) | |
28660 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28661 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28662 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28663 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28664 | def test_tensor_mult_Symbol_rank2_constData_rank2(self): | |
28665 | arg0=Symbol(shape=(2, 3)) | |
28666 | arg1=Data(numarray.array([[7.0, 0.0], [7.0, 4.0], [-4.0, -5.0]]),self.functionspace) | |
28667 | res=tensor_mult(arg0,arg1) | |
28668 | s0=numarray.array([[-3.0, 6.0, -7.0], [7.0, 6.0, -7.0]]) | |
28669 | sub=res.substitute({arg0:s0}) | |
28670 | ref=Data(numarray.array([[49.0, 59.0], [119.0, 59.0]]),self.functionspace) | |
28671 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28672 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28673 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28674 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28675 | def test_tensor_mult_Symbol_rank2_expandedData_rank1(self): | |
28676 | arg0=Symbol(shape=(2, 3)) | |
28677 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28678 | arg1=msk_arg1*numarray.array([3.0, -1.0, -1.0])+(1.-msk_arg1)*numarray.array([3.0, -1.0, -7.0]) | |
28679 | res=tensor_mult(arg0,arg1) | |
28680 | s0=numarray.array([[7.0, 5.0, 6.0], [0.0, 6.0, 4.0]]) | |
28681 | sub=res.substitute({arg0:s0}) | |
28682 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28683 | ref=msk_ref*numarray.array([10.0, -10.0])+(1.-msk_ref)*numarray.array([-26.0, -34.0]) | |
28684 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28685 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28686 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28687 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28688 | def test_tensor_mult_Symbol_rank2_expandedData_rank2(self): | |
28689 | arg0=Symbol(shape=(2, 3)) | |
28690 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28691 | arg1=msk_arg1*numarray.array([[6.0, 1.0], [6.0, 3.0], [3.0, -1.0]])+(1.-msk_arg1)*numarray.array([[0.0, -6.0], [6.0, -7.0], [0.0, 6.0]]) | |
28692 | res=tensor_mult(arg0,arg1) | |
28693 | s0=numarray.array([[0.0, 2.0, -2.0], [-1.0, 5.0, 7.0]]) | |
28694 | sub=res.substitute({arg0:s0}) | |
28695 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28696 | ref=msk_ref*numarray.array([[6.0, 8.0], [45.0, 7.0]])+(1.-msk_ref)*numarray.array([[12.0, -26.0], [30.0, 13.0]]) | |
28697 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28698 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28699 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28700 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28701 | def test_tensor_mult_Symbol_rank4_array_rank2(self): | |
28702 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28703 | arg1=numarray.array([[-6.0, -2.0, 0.0], [6.0, 0.0, -5.0]]) | |
28704 | res=tensor_mult(arg0,arg1) | |
28705 | s0=numarray.array([[[[5.0, -6.0, 0.0], [-4.0, 0.0, -5.0]], [[-3.0, 0.0, -2.0], [7.0, 5.0, 2.0]], [[-6.0, 2.0, -7.0], [0.0, 3.0, 7.0]], [[-7.0, -4.0, -6.0], [1.0, 4.0, 5.0]], [[6.0, 5.0, 5.0], [-3.0, -6.0, -7.0]]], [[[-4.0, 6.0, -6.0], [1.0, 7.0, 7.0]], [[0.0, 5.0, 3.0], [-5.0, 2.0, -7.0]], [[-3.0, 0.0, -5.0], [5.0, -2.0, -5.0]], [[2.0, 0.0, -3.0], [-5.0, -2.0, 0.0]], [[5.0, 6.0, -2.0], [-6.0, 7.0, 3.0]]], [[[0.0, 6.0, 3.0], [-7.0, 0.0, 7.0]], [[-4.0, -7.0, -1.0], [-5.0, 2.0, -6.0]], [[4.0, 1.0, 0.0], [4.0, -6.0, 0.0]], [[-5.0, 0.0, 0.0], [-1.0, 4.0, 5.0]], [[1.0, -2.0, -2.0], [1.0, -2.0, 0.0]]], [[[-2.0, 7.0, -3.0], [-2.0, -4.0, -5.0]], [[-1.0, -3.0, 1.0], [-4.0, 5.0, 2.0]], [[-5.0, -1.0, 3.0], [4.0, 6.0, -1.0]], [[7.0, 1.0, 0.0], [-7.0, 7.0, 3.0]], [[1.0, -2.0, 1.0], [-6.0, -7.0, 0.0]]]]) | |
28706 | sub=res.substitute({arg0:s0}) | |
28707 | ref=numarray.array([[-17.0, 50.0, -3.0, 31.0, -29.0], [-17.0, -5.0, 73.0, -42.0, -93.0], [-89.0, 38.0, -2.0, -1.0, 4.0], [11.0, -22.0, 61.0, -101.0, -38.0]]) | |
28708 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28709 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28710 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28711 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28712 | def test_tensor_mult_Symbol_rank4_array_rank3(self): | |
28713 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28714 | arg1=numarray.array([[[-6.0, 0.0], [5.0, -4.0], [-3.0, -2.0]], [[1.0, 3.0], [-2.0, -2.0], [-3.0, -4.0]]]) | |
28715 | res=tensor_mult(arg0,arg1) | |
28716 | s0=numarray.array([[[[2.0, 1.0, 1.0], [6.0, -2.0, -5.0]], [[0.0, 1.0, 1.0], [5.0, -3.0, 0.0]], [[-4.0, 1.0, 1.0], [2.0, 6.0, -7.0]], [[-2.0, 0.0, -7.0], [-1.0, 0.0, 7.0]], [[-2.0, 0.0, 7.0], [-1.0, 4.0, 0.0]]], [[[2.0, 7.0, -2.0], [-4.0, -2.0, -3.0]], [[-3.0, 2.0, -2.0], [-3.0, 0.0, 7.0]], [[-2.0, 4.0, 7.0], [-2.0, 1.0, 0.0]], [[1.0, -3.0, 3.0], [-6.0, -5.0, -3.0]], [[0.0, 5.0, 7.0], [0.0, 2.0, -1.0]]], [[[-5.0, 1.0, 2.0], [-6.0, 6.0, -6.0]], [[0.0, 7.0, 7.0], [0.0, -7.0, 3.0]], [[0.0, 0.0, 0.0], [-3.0, -2.0, 4.0]], [[-4.0, -4.0, 0.0], [0.0, 0.0, -6.0]], [[-3.0, -5.0, -1.0], [-3.0, 4.0, -2.0]]], [[[-4.0, 0.0, -5.0], [2.0, -4.0, -2.0]], [[0.0, -2.0, 0.0], [4.0, 0.0, 7.0]], [[2.0, 3.0, 1.0], [-2.0, -2.0, -1.0]], [[3.0, 0.0, -4.0], [6.0, -2.0, 2.0]], [[-4.0, 2.0, -3.0], [6.0, 4.0, 1.0]]]]) | |
28717 | sub=res.substitute({arg0:s0}) | |
28718 | ref=numarray.array([[[15.0, 36.0], [13.0, 15.0], [37.0, 16.0], [11.0, -17.0], [-18.0, -25.0]], [[38.0, -20.0], [10.0, -41.0], [7.0, -38.0], [-17.0, 10.0], [3.0, -34.0]], [[29.0, -14.0], [19.0, -40.0], [-11.0, -21.0], [22.0, 40.0], [-9.0, 13.0]], [[55.0, 32.0], [-27.0, -8.0], [5.0, -12.0], [-2.0, 22.0], [38.0, 4.0]]]) | |
28719 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28720 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28721 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28722 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28723 | def test_tensor_mult_Symbol_rank4_array_rank4(self): | |
28724 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28725 | arg1=numarray.array([[[[7.0, 6.0, 2.0, -2.0, 1.0], [4.0, 2.0, 5.0, -6.0, 3.0], [-4.0, -5.0, -1.0, -4.0, -3.0], [1.0, -7.0, -7.0, -7.0, 7.0]], [[1.0, -7.0, 0.0, -6.0, -5.0], [-3.0, 5.0, 2.0, -2.0, 4.0], [7.0, -7.0, -4.0, 2.0, 0.0], [-6.0, 2.0, -3.0, 2.0, 2.0]], [[-1.0, 1.0, 4.0, 6.0, 0.0], [-5.0, -2.0, -1.0, 0.0, 5.0], [6.0, -2.0, -3.0, 4.0, 5.0], [-5.0, -7.0, 2.0, -5.0, -7.0]]], [[[-1.0, 0.0, -2.0, 3.0, 3.0], [4.0, 0.0, 4.0, 0.0, 2.0], [-4.0, 0.0, 7.0, 1.0, -1.0], [5.0, -4.0, -7.0, -4.0, -5.0]], [[-6.0, 5.0, 0.0, 0.0, -5.0], [0.0, -4.0, 2.0, 0.0, 4.0], [7.0, 0.0, -1.0, 3.0, 0.0], [3.0, 3.0, -1.0, 4.0, -4.0]], [[-1.0, 6.0, 4.0, 1.0, -7.0], [-3.0, -6.0, 4.0, -6.0, -7.0], [-6.0, -2.0, -6.0, -3.0, -7.0], [-2.0, 6.0, 7.0, -3.0, 0.0]]]]) | |
28726 | res=tensor_mult(arg0,arg1) | |
28727 | s0=numarray.array([[[[-6.0, -3.0, 2.0], [4.0, -6.0, -4.0]], [[7.0, -7.0, 0.0], [-7.0, -1.0, -6.0]], [[7.0, 6.0, 6.0], [5.0, 0.0, 6.0]], [[3.0, -4.0, 4.0], [-1.0, -7.0, -7.0]], [[-6.0, -7.0, 7.0], [6.0, -5.0, 0.0]]], [[[6.0, -6.0, -6.0], [3.0, 0.0, -5.0]], [[1.0, 1.0, 1.0], [6.0, 7.0, 5.0]], [[-1.0, -5.0, 4.0], [-3.0, -1.0, 0.0]], [[-2.0, 2.0, -5.0], [0.0, 0.0, -3.0]], [[-2.0, -2.0, 4.0], [-5.0, 4.0, 5.0]]], [[[-2.0, -4.0, -3.0], [-3.0, -7.0, 0.0]], [[1.0, 1.0, 3.0], [-6.0, 7.0, 0.0]], [[0.0, -3.0, 1.0], [1.0, 0.0, -5.0]], [[-6.0, 5.0, -4.0], [1.0, -3.0, -3.0]], [[-4.0, 7.0, 0.0], [0.0, 0.0, 7.0]]], [[[-6.0, -5.0, 0.0], [2.0, -1.0, -7.0]], [[2.0, 2.0, 3.0], [5.0, 4.0, -5.0]], [[-3.0, -4.0, -4.0], [2.0, -2.0, 4.0]], [[1.0, -2.0, -2.0], [0.0, 4.0, 7.0]], [[-3.0, 0.0, -5.0], [4.0, -1.0, 7.0]]]]) | |
28728 | sub=res.substitute({arg0:s0}) | |
28729 | ref=numarray.array([[[[-11.0, -67.0, -28.0, 50.0, 79.0], [3.0, 17.0, -50.0, 66.0, -8.0], [-19.0, 55.0, 70.0, 24.0, 52.0], [12.0, -36.0, 5.0, -2.0, -58.0]], [[61.0, 50.0, 4.0, 1.0, 68.0], [39.0, 19.0, -33.0, 8.0, 17.0], [-20.0, 26.0, 9.0, -34.0, 28.0], [23.0, -74.0, -20.0, -21.0, 74.0]], [[38.0, 42.0, 52.0, 7.0, -50.0], [-18.0, -4.0, 85.0, -90.0, 43.0], [-6.0, -101.0, -50.0, -5.0, -38.0], [-46.0, -63.0, -48.0, -105.0, -6.0]], [[63.0, -27.0, -4.0, 32.0, 104.0], [21.0, 48.0, -43.0, 32.0, 32.0], [-19.0, 19.0, 43.0, -5.0, 61.0], [-5.0, -116.0, -36.0, -52.0, 18.0]], [[-32.0, -5.0, 4.0, 114.0, 72.0], [-14.0, -41.0, -37.0, 50.0, -19.0], [-42.0, 65.0, 60.0, 29.0, 47.0], [16.0, -60.0, 40.0, -51.0, -115.0]]], [[[44.0, 42.0, -38.0, -8.0, 80.0], [99.0, 24.0, 16.0, 6.0, 5.0], [-84.0, 34.0, 87.0, -42.0, -16.0], [97.0, -54.0, -92.0, -21.0, 57.0]], [[-46.0, 65.0, 14.0, 21.0, -56.0], [5.0, -53.0, 64.0, -38.0, 17.0], [4.0, -24.0, -3.0, 14.0, -39.0], [31.0, 15.0, -22.0, -21.0, -56.0]], [[-7.0, 28.0, 20.0, 47.0, 20.0], [-21.0, -31.0, -33.0, 16.0, -13.0], [-2.0, 32.0, -11.0, 4.0, 26.0], [-9.0, -22.0, 52.0, -15.0, -26.0]], [[-4.0, -49.0, -36.0, -41.0, 9.0], [20.0, 34.0, -13.0, 26.0, -2.0], [10.0, 12.0, 27.0, 1.0, 2.0], [17.0, 35.0, -23.0, 52.0, 25.0]], [[-44.0, 56.0, 42.0, 30.0, -62.0], [-57.0, -68.0, -10.0, -14.0, -23.0], [36.0, 6.0, -71.0, 12.0, -4.0], [-33.0, 44.0, 94.0, 11.0, -37.0]]], [[[30.0, -22.0, -10.0, 1.0, 44.0], [7.0, 10.0, -41.0, 20.0, -71.0], [-75.0, 44.0, 13.0, -36.0, -6.0], [1.0, 18.0, 48.0, 5.0, 42.0]], [[-31.0, 37.0, 26.0, -8.0, -57.0], [-38.0, -27.0, -6.0, -8.0, 38.0], [94.0, -18.0, -63.0, 25.0, 18.0], [-29.0, 19.0, 31.0, 32.0, -10.0]], [[0.0, -8.0, -18.0, 22.0, 53.0], [23.0, 13.0, -23.0, 36.0, 30.0], [11.0, 29.0, 46.0, 14.0, 39.0], [28.0, -47.0, -31.0, 0.0, -18.0]], [[-13.0, -108.0, -42.0, -42.0, 8.0], [-6.0, 51.0, -30.0, 44.0, -7.0], [28.0, 9.0, 26.0, 19.0, 18.0], [-14.0, 49.0, -6.0, 65.0, 3.0]], [[-28.0, -31.0, 20.0, -27.0, -88.0], [-58.0, -15.0, 22.0, -32.0, -33.0], [23.0, -43.0, -66.0, 9.0, -37.0], [-60.0, 84.0, 56.0, 21.0, -14.0]]], [[[-36.0, -48.0, -44.0, 41.0, 79.0], [20.0, 9.0, -62.0, 88.0, 11.0], [16.0, 79.0, 83.0, 34.0, 65.0], [45.0, -21.0, -5.0, 41.0, -58.0]], [[-11.0, -9.0, -14.0, 12.0, 22.0], [22.0, 22.0, 19.0, 14.0, 90.0], [62.0, -20.0, 42.0, 40.0, 39.0], [22.0, -69.0, -88.0, -14.0, -44.0]], [[-15.0, 20.0, -10.0, 16.0, 5.0], [16.0, -34.0, 1.0, 2.0, -77.0], [-86.0, 43.0, 23.0, -28.0, -41.0], [37.0, 51.0, 41.0, 5.0, -3.0]], [[-24.0, 80.0, 22.0, 5.0, -58.0], [-1.0, -62.0, 39.0, -44.0, -48.0], [-44.0, -1.0, -33.0, -25.0, -62.0], [21.0, 57.0, 40.0, -6.0, 1.0]], [[-21.0, 14.0, -6.0, -5.0, -35.0], [8.0, -34.0, 32.0, -24.0, -79.0], [-83.0, 11.0, 5.0, -28.0, -69.0], [25.0, 79.0, 33.0, 5.0, -2.0]]]]) | |
28730 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28731 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28732 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28733 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28734 | def test_tensor_mult_Symbol_rank4_Symbol_rank2(self): | |
28735 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28736 | arg1=Symbol(shape=(2, 3)) | |
28737 | res=tensor_mult(arg0,arg1) | |
28738 | s0=numarray.array([[[[1.0, -3.0, 5.0], [6.0, 0.0, 2.0]], [[-5.0, -6.0, -1.0], [-7.0, 6.0, -2.0]], [[6.0, -3.0, 5.0], [7.0, -4.0, 2.0]], [[-6.0, 1.0, -2.0], [-5.0, -6.0, 4.0]], [[-3.0, 6.0, 4.0], [0.0, 2.0, 3.0]]], [[[2.0, -2.0, 1.0], [-7.0, -2.0, 7.0]], [[-3.0, -3.0, -7.0], [5.0, 0.0, 3.0]], [[-1.0, 5.0, 5.0], [3.0, -2.0, 4.0]], [[0.0, 2.0, -3.0], [6.0, 7.0, 2.0]], [[4.0, 4.0, -5.0], [1.0, -4.0, 5.0]]], [[[3.0, 4.0, -7.0], [-4.0, -2.0, 6.0]], [[7.0, -2.0, -2.0], [2.0, -4.0, 5.0]], [[-6.0, 0.0, -1.0], [6.0, 1.0, 7.0]], [[-7.0, -4.0, -6.0], [6.0, -6.0, 2.0]], [[-6.0, 0.0, 5.0], [7.0, 6.0, 1.0]]], [[[7.0, 3.0, 3.0], [7.0, -1.0, 0.0]], [[0.0, 2.0, 3.0], [0.0, -2.0, -3.0]], [[-6.0, 0.0, 0.0], [5.0, -5.0, 0.0]], [[-6.0, 7.0, 1.0], [-2.0, -4.0, 2.0]], [[3.0, 4.0, 6.0], [-7.0, 7.0, -5.0]]]]) | |
28739 | s1=numarray.array([[3.0, 6.0, -3.0], [-6.0, 3.0, 4.0]]) | |
28740 | sub=res.substitute({arg0:s0,arg1:s1}) | |
28741 | ref=numarray.array([[-58.0, 4.0, -61.0, 22.0, 33.0], [55.0, -24.0, 4.0, 14.0, 53.0], [96.0, 11.0, -20.0, -73.0, -53.0], [-15.0, -15.0, -63.0, 29.0, 58.0]]) | |
28742 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28743 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28744 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28745 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28746 | def test_tensor_mult_Symbol_rank4_Symbol_rank3(self): | |
28747 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28748 | arg1=Symbol(shape=(2, 3, 2)) | |
28749 | res=tensor_mult(arg0,arg1) | |
28750 | s0=numarray.array([[[[2.0, -6.0, 3.0], [0.0, 0.0, -6.0]], [[6.0, -2.0, -4.0], [4.0, 2.0, 2.0]], [[-4.0, 0.0, -3.0], [3.0, 6.0, 2.0]], [[3.0, -2.0, 1.0], [6.0, -2.0, 1.0]], [[3.0, -5.0, -2.0], [3.0, -5.0, 5.0]]], [[[3.0, -2.0, 7.0], [0.0, -7.0, 6.0]], [[0.0, -6.0, -6.0], [7.0, -7.0, 5.0]], [[-6.0, -1.0, 2.0], [-3.0, 2.0, 6.0]], [[-6.0, 7.0, 1.0], [-1.0, -5.0, 5.0]], [[2.0, 0.0, -7.0], [-4.0, -1.0, 6.0]]], [[[-2.0, 0.0, -3.0], [-5.0, 0.0, -6.0]], [[1.0, 1.0, -3.0], [0.0, -6.0, 6.0]], [[-6.0, -6.0, 6.0], [1.0, 0.0, -3.0]], [[-5.0, -1.0, 0.0], [7.0, 4.0, 1.0]], [[2.0, 4.0, 0.0], [-1.0, -4.0, 6.0]]], [[[-2.0, 0.0, -3.0], [1.0, 6.0, 5.0]], [[-5.0, -7.0, 5.0], [-4.0, 0.0, -1.0]], [[-7.0, 4.0, 0.0], [0.0, 7.0, -1.0]], [[4.0, -6.0, -6.0], [4.0, 0.0, -2.0]], [[-5.0, -5.0, 0.0], [-7.0, -5.0, -3.0]]]]) | |
28751 | s1=numarray.array([[[7.0, -3.0], [2.0, -6.0], [2.0, 3.0]], [[2.0, -4.0], [7.0, -1.0], [-7.0, -1.0]]]) | |
28752 | sub=res.substitute({arg0:s0,arg1:s1}) | |
28753 | ref=numarray.array([[[50.0, 45.0], [38.0, -38.0], [0.0, -17.0], [10.0, -17.0], [-57.0, 3.0]], [[-60.0, 25.0], [-94.0, -8.0], [-74.0, 34.0], [-98.0, -17.0], [-57.0, -16.0]], [[12.0, 23.0], [-81.0, -18.0], [-19.0, 71.0], [-2.0, -12.0], [-50.0, -28.0]], [[-11.0, -18.0], [-40.0, 89.0], [15.0, -9.0], [26.0, -8.0], [-73.0, 81.0]]]) | |
28754 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28755 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28756 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28757 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28758 | def test_tensor_mult_Symbol_rank4_Symbol_rank4(self): | |
28759 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28760 | arg1=Symbol(shape=(2, 3, 4, 5)) | |
28761 | res=tensor_mult(arg0,arg1) | |
28762 | s0=numarray.array([[[[-5.0, -4.0, 3.0], [7.0, -3.0, 2.0]], [[-6.0, -1.0, -6.0], [7.0, -4.0, 0.0]], [[4.0, 1.0, 4.0], [1.0, -2.0, 0.0]], [[-2.0, 6.0, 3.0], [-2.0, -7.0, -7.0]], [[3.0, 1.0, 6.0], [2.0, 1.0, -2.0]]], [[[0.0, -4.0, -1.0], [6.0, -5.0, -5.0]], [[5.0, 1.0, -2.0], [0.0, -4.0, -7.0]], [[-1.0, 1.0, 0.0], [0.0, 0.0, 6.0]], [[-6.0, -7.0, -5.0], [-1.0, -4.0, 2.0]], [[1.0, -2.0, 0.0], [4.0, 3.0, -4.0]]], [[[0.0, -2.0, 4.0], [1.0, 5.0, -1.0]], [[6.0, 0.0, 7.0], [7.0, -1.0, 3.0]], [[-6.0, 6.0, 2.0], [1.0, 1.0, -2.0]], [[-6.0, 1.0, 5.0], [0.0, -1.0, -4.0]], [[-3.0, 6.0, 6.0], [0.0, 3.0, -1.0]]], [[[-3.0, -5.0, 6.0], [3.0, 0.0, -7.0]], [[6.0, -4.0, 3.0], [0.0, 3.0, 6.0]], [[2.0, -3.0, 3.0], [-2.0, 0.0, -4.0]], [[0.0, -7.0, 0.0], [2.0, 5.0, 3.0]], [[-3.0, 0.0, -3.0], [-5.0, 1.0, 7.0]]]]) | |
28763 | s1=numarray.array([[[[0.0, 5.0, -5.0, -1.0, -2.0], [0.0, -3.0, 7.0, 4.0, -2.0], [3.0, 2.0, -2.0, -2.0, -6.0], [0.0, -2.0, -2.0, 7.0, -6.0]], [[5.0, 0.0, 4.0, -5.0, 0.0], [-4.0, -1.0, 6.0, 0.0, 4.0], [-3.0, 2.0, 0.0, -2.0, -3.0], [3.0, -4.0, -1.0, -7.0, 4.0]], [[6.0, -4.0, 7.0, -4.0, -4.0], [-7.0, 6.0, 7.0, 0.0, 7.0], [1.0, -5.0, 0.0, 6.0, 3.0], [1.0, 3.0, 1.0, 6.0, 1.0]]], [[[5.0, 2.0, -6.0, 5.0, -2.0], [-7.0, 3.0, 6.0, -7.0, -4.0], [5.0, 4.0, -1.0, -1.0, 7.0], [6.0, -7.0, 0.0, -7.0, 1.0]], [[1.0, 1.0, -7.0, -2.0, -7.0], [-5.0, 4.0, 0.0, 7.0, -4.0], [0.0, 3.0, 4.0, -6.0, -3.0], [5.0, 6.0, 7.0, 7.0, 0.0]], [[6.0, 1.0, 1.0, -1.0, 5.0], [-3.0, -7.0, 5.0, 0.0, 1.0], [2.0, -6.0, 0.0, 7.0, -2.0], [-3.0, 7.0, -5.0, 1.0, 3.0]]]]) | |
28764 | sub=res.substitute({arg0:s0,arg1:s1}) | |
28765 | ref=numarray.array([[[[42.0, -24.0, 11.0, 52.0, 15.0], [-45.0, 32.0, 14.0, -90.0, 1.0], [39.0, -26.0, -9.0, 61.0, 105.0], [12.0, -18.0, -14.0, -57.0, 30.0]], [[-10.0, 4.0, -30.0, 78.0, 50.0], [17.0, -12.0, -48.0, -101.0, -46.0], [14.0, 32.0, -11.0, -5.0, 82.0], [13.0, -75.0, -21.0, -148.0, 33.0]], [[32.0, 4.0, 20.0, -16.0, -12.0], [-29.0, 6.0, 68.0, -5.0, 28.0], [18.0, -12.0, -17.0, 25.0, -2.0], [3.0, -19.0, -19.0, 24.0, -15.0]], [[-11.0, -40.0, 109.0, -29.0, 10.0], [25.0, 33.0, -4.0, -43.0, 78.0], [-45.0, 6.0, -22.0, 5.0, 24.0], [-5.0, -88.0, -13.0, -80.0, 16.0]], [[40.0, -6.0, 10.0, -22.0, -51.0], [-59.0, 50.0, 71.0, 5.0, 26.0], [18.0, 1.0, -4.0, 6.0, 12.0], [32.0, -14.0, 16.0, 41.0, -12.0]]], [[[-31.0, 6.0, -29.0, 69.0, 2.0], [21.0, 31.0, -20.0, -77.0, -32.0], [31.0, 36.0, -26.0, -9.0, 76.0], [13.0, -94.0, -7.0, -60.0, -26.0]], [[-53.0, 22.0, -14.0, 13.0, -9.0], [51.0, 5.0, -8.0, -8.0, -11.0], [-4.0, 52.0, -26.0, -49.0, -13.0], [2.0, -93.0, -6.0, -19.0, -49.0]], [[41.0, 1.0, 15.0, -10.0, 32.0], [-22.0, -40.0, 29.0, -4.0, 12.0], [6.0, -36.0, 2.0, 42.0, -9.0], [-15.0, 40.0, -29.0, -8.0, 28.0]], [[-62.0, -14.0, 3.0, 62.0, 72.0], [84.0, -38.0, -115.0, -45.0, -29.0], [-3.0, -29.0, -3.0, 35.0, 43.0], [-58.0, 22.0, -24.0, -42.0, 8.0]], [[-11.0, 12.0, -62.0, 27.0, -51.0], [-23.0, 51.0, -1.0, -3.0, -42.0], [21.0, 47.0, 6.0, -48.0, 27.0], [45.0, -32.0, 41.0, 10.0, -22.0]]], [[[18.0, -10.0, -22.0, -10.0, -58.0], [-49.0, 56.0, 17.0, 28.0, -5.0], [13.0, 1.0, 19.0, -10.0, 12.0], [32.0, 36.0, 46.0, 65.0, -6.0]], [[94.0, 18.0, -13.0, 0.0, -32.0], [-102.0, 20.0, 148.0, -32.0, 16.0], [66.0, -16.0, -23.0, 50.0, 31.0], [35.0, -25.0, -27.0, 31.0, -13.0]], [[36.0, -37.0, 53.0, -27.0, -15.0], [-44.0, 45.0, 4.0, -24.0, 40.0], [-33.0, 9.0, 15.0, -9.0, 32.0], [37.0, -21.0, 25.0, -74.0, 57.0]], [[10.0, -55.0, 72.0, -13.0, -21.0], [-22.0, 71.0, -21.0, -31.0, 51.0], [-24.0, -14.0, 8.0, 18.0, 59.0], [15.0, -11.0, 29.0, -30.0, 33.0]], [[63.0, -37.0, 59.0, -56.0, -44.0], [-78.0, 58.0, 52.0, 9.0, 59.0], [-23.0, -9.0, 18.0, 5.0, 11.0], [42.0, 11.0, 32.0, -7.0, 45.0]]], [[[-16.0, -40.0, 12.0, 26.0, -59.0], [-22.0, 108.0, -26.0, -33.0, 9.0], [13.0, 8.0, 3.0, 0.0, 86.0], [30.0, -26.0, 52.0, 22.0, -14.0]], [[37.0, 27.0, -40.0, -10.0, -15.0], [-38.0, -26.0, 69.0, 45.0, -13.0], [45.0, -38.0, 0.0, 38.0, -36.0], [-12.0, 73.0, -14.0, 115.0, -31.0]], [[-31.0, -10.0, 7.0, -5.0, -32.0], [17.0, 37.0, -15.0, 22.0, 9.0], [0.0, -1.0, -2.0, -6.0, 0.0], [-6.0, 3.0, 22.0, 63.0, -35.0]], [[-2.0, 12.0, -72.0, 32.0, -24.0], [-20.0, 12.0, -15.0, 21.0, -53.0], [37.0, -9.0, 18.0, 3.0, 14.0], [7.0, 65.0, 27.0, 73.0, -17.0]], [[0.0, -5.0, 24.0, -19.0, 56.0], [30.0, -69.0, -37.0, 30.0, 8.0], [-23.0, -50.0, 15.0, 36.0, -43.0], [-49.0, 87.0, -25.0, 10.0, 31.0]]]]) | |
28766 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28767 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28768 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28769 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28770 | def test_tensor_mult_Symbol_rank4_constData_rank2(self): | |
28771 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28772 | arg1=Data(numarray.array([[-2.0, 0.0, 5.0], [-5.0, -5.0, 3.0]]),self.functionspace) | |
28773 | res=tensor_mult(arg0,arg1) | |
28774 | s0=numarray.array([[[[6.0, -4.0, -3.0], [-3.0, -4.0, 0.0]], [[-6.0, 1.0, -6.0], [6.0, 7.0, 5.0]], [[2.0, -4.0, -4.0], [0.0, 3.0, -7.0]], [[3.0, 5.0, 4.0], [-5.0, 0.0, -5.0]], [[2.0, -4.0, -4.0], [1.0, -7.0, 3.0]]], [[[-4.0, -3.0, 2.0], [-2.0, 0.0, 4.0]], [[-1.0, -4.0, -6.0], [7.0, -5.0, -4.0]], [[7.0, -1.0, 0.0], [6.0, -3.0, 3.0]], [[-1.0, -3.0, 0.0], [2.0, 3.0, -4.0]], [[-6.0, 2.0, 7.0], [7.0, 4.0, -6.0]]], [[[4.0, -5.0, 5.0], [-6.0, -7.0, -6.0]], [[2.0, 5.0, -5.0], [-6.0, -1.0, -1.0]], [[2.0, 2.0, 4.0], [1.0, -3.0, 6.0]], [[6.0, 2.0, 1.0], [7.0, 7.0, -4.0]], [[-3.0, 0.0, 2.0], [-5.0, 2.0, 4.0]]], [[[-5.0, 0.0, -3.0], [-3.0, 1.0, -3.0]], [[2.0, -6.0, 0.0], [1.0, 5.0, 5.0]], [[0.0, -3.0, 4.0], [-7.0, 6.0, 2.0]], [[-6.0, -1.0, 7.0], [4.0, -4.0, 6.0]], [[-4.0, -2.0, -7.0], [7.0, 0.0, 2.0]]]]) | |
28775 | sub=res.substitute({arg0:s0}) | |
28776 | ref=Data(numarray.array([[8.0, -68.0, -60.0, 24.0, 15.0], [40.0, -50.0, -20.0, -35.0, -26.0], [64.0, 3.0, 44.0, -89.0, 43.0], [-4.0, -19.0, 31.0, 65.0, -56.0]]),self.functionspace) | |
28777 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28778 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28779 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28780 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28781 | def test_tensor_mult_Symbol_rank4_constData_rank3(self): | |
28782 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28783 | arg1=Data(numarray.array([[[-5.0, -3.0], [-1.0, -1.0], [6.0, 4.0]], [[5.0, -5.0], [0.0, -2.0], [-3.0, 1.0]]]),self.functionspace) | |
28784 | res=tensor_mult(arg0,arg1) | |
28785 | s0=numarray.array([[[[-3.0, -2.0, 1.0], [6.0, -6.0, 5.0]], [[0.0, -1.0, -3.0], [2.0, -2.0, 4.0]], [[-1.0, 0.0, -1.0], [-3.0, 4.0, -4.0]], [[2.0, 5.0, 2.0], [1.0, 6.0, -1.0]], [[6.0, 2.0, -6.0], [6.0, 0.0, 2.0]]], [[[5.0, 6.0, -6.0], [2.0, 2.0, 2.0]], [[0.0, -1.0, -1.0], [5.0, 2.0, 7.0]], [[-2.0, 4.0, -4.0], [1.0, -7.0, 3.0]], [[-4.0, 2.0, 6.0], [5.0, -7.0, 6.0]], [[-5.0, 0.0, 0.0], [-5.0, 1.0, -2.0]]], [[[-5.0, -4.0, 6.0], [7.0, 7.0, 0.0]], [[5.0, 4.0, 2.0], [-5.0, -2.0, -4.0]], [[-2.0, 4.0, 1.0], [-6.0, -7.0, 7.0]], [[-5.0, 6.0, 1.0], [-6.0, -1.0, 4.0]], [[4.0, -7.0, -7.0], [5.0, -7.0, 5.0]]], [[[0.0, -4.0, 4.0], [6.0, 0.0, 7.0]], [[-6.0, -1.0, 7.0], [6.0, 4.0, 3.0]], [[4.0, 0.0, 3.0], [6.0, 5.0, 5.0]], [[0.0, -2.0, 0.0], [-2.0, 1.0, 7.0]], [[6.0, 0.0, 4.0], [4.0, -6.0, -2.0]]]]) | |
28786 | sub=res.substitute({arg0:s0}) | |
28787 | ref=Data(numarray.array([[[38.0, 2.0], [-19.0, -13.0], [-4.0, 2.0], [5.0, -21.0], [-44.0, -72.0]], [[-63.0, -57.0], [-1.0, -25.0], [-22.0, -2.0], [61.0, 29.0], [6.0, 36.0]], [[100.0, -6.0], [-30.0, 14.0], [-39.0, 57.0], [-17.0, 49.0], [-45.0, -39.0]], [[37.0, -3.0], [94.0, 12.0], [13.0, -35.0], [-29.0, 17.0], [20.0, -12.0]]]),self.functionspace) | |
28788 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28789 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28790 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28791 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28792 | def test_tensor_mult_Symbol_rank4_constData_rank4(self): | |
28793 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28794 | arg1=Data(numarray.array([[[[6.0, -5.0, -7.0, 1.0, 1.0], [5.0, -3.0, 4.0, -5.0, -1.0], [0.0, 2.0, 0.0, 5.0, 4.0], [-5.0, 0.0, 6.0, -2.0, -7.0]], [[4.0, 1.0, 3.0, -7.0, 0.0], [4.0, -5.0, 1.0, -5.0, -1.0], [3.0, -4.0, 0.0, -4.0, 7.0], [4.0, 3.0, 6.0, -1.0, -3.0]], [[0.0, -2.0, 4.0, 3.0, 7.0], [2.0, -2.0, 3.0, -7.0, -4.0], [0.0, -5.0, -1.0, -5.0, -7.0], [0.0, -7.0, -7.0, 4.0, 0.0]]], [[[-1.0, -6.0, 0.0, -5.0, -4.0], [-2.0, 0.0, -1.0, -5.0, 4.0], [-1.0, 2.0, -6.0, 0.0, -2.0], [-6.0, 5.0, -3.0, 3.0, 0.0]], [[6.0, 5.0, 7.0, 5.0, -3.0], [-2.0, 6.0, 0.0, 2.0, 0.0], [-2.0, 6.0, -3.0, 0.0, 0.0], [4.0, -6.0, 6.0, -1.0, 7.0]], [[-1.0, 6.0, 2.0, 1.0, 1.0], [-5.0, -3.0, 6.0, 0.0, -5.0], [-6.0, 3.0, -5.0, 7.0, -5.0], [7.0, 7.0, -2.0, -3.0, -7.0]]]]),self.functionspace) | |
28795 | res=tensor_mult(arg0,arg1) | |
28796 | s0=numarray.array([[[[-7.0, 0.0, 7.0], [2.0, -7.0, 1.0]], [[1.0, -2.0, -5.0], [-6.0, -3.0, 3.0]], [[-3.0, 1.0, -7.0], [7.0, -4.0, 5.0]], [[-1.0, -7.0, 6.0], [-3.0, -5.0, 5.0]], [[2.0, 4.0, 6.0], [-4.0, 7.0, -7.0]]], [[[-2.0, -2.0, 7.0], [0.0, 1.0, -7.0]], [[-4.0, -4.0, 5.0], [-3.0, -2.0, 4.0]], [[-5.0, 2.0, -5.0], [-3.0, 5.0, -5.0]], [[4.0, 0.0, -7.0], [0.0, 4.0, 2.0]], [[-3.0, -5.0, 0.0], [2.0, -2.0, 6.0]]], [[[-2.0, 7.0, 5.0], [0.0, 4.0, 3.0]], [[7.0, -7.0, 5.0], [5.0, 3.0, 1.0]], [[6.0, 6.0, -6.0], [-2.0, 4.0, 4.0]], [[-2.0, 2.0, 7.0], [5.0, 4.0, 5.0]], [[-5.0, 1.0, -5.0], [-1.0, 4.0, 3.0]]], [[[5.0, 6.0, -5.0], [6.0, 5.0, 2.0]], [[3.0, -2.0, -3.0], [-7.0, -5.0, 3.0]], [[1.0, 2.0, 1.0], [-2.0, -3.0, -5.0]], [[5.0, -1.0, 3.0], [-2.0, 2.0, -7.0]], [[7.0, 2.0, -7.0], [-5.0, 3.0, 5.0]]]]) | |
28797 | sub=res.substitute({arg0:s0}) | |
28798 | ref=Data(numarray.array([[[[-87.0, -20.0, 30.0, -30.0, 56.0], [-16.0, -38.0, -3.0, -38.0, -18.0], [6.0, -84.0, -3.0, -63.0, -86.0], [2.0, 10.0, -141.0, 52.0, -7.0]], [[-17.0, 42.0, -48.0, 18.0, 2.0], [-10.0, -10.0, 11.0, 64.0, -18.0], [-12.0, 14.0, 35.0, 59.0, 22.0], [32.0, 38.0, 23.0, -44.0, -43.0]], [[-50.0, -2.0, -22.0, -81.0, -63.0], [-56.0, -21.0, -9.0, 16.0, 33.0], [-26.0, 30.0, -48.0, 51.0, 5.0], [-4.0, 146.0, -18.0, -13.0, -45.0]], [[-66.0, 9.0, -15.0, 61.0, 73.0], [-30.0, -19.0, 40.0, 3.0, -53.0], [-38.0, -25.0, 2.0, 28.0, -114.0], [10.0, -13.0, -121.0, 14.0, -42.0]], [[81.0, -1.0, 57.0, 40.0, 32.0], [67.0, 25.0, -8.0, -38.0, -11.0], [44.0, -29.0, 32.0, -85.0, 37.0], [9.0, -141.0, 62.0, 18.0, 72.0]]], [[[-7.0, -43.0, 29.0, 31.0, 37.0], [29.0, 29.0, -31.0, -27.0, 11.0], [34.0, -46.0, 25.0, -86.0, -36.0], [-43.0, -110.0, -53.0, 54.0, 76.0]], [[-53.0, 38.0, 30.0, 48.0, 53.0], [-36.0, -2.0, 22.0, 16.0, -44.0], [-29.0, -23.0, -1.0, -1.0, -93.0], [42.0, -22.0, -94.0, 13.0, -2.0]], [[16.0, 50.0, 46.0, 1.0, -48.0], [-6.0, 60.0, -60.0, 75.0, 36.0], [29.0, 16.0, 33.0, -43.0, 60.0], [36.0, -39.0, 66.0, -11.0, 99.0]], [[46.0, 26.0, -24.0, 5.0, -55.0], [-12.0, 20.0, 7.0, 37.0, 14.0], [-20.0, 73.0, -15.0, 69.0, 55.0], [10.0, 39.0, 93.0, -46.0, -14.0]], [[-58.0, 24.0, 4.0, 18.0, 1.0], [-65.0, 4.0, 17.0, 26.0, -14.0], [-49.0, 24.0, -36.0, 47.0, -81.0], [17.0, 49.0, -78.0, 1.0, -20.0]]], [[[37.0, 45.0, 89.0, -13.0, 24.0], [5.0, -24.0, 32.0, -52.0, -40.0], [-5.0, -24.0, -32.0, -42.0, -9.0], [75.0, -17.0, 13.0, 4.0, 0.0]], [[26.0, -61.0, -27.0, 62.0, 14.0], [-4.0, 19.0, 37.0, -54.0, -5.0], [-38.0, 48.0, -49.0, 45.0, -71.0], [-74.0, -42.0, -34.0, 22.0, -14.0]], [[82.0, 44.0, -12.0, -20.0, -36.0], [18.0, -24.0, 38.0, 0.0, -16.0], [-12.0, 50.0, -14.0, 64.0, 92.0], [50.0, 54.0, 136.0, -64.0, -60.0]], [[10.0, 18.0, 86.0, 5.0, 20.0], [-31.0, -9.0, 40.0, -66.0, -33.0], [-37.0, 2.0, -74.0, -18.0, -78.0], [39.0, -7.0, -50.0, 26.0, 1.0]], [[-4.0, 80.0, 52.0, 1.0, -45.0], [-52.0, 35.0, -15.0, 68.0, 5.0], [-22.0, 42.0, -16.0, 17.0, 9.0], [72.0, 30.0, 32.0, -27.0, 39.0]]], [[[76.0, -8.0, 2.0, -55.0, -67.0], [7.0, -11.0, 17.0, -40.0, 23.0], [-10.0, 59.0, -56.0, 40.0, 75.0], [-3.0, 67.0, 109.0, -29.0, -32.0]], [[-16.0, 24.0, -68.0, 21.0, 28.0], [10.0, -32.0, 26.0, 41.0, -32.0], [-7.0, -6.0, 45.0, 59.0, 18.0], [20.0, 31.0, 12.0, -41.0, -71.0]], [[3.0, -38.0, -28.0, -20.0, 20.0], [50.0, -18.0, -19.0, -18.0, 10.0], [44.0, -48.0, 45.0, -43.0, 40.0], [-32.0, -28.0, 9.0, 12.0, 1.0]], [[47.0, -52.0, -26.0, 34.0, 21.0], [62.0, 17.0, -12.0, -27.0, 11.0], [37.0, -14.0, 38.0, -35.0, 31.0], [-58.0, -95.0, 35.0, 16.0, 31.0]], [[68.0, 56.0, -40.0, 17.0, -26.0], [8.0, -14.0, 44.0, 35.0, -26.0], [-25.0, 64.0, 3.0, 97.0, 76.0], [50.0, 47.0, 126.0, -77.0, -69.0]]]]),self.functionspace) | |
28799 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28800 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28801 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28802 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28803 | def test_tensor_mult_Symbol_rank4_expandedData_rank2(self): | |
28804 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28805 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28806 | arg1=msk_arg1*numarray.array([[0.0, -6.0, -7.0], [0.0, 1.0, 5.0]])+(1.-msk_arg1)*numarray.array([[2.0, -5.0, 4.0], [0.0, -6.0, 1.0]]) | |
28807 | res=tensor_mult(arg0,arg1) | |
28808 | s0=numarray.array([[[[-7.0, 6.0, 5.0], [-7.0, 6.0, 0.0]], [[3.0, 0.0, -2.0], [-7.0, 7.0, 1.0]], [[0.0, -5.0, 2.0], [3.0, -2.0, 4.0]], [[6.0, -1.0, -3.0], [-4.0, -3.0, -1.0]], [[0.0, -5.0, 2.0], [1.0, 3.0, -6.0]]], [[[-5.0, 7.0, -4.0], [6.0, -7.0, 7.0]], [[-6.0, 4.0, 4.0], [0.0, -1.0, -4.0]], [[-1.0, -5.0, 0.0], [-1.0, 3.0, 6.0]], [[-5.0, 2.0, 6.0], [5.0, -1.0, -7.0]], [[6.0, 5.0, 5.0], [-1.0, -4.0, -5.0]]], [[[3.0, 5.0, -1.0], [5.0, -6.0, -4.0]], [[7.0, -5.0, -3.0], [0.0, 0.0, -1.0]], [[6.0, 4.0, 6.0], [0.0, -6.0, -2.0]], [[5.0, 2.0, 3.0], [-4.0, 7.0, 5.0]], [[2.0, 3.0, 4.0], [-4.0, 0.0, 3.0]]], [[[-7.0, 5.0, -2.0], [-5.0, -3.0, 4.0]], [[2.0, -1.0, 0.0], [5.0, 0.0, -5.0]], [[6.0, 0.0, 0.0], [6.0, -4.0, -6.0]], [[-1.0, -4.0, 7.0], [5.0, 0.0, 1.0]], [[2.0, 0.0, 3.0], [-1.0, 0.0, 6.0]]]]) | |
28809 | sub=res.substitute({arg0:s0}) | |
28810 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28811 | ref=msk_ref*numarray.array([[-65.0, 26.0, 34.0, 19.0, -11.0], [14.0, -73.0, 63.0, -90.0, -94.0], [-49.0, 46.0, -82.0, -1.0, -31.0], [1.0, -19.0, -34.0, -20.0, 9.0]])+(1.-msk_ref)*numarray.array([[-60.0, -43.0, 49.0, 22.0, 9.0], [-12.0, -14.0, 11.0, 3.0, 26.0], [9.0, 26.0, 50.0, -25.0, 8.0], [-25.0, 4.0, 30.0, 47.0, 22.0]]) | |
28812 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28813 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28814 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28815 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28816 | def test_tensor_mult_Symbol_rank4_expandedData_rank3(self): | |
28817 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28818 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28819 | arg1=msk_arg1*numarray.array([[[6.0, 0.0], [-7.0, -7.0], [7.0, 0.0]], [[-1.0, 6.0], [-2.0, 6.0], [-3.0, 4.0]]])+(1.-msk_arg1)*numarray.array([[[2.0, -3.0], [-7.0, 6.0], [5.0, -4.0]], [[0.0, 7.0], [3.0, 7.0], [-1.0, 4.0]]]) | |
28820 | res=tensor_mult(arg0,arg1) | |
28821 | s0=numarray.array([[[[-3.0, 5.0, 6.0], [-1.0, 4.0, -1.0]], [[-7.0, 4.0, -6.0], [-7.0, -3.0, 6.0]], [[3.0, 4.0, 0.0], [-7.0, -2.0, 0.0]], [[-2.0, 5.0, -4.0], [-4.0, 2.0, 3.0]], [[0.0, 3.0, 2.0], [1.0, 1.0, 3.0]]], [[[5.0, 2.0, -4.0], [-5.0, 1.0, 4.0]], [[0.0, 6.0, -3.0], [-5.0, 2.0, -4.0]], [[0.0, 6.0, -3.0], [7.0, 7.0, 1.0]], [[-6.0, -3.0, 0.0], [7.0, 6.0, -4.0]], [[-6.0, 5.0, 0.0], [6.0, -4.0, 1.0]]], [[[-2.0, 2.0, -6.0], [0.0, -7.0, -1.0]], [[7.0, 0.0, -7.0], [-3.0, -4.0, 2.0]], [[-6.0, 0.0, 7.0], [2.0, -4.0, -1.0]], [[3.0, 0.0, 4.0], [-4.0, 1.0, 4.0]], [[-2.0, -7.0, -7.0], [-6.0, -5.0, -6.0]]], [[[7.0, 4.0, -4.0], [1.0, 3.0, 1.0]], [[7.0, -3.0, -4.0], [-7.0, -2.0, -2.0]], [[2.0, 5.0, 4.0], [-7.0, 6.0, -5.0]], [[-4.0, 6.0, 0.0], [4.0, -6.0, 1.0]], [[6.0, 7.0, -4.0], [-6.0, -2.0, 6.0]]]]) | |
28822 | sub=res.substitute({arg0:s0}) | |
28823 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28824 | ref=msk_ref*numarray.array([[[-15.0, -21.0], [-117.0, -64.0], [1.0, -82.0], [-84.0, -35.0], [-19.0, 3.0]], [[-21.0, -22.0], [-50.0, -76.0], [-87.0, 46.0], [-22.0, 83.0], [-72.0, -19.0]], [[-51.0, -60.0], [-2.0, -34.0], [22.0, -16.0], [36.0, -2.0], [22.0, -41.0]], [[-24.0, 0.0], [52.0, -41.0], [15.0, -61.0], [-61.0, -50.0], [-49.0, -73.0]]])+(1.-msk_ref)*numarray.array([[[2.0, 32.0], [-87.0, 23.0], [-28.0, -48.0], [-56.0, 50.0], [-11.0, 36.0]], [[-25.0, 1.0], [-47.0, 11.0], [-37.0, 150.0], [31.0, 75.0], [-60.0, 66.0]], [[-68.0, -11.0], [-35.0, -34.0], [12.0, -28.0], [25.0, -30.0], [1.0, -109.0]], [[-26.0, 51.0], [11.0, -94.0], [12.0, -19.0], [-69.0, 38.0], [-69.0, 8.0]]]) | |
28825 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28826 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28827 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28828 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28829 | def test_tensor_mult_Symbol_rank4_expandedData_rank4(self): | |
28830 | arg0=Symbol(shape=(4, 5, 2, 3)) | |
28831 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28832 | arg1=msk_arg1*numarray.array([[[[-3.0, -3.0, 5.0, 1.0, 3.0], [-2.0, -3.0, 7.0, -2.0, -6.0], [0.0, 3.0, 0.0, -5.0, 4.0], [0.0, -5.0, -4.0, -6.0, 2.0]], [[3.0, -1.0, -7.0, -3.0, -3.0], [0.0, -4.0, 2.0, -2.0, -6.0], [0.0, -1.0, 6.0, 7.0, -3.0], [2.0, 7.0, -5.0, 6.0, 0.0]], [[4.0, 5.0, 0.0, 7.0, 1.0], [7.0, 0.0, 1.0, 6.0, -1.0], [-3.0, -5.0, 1.0, -1.0, 6.0], [0.0, -4.0, 2.0, 5.0, -7.0]]], [[[0.0, 0.0, 4.0, 2.0, -6.0], [-3.0, 0.0, 3.0, -3.0, 0.0], [-1.0, -6.0, -1.0, -5.0, 7.0], [0.0, 0.0, 4.0, -4.0, -3.0]], [[7.0, 3.0, -6.0, -5.0, 4.0], [6.0, -1.0, 7.0, 6.0, -6.0], [-6.0, 0.0, 5.0, -7.0, 3.0], [-3.0, -5.0, 3.0, 7.0, -5.0]], [[-5.0, -1.0, 4.0, -1.0, 2.0], [-1.0, 7.0, -5.0, -4.0, 0.0], [0.0, 5.0, -3.0, -6.0, -5.0], [0.0, -5.0, 5.0, 1.0, 2.0]]]])+(1.-msk_arg1)*numarray.array([[[[5.0, -4.0, -5.0, 7.0, 0.0], [-4.0, -7.0, -6.0, 6.0, 7.0], [6.0, 1.0, 1.0, 4.0, 1.0], [-7.0, 0.0, 1.0, 0.0, 6.0]], [[0.0, -1.0, 7.0, 4.0, -1.0], [2.0, 5.0, -7.0, -6.0, 1.0], [-2.0, 7.0, 2.0, -4.0, -5.0], [1.0, 7.0, 3.0, 6.0, -2.0]], [[-4.0, -6.0, -1.0, 0.0, 7.0], [3.0, 4.0, 4.0, -3.0, -4.0], [-5.0, -4.0, 3.0, 0.0, 1.0], [-3.0, -3.0, -2.0, 2.0, -1.0]]], [[[-6.0, -3.0, 3.0, -6.0, 2.0], [5.0, 0.0, -5.0, 4.0, -7.0], [-4.0, 6.0, 0.0, 2.0, 3.0], [0.0, 6.0, -3.0, -2.0, 7.0]], [[-5.0, 0.0, 1.0, 0.0, 1.0], [-4.0, -3.0, 2.0, 0.0, 2.0], [1.0, 0.0, 7.0, -4.0, -2.0], [-7.0, 7.0, -5.0, 3.0, 3.0]], [[7.0, -3.0, 4.0, 4.0, 0.0], [-4.0, -2.0, -3.0, -5.0, -5.0], [3.0, 5.0, 5.0, -7.0, -6.0], [-7.0, -6.0, 4.0, 2.0, -5.0]]]]) | |
28833 | res=tensor_mult(arg0,arg1) | |
28834 | s0=numarray.array([[[[-3.0, -6.0, 6.0], [-3.0, -6.0, 1.0]], [[-7.0, -5.0, -4.0], [-1.0, 4.0, 3.0]], [[-5.0, 6.0, 5.0], [-7.0, 4.0, 2.0]], [[-7.0, 0.0, 0.0], [-2.0, 6.0, -1.0]], [[5.0, 0.0, -2.0], [1.0, 4.0, 5.0]]], [[[-5.0, 4.0, -4.0], [6.0, 0.0, 3.0]], [[-2.0, -3.0, 5.0], [-7.0, 1.0, -2.0]], [[-2.0, -2.0, 5.0], [-7.0, 3.0, -3.0]], [[-4.0, 7.0, 5.0], [0.0, -1.0, -6.0]], [[6.0, -5.0, -4.0], [3.0, 0.0, 0.0]]], [[[5.0, 7.0, -6.0], [-1.0, -3.0, -5.0]], [[1.0, -2.0, 3.0], [-5.0, 3.0, 6.0]], [[4.0, 0.0, -7.0], [6.0, -1.0, 7.0]], [[-4.0, 0.0, -1.0], [-6.0, -5.0, 4.0]], [[7.0, 6.0, 2.0], [1.0, -6.0, 0.0]]], [[[-3.0, 1.0, 0.0], [6.0, -2.0, 0.0]], [[0.0, -5.0, 1.0], [0.0, -7.0, -4.0]], [[7.0, -2.0, -1.0], [7.0, -5.0, -6.0]], [[7.0, 4.0, -6.0], [3.0, 3.0, 6.0]], [[-1.0, 0.0, -7.0], [-7.0, 5.0, -3.0]]]]) | |
28835 | sub=res.substitute({arg0:s0}) | |
28836 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28837 | ref=msk_ref*numarray.array([[[[-32.0, 26.0, 55.0, 80.0, 11.0], [20.0, 46.0, -83.0, 23.0, 84.0], [21.0, -10.0, -60.0, 18.0, -2.0], [6.0, -26.0, 29.0, -17.0, -7.0]], [[3.0, 15.0, -16.0, -45.0, 18.0], [10.0, 58.0, -53.0, 15.0, 52.0], [-11.0, 25.0, -22.0, -37.0, -47.0], [-22.0, -19.0, 68.0, 27.0, 3.0]], [[71.0, 44.0, -111.0, -24.0, 34.0], [88.0, 1.0, -21.0, 65.0, -35.0], [-32.0, 6.0, 62.0, 57.0, -55.0], [0.0, 17.0, -6.0, 149.0, -40.0]], [[68.0, 40.0, -83.0, -40.0, 13.0], [57.0, 8.0, -8.0, 60.0, 6.0], [-34.0, -14.0, 35.0, 9.0, -19.0], [-18.0, 10.0, 33.0, 91.0, -40.0]], [[-20.0, -18.0, 25.0, -32.0, 33.0], [-8.0, 16.0, 39.0, -21.0, -52.0], [-19.0, 44.0, 2.0, -86.0, 2.0], [-12.0, -62.0, 17.0, -11.0, 11.0]]], [[[-4.0, -12.0, -17.0, -36.0, -61.0], [-39.0, 20.0, -28.0, -52.0, 10.0], [6.0, -20.0, 5.0, 9.0, -29.0], [8.0, 54.0, 31.0, 13.0, 6.0]], [[34.0, 39.0, -31.0, 25.0, 50.0], [68.0, 3.0, -19.0, 75.0, 19.0], [-14.0, 4.0, 5.0, 24.0, -5.0], [-9.0, -26.0, -2.0, 52.0, -27.0]], [[56.0, 45.0, -54.0, 13.0, 53.0], [81.0, -10.0, 2.0, 89.0, 1.0], [-26.0, -2.0, 24.0, 23.0, 3.0], [-13.0, -24.0, -6.0, 71.0, -39.0]], [[76.0, 33.0, -87.0, 21.0, -44.0], [43.0, -57.0, 14.0, 42.0, -17.0], [-9.0, -74.0, 60.0, 107.0, 20.0], [17.0, 84.0, -42.0, 78.0, -50.0]], [[-49.0, -33.0, 77.0, -1.0, 11.0], [-49.0, 2.0, 37.0, -35.0, -2.0], [9.0, 25.0, -37.0, -76.0, 36.0], [-10.0, -49.0, 5.0, -98.0, 31.0]]], [[[-14.0, -56.0, -30.0, -40.0, -28.0], [-62.0, -75.0, 44.0, -55.0, -48.0], [37.0, 19.0, 37.0, 86.0, -28.0], [23.0, 88.0, -105.0, -40.0, 60.0]], [[-6.0, 17.0, 5.0, -3.0, 66.0], [46.0, 44.0, -18.0, 29.0, -15.0], [-22.0, 50.0, -7.0, -54.0, -28.0], [-13.0, -76.0, 31.0, 44.0, -7.0]], [[-82.0, -57.0, 78.0, -35.0, -21.0], [-88.0, 38.0, -3.0, -102.0, -11.0], [21.0, 46.0, -39.0, -78.0, -22.0], [3.0, -22.0, 26.0, -83.0, 58.0]], [[-47.0, -12.0, 2.0, -2.0, 11.0], [-15.0, 45.0, -102.0, -26.0, 55.0], [39.0, 49.0, -32.0, 62.0, -99.0], [15.0, 29.0, -5.0, 12.0, 50.0]], [[-37.0, -35.0, 33.0, 35.0, -25.0], [-39.0, -39.0, 24.0, -53.0, -44.0], [29.0, -1.0, 7.0, 42.0, 11.0], [30.0, 29.0, -68.0, -42.0, 27.0]]], [[[-2.0, 2.0, 14.0, 16.0, -56.0], [-24.0, 7.0, -15.0, -26.0, 24.0], [6.0, -46.0, -10.0, 6.0, 21.0], [8.0, 32.0, 25.0, -14.0, -14.0]], [[-40.0, -7.0, 61.0, 61.0, -20.0], [-31.0, -1.0, -38.0, -10.0, 71.0], [39.0, -20.0, -52.0, 37.0, 20.0], [11.0, 16.0, -14.0, -78.0, 20.0]], [[-36.0, -33.0, 83.0, 51.0, -48.0], [-66.0, -50.0, 60.0, -43.0, 1.0], [26.0, -44.0, -27.0, -12.0, 92.0], [11.0, 10.0, -37.0, -128.0, 13.0]], [[-42.0, -52.0, 25.0, -62.0, 9.0], [-53.0, 2.0, 51.0, -73.0, -78.0], [-3.0, 59.0, 12.0, -73.0, -20.0], [-1.0, -28.0, -9.0, -33.0, 44.0]], [[25.0, -14.0, -75.0, -86.0, 46.0], [7.0, -23.0, 15.0, 23.0, -17.0], [-2.0, 59.0, 34.0, 30.0, -65.0], [-15.0, 23.0, -38.0, 31.0, 37.0]]]])+(1.-msk_ref)*numarray.array([[[[16.0, -12.0, -44.0, -23.0, 36.0], [23.0, 31.0, 84.0, -17.0, -47.0], [-27.0, -82.0, -34.0, 23.0, 30.0], [32.0, -126.0, 10.0, -34.0, -56.0]], [[-12.0, 51.0, 17.0, -51.0, -21.0], [-27.0, -10.0, 65.0, -19.0, -38.0], [5.0, -17.0, 14.0, -47.0, -15.0], [7.0, -19.0, -19.0, -18.0, -38.0]], [[-9.0, -1.0, 53.0, 39.0, 19.0], [-12.0, 69.0, 45.0, -119.0, -2.0], [-29.0, -15.0, 60.0, -88.0, -71.0], [-16.0, 1.0, 12.0, 76.0, -94.0]], [[-60.0, 37.0, 31.0, -41.0, 2.0], [-2.0, 33.0, 67.0, -45.0, -18.0], [-31.0, -24.0, 30.0, -49.0, -19.0], [14.0, 36.0, -35.0, 20.0, -33.0]], [[42.0, -26.0, 4.0, 49.0, -8.0], [-57.0, -65.0, -50.0, 15.0, 19.0], [55.0, 44.0, 52.0, -29.0, -32.0], [-92.0, 10.0, 6.0, 16.0, 26.0]]], [[[-24.0, 13.0, 87.0, -43.0, -20.0], [34.0, 33.0, -53.0, -33.0, -72.0], [-33.0, 90.0, 6.0, -45.0, -29.0], [30.0, 58.0, 9.0, 10.0, -7.0]], [[-7.0, 8.0, -44.0, 8.0, 25.0], [-14.0, 20.0, 96.0, -27.0, 24.0], [-8.0, -95.0, 4.0, 0.0, 7.0], [3.0, -59.0, -13.0, 5.0, -47.0]], [[-24.0, 10.0, -39.0, 8.0, 26.0], [-16.0, 21.0, 96.0, -28.0, 34.0], [-11.0, -93.0, 15.0, -5.0, 4.0], [-3.0, -32.0, -24.0, 15.0, -38.0]], [[-77.0, -3.0, 39.0, -24.0, 27.0], [73.0, 98.0, 11.0, -51.0, -13.0], [-82.0, -5.0, -12.0, 2.0, 4.0], [69.0, 63.0, -12.0, 37.0, -16.0]], [[28.0, -4.0, -52.0, 4.0, -17.0], [-31.0, -83.0, -32.0, 90.0, 32.0], [54.0, 5.0, -16.0, 50.0, 36.0], [-35.0, -5.0, -10.0, -44.0, 71.0]]], [[[35.0, 27.0, 4.0, 49.0, -54.0], [3.0, -5.0, -89.0, 27.0, 92.0], [32.0, 47.0, -45.0, 37.0, -3.0], [46.0, 70.0, 36.0, 13.0, 31.0]], [[50.0, -23.0, -10.0, 53.0, 16.0], [-60.0, -26.0, 33.0, -41.0, 4.0], [36.0, -25.0, 57.0, -52.0, -43.0], [-81.0, -68.0, 13.0, 25.0, -49.0]], [[66.0, -13.0, 32.0, 20.0, -38.0], [-31.0, -67.0, -105.0, 34.0, -23.0], [55.0, 103.0, 11.0, -17.0, -25.0], [-49.0, 8.0, 33.0, -15.0, 35.0]], [[73.0, 28.0, 14.0, 24.0, -24.0], [-13.0, 31.0, 28.0, -65.0, -12.0], [12.0, -16.0, -22.0, -36.0, -37.0], [38.0, -92.0, 57.0, 3.0, -100.0]], [[51.0, -49.0, 2.0, 67.0, 4.0], [19.0, 7.0, -93.0, 4.0, 28.0], [10.0, 47.0, -17.0, 30.0, -6.0], [-7.0, 0.0, 48.0, 20.0, 17.0]]], [[[-41.0, -7.0, 38.0, -53.0, 9.0], [52.0, 32.0, -23.0, 0.0, -66.0], [-46.0, 40.0, -15.0, 4.0, 14.0], [36.0, 29.0, -8.0, -12.0, 16.0]], [[3.0, 11.0, -59.0, -36.0, 5.0], [37.0, 8.0, 37.0, 47.0, -3.0], [-14.0, -59.0, -76.0, 76.0, 64.0], [69.0, -63.0, 2.0, -57.0, 8.0]], [[-20.0, -23.0, -56.0, -25.0, 4.0], [44.0, -36.0, -59.0, 115.0, 22.0], [0.0, 9.0, -65.0, 112.0, 83.0], [29.0, 32.0, -17.0, -55.0, 111.0]], [[68.0, -23.0, 35.0, 71.0, -37.0], [-59.0, -74.0, -121.0, 18.0, 32.0], [73.0, 107.0, 48.0, -36.0, -52.0], [-90.0, 49.0, 31.0, 27.0, 40.0]], [[19.0, 76.0, -16.0, 23.0, -58.0], [-60.0, -30.0, 32.0, 2.0, 95.0], [53.0, -30.0, -2.0, -17.0, -21.0], [14.0, 32.0, -3.0, 9.0, -18.0]]]]) | |
28838 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28839 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28840 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28841 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28842 | def test_tensor_mult_constData_rank2_array_rank1(self): | |
28843 | arg0=Data(numarray.array([[-7.0, 2.0, 3.0], [5.0, -1.0, -4.0]]),self.functionspace) | |
28844 | arg1=numarray.array([-3.0, -4.0, -2.0]) | |
28845 | res=tensor_mult(arg0,arg1) | |
28846 | ref=Data(numarray.array([7.0, -3.0]),self.functionspace) | |
28847 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28848 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28849 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28850 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28851 | def test_tensor_mult_constData_rank2_array_rank2(self): | |
28852 | arg0=Data(numarray.array([[0.0, 3.0, -2.0], [-7.0, -3.0, -7.0]]),self.functionspace) | |
28853 | arg1=numarray.array([[2.0, 6.0], [-4.0, -1.0], [-2.0, 3.0]]) | |
28854 | res=tensor_mult(arg0,arg1) | |
28855 | ref=Data(numarray.array([[-8.0, -9.0], [12.0, -60.0]]),self.functionspace) | |
28856 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28857 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28858 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28859 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28860 | def test_tensor_mult_constData_rank2_Symbol_rank1(self): | |
28861 | arg0=Data(numarray.array([[0.0, -1.0, -5.0], [1.0, -7.0, -2.0]]),self.functionspace) | |
28862 | arg1=Symbol(shape=(3,)) | |
28863 | res=tensor_mult(arg0,arg1) | |
28864 | s1=numarray.array([-2.0, -1.0, 4.0]) | |
28865 | sub=res.substitute({arg1:s1}) | |
28866 | ref=Data(numarray.array([-19.0, -3.0]),self.functionspace) | |
28867 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28868 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28869 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28870 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28871 | def test_tensor_mult_constData_rank2_Symbol_rank2(self): | |
28872 | arg0=Data(numarray.array([[-3.0, 0.0, -4.0], [1.0, -5.0, 0.0]]),self.functionspace) | |
28873 | arg1=Symbol(shape=(3, 2)) | |
28874 | res=tensor_mult(arg0,arg1) | |
28875 | s1=numarray.array([[4.0, 1.0], [5.0, 2.0], [4.0, 3.0]]) | |
28876 | sub=res.substitute({arg1:s1}) | |
28877 | ref=Data(numarray.array([[-28.0, -15.0], [-21.0, -9.0]]),self.functionspace) | |
28878 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28879 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28880 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28881 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28882 | def test_tensor_mult_constData_rank2_constData_rank1(self): | |
28883 | arg0=Data(numarray.array([[5.0, -6.0, 5.0], [-3.0, 7.0, -5.0]]),self.functionspace) | |
28884 | arg1=Data(numarray.array([-1.0, 3.0, -6.0]),self.functionspace) | |
28885 | res=tensor_mult(arg0,arg1) | |
28886 | ref=Data(numarray.array([-53.0, 54.0]),self.functionspace) | |
28887 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28888 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28889 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28890 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28891 | def test_tensor_mult_constData_rank2_constData_rank2(self): | |
28892 | arg0=Data(numarray.array([[6.0, 3.0, -3.0], [-7.0, -7.0, -2.0]]),self.functionspace) | |
28893 | arg1=Data(numarray.array([[5.0, -4.0], [3.0, 3.0], [3.0, -6.0]]),self.functionspace) | |
28894 | res=tensor_mult(arg0,arg1) | |
28895 | ref=Data(numarray.array([[30.0, 3.0], [-62.0, 19.0]]),self.functionspace) | |
28896 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28897 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28898 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28899 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28900 | def test_tensor_mult_constData_rank2_expandedData_rank1(self): | |
28901 | arg0=Data(numarray.array([[6.0, 6.0, -5.0], [5.0, -6.0, -6.0]]),self.functionspace) | |
28902 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28903 | arg1=msk_arg1*numarray.array([4.0, -2.0, 0.0])+(1.-msk_arg1)*numarray.array([-1.0, -6.0, -7.0]) | |
28904 | res=tensor_mult(arg0,arg1) | |
28905 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28906 | ref=msk_ref*numarray.array([12.0, 32.0])+(1.-msk_ref)*numarray.array([-7.0, 73.0]) | |
28907 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28908 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
28909 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28910 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28911 | def test_tensor_mult_constData_rank2_expandedData_rank2(self): | |
28912 | arg0=Data(numarray.array([[-3.0, 5.0, -2.0], [-1.0, -1.0, -5.0]]),self.functionspace) | |
28913 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28914 | arg1=msk_arg1*numarray.array([[-5.0, 4.0], [2.0, 6.0], [7.0, 1.0]])+(1.-msk_arg1)*numarray.array([[-4.0, 0.0], [-1.0, 4.0], [-3.0, 1.0]]) | |
28915 | res=tensor_mult(arg0,arg1) | |
28916 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
28917 | ref=msk_ref*numarray.array([[11.0, 16.0], [-32.0, -15.0]])+(1.-msk_ref)*numarray.array([[13.0, 18.0], [20.0, -9.0]]) | |
28918 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28919 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
28920 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28921 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28922 | def test_tensor_mult_constData_rank4_array_rank2(self): | |
28923 | arg0=Data(numarray.array([[[[7.0, -6.0, 1.0], [-7.0, -2.0, 2.0]], [[0.0, -7.0, -1.0], [2.0, 0.0, -5.0]], [[3.0, 4.0, 3.0], [-2.0, 5.0, 7.0]], [[0.0, 0.0, 4.0], [0.0, 6.0, -7.0]], [[2.0, 3.0, -2.0], [-1.0, -7.0, 0.0]]], [[[3.0, 2.0, 1.0], [3.0, 0.0, 3.0]], [[-4.0, 0.0, -2.0], [-5.0, 3.0, -5.0]], [[-7.0, -7.0, -2.0], [3.0, 0.0, 5.0]], [[-1.0, 7.0, -3.0], [-4.0, 0.0, 6.0]], [[-7.0, 6.0, -1.0], [-4.0, -7.0, 2.0]]], [[[-3.0, 5.0, 0.0], [-4.0, -2.0, -4.0]], [[-1.0, 7.0, -6.0], [3.0, 0.0, 3.0]], [[-1.0, -1.0, -7.0], [1.0, 3.0, 6.0]], [[-2.0, 7.0, -4.0], [-2.0, -2.0, -3.0]], [[-6.0, -7.0, 0.0], [6.0, 4.0, -6.0]]], [[[-7.0, -4.0, 4.0], [-2.0, -7.0, 5.0]], [[-3.0, 1.0, -4.0], [1.0, -6.0, 7.0]], [[4.0, 0.0, 7.0], [-2.0, 6.0, -3.0]], [[-5.0, 2.0, 7.0], [3.0, 4.0, -2.0]], [[-7.0, 5.0, 5.0], [-5.0, 1.0, 3.0]]]]),self.functionspace) | |
28924 | arg1=numarray.array([[-3.0, -4.0, 1.0], [-2.0, 5.0, -3.0]]) | |
28925 | res=tensor_mult(arg0,arg1) | |
28926 | ref=Data(numarray.array([[2.0, 38.0, -14.0, 55.0, -53.0], [-31.0, 50.0, 26.0, -38.0, -37.0], [-1.0, -46.0, -5.0, -23.0, 72.0], [-5.0, -52.0, 38.0, 34.0, 12.0]]),self.functionspace) | |
28927 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28928 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28929 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28930 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28931 | def test_tensor_mult_constData_rank4_array_rank3(self): | |
28932 | arg0=Data(numarray.array([[[[-5.0, -4.0, 7.0], [0.0, 5.0, -2.0]], [[1.0, 2.0, -7.0], [6.0, 0.0, 5.0]], [[-2.0, 5.0, 2.0], [6.0, 4.0, 5.0]], [[4.0, -4.0, 0.0], [2.0, 3.0, 0.0]], [[5.0, 4.0, -5.0], [-1.0, -5.0, 0.0]]], [[[5.0, 5.0, -7.0], [4.0, -7.0, -3.0]], [[2.0, 7.0, 5.0], [3.0, -3.0, -1.0]], [[3.0, -5.0, -1.0], [-3.0, 6.0, -5.0]], [[-5.0, -1.0, 2.0], [-7.0, 3.0, -2.0]], [[-4.0, 2.0, 6.0], [-6.0, 4.0, 2.0]]], [[[-5.0, 2.0, -4.0], [6.0, -1.0, -4.0]], [[-3.0, 0.0, 6.0], [-5.0, -3.0, -4.0]], [[4.0, 0.0, 7.0], [1.0, -1.0, 4.0]], [[7.0, 5.0, 6.0], [-4.0, 3.0, 1.0]], [[1.0, 0.0, -4.0], [0.0, -5.0, 5.0]]], [[[-3.0, 1.0, 4.0], [6.0, 6.0, 3.0]], [[-3.0, 5.0, 3.0], [-2.0, -6.0, 0.0]], [[3.0, 4.0, 7.0], [7.0, 5.0, -4.0]], [[-7.0, -6.0, -6.0], [-7.0, -6.0, 2.0]], [[6.0, 4.0, -3.0], [0.0, -7.0, -3.0]]]]),self.functionspace) | |
28933 | arg1=numarray.array([[[3.0, 6.0], [0.0, 7.0], [3.0, -4.0]], [[-6.0, -3.0], [-3.0, -2.0], [-1.0, -5.0]]]) | |
28934 | res=tensor_mult(arg0,arg1) | |
28935 | ref=Data(numarray.array([[[-7.0, -86.0], [-59.0, 5.0], [-53.0, -36.0], [-9.0, -16.0], [21.0, 91.0]], [[-6.0, 110.0], [13.0, 43.0], [11.0, 9.0], [26.0, -20.0], [28.0, -34.0]], [[-56.0, 4.0], [52.0, -1.0], [26.0, -25.0], [53.0, 54.0], [1.0, 7.0]], [[-54.0, -72.0], [30.0, 23.0], [-23.0, 7.0], [19.0, -37.0], [33.0, 105.0]]]),self.functionspace) | |
28936 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28937 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28938 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28939 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28940 | def test_tensor_mult_constData_rank4_array_rank4(self): | |
28941 | arg0=Data(numarray.array([[[[2.0, 6.0, -1.0], [-2.0, -2.0, -2.0]], [[-4.0, -6.0, 3.0], [1.0, 6.0, 0.0]], [[1.0, 2.0, -6.0], [-7.0, -5.0, -5.0]], [[5.0, 2.0, 6.0], [3.0, 0.0, -1.0]], [[-7.0, -1.0, 4.0], [1.0, -3.0, -5.0]]], [[[2.0, -6.0, -7.0], [-2.0, 5.0, 7.0]], [[6.0, -3.0, 6.0], [-2.0, -5.0, -4.0]], [[2.0, 7.0, -4.0], [-1.0, 6.0, -5.0]], [[0.0, -3.0, -7.0], [7.0, 0.0, -7.0]], [[-5.0, -5.0, -5.0], [0.0, -3.0, 6.0]]], [[[-6.0, -7.0, -3.0], [6.0, 3.0, 3.0]], [[-5.0, 6.0, -5.0], [3.0, -5.0, 6.0]], [[3.0, -3.0, -6.0], [-5.0, -6.0, -6.0]], [[-1.0, -3.0, 1.0], [-4.0, 1.0, 2.0]], [[6.0, -6.0, 1.0], [2.0, -6.0, 5.0]]], [[[6.0, 6.0, 5.0], [2.0, 6.0, 1.0]], [[6.0, -6.0, -1.0], [7.0, -4.0, 6.0]], [[-3.0, -2.0, 0.0], [5.0, 1.0, 0.0]], [[-3.0, 2.0, 4.0], [3.0, 4.0, -1.0]], [[-5.0, 0.0, 2.0], [1.0, 4.0, 0.0]]]]),self.functionspace) | |
28942 | arg1=numarray.array([[[[6.0, 0.0, -1.0, 6.0, -4.0], [-2.0, -4.0, 1.0, 1.0, -2.0], [0.0, -7.0, -1.0, 2.0, 6.0], [3.0, -3.0, -3.0, 4.0, 0.0]], [[-1.0, 6.0, 0.0, 3.0, 2.0], [0.0, 4.0, 5.0, 7.0, -5.0], [-4.0, 0.0, 7.0, 4.0, 2.0], [-5.0, 1.0, -6.0, 1.0, -7.0]], [[4.0, 6.0, -7.0, -4.0, -1.0], [-7.0, 6.0, 1.0, 7.0, 0.0], [-3.0, -4.0, -7.0, 1.0, 0.0], [1.0, -4.0, -5.0, 2.0, 3.0]]], [[[-5.0, 3.0, 1.0, 5.0, -1.0], [-1.0, 0.0, 0.0, 7.0, 7.0], [4.0, 0.0, 4.0, -7.0, -7.0], [-7.0, 5.0, 6.0, -5.0, -2.0]], [[-4.0, 7.0, 4.0, -3.0, -4.0], [-5.0, -3.0, 4.0, 0.0, 6.0], [6.0, -1.0, 0.0, 3.0, -7.0], [0.0, -7.0, -4.0, 4.0, 4.0]], [[6.0, -6.0, -6.0, 6.0, 0.0], [0.0, 6.0, -2.0, -1.0, -3.0], [-7.0, 2.0, -3.0, 1.0, -4.0], [-5.0, 3.0, 0.0, -6.0, -3.0]]]]) | |
28943 | res=tensor_mult(arg0,arg1) | |
28944 | ref=Data(numarray.array([[[[8.0, 22.0, 7.0, 18.0, 15.0], [15.0, 4.0, 27.0, 25.0, -54.0], [-27.0, -12.0, 45.0, 33.0, 60.0], [-1.0, 2.0, -41.0, 26.0, -43.0]], [[-35.0, 27.0, 8.0, -67.0, -24.0], [-44.0, -8.0, -7.0, -18.0, 81.0], [55.0, 10.0, -55.0, -18.0, -85.0], [14.0, -43.0, 15.0, 3.0, 73.0]], [[5.0, -50.0, 44.0, -14.0, 33.0], [72.0, -47.0, -5.0, -71.0, -76.0], [-13.0, 12.0, 42.0, 33.0, 114.0], [61.0, 8.0, -7.0, 39.0, -23.0]], [[31.0, 63.0, -38.0, 21.0, -25.0], [-55.0, 18.0, 23.0, 83.0, 4.0], [-7.0, -61.0, -18.0, 2.0, 17.0], [-5.0, -25.0, -39.0, 25.0, 1.0]], [[-48.0, 30.0, -2.0, -77.0, 33.0], [0.0, 27.0, -10.0, 26.0, 23.0], [13.0, 26.0, -9.0, -35.0, -10.0], [6.0, 15.0, 25.0, -8.0, 20.0]]], [[[22.0, -91.0, 23.0, 39.0, -31.0], [22.0, -47.0, -29.0, -110.0, 21.0], [18.0, 23.0, -24.0, 9.0, -49.0], [8.0, -8.0, 33.0, -24.0, 24.0]], [[69.0, 1.0, -46.0, -16.0, -14.0], [-27.0, -9.0, -15.0, 17.0, -29.0], [-16.0, -69.0, -65.0, 1.0, 95.0], [73.0, -32.0, -22.0, 47.0, 35.0]], [[-60.0, 87.0, 79.0, -4.0, -13.0], [-5.0, -52.0, 67.0, 21.0, 5.0], [51.0, -14.0, 86.0, 48.0, 11.0], [-1.0, -45.0, -58.0, 66.0, -20.0]], [[-102.0, 3.0, 98.0, 12.0, -6.0], [42.0, -96.0, -8.0, -14.0, 85.0], [110.0, 14.0, 77.0, -75.0, -27.0], [-6.0, 39.0, 95.0, -10.0, 7.0]], [[3.0, -117.0, -8.0, 20.0, 27.0], [60.0, 15.0, -59.0, -81.0, -1.0], [-25.0, 70.0, -13.0, -38.0, -43.0], [-25.0, 69.0, 82.0, -83.0, -10.0]]], [[[-65.0, -39.0, 27.0, -6.0, -5.0], [12.0, -13.0, -38.0, -37.0, 98.0], [58.0, 57.0, -7.0, -73.0, -125.0], [-43.0, 41.0, 99.0, -73.0, 31.0]], [[-15.0, -56.0, -13.0, 74.0, 54.0], [67.0, 65.0, -12.0, 17.0, -47.0], [-69.0, 72.0, 76.0, -21.0, -28.0], [-101.0, 109.0, 42.0, -95.0, -101.0]], [[10.0, -75.0, 46.0, -10.0, 17.0], [71.0, -78.0, -30.0, -89.0, -44.0], [16.0, -3.0, 16.0, -1.0, 113.0], [83.0, 11.0, 33.0, 34.0, 7.0]], [[29.0, -29.0, -18.0, -30.0, -3.0], [-6.0, 7.0, -15.0, -45.0, -11.0], [-15.0, 6.0, -49.0, 20.0, 1.0], [31.0, -25.0, -12.0, 7.0, 30.0]], [[90.0, -96.0, -65.0, 72.0, -15.0], [9.0, 6.0, -57.0, -20.0, -19.0], [-42.0, -30.0, -62.0, -38.0, 32.0], [10.0, 39.0, 49.0, -44.0, 2.0]]], [[[22.0, 108.0, -21.0, 32.0, -43.0], [-79.0, 18.0, 63.0, 96.0, 5.0], [-2.0, -66.0, 6.0, 46.0, -12.0], [-26.0, -61.0, -91.0, 48.0, -10.0]], [[55.0, -85.0, -44.0, 105.0, -26.0], [8.0, -6.0, -53.0, 0.0, 25.0], [-11.0, -22.0, -31.0, -68.0, -21.0], [-32.0, 61.0, 81.0, -71.0, -9.0]], [[-45.0, 10.0, 12.0, -2.0, -1.0], [-4.0, 1.0, -9.0, 18.0, 57.0], [34.0, 20.0, 9.0, -46.0, -64.0], [-34.0, 25.0, 47.0, -35.0, 8.0]], [[-41.0, 79.0, 0.0, -31.0, -7.0], [-45.0, 26.0, 29.0, 61.0, 44.0], [23.0, -1.0, 4.0, -4.0, -59.0], [-31.0, -21.0, -21.0, 5.0, 11.0]], [[-43.0, 43.0, 8.0, -45.0, 1.0], [-25.0, 20.0, 13.0, 16.0, 41.0], [22.0, 23.0, -5.0, -3.0, -65.0], [-20.0, -16.0, -5.0, -5.0, 20.0]]]]),self.functionspace) | |
28945 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28946 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28947 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28948 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28949 | def test_tensor_mult_constData_rank4_Symbol_rank2(self): | |
28950 | arg0=Data(numarray.array([[[[-5.0, 5.0, 7.0], [-3.0, -6.0, 0.0]], [[5.0, 0.0, 0.0], [3.0, -6.0, -3.0]], [[0.0, 4.0, 5.0], [3.0, 0.0, -3.0]], [[7.0, 3.0, -4.0], [3.0, 7.0, 5.0]], [[7.0, -5.0, -7.0], [0.0, 3.0, 0.0]]], [[[4.0, -6.0, 6.0], [-5.0, -4.0, -4.0]], [[4.0, 2.0, -3.0], [6.0, 1.0, 7.0]], [[0.0, -2.0, 4.0], [-1.0, 0.0, -1.0]], [[0.0, 5.0, 7.0], [-1.0, 1.0, -4.0]], [[3.0, -6.0, -6.0], [3.0, -3.0, 0.0]]], [[[7.0, 3.0, -6.0], [2.0, -2.0, 4.0]], [[-5.0, -3.0, 6.0], [1.0, 6.0, -7.0]], [[4.0, -5.0, 6.0], [-3.0, 2.0, -1.0]], [[-4.0, 1.0, 0.0], [-3.0, -5.0, 6.0]], [[4.0, 7.0, 0.0], [2.0, 2.0, -3.0]]], [[[-3.0, 7.0, -1.0], [-6.0, -1.0, -2.0]], [[0.0, -4.0, -5.0], [-6.0, -3.0, -5.0]], [[-7.0, -4.0, -7.0], [-7.0, -4.0, -1.0]], [[0.0, -3.0, -5.0], [2.0, 7.0, 2.0]], [[7.0, 7.0, -6.0], [0.0, 1.0, 6.0]]]]),self.functionspace) | |
28951 | arg1=Symbol(shape=(2, 3)) | |
28952 | res=tensor_mult(arg0,arg1) | |
28953 | s1=numarray.array([[3.0, -3.0, 2.0], [-1.0, 7.0, 0.0]]) | |
28954 | sub=res.substitute({arg1:s1}) | |
28955 | ref=Data(numarray.array([[-55.0, -30.0, -5.0, 50.0, 43.0], [19.0, 1.0, 15.0, 7.0, -9.0], [-16.0, 47.0, 56.0, -47.0, 3.0], [-33.0, -13.0, -44.0, 46.0, -5.0]]),self.functionspace) | |
28956 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28957 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28958 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28959 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28960 | def test_tensor_mult_constData_rank4_Symbol_rank3(self): | |
28961 | arg0=Data(numarray.array([[[[-4.0, 0.0, 0.0], [1.0, -3.0, 7.0]], [[5.0, 5.0, -4.0], [4.0, 6.0, 2.0]], [[0.0, 6.0, -1.0], [-1.0, 3.0, 1.0]], [[-7.0, 0.0, 1.0], [0.0, 5.0, -7.0]], [[-1.0, 5.0, 6.0], [-5.0, 4.0, -3.0]]], [[[1.0, -7.0, 1.0], [4.0, 0.0, 0.0]], [[-6.0, 7.0, -4.0], [0.0, 0.0, -5.0]], [[2.0, 0.0, -7.0], [-4.0, -5.0, -6.0]], [[4.0, -5.0, -3.0], [-7.0, -5.0, -6.0]], [[4.0, -6.0, -1.0], [5.0, 7.0, -3.0]]], [[[3.0, 0.0, -5.0], [0.0, 0.0, 1.0]], [[0.0, 0.0, -4.0], [0.0, -7.0, -3.0]], [[-3.0, 7.0, -3.0], [-5.0, 4.0, 1.0]], [[6.0, 1.0, 1.0], [-1.0, -6.0, -1.0]], [[6.0, -1.0, 4.0], [-5.0, -3.0, -2.0]]], [[[4.0, 6.0, 0.0], [3.0, 1.0, -1.0]], [[-6.0, 0.0, 5.0], [-6.0, 7.0, 7.0]], [[-3.0, 1.0, 7.0], [6.0, -6.0, 7.0]], [[-3.0, -7.0, -2.0], [7.0, -6.0, 3.0]], [[7.0, -5.0, 5.0], [-4.0, -4.0, 1.0]]]]),self.functionspace) | |
28962 | arg1=Symbol(shape=(2, 3, 2)) | |
28963 | res=tensor_mult(arg0,arg1) | |
28964 | s1=numarray.array([[[0.0, 4.0], [-5.0, 7.0], [-5.0, 7.0]], [[2.0, -6.0], [-4.0, -3.0], [4.0, -2.0]]]) | |
28965 | sub=res.substitute({arg1:s1}) | |
28966 | ref=Data(numarray.array([[[42.0, -27.0], [-13.0, -19.0], [-35.0, 30.0], [-53.0, -22.0], [-93.0, 97.0]], [[38.0, -62.0], [-35.0, 7.0], [23.0, 10.0], [22.0, 29.0], [5.0, -78.0]], [[29.0, -25.0], [36.0, -1.0], [-42.0, 32.0], [8.0, 64.0], [-21.0, 88.0]], [[-32.0, 39.0], [-37.0, 12.0], [24.0, 12.0], [95.0, -105.0], [12.0, 62.0]]]),self.functionspace) | |
28967 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28968 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28969 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28970 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28971 | def test_tensor_mult_constData_rank4_Symbol_rank4(self): | |
28972 | arg0=Data(numarray.array([[[[6.0, -5.0, 7.0], [-2.0, 2.0, 5.0]], [[-2.0, -4.0, 5.0], [0.0, 7.0, 5.0]], [[-2.0, 2.0, 6.0], [0.0, 1.0, 6.0]], [[-3.0, 4.0, -2.0], [0.0, 1.0, -7.0]], [[0.0, 1.0, 4.0], [1.0, -4.0, 3.0]]], [[[-6.0, 4.0, 3.0], [-5.0, 0.0, -7.0]], [[4.0, 3.0, -3.0], [-2.0, -7.0, -4.0]], [[5.0, 1.0, 7.0], [-7.0, -6.0, 2.0]], [[0.0, -5.0, -3.0], [-3.0, 4.0, 0.0]], [[5.0, 3.0, 6.0], [-2.0, 4.0, 0.0]]], [[[-2.0, 6.0, -6.0], [6.0, -2.0, 7.0]], [[-1.0, -4.0, -4.0], [-1.0, 5.0, 0.0]], [[-6.0, 1.0, 7.0], [1.0, 2.0, -4.0]], [[7.0, -5.0, 0.0], [-2.0, 1.0, -4.0]], [[-6.0, -4.0, 1.0], [-5.0, 3.0, 3.0]]], [[[-1.0, -2.0, -7.0], [3.0, 7.0, 1.0]], [[4.0, 7.0, 4.0], [6.0, 2.0, 7.0]], [[0.0, -6.0, 7.0], [0.0, 7.0, -1.0]], [[-6.0, 6.0, 5.0], [-7.0, -3.0, 5.0]], [[3.0, 2.0, -7.0], [-3.0, -3.0, 0.0]]]]),self.functionspace) | |
28973 | arg1=Symbol(shape=(2, 3, 4, 5)) | |
28974 | res=tensor_mult(arg0,arg1) | |
28975 | s1=numarray.array([[[[1.0, 2.0, 0.0, 2.0, 3.0], [1.0, -1.0, 2.0, -7.0, -4.0], [-6.0, 2.0, -7.0, -1.0, -5.0], [1.0, 3.0, -7.0, 0.0, -2.0]], [[-4.0, 1.0, 4.0, -3.0, 3.0], [2.0, -7.0, -6.0, 5.0, 7.0], [-2.0, 0.0, -4.0, -1.0, 4.0], [-7.0, -5.0, 4.0, 0.0, -1.0]], [[-5.0, 2.0, 4.0, -5.0, 1.0], [6.0, 4.0, 5.0, 2.0, 6.0], [3.0, -1.0, 2.0, 2.0, -5.0], [0.0, 6.0, -2.0, -5.0, 2.0]]], [[[0.0, -7.0, -1.0, -7.0, 6.0], [3.0, -4.0, 2.0, -3.0, -1.0], [3.0, 4.0, 3.0, 6.0, -2.0], [0.0, 2.0, 5.0, 0.0, -4.0]], [[0.0, 3.0, 7.0, -3.0, 5.0], [4.0, -4.0, -2.0, 0.0, 0.0], [7.0, -7.0, 5.0, 0.0, -5.0], [-1.0, 0.0, -3.0, 1.0, -1.0]], [[-4.0, 1.0, -5.0, 0.0, -3.0], [4.0, 7.0, -1.0, 7.0, 4.0], [0.0, -3.0, -4.0, 4.0, -1.0], [-7.0, -7.0, 6.0, 4.0, 0.0]]]]) | |
28976 | sub=res.substitute({arg1:s1}) | |
28977 | ref=Data(numarray.array([[[[-29.0, 46.0, -1.0, 0.0, -7.0], [60.0, 92.0, 64.0, -12.0, 5.0], [3.0, -32.0, -24.0, 21.0, -96.0], [4.0, 46.0, -62.0, -13.0, 13.0]], [[-31.0, 28.0, 28.0, -38.0, 7.0], [68.0, 57.0, 26.0, 39.0, 30.0], [84.0, -73.0, 55.0, 36.0, -71.0], [-16.0, 9.0, -3.0, 2.0, 11.0]], [[-64.0, 19.0, 9.0, -43.0, -7.0], [66.0, 50.0, 6.0, 78.0, 82.0], [33.0, -35.0, -1.0, 36.0, -23.0], [-59.0, -22.0, 43.0, -5.0, 13.0]], [[19.0, -10.0, 50.0, -11.0, 27.0], [-31.0, -86.0, -35.0, -12.0, 0.0], [11.0, 10.0, 34.0, -33.0, 43.0], [17.0, 8.0, -4.0, -17.0, -3.0]], [[-36.0, -7.0, -24.0, -18.0, -16.0], [25.0, 42.0, 21.0, 31.0, 42.0], [-15.0, 19.0, -25.0, 25.0, -1.0], [-24.0, 0.0, 31.0, -12.0, 7.0]]], [[[-9.0, 26.0, 68.0, -4.0, -12.0], [-23.0, -39.0, -24.0, 34.0, 47.0], [22.0, -14.0, 45.0, -50.0, 48.0], [15.0, 19.0, -15.0, -43.0, 34.0]], [[23.0, -6.0, -27.0, 49.0, -17.0], [-58.0, -29.0, -11.0, -41.0, -27.0], [-94.0, 64.0, -71.0, -41.0, 50.0], [18.0, 3.0, -23.0, -8.0, -2.0]], [[-42.0, 58.0, -13.0, 39.0, -53.0], [12.0, 82.0, 35.0, 19.0, 44.0], [-74.0, 11.0, -84.0, -26.0, -14.0], [-10.0, 24.0, -50.0, -33.0, 37.0]], [[35.0, 22.0, -1.0, 39.0, -16.0], [-21.0, 19.0, 1.0, -22.0, -50.0], [20.0, -37.0, 25.0, -19.0, -19.0], [31.0, 1.0, -41.0, 19.0, 7.0]], [[-37.0, 51.0, 66.0, -27.0, 38.0], [57.0, -10.0, 10.0, -2.0, 39.0], [4.0, -32.0, -21.0, -8.0, -59.0], [-20.0, 32.0, -57.0, -26.0, 3.0]]], [[[-24.0, -51.0, -55.0, -28.0, 11.0], [12.0, -31.0, -61.0, 63.0, 36.0], [-14.0, 19.0, -42.0, 48.0, 55.0], [-91.0, -109.0, 128.0, 56.0, -36.0]], [[35.0, 8.0, 4.0, 22.0, 0.0], [-16.0, -3.0, -10.0, -18.0, -47.0], [34.0, -37.0, 37.0, -9.0, -14.0], [22.0, -9.0, -21.0, 25.0, -3.0]], [[-29.0, -2.0, 65.0, -63.0, 20.0], [33.0, -13.0, 19.0, 30.0, 56.0], [72.0, -17.0, 81.0, 9.0, -9.0], [13.0, 49.0, 7.0, -49.0, 19.0]], [[43.0, 22.0, 9.0, 40.0, 11.0], [-21.0, 4.0, 42.0, -96.0, -77.0], [-31.0, 11.0, -14.0, -30.0, -52.0], [69.0, 70.0, -106.0, -15.0, -2.0]], [[-7.0, 33.0, -1.0, 21.0, -53.0], [1.0, 67.0, -2.0, 60.0, 19.0], [53.0, -63.0, 48.0, -6.0, 1.0], [-2.0, -23.0, 8.0, 10.0, 35.0]]], [[[38.0, -17.0, 5.0, -3.0, 34.0], [-6.0, -46.0, -34.0, -19.0, -51.0], [47.0, -35.0, 41.0, 11.0, -10.0], [-1.0, -36.0, 13.0, 46.0, -29.0]], [[-72.0, -6.0, 17.0, -81.0, 62.0], [96.0, -20.0, -13.0, 46.0, 79.0], [6.0, -7.0, -48.0, 61.0, -41.0], [-96.0, -36.0, 58.0, 10.0, -33.0]], [[-7.0, 28.0, 58.0, -38.0, 27.0], [54.0, 35.0, 58.0, -23.0, -4.0], [82.0, -53.0, 77.0, 16.0, -93.0], [42.0, 79.0, -65.0, -32.0, 13.0]], [[-75.0, 49.0, 5.0, 3.0, -67.0], [23.0, 59.0, -36.0, 138.0, 123.0], [-3.0, -39.0, -28.0, -12.0, 53.0], [-80.0, -67.0, 60.0, -8.0, 47.0]], [[30.0, 6.0, -38.0, 65.0, -25.0], [-56.0, -21.0, -41.0, -16.0, -37.0], [-73.0, 22.0, -67.0, -37.0, 49.0], [-8.0, -49.0, -5.0, 32.0, -7.0]]]]),self.functionspace) | |
28978 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
28979 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
28980 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28981 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28982 | def test_tensor_mult_constData_rank4_constData_rank2(self): | |
28983 | arg0=Data(numarray.array([[[[0.0, 6.0, -6.0], [0.0, 3.0, 7.0]], [[7.0, 0.0, 4.0], [-7.0, -6.0, -6.0]], [[5.0, -3.0, 2.0], [-5.0, -1.0, 4.0]], [[4.0, -3.0, 1.0], [0.0, -3.0, -2.0]], [[1.0, 5.0, -7.0], [4.0, 0.0, -1.0]]], [[[0.0, -2.0, 1.0], [-1.0, -3.0, 7.0]], [[0.0, 6.0, -3.0], [-7.0, 6.0, 3.0]], [[6.0, -1.0, 7.0], [-6.0, -5.0, 2.0]], [[6.0, 0.0, 0.0], [-7.0, -3.0, -4.0]], [[0.0, 1.0, 0.0], [-4.0, -5.0, -4.0]]], [[[3.0, 5.0, -2.0], [7.0, 3.0, -2.0]], [[-5.0, 0.0, 4.0], [-4.0, 5.0, 0.0]], [[3.0, -4.0, 5.0], [2.0, -1.0, 0.0]], [[-4.0, 0.0, 4.0], [5.0, 0.0, 4.0]], [[0.0, 6.0, -6.0], [-5.0, -7.0, -1.0]]], [[[1.0, -3.0, 0.0], [4.0, 4.0, 5.0]], [[-7.0, 1.0, -7.0], [3.0, 3.0, -3.0]], [[5.0, 5.0, -5.0], [0.0, 3.0, 0.0]], [[0.0, -6.0, -5.0], [-1.0, 6.0, 5.0]], [[-5.0, -4.0, -4.0], [4.0, 0.0, -6.0]]]]),self.functionspace) | |
28984 | arg1=Data(numarray.array([[-1.0, -6.0, -6.0], [0.0, 6.0, -7.0]]),self.functionspace) | |
28985 | res=tensor_mult(arg0,arg1) | |
28986 | ref=Data(numarray.array([[-31.0, -25.0, -33.0, 4.0, 18.0], [-61.0, -3.0, -86.0, 4.0, -8.0], [11.0, 11.0, -15.0, -48.0, -35.0], [6.0, 82.0, 13.0, 67.0, 95.0]]),self.functionspace) | |
28987 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28988 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
28989 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28990 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28991 | def test_tensor_mult_constData_rank4_constData_rank3(self): | |
28992 | arg0=Data(numarray.array([[[[-1.0, 2.0, -7.0], [-6.0, 2.0, 6.0]], [[0.0, 3.0, 6.0], [-6.0, 5.0, -3.0]], [[5.0, 5.0, -2.0], [2.0, 0.0, -2.0]], [[-1.0, 1.0, 5.0], [3.0, 1.0, -7.0]], [[-6.0, 0.0, -7.0], [-2.0, -2.0, 7.0]]], [[[-7.0, 4.0, 1.0], [1.0, 2.0, -2.0]], [[6.0, -5.0, -3.0], [1.0, 0.0, 7.0]], [[-4.0, 4.0, 2.0], [7.0, 0.0, 3.0]], [[-5.0, -7.0, 4.0], [-4.0, -5.0, 3.0]], [[0.0, 6.0, 5.0], [-2.0, 7.0, 3.0]]], [[[-2.0, 1.0, 3.0], [0.0, -6.0, -7.0]], [[7.0, -7.0, -6.0], [-2.0, 6.0, 3.0]], [[4.0, 2.0, -1.0], [1.0, 4.0, -4.0]], [[1.0, 0.0, -6.0], [0.0, -7.0, 0.0]], [[-6.0, 0.0, 1.0], [1.0, -6.0, -6.0]]], [[[-6.0, -4.0, 1.0], [-5.0, 4.0, -4.0]], [[-7.0, 3.0, 7.0], [7.0, 7.0, 0.0]], [[3.0, 3.0, -2.0], [-4.0, 0.0, 0.0]], [[5.0, 3.0, -4.0], [-2.0, -4.0, -6.0]], [[5.0, 1.0, 7.0], [-1.0, 7.0, 2.0]]]]),self.functionspace) | |
28993 | arg1=Data(numarray.array([[[0.0, -7.0], [4.0, 7.0], [5.0, 1.0]], [[-3.0, 1.0], [2.0, -6.0], [-3.0, 0.0]]]),self.functionspace) | |
28994 | res=tensor_mult(arg0,arg1) | |
28995 | ref=Data(numarray.array([[[-23.0, -4.0], [79.0, -9.0], [10.0, 0.0], [43.0, 16.0], [-54.0, 45.0]], [[28.0, 67.0], [-59.0, -79.0], [-4.0, 65.0], [-15.0, 16.0], [60.0, 3.0]], [[28.0, 60.0], [-49.0, -142.0], [20.0, -38.0], [-44.0, 29.0], [8.0, 80.0]], [[24.0, -14.0], [40.0, 42.0], [14.0, -6.0], [8.0, 4.0], [50.0, -64.0]]]),self.functionspace) | |
28996 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
28997 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
28998 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
28999 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29000 | def test_tensor_mult_constData_rank4_constData_rank4(self): | |
29001 | arg0=Data(numarray.array([[[[0.0, 1.0, -6.0], [-6.0, 6.0, -2.0]], [[5.0, -2.0, 0.0], [-7.0, 0.0, 4.0]], [[-3.0, -4.0, -6.0], [-7.0, -6.0, 2.0]], [[-4.0, -2.0, -7.0], [0.0, 6.0, 3.0]], [[-3.0, 3.0, -4.0], [0.0, 5.0, 4.0]]], [[[-5.0, 1.0, -6.0], [-4.0, 5.0, 4.0]], [[2.0, 7.0, 6.0], [-7.0, 0.0, -3.0]], [[-6.0, -6.0, 7.0], [-2.0, 6.0, 6.0]], [[-5.0, 7.0, 6.0], [0.0, 3.0, -7.0]], [[7.0, 5.0, -2.0], [1.0, -1.0, -1.0]]], [[[-2.0, 0.0, 6.0], [0.0, -3.0, 0.0]], [[0.0, 7.0, -1.0], [-6.0, 3.0, 2.0]], [[-3.0, 0.0, -2.0], [4.0, -5.0, 0.0]], [[-6.0, 3.0, 3.0], [0.0, 3.0, 6.0]], [[-2.0, 4.0, -2.0], [-4.0, -5.0, -7.0]]], [[[-4.0, 1.0, 0.0], [0.0, 3.0, 5.0]], [[5.0, 1.0, -7.0], [6.0, 0.0, 0.0]], [[-7.0, 3.0, 6.0], [-6.0, -2.0, 2.0]], [[0.0, -6.0, 6.0], [5.0, 7.0, 0.0]], [[-5.0, -4.0, -5.0], [6.0, -2.0, -5.0]]]]),self.functionspace) | |
29002 | arg1=Data(numarray.array([[[[-2.0, 7.0, 4.0, -6.0, 4.0], [3.0, 1.0, 7.0, 2.0, -5.0], [-6.0, -2.0, -2.0, 0.0, -1.0], [-3.0, -2.0, 1.0, -5.0, 6.0]], [[-1.0, 0.0, 6.0, 7.0, -1.0], [7.0, 0.0, -5.0, -6.0, 2.0], [-1.0, 2.0, -4.0, -2.0, 6.0], [7.0, -1.0, -4.0, 2.0, 4.0]], [[3.0, -6.0, 4.0, -3.0, -1.0], [0.0, 0.0, -3.0, -7.0, -6.0], [7.0, 3.0, 1.0, 2.0, -6.0], [-5.0, -2.0, 2.0, 0.0, 3.0]]], [[[1.0, -7.0, 0.0, -5.0, 6.0], [-5.0, -2.0, 4.0, -2.0, 4.0], [-5.0, -4.0, 2.0, 4.0, -7.0], [-5.0, 1.0, -3.0, -6.0, 6.0]], [[-3.0, 4.0, 2.0, -1.0, -1.0], [-3.0, -1.0, -3.0, 0.0, 5.0], [1.0, 7.0, -6.0, -5.0, 4.0], [5.0, -2.0, 4.0, 5.0, 2.0]], [[0.0, 7.0, 6.0, -4.0, 3.0], [6.0, -5.0, 0.0, 5.0, -2.0], [-4.0, -2.0, 3.0, -6.0, -1.0], [-4.0, 5.0, 0.0, -4.0, 4.0]]]]),self.functionspace) | |
29003 | res=tensor_mult(arg0,arg1) | |
29004 | ref=Data(numarray.array([[[[-43.0, 88.0, -18.0, 57.0, -43.0], [7.0, 16.0, -29.0, 38.0, 48.0], [1.0, 54.0, -64.0, -56.0, 110.0], [105.0, -17.0, 26.0, 76.0, -46.0]], [[-15.0, 112.0, 32.0, -25.0, -8.0], [60.0, -1.0, 17.0, 56.0, -65.0], [-9.0, 6.0, -4.0, -48.0, 28.0], [-10.0, 5.0, 34.0, -3.0, -4.0]], [[3.0, 54.0, -60.0, 41.0, -32.0], [28.0, 7.0, 7.0, 84.0, -19.0], [1.0, -38.0, 44.0, -14.0, 38.0], [8.0, 37.0, -2.0, 11.0, -98.0]], [[-29.0, 59.0, -26.0, 13.0, -4.0], [-26.0, -25.0, -15.0, 68.0, 82.0], [-29.0, 19.0, -18.0, -58.0, 55.0], [51.0, 27.0, 14.0, 34.0, -29.0]], [[-24.0, 51.0, 24.0, 30.0, -4.0], [21.0, -28.0, -39.0, 24.0, 62.0], [-24.0, 27.0, -28.0, -63.0, 61.0], [59.0, 21.0, -3.0, 30.0, 8.0]]], [[[-28.0, 77.0, -4.0, 54.0, -32.0], [21.0, -22.0, -53.0, 54.0, 64.0], [-4.0, 37.0, -26.0, -79.0, 91.0], [81.0, 27.0, 11.0, 60.0, -42.0]], [[0.0, 6.0, 56.0, 66.0, -56.0], [72.0, 31.0, -67.0, -81.0, -54.0], [70.0, 62.0, -49.0, -12.0, 56.0], [60.0, -45.0, 7.0, 58.0, 4.0]], [[19.0, -4.0, 16.0, -47.0, -25.0], [-32.0, -38.0, -59.0, 9.0, -14.0], [83.0, 59.0, 21.0, -48.0, -40.0], [-43.0, 20.0, 62.0, 36.0, -15.0]], [[12.0, -108.0, 10.0, 86.0, -57.0], [-17.0, 27.0, -97.0, -129.0, 32.0], [96.0, 77.0, -51.0, 25.0, 30.0], [77.0, -50.0, -9.0, 82.0, -6.0]], [[-21.0, 43.0, 42.0, -1.0, 29.0], [48.0, 11.0, 37.0, -9.0, -12.0], [-63.0, -19.0, -31.0, 1.0, 25.0], [18.0, -17.0, -24.0, -32.0, 56.0]]], [[[31.0, -62.0, 10.0, -3.0, -11.0], [3.0, 1.0, -23.0, -46.0, -41.0], [51.0, 1.0, 28.0, 27.0, -46.0], [-39.0, -2.0, -2.0, -5.0, 0.0]], [[-25.0, 74.0, 56.0, 71.0, -39.0], [82.0, -1.0, -65.0, -13.0, 7.0], [11.0, 52.0, -53.0, -67.0, 100.0], [91.0, -7.0, 0.0, 57.0, 3.0]], [[19.0, -57.0, -30.0, 9.0, 19.0], [-14.0, -6.0, 16.0, 0.0, 18.0], [-21.0, -51.0, 42.0, 37.0, -33.0], [-26.0, 24.0, -39.0, -34.0, -10.0]], [[9.0, -6.0, 48.0, 21.0, -15.0], [30.0, -39.0, -75.0, -21.0, 21.0], [33.0, 36.0, 3.0, -51.0, 12.0], [15.0, 27.0, 0.0, 27.0, 15.0]], [[5.0, -43.0, -44.0, 99.0, -50.0], [15.0, 46.0, -29.0, -41.0, 3.0], [37.0, 1.0, -13.0, 39.0, 53.0], [67.0, -25.0, -30.0, 45.0, -64.0]]], [[[-2.0, 19.0, 26.0, 8.0, -5.0], [16.0, -32.0, -42.0, 11.0, 27.0], [6.0, 21.0, 1.0, -47.0, 17.0], [14.0, 26.0, 4.0, 17.0, 6.0]], [[-26.0, 35.0, -2.0, -32.0, 62.0], [-8.0, -7.0, 75.0, 41.0, 43.0], [-110.0, -53.0, -9.0, 8.0, 1.0], [-3.0, 9.0, -31.0, -59.0, 49.0]], [[29.0, -37.0, 22.0, 69.0, -65.0], [48.0, -3.0, -100.0, -52.0, -33.0], [101.0, 44.0, 14.0, -20.0, 21.0], [24.0, 7.0, 3.0, 59.0, -44.0]], [[8.0, -43.0, 2.0, -92.0, 23.0], [-88.0, -17.0, 11.0, -16.0, 7.0], [30.0, 35.0, -2.0, 9.0, -79.0], [-62.0, -15.0, 49.0, -7.0, 38.0]], [[11.0, -90.0, -98.0, 9.0, 12.0], [-97.0, 10.0, 30.0, 12.0, 71.0], [-13.0, -41.0, 30.0, 62.0, -34.0], [-8.0, 9.0, -25.0, -9.0, -49.0]]]]),self.functionspace) | |
29005 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29006 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
29007 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29008 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29009 | def test_tensor_mult_constData_rank4_expandedData_rank2(self): | |
29010 | arg0=Data(numarray.array([[[[0.0, -5.0, -6.0], [3.0, 1.0, -4.0]], [[1.0, 7.0, -2.0], [0.0, 7.0, -4.0]], [[5.0, -6.0, -6.0], [-2.0, 1.0, 5.0]], [[1.0, 5.0, 6.0], [-4.0, -4.0, 0.0]], [[4.0, -7.0, 4.0], [-1.0, 3.0, 6.0]]], [[[2.0, 5.0, -1.0], [-6.0, 1.0, 2.0]], [[6.0, 2.0, 6.0], [5.0, 7.0, 4.0]], [[-7.0, 1.0, 6.0], [0.0, 6.0, 0.0]], [[-5.0, -3.0, 1.0], [7.0, 6.0, 2.0]], [[3.0, -3.0, -4.0], [-3.0, -7.0, -1.0]]], [[[-4.0, -4.0, 4.0], [0.0, -4.0, 0.0]], [[-2.0, 7.0, 4.0], [2.0, -7.0, -1.0]], [[2.0, 6.0, 1.0], [2.0, 0.0, 6.0]], [[-2.0, 0.0, -6.0], [1.0, 4.0, 3.0]], [[-6.0, 7.0, 6.0], [1.0, 3.0, -7.0]]], [[[-7.0, 0.0, 3.0], [-6.0, -5.0, -5.0]], [[-5.0, -5.0, 7.0], [-7.0, 6.0, -6.0]], [[-1.0, -3.0, 5.0], [-7.0, -6.0, -1.0]], [[7.0, 1.0, -2.0], [4.0, 0.0, 0.0]], [[-3.0, -4.0, 2.0], [-1.0, -3.0, 1.0]]]]),self.functionspace) | |
29011 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29012 | arg1=msk_arg1*numarray.array([[-5.0, 1.0, -3.0], [5.0, 4.0, 4.0]])+(1.-msk_arg1)*numarray.array([[-1.0, 0.0, 7.0], [0.0, -5.0, -2.0]]) | |
29013 | res=tensor_mult(arg0,arg1) | |
29014 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29015 | ref=msk_ref*numarray.array([[16.0, 20.0, 1.0, -54.0, -8.0], [-20.0, 23.0, 42.0, 86.0, -53.0], [-12.0, -17.0, 27.0, 61.0, 8.0], [-44.0, -36.0, -76.0, -8.0, -8.0]])+(1.-msk_ref)*numarray.array([[-39.0, -42.0, -62.0, 61.0, -3.0], [-18.0, -7.0, 19.0, -22.0, 6.0], [52.0, 67.0, -7.0, -66.0, 47.0], [63.0, 36.0, 68.0, -21.0, 30.0]]) | |
29016 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29017 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
29018 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29019 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29020 | def test_tensor_mult_constData_rank4_expandedData_rank3(self): | |
29021 | arg0=Data(numarray.array([[[[-2.0, 7.0, -3.0], [-5.0, -1.0, -4.0]], [[2.0, -2.0, 4.0], [-7.0, 2.0, -2.0]], [[-2.0, 0.0, 2.0], [-3.0, 5.0, 4.0]], [[0.0, 0.0, 2.0], [2.0, 0.0, -3.0]], [[6.0, 6.0, -6.0], [4.0, 6.0, -1.0]]], [[[-1.0, 0.0, 1.0], [-2.0, 7.0, 2.0]], [[-6.0, -3.0, 1.0], [0.0, 7.0, -5.0]], [[0.0, 2.0, -3.0], [0.0, -6.0, 3.0]], [[6.0, -3.0, 4.0], [2.0, -2.0, 3.0]], [[-6.0, -1.0, 1.0], [5.0, -3.0, -1.0]]], [[[5.0, -5.0, -1.0], [4.0, -5.0, -4.0]], [[-2.0, 4.0, 7.0], [-4.0, 0.0, 5.0]], [[5.0, 2.0, 1.0], [-7.0, -7.0, 2.0]], [[4.0, 6.0, 7.0], [-3.0, -1.0, -1.0]], [[2.0, 5.0, -4.0], [-7.0, 6.0, -6.0]]], [[[2.0, -4.0, -4.0], [-5.0, -7.0, 1.0]], [[-7.0, 3.0, 7.0], [-3.0, -6.0, 1.0]], [[-4.0, -7.0, -5.0], [-1.0, 1.0, 7.0]], [[-5.0, 4.0, 3.0], [-5.0, 1.0, 3.0]], [[6.0, -5.0, 0.0], [-1.0, -3.0, -6.0]]]]),self.functionspace) | |
29022 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29023 | arg1=msk_arg1*numarray.array([[[-2.0, -2.0], [-7.0, -3.0], [-5.0, 3.0]], [[0.0, -7.0], [-1.0, -4.0], [5.0, 1.0]]])+(1.-msk_arg1)*numarray.array([[[0.0, -5.0], [0.0, -7.0], [-5.0, -1.0]], [[3.0, 3.0], [0.0, 3.0], [2.0, 2.0]]]) | |
29024 | res=tensor_mult(arg0,arg1) | |
29025 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29026 | ref=msk_ref*numarray.array([[[-49.0, 9.0], [-22.0, 53.0], [9.0, 15.0], [-25.0, -11.0], [-35.0, -101.0]], [[0.0, -7.0], [-4.0, -9.0], [22.0, 12.0], [6.0, 6.0], [12.0, -6.0]], [[15.0, -10.0], [-34.0, 46.0], [-12.0, 66.0], [-89.0, 19.0], [-55.0, -12.0]], [[56.0, 60.0], [-31.0, 72.0], [116.0, 24.0], [-19.0, 41.0], [-4.0, 16.0]]])+(1.-msk_ref)*numarray.array([[[-8.0, -62.0], [-45.0, -19.0], [-11.0, 22.0], [-10.0, -2.0], [40.0, -38.0]], [[-7.0, 23.0], [-15.0, 61.0], [21.0, -23.0], [-8.0, -7.0], [8.0, 40.0]], [[9.0, 0.0], [-37.0, -27.0], [-22.0, -78.0], [-46.0, -83.0], [-13.0, -56.0]], [[7.0, -12.0], [-42.0, -18.0], [36.0, 88.0], [-24.0, -12.0], [-15.0, -19.0]]]) | |
29027 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29028 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
29029 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29030 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29031 | def test_tensor_mult_constData_rank4_expandedData_rank4(self): | |
29032 | arg0=Data(numarray.array([[[[-2.0, 0.0, -7.0], [-6.0, 0.0, 3.0]], [[-7.0, 0.0, -4.0], [-6.0, 5.0, 3.0]], [[6.0, 5.0, -3.0], [-7.0, -3.0, -4.0]], [[7.0, 0.0, 3.0], [0.0, 4.0, 6.0]], [[-5.0, 0.0, -1.0], [0.0, 0.0, -6.0]]], [[[-5.0, 1.0, 7.0], [-1.0, 1.0, -6.0]], [[6.0, -6.0, 1.0], [6.0, -3.0, -6.0]], [[-7.0, 6.0, -6.0], [-3.0, 0.0, -6.0]], [[0.0, 0.0, 7.0], [2.0, 0.0, -3.0]], [[-4.0, -5.0, 4.0], [-7.0, 2.0, -4.0]]], [[[4.0, -1.0, 0.0], [-3.0, 2.0, -4.0]], [[3.0, -2.0, -7.0], [3.0, 2.0, 5.0]], [[-3.0, 7.0, 4.0], [5.0, 0.0, -1.0]], [[2.0, 6.0, 5.0], [0.0, -6.0, 1.0]], [[-4.0, 4.0, 2.0], [-1.0, -4.0, -3.0]]], [[[4.0, -5.0, 5.0], [-3.0, -7.0, -3.0]], [[-6.0, -7.0, 5.0], [-6.0, 7.0, 1.0]], [[-2.0, 1.0, -7.0], [0.0, 5.0, 0.0]], [[3.0, 2.0, 1.0], [0.0, -2.0, 1.0]], [[-1.0, -1.0, 5.0], [7.0, 1.0, 3.0]]]]),self.functionspace) | |
29033 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29034 | arg1=msk_arg1*numarray.array([[[[-7.0, -4.0, -5.0, -6.0, -4.0], [0.0, 0.0, -5.0, 1.0, 6.0], [7.0, -1.0, -5.0, 4.0, 5.0], [-5.0, 5.0, 0.0, 1.0, -3.0]], [[3.0, 1.0, 3.0, 4.0, -5.0], [5.0, 7.0, -2.0, -1.0, 0.0], [-5.0, -3.0, -5.0, 6.0, 3.0], [6.0, -5.0, 0.0, -4.0, 0.0]], [[6.0, -1.0, -4.0, -6.0, 1.0], [-1.0, -3.0, 2.0, -7.0, -4.0], [0.0, -2.0, 7.0, 5.0, 1.0], [4.0, 0.0, 0.0, 6.0, 4.0]]], [[[6.0, -2.0, 7.0, 1.0, -1.0], [-7.0, -5.0, 3.0, 4.0, 0.0], [-7.0, 4.0, -4.0, 0.0, 0.0], [0.0, -6.0, -7.0, -2.0, 1.0]], [[0.0, 0.0, 2.0, 0.0, 2.0], [4.0, -5.0, 3.0, 2.0, 0.0], [1.0, -3.0, -4.0, -2.0, 2.0], [6.0, -3.0, 6.0, -7.0, 5.0]], [[-4.0, -2.0, -7.0, -4.0, -1.0], [-1.0, 5.0, 0.0, -2.0, -1.0], [4.0, 0.0, 4.0, 4.0, -5.0], [0.0, -1.0, 4.0, 1.0, 6.0]]]])+(1.-msk_arg1)*numarray.array([[[[-7.0, 7.0, 3.0, 3.0, -6.0], [2.0, 6.0, -4.0, 0.0, -4.0], [-7.0, 7.0, 2.0, 5.0, -3.0], [-6.0, 1.0, -3.0, -7.0, 5.0]], [[5.0, -5.0, 0.0, 5.0, -3.0], [-4.0, 5.0, 6.0, 4.0, -7.0], [-6.0, 3.0, 6.0, 5.0, 2.0], [-1.0, 3.0, -4.0, 5.0, 0.0]], [[0.0, 6.0, 0.0, -1.0, 6.0], [-6.0, -1.0, 2.0, -1.0, 6.0], [3.0, 1.0, 1.0, -1.0, 2.0], [-3.0, -2.0, -4.0, 1.0, 3.0]]], [[[4.0, -6.0, 2.0, 2.0, 7.0], [-4.0, -3.0, 7.0, -5.0, 1.0], [4.0, -7.0, 4.0, 5.0, -4.0], [3.0, 1.0, -5.0, -7.0, -6.0]], [[-7.0, -3.0, -6.0, -2.0, 1.0], [0.0, 0.0, 0.0, 2.0, -1.0], [5.0, 3.0, 7.0, 6.0, 1.0], [-6.0, 5.0, -5.0, -2.0, -2.0]], [[-2.0, -6.0, -5.0, -7.0, -5.0], [0.0, -2.0, -1.0, 6.0, 5.0], [6.0, -6.0, 0.0, 7.0, -2.0], [1.0, -5.0, 2.0, -5.0, -6.0]]]]) | |
29035 | res=tensor_mult(arg0,arg1) | |
29036 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29037 | ref=msk_ref*numarray.array([[[[-76.0, 21.0, -25.0, 36.0, 4.0], [46.0, 66.0, -22.0, 17.0, 13.0], [40.0, -8.0, -3.0, -31.0, -32.0], [-18.0, 23.0, 54.0, -29.0, -10.0]], [[-23.0, 38.0, -2.0, 48.0, 37.0], [63.0, 32.0, 24.0, 1.0, -29.0], [10.0, -24.0, 23.0, -46.0, -44.0], [49.0, -17.0, 84.0, -51.0, 42.0]], [[-71.0, 6.0, -30.0, 11.0, -47.0], [69.0, 74.0, -76.0, -4.0, 52.0], [47.0, -34.0, -52.0, 29.0, 56.0], [-30.0, 60.0, 15.0, -1.0, -76.0]], [[-55.0, -43.0, -81.0, -84.0, -23.0], [7.0, 1.0, -17.0, -18.0, 24.0], [77.0, -25.0, -6.0, 59.0, 16.0], [1.0, 17.0, 48.0, 3.0, 47.0]], [[53.0, 33.0, 71.0, 60.0, 25.0], [7.0, -27.0, 23.0, 14.0, -20.0], [-59.0, 7.0, -6.0, -49.0, 4.0], [21.0, -19.0, -24.0, -17.0, -25.0]]], [[[98.0, 28.0, 37.0, 15.0, 31.0], [15.0, -44.0, 37.0, -45.0, -52.0], [-56.0, -19.0, 45.0, -5.0, 17.0], [65.0, -21.0, -11.0, 22.0, 11.0]], [[6.0, -31.0, 26.0, -36.0, 1.0], [-79.0, -90.0, -7.0, 35.0, 38.0], [3.0, 43.0, -29.0, -25.0, 37.0], [-80.0, 39.0, -84.0, 39.0, -59.0]], [[37.0, 58.0, 98.0, 123.0, 1.0], [63.0, 45.0, 2.0, 29.0, -12.0], [-82.0, -11.0, -49.0, -46.0, 7.0], [47.0, -41.0, -3.0, -67.0, -42.0]], [[66.0, -5.0, 7.0, -28.0, 8.0], [-18.0, -46.0, 20.0, -35.0, -25.0], [-26.0, -6.0, 29.0, 23.0, 22.0], [28.0, -9.0, -26.0, 35.0, 12.0]], [[11.0, 29.0, -28.0, -11.0, 60.0], [32.0, -42.0, 23.0, -43.0, -36.0], [32.0, -23.0, 77.0, -46.0, -7.0], [18.0, 45.0, 45.0, 36.0, 7.0]]], [[[-33.0, -3.0, -12.0, -15.0, 0.0], [28.0, -22.0, -21.0, 5.0, 28.0], [40.0, -19.0, -27.0, -10.0, 41.0], [-14.0, 41.0, 17.0, -4.0, -29.0]], [[-71.0, -23.0, -3.0, -1.0, -13.0], [-21.0, 7.0, -10.0, 60.0, 41.0], [32.0, 23.0, -54.0, -19.0, -19.0], [-43.0, -4.0, 11.0, -46.0, 6.0]], [[100.0, 7.0, 62.0, 31.0, -23.0], [-3.0, 7.0, 24.0, -16.0, -33.0], [-95.0, -6.0, -16.0, 46.0, 15.0], [73.0, -79.0, -39.0, -18.0, 24.0]], [[30.0, -9.0, -31.0, -22.0, -46.0], [0.0, 62.0, -30.0, -53.0, -9.0], [-18.0, -12.0, 23.0, 85.0, 16.0], [10.0, -3.0, -32.0, 51.0, -10.0]], [[58.0, 26.0, 30.0, 39.0, -6.0], [12.0, 32.0, 1.0, -28.0, -29.0], [-57.0, -4.0, 22.0, 14.0, 1.0], [28.0, -19.0, -29.0, 19.0, -19.0]]], [[[-19.0, -14.0, -69.0, -65.0, 6.0], [-34.0, -15.0, -30.0, -46.0, 7.0], [55.0, 10.0, 68.0, 13.0, 11.0], [-72.0, 87.0, -33.0, 106.0, -48.0]], [[11.0, 22.0, -46.0, -32.0, 83.0], [29.0, -64.0, 57.0, -46.0, -57.0], [46.0, -28.0, 100.0, -51.0, -37.0], [50.0, 19.0, 88.0, 16.0, 73.0]], [[-25.0, 16.0, 51.0, 58.0, 6.0], [32.0, 3.0, 9.0, 56.0, 16.0], [-14.0, -2.0, -64.0, -47.0, -4.0], [18.0, -30.0, 30.0, -83.0, 3.0]], [[-13.0, -13.0, -24.0, -20.0, -26.0], [0.0, 26.0, -23.0, -12.0, 13.0], [13.0, -5.0, -6.0, 37.0, 13.0], [-11.0, 10.0, -8.0, 16.0, -9.0]], [[64.0, -22.0, 12.0, -33.0, 6.0], [-58.0, -47.0, 41.0, -11.0, -29.0], [-38.0, 19.0, 25.0, 25.0, -16.0], [25.0, -48.0, -31.0, 15.0, 53.0]]]])+(1.-msk_ref)*numarray.array([[[[-16.0, -38.0, -33.0, -32.0, -87.0], [62.0, 7.0, -51.0, 55.0, -25.0], [-13.0, 3.0, -35.0, -12.0, 10.0], [18.0, -9.0, 70.0, 34.0, -13.0]], [[-16.0, -70.0, -78.0, -60.0, -34.0], [34.0, -26.0, -25.0, 62.0, 8.0], [56.0, -14.0, -7.0, -10.0, 36.0], [9.0, 5.0, 48.0, 62.0, -39.0]], [[-16.0, 74.0, 42.0, 66.0, -101.0], [38.0, 93.0, -45.0, 28.0, -101.0], [-148.0, 118.0, -10.0, -23.0, 19.0], [-39.0, 25.0, 16.0, 55.0, 93.0]], [[-89.0, 19.0, -33.0, -32.0, -50.0], [-4.0, 27.0, -28.0, 41.0, 16.0], [16.0, 28.0, 45.0, 98.0, -23.0], [-69.0, -9.0, -41.0, -84.0, 0.0]], [[47.0, -5.0, 15.0, 28.0, 54.0], [-4.0, -17.0, 24.0, -35.0, -16.0], [-4.0, 0.0, -11.0, -66.0, 25.0], [27.0, 27.0, 7.0, 64.0, 8.0]]], [[[41.0, 41.0, 7.0, 21.0, 93.0], [-52.0, -17.0, 39.0, -32.0, 23.0], [15.0, 21.0, 6.0, -68.0, 48.0], [-7.0, 18.0, -29.0, 82.0, 36.0]], [[-15.0, 87.0, 78.0, 47.0, 57.0], [6.0, -1.0, -10.0, -97.0, 3.0], [-30.0, 10.0, -20.0, -31.0, -43.0], [-3.0, 7.0, -25.0, -77.0, 39.0]], [[79.0, -61.0, 3.0, 51.0, -3.0], [10.0, 15.0, 37.0, 9.0, -83.0], [-53.0, 20.0, 4.0, -56.0, 45.0], [39.0, 50.0, 24.0, 124.0, 1.0]], [[14.0, 48.0, 19.0, 18.0, 71.0], [-50.0, -7.0, 31.0, -35.0, 29.0], [11.0, 11.0, 15.0, -18.0, 12.0], [-18.0, 3.0, -44.0, 8.0, 27.0]], [[-31.0, 81.0, -18.0, -31.0, 36.0], [16.0, -24.0, -51.0, -9.0, 46.0], [28.0, 40.0, -48.0, -100.0, 48.0], [-20.0, -4.0, 33.0, 72.0, 54.0]]], [[[-51.0, 69.0, 14.0, 25.0, -20.0], [24.0, 36.0, -39.0, -9.0, -34.0], [-48.0, 76.0, 4.0, -16.0, 8.0], [-48.0, 28.0, -11.0, 4.0, 58.0]], [[-43.0, -65.0, -22.0, -27.0, -56.0], [44.0, -4.0, -22.0, 18.0, -14.0], [22.0, -37.0, 13.0, 74.0, -47.0], [7.0, -1.0, 12.0, -88.0, -58.0]], [[78.0, -56.0, 6.0, 39.0, 61.0], [-78.0, 0.0, 98.0, -7.0, -13.0], [5.0, -25.0, 60.0, 34.0, 13.0], [13.0, 20.0, -62.0, 30.0, -27.0]], [[56.0, 26.0, 37.0, 36.0, -11.0], [-50.0, 35.0, 37.0, 13.0, -9.0], [-59.0, 13.0, 3.0, 6.0, 8.0], [4.0, -25.0, -18.0, 28.0, 31.0]], [[78.0, 0.0, 25.0, 33.0, 28.0], [-32.0, 3.0, 40.0, -7.0, -12.0], [-32.0, -1.0, -14.0, -52.0, 30.0], [32.0, -2.0, 7.0, 80.0, 18.0]]], [[[-10.0, 140.0, 63.0, 11.0, 8.0], [10.0, 9.0, -54.0, -42.0, 38.0], [-48.0, 36.0, -78.0, -88.0, -1.0], [-4.0, -44.0, 32.0, 2.0, 85.0]], [[-68.0, 32.0, -77.0, -91.0, 47.0], [10.0, -60.0, -51.0, 17.0, 95.0], [116.0, -1.0, -24.0, -51.0, 43.0], [-31.0, -13.0, 23.0, 35.0, 1.0]], [[-16.0, -76.0, -36.0, -4.0, -28.0], [34.0, 0.0, 0.0, 21.0, -46.0], [12.0, -3.0, 30.0, 32.0, -1.0], [2.0, 40.0, 5.0, 2.0, -41.0]], [[1.0, 17.0, 16.0, 15.0, -25.0], [-8.0, 25.0, 1.0, 9.0, -13.0], [-34.0, 16.0, 5.0, 19.0, -7.0], [-10.0, -8.0, -9.0, -11.0, 16.0]], [[17.0, -35.0, -10.0, -22.0, 74.0], [-56.0, -43.0, 54.0, -24.0, 62.0], [79.0, -69.0, 32.0, 47.0, -22.0], [10.0, -17.0, -47.0, -59.0, -52.0]]]]) | |
29038 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29039 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
29040 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29041 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29042 | def test_tensor_mult_expandedData_rank2_array_rank1(self): | |
29043 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29044 | arg0=msk_arg0*numarray.array([[-4.0, 1.0, 0.0], [7.0, 7.0, -2.0]])+(1.-msk_arg0)*numarray.array([[-4.0, 3.0, -1.0], [0.0, -5.0, -2.0]]) | |
29045 | arg1=numarray.array([-1.0, 5.0, 0.0]) | |
29046 | res=tensor_mult(arg0,arg1) | |
29047 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29048 | ref=msk_ref*numarray.array([9.0, 28.0])+(1.-msk_ref)*numarray.array([19.0, -25.0]) | |
29049 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29050 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
29051 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29052 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29053 | def test_tensor_mult_expandedData_rank2_array_rank2(self): | |
29054 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29055 | arg0=msk_arg0*numarray.array([[-6.0, -5.0, 5.0], [7.0, -2.0, 0.0]])+(1.-msk_arg0)*numarray.array([[1.0, -2.0, -1.0], [6.0, 2.0, 0.0]]) | |
29056 | arg1=numarray.array([[1.0, 6.0], [-5.0, 3.0], [0.0, 6.0]]) | |
29057 | res=tensor_mult(arg0,arg1) | |
29058 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29059 | ref=msk_ref*numarray.array([[19.0, -21.0], [17.0, 36.0]])+(1.-msk_ref)*numarray.array([[11.0, -6.0], [-4.0, 42.0]]) | |
29060 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29061 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
29062 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29063 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29064 | def test_tensor_mult_expandedData_rank2_Symbol_rank1(self): | |
29065 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29066 | arg0=msk_arg0*numarray.array([[6.0, 6.0, -2.0], [-1.0, -6.0, -1.0]])+(1.-msk_arg0)*numarray.array([[1.0, -7.0, -1.0], [7.0, 3.0, -7.0]]) | |
29067 | arg1=Symbol(shape=(3,)) | |
29068 | res=tensor_mult(arg0,arg1) | |
29069 | s1=numarray.array([-3.0, 0.0, 5.0]) | |
29070 | sub=res.substitute({arg1:s1}) | |
29071 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29072 | ref=msk_ref*numarray.array([-28.0, -2.0])+(1.-msk_ref)*numarray.array([-8.0, -56.0]) | |
29073 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
29074 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
29075 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29076 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29077 | def test_tensor_mult_expandedData_rank2_Symbol_rank2(self): | |
29078 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29079 | arg0=msk_arg0*numarray.array([[0.0, -2.0, -6.0], [-2.0, 0.0, 1.0]])+(1.-msk_arg0)*numarray.array([[-6.0, 7.0, 1.0], [-7.0, -2.0, -1.0]]) | |
29080 | arg1=Symbol(shape=(3, 2)) | |
29081 | res=tensor_mult(arg0,arg1) | |
29082 | s1=numarray.array([[-1.0, 7.0], [-1.0, 0.0], [-5.0, 1.0]]) | |
29083 | sub=res.substitute({arg1:s1}) | |
29084 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29085 | ref=msk_ref*numarray.array([[32.0, -6.0], [-3.0, -13.0]])+(1.-msk_ref)*numarray.array([[-6.0, -41.0], [14.0, -50.0]]) | |
29086 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
29087 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
29088 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29089 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29090 | def test_tensor_mult_expandedData_rank2_constData_rank1(self): | |
29091 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29092 | arg0=msk_arg0*numarray.array([[2.0, -5.0, 5.0], [-4.0, -7.0, 6.0]])+(1.-msk_arg0)*numarray.array([[5.0, -2.0, -3.0], [5.0, -4.0, -6.0]]) | |
29093 | arg1=Data(numarray.array([2.0, 1.0, 6.0]),self.functionspace) | |
29094 | res=tensor_mult(arg0,arg1) | |
29095 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29096 | ref=msk_ref*numarray.array([29.0, 21.0])+(1.-msk_ref)*numarray.array([-10.0, -30.0]) | |
29097 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29098 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
29099 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29100 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29101 | def test_tensor_mult_expandedData_rank2_constData_rank2(self): | |
29102 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29103 | arg0=msk_arg0*numarray.array([[-4.0, 1.0, -7.0], [-1.0, -4.0, 3.0]])+(1.-msk_arg0)*numarray.array([[0.0, -2.0, -4.0], [5.0, -5.0, -3.0]]) | |
29104 | arg1=Data(numarray.array([[5.0, -6.0], [-7.0, 5.0], [0.0, 0.0]]),self.functionspace) | |
29105 | res=tensor_mult(arg0,arg1) | |
29106 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29107 | ref=msk_ref*numarray.array([[-27.0, 29.0], [23.0, -14.0]])+(1.-msk_ref)*numarray.array([[14.0, -10.0], [60.0, -55.0]]) | |
29108 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29109 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
29110 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29111 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29112 | def test_tensor_mult_expandedData_rank2_expandedData_rank1(self): | |
29113 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29114 | arg0=msk_arg0*numarray.array([[4.0, 0.0, 2.0], [2.0, 2.0, 5.0]])+(1.-msk_arg0)*numarray.array([[5.0, 2.0, 3.0], [5.0, 5.0, 7.0]]) | |
29115 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29116 | arg1=msk_arg1*numarray.array([1.0, 0.0, 6.0])+(1.-msk_arg1)*numarray.array([-2.0, -2.0, 1.0]) | |
29117 | res=tensor_mult(arg0,arg1) | |
29118 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29119 | ref=msk_ref*numarray.array([16.0, 32.0])+(1.-msk_ref)*numarray.array([-11.0, -13.0]) | |
29120 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29121 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | |
29122 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29123 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29124 | def test_tensor_mult_expandedData_rank2_expandedData_rank2(self): | |
29125 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29126 | arg0=msk_arg0*numarray.array([[4.0, -4.0, -6.0], [2.0, 0.0, -5.0]])+(1.-msk_arg0)*numarray.array([[-6.0, -6.0, -3.0], [-7.0, -2.0, -2.0]]) | |
29127 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29128 | arg1=msk_arg1*numarray.array([[2.0, 2.0], [0.0, 4.0], [3.0, -2.0]])+(1.-msk_arg1)*numarray.array([[2.0, 1.0], [-7.0, 1.0], [-7.0, 5.0]]) | |
29129 | res=tensor_mult(arg0,arg1) | |
29130 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29131 | ref=msk_ref*numarray.array([[-10.0, 4.0], [-11.0, 14.0]])+(1.-msk_ref)*numarray.array([[51.0, -27.0], [14.0, -19.0]]) | |
29132 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29133 | self.failUnlessEqual(res.getShape(),(2, 2),"wrong shape of result.") | |
29134 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29135 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29136 | def test_tensor_mult_expandedData_rank4_array_rank2(self): | |
29137 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29138 | arg0=msk_arg0*numarray.array([[[[-7.0, -7.0, 3.0], [7.0, -2.0, -6.0]], [[0.0, -1.0, -7.0], [4.0, 1.0, 7.0]], [[0.0, -7.0, 5.0], [-5.0, 0.0, 3.0]], [[-6.0, 4.0, -6.0], [4.0, -6.0, 0.0]], [[-2.0, 6.0, 0.0], [1.0, 0.0, -7.0]]], [[[1.0, -1.0, 1.0], [3.0, -2.0, 6.0]], [[-5.0, 1.0, -3.0], [0.0, -6.0, 5.0]], [[2.0, 4.0, -4.0], [-7.0, -5.0, 0.0]], [[6.0, 1.0, -5.0], [6.0, -4.0, 3.0]], [[-1.0, -7.0, 7.0], [-3.0, 1.0, 4.0]]], [[[-7.0, -6.0, 3.0], [-2.0, -4.0, 0.0]], [[4.0, -5.0, -6.0], [3.0, -2.0, 0.0]], [[2.0, 3.0, -7.0], [5.0, 0.0, 7.0]], [[-2.0, -6.0, 6.0], [-4.0, 6.0, -2.0]], [[7.0, 0.0, -5.0], [-4.0, 3.0, 1.0]]], [[[1.0, -3.0, -4.0], [2.0, 2.0, -1.0]], [[5.0, 5.0, 1.0], [7.0, 0.0, 7.0]], [[-2.0, 7.0, -7.0], [-7.0, 3.0, 3.0]], [[0.0, -3.0, 1.0], [3.0, 2.0, -2.0]], [[-1.0, 5.0, -3.0], [7.0, -4.0, 2.0]]]])+(1.-msk_arg0)*numarray.array([[[[-5.0, -7.0, -2.0], [0.0, -4.0, 4.0]], [[2.0, 6.0, -5.0], [0.0, 0.0, 2.0]], [[4.0, 0.0, 0.0], [0.0, 7.0, -1.0]], [[-1.0, 5.0, 5.0], [-6.0, -1.0, 4.0]], [[0.0, -7.0, -4.0], [2.0, -7.0, -6.0]]], [[[0.0, 5.0, 0.0], [-1.0, 6.0, 3.0]], [[4.0, -6.0, -4.0], [3.0, 2.0, 3.0]], [[2.0, 0.0, 2.0], [1.0, 2.0, 4.0]], [[4.0, -3.0, -3.0], [6.0, -6.0, -7.0]], [[2.0, -3.0, 1.0], [2.0, -6.0, 7.0]]], [[[6.0, 0.0, 6.0], [-2.0, 0.0, -3.0]], [[3.0, 5.0, -5.0], [6.0, 0.0, -4.0]], [[5.0, 1.0, 1.0], [-2.0, 5.0, -4.0]], [[-2.0, -5.0, 0.0], [5.0, -6.0, 7.0]], [[-1.0, 2.0, -5.0], [6.0, 4.0, 0.0]]], [[[4.0, 7.0, 6.0], [-3.0, 1.0, 7.0]], [[5.0, 0.0, 7.0], [-1.0, 5.0, 0.0]], [[-6.0, -1.0, 7.0], [-7.0, -4.0, 0.0]], [[2.0, 3.0, 2.0], [3.0, 3.0, -1.0]], [[7.0, 3.0, 7.0], [-7.0, 1.0, 0.0]]]]) | |
29139 | arg1=numarray.array([[1.0, -7.0, -1.0], [3.0, 1.0, -6.0]]) | |
29140 | res=tensor_mult(arg0,arg1) | |
29141 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29142 | ref=msk_ref*numarray.array([[94.0, -15.0, 11.0, -22.0, 1.0], [-22.0, -45.0, -48.0, 0.0, 9.0], [22.0, 52.0, -39.0, 40.0, -3.0], [40.0, -52.0, -80.0, 43.0, -28.0]])+(1.-msk_ref)*numarray.array([[18.0, -47.0, 17.0, -84.0, 88.0], [-50.0, 43.0, -19.0, 82.0, -20.0], [12.0, 15.0, 20.0, 0.0, 12.0], [-101.0, 0.0, -31.0, -3.0, -41.0]]) | |
29143 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29144 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
29145 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29146 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29147 | def test_tensor_mult_expandedData_rank4_array_rank3(self): | |
29148 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29149 | arg0=msk_arg0*numarray.array([[[[3.0, 5.0, 6.0], [5.0, -2.0, 0.0]], [[-6.0, -5.0, 1.0], [4.0, -1.0, 3.0]], [[6.0, -3.0, -7.0], [7.0, 3.0, 7.0]], [[0.0, 0.0, 2.0], [-5.0, -4.0, 7.0]], [[-5.0, 3.0, -1.0], [1.0, 0.0, -5.0]]], [[[0.0, -6.0, 0.0], [-2.0, 4.0, -1.0]], [[4.0, -4.0, 3.0], [-1.0, 3.0, -6.0]], [[-1.0, 5.0, 3.0], [5.0, -4.0, -1.0]], [[7.0, -6.0, 2.0], [6.0, -1.0, 4.0]], [[0.0, -1.0, -2.0], [-4.0, -4.0, 0.0]]], [[[-2.0, 5.0, -2.0], [-1.0, 6.0, -7.0]], [[-7.0, 0.0, -1.0], [4.0, 3.0, -3.0]], [[-1.0, 2.0, 7.0], [6.0, -7.0, 3.0]], [[1.0, 7.0, -5.0], [5.0, 7.0, -1.0]], [[1.0, 3.0, -3.0], [-7.0, -2.0, 1.0]]], [[[6.0, 4.0, 0.0], [1.0, 5.0, 5.0]], [[-2.0, -1.0, -5.0], [-4.0, 5.0, 3.0]], [[7.0, 0.0, 0.0], [3.0, -6.0, -6.0]], [[4.0, 0.0, 4.0], [-4.0, -6.0, 0.0]], [[1.0, 0.0, -4.0], [-3.0, 5.0, -4.0]]]])+(1.-msk_arg0)*numarray.array([[[[0.0, -7.0, 5.0], [-4.0, 6.0, -3.0]], [[5.0, -5.0, -4.0], [6.0, -7.0, -3.0]], [[7.0, 2.0, 0.0], [0.0, -3.0, 2.0]], [[0.0, -1.0, 7.0], [4.0, 0.0, 3.0]], [[-4.0, -2.0, -6.0], [7.0, -1.0, -7.0]]], [[[-4.0, -4.0, 1.0], [-5.0, -3.0, -1.0]], [[-1.0, 6.0, -6.0], [5.0, 5.0, 1.0]], [[6.0, 4.0, -1.0], [-1.0, 3.0, 5.0]], [[-6.0, -6.0, -5.0], [0.0, 0.0, -3.0]], [[4.0, -4.0, -1.0], [0.0, -5.0, 0.0]]], [[[-5.0, 2.0, 6.0], [5.0, -4.0, 2.0]], [[6.0, -3.0, 2.0], [4.0, 1.0, 6.0]], [[-6.0, -4.0, 5.0], [-5.0, 7.0, 2.0]], [[2.0, 4.0, -7.0], [6.0, 1.0, 5.0]], [[-6.0, 5.0, -6.0], [3.0, 4.0, -6.0]]], [[[-3.0, -6.0, -6.0], [-3.0, -6.0, 0.0]], [[-2.0, -5.0, -6.0], [-4.0, -1.0, 5.0]], [[3.0, 5.0, 3.0], [-3.0, 3.0, 7.0]], [[6.0, 3.0, -6.0], [-4.0, 7.0, 3.0]], [[-6.0, 5.0, 5.0], [0.0, -5.0, 5.0]]]]) | |
29150 | arg1=numarray.array([[[7.0, -4.0], [5.0, 2.0], [-6.0, 7.0]], [[5.0, -2.0], [-3.0, 7.0], [-5.0, 0.0]]]) | |
29151 | res=tensor_mult(arg0,arg1) | |
29152 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29153 | ref=msk_ref*numarray.array([[[41.0, 16.0], [-65.0, 6.0], [60.0, -72.0], [-60.0, -4.0], [16.0, 17.0]], [[-47.0, 20.0], [6.0, 20.0], [42.0, -3.0], [20.0, -45.0], [-1.0, -36.0]], [[35.0, 48.0], [-17.0, 34.0], [-3.0, -4.0], [81.0, 14.0], [6.0, -19.0]], [[27.0, 17.0], [-39.0, 14.0], [112.0, -76.0], [2.0, -22.0], [21.0, 9.0]]])+(1.-msk_ref)*numarray.array([[[-88.0, 71.0], [100.0, -119.0], [58.0, -45.0], [-42.0, 39.0], [71.0, -51.0]], [[-65.0, 4.0], [64.0, -1.0], [29.0, 0.0], [-27.0, -23.0], [29.0, -66.0]], [[-34.0, 28.0], [2.0, -17.0], [-148.0, 110.0], [78.0, -54.0], [52.0, 14.0]], [[-12.0, -78.0], [-45.0, -43.0], [-31.0, 46.0], [37.0, -3.0], [-57.0, 34.0]]]) | |
29154 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29155 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
29156 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29157 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29158 | def test_tensor_mult_expandedData_rank4_array_rank4(self): | |
29159 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29160 | arg0=msk_arg0*numarray.array([[[[-3.0, -1.0, -5.0], [6.0, 0.0, -3.0]], [[4.0, -2.0, -2.0], [3.0, -1.0, -4.0]], [[5.0, 3.0, 7.0], [-4.0, 2.0, 1.0]], [[3.0, 4.0, 0.0], [7.0, -6.0, -6.0]], [[-4.0, -5.0, 7.0], [-5.0, -3.0, -3.0]]], [[[7.0, -4.0, 0.0], [-2.0, 2.0, 0.0]], [[1.0, -5.0, 0.0], [0.0, -4.0, -6.0]], [[-6.0, 3.0, 7.0], [3.0, -4.0, 5.0]], [[-1.0, 2.0, -1.0], [1.0, 0.0, -2.0]], [[1.0, -2.0, 6.0], [-2.0, 6.0, 7.0]]], [[[2.0, 6.0, 7.0], [-4.0, 3.0, -6.0]], [[-7.0, -3.0, 0.0], [-4.0, -5.0, -2.0]], [[1.0, 7.0, -7.0], [-2.0, -1.0, 7.0]], [[4.0, 2.0, 6.0], [-3.0, 1.0, 7.0]], [[7.0, 0.0, -3.0], [0.0, -5.0, -3.0]]], [[[3.0, -6.0, -3.0], [-6.0, 6.0, 0.0]], [[0.0, -2.0, -7.0], [-1.0, 0.0, 5.0]], [[-3.0, -2.0, -5.0], [7.0, 3.0, -7.0]], [[-2.0, -3.0, -2.0], [-3.0, 0.0, -2.0]], [[-1.0, -5.0, 2.0], [3.0, -3.0, 6.0]]]])+(1.-msk_arg0)*numarray.array([[[[0.0, 1.0, 0.0], [-7.0, -1.0, -1.0]], [[-2.0, 3.0, 0.0], [-4.0, 6.0, -4.0]], [[-5.0, 6.0, -5.0], [-4.0, 0.0, 0.0]], [[5.0, 1.0, -7.0], [7.0, -5.0, 3.0]], [[5.0, 2.0, 5.0], [-1.0, 4.0, 0.0]]], [[[-1.0, 4.0, -4.0], [-5.0, -1.0, 2.0]], [[0.0, 6.0, 4.0], [0.0, -6.0, -2.0]], [[-5.0, 5.0, -7.0], [-3.0, -4.0, -7.0]], [[-6.0, -6.0, 0.0], [0.0, 5.0, 4.0]], [[-6.0, 6.0, 0.0], [5.0, -4.0, -3.0]]], [[[0.0, 3.0, -3.0], [-3.0, -1.0, 1.0]], [[-3.0, -2.0, -7.0], [7.0, 4.0, -2.0]], [[0.0, 2.0, -1.0], [-6.0, 7.0, -6.0]], [[0.0, -3.0, -4.0], [-7.0, -6.0, -4.0]], [[-2.0, -2.0, 0.0], [0.0, -5.0, -7.0]]], [[[5.0, 6.0, -4.0], [4.0, 2.0, 5.0]], [[6.0, 3.0, 5.0], [-1.0, 7.0, -4.0]], [[4.0, -1.0, -5.0], [0.0, 7.0, 0.0]], [[-3.0, -1.0, -2.0], [6.0, -3.0, -2.0]], [[0.0, -2.0, 6.0], [-1.0, 5.0, 7.0]]]]) | |
29161 | arg1=numarray.array([[[[-3.0, -3.0, 7.0, 4.0, -1.0], [7.0, -1.0, -4.0, -7.0, -3.0], [3.0, -3.0, -1.0, -6.0, 2.0], [-4.0, -6.0, 3.0, 3.0, 7.0]], [[7.0, -4.0, 4.0, 6.0, 2.0], [0.0, -3.0, 0.0, -2.0, -1.0], [0.0, -6.0, 7.0, -7.0, 7.0], [-1.0, 6.0, -1.0, 4.0, 0.0]], [[-1.0, -7.0, 2.0, 2.0, -2.0], [6.0, -6.0, -4.0, -6.0, 4.0], [-6.0, -5.0, -2.0, 7.0, -1.0], [6.0, 0.0, 3.0, -4.0, -6.0]]], [[[1.0, 0.0, -2.0, 6.0, -7.0], [6.0, -4.0, -6.0, 4.0, -1.0], [-7.0, 0.0, -7.0, 6.0, 1.0], [1.0, -5.0, 2.0, 1.0, 0.0]], [[2.0, -6.0, -5.0, 0.0, -4.0], [0.0, 2.0, -6.0, -6.0, -7.0], [5.0, 6.0, 4.0, 7.0, -7.0], [1.0, 7.0, 1.0, 1.0, -7.0]], [[-4.0, -6.0, -5.0, -5.0, 3.0], [-6.0, 3.0, 4.0, 0.0, 7.0], [7.0, 4.0, 0.0, 6.0, 5.0], [0.0, -2.0, 0.0, 0.0, -7.0]]]]) | |
29162 | res=tensor_mult(arg0,arg1) | |
29163 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29164 | ref=msk_ref*numarray.array([[[[25.0, 66.0, -32.0, 23.0, -40.0], [3.0, 3.0, -16.0, 77.0, -37.0], [-42.0, 28.0, -36.0, 8.0, -17.0], [-11.0, -12.0, -11.0, 13.0, 30.0]], [[-7.0, 40.0, 35.0, 38.0, -33.0], [58.0, -12.0, -36.0, 6.0, -42.0], [-30.0, -12.0, -39.0, -37.0, -14.0], [-24.0, -50.0, 13.0, 14.0, 75.0]], [[-5.0, -94.0, 54.0, 23.0, 10.0], [47.0, -33.0, -32.0, -111.0, 7.0], [18.0, -52.0, 38.0, -6.0, 11.0], [17.0, 20.0, 27.0, -3.0, -28.0]], [[38.0, 47.0, 83.0, 108.0, -38.0], [99.0, -73.0, -42.0, 35.0, -20.0], [-112.0, -93.0, -48.0, -82.0, 53.0], [-15.0, -59.0, 13.0, 26.0, 105.0]], [[-29.0, 19.0, 6.0, -47.0, 18.0], [2.0, -18.0, 24.0, -6.0, 50.0], [-55.0, -23.0, -22.0, 39.0, -49.0], [55.0, 4.0, 1.0, -68.0, -28.0]]], [[[-47.0, -17.0, 27.0, -8.0, -9.0], [37.0, 17.0, -28.0, -61.0, -29.0], [45.0, 15.0, -13.0, -12.0, -30.0], [-24.0, -42.0, 23.0, 5.0, 35.0]], [[-22.0, 77.0, 37.0, 4.0, -13.0], [43.0, -12.0, -4.0, 27.0, -12.0], [-59.0, -21.0, -52.0, -35.0, -35.0], [-3.0, -52.0, 4.0, -21.0, 77.0]], [[7.0, -49.0, -27.0, 1.0, 8.0], [-12.0, -50.0, 22.0, 30.0, 103.0], [-66.0, -39.0, -24.0, 84.0, 58.0], [62.0, 1.0, 2.0, -35.0, -91.0]], [[27.0, 14.0, 7.0, 22.0, -6.0], [5.0, -9.0, -6.0, 13.0, -18.0], [-18.0, -12.0, 10.0, -21.0, 4.0], [-3.0, 17.0, -6.0, 10.0, 13.0]], [[-41.0, -115.0, -50.0, -43.0, -6.0], [-11.0, 10.0, -24.0, -83.0, 32.0], [60.0, 43.0, 11.0, 122.0, -27.0], [38.0, 20.0, 25.0, -25.0, -120.0]]], [[[55.0, -61.0, 75.0, 64.0, -6.0], [68.0, -58.0, -54.0, -102.0, -43.0], [-35.0, -83.0, 66.0, -44.0, -16.0], [27.0, 77.0, 16.0, 1.0, -7.0]], [[-6.0, 75.0, -18.0, -60.0, 43.0], [-61.0, 16.0, 74.0, 69.0, 49.0], [-32.0, 1.0, -6.0, -8.0, -14.0], [22.0, 13.0, -31.0, -42.0, 0.0]], [[21.0, -18.0, -5.0, -15.0, 66.0], [-89.0, 47.0, 70.0, 19.0, 20.0], [103.0, 12.0, 72.0, -81.0, 98.0], [-56.0, 25.0, -30.0, 56.0, 7.0]], [[-33.0, -110.0, 14.0, -13.0, 26.0], [4.0, -11.0, 0.0, -86.0, 55.0], [51.0, -20.0, 23.0, 35.0, 41.0], [16.0, -4.0, 23.0, -6.0, -64.0]], [[-16.0, 48.0, 83.0, 37.0, 10.0], [49.0, -8.0, 2.0, -1.0, -19.0], [-7.0, -48.0, -21.0, -116.0, 37.0], [-51.0, -71.0, 7.0, 28.0, 123.0]]], [[[-42.0, 0.0, -27.0, -66.0, 9.0], [-33.0, 69.0, 0.0, -51.0, -51.0], [99.0, 78.0, 27.0, 9.0, -81.0], [-24.0, 18.0, 0.0, -3.0, -3.0]], [[-28.0, 27.0, -45.0, -57.0, 32.0], [-78.0, 67.0, 54.0, 42.0, 10.0], [84.0, 67.0, 7.0, -11.0, 17.0], [-41.0, -17.0, -21.0, 19.0, 7.0]], [[41.0, 76.0, -33.0, 43.0, -73.0], [33.0, -4.0, -56.0, 65.0, -86.0], [-62.0, 36.0, -38.0, 18.0, -64.0], [-6.0, 6.0, -5.0, 13.0, 37.0]], [[-8.0, 44.0, -14.0, -38.0, 15.0], [-32.0, 29.0, 26.0, 20.0, -10.0], [13.0, 26.0, 6.0, -11.0, -36.0], [-4.0, 13.0, -15.0, -13.0, 12.0]], [[-61.0, -9.0, -44.0, -42.0, -4.0], [-13.0, 4.0, 20.0, 35.0, 76.0], [-9.0, 29.0, -71.0, 88.0, 15.0], [21.0, -72.0, 11.0, -31.0, -40.0]]]])+(1.-msk_ref)*numarray.array([[[[2.0, 8.0, 28.0, -31.0, 52.0], [-36.0, 20.0, 44.0, -24.0, 6.0], [37.0, -16.0, 52.0, -62.0, 2.0], [-9.0, 36.0, -16.0, -4.0, 14.0]], [[51.0, -18.0, -4.0, 6.0, 0.0], [-14.0, 9.0, -20.0, -44.0, -63.0], [24.0, 8.0, 75.0, -15.0, -49.0], [7.0, 100.0, -11.0, 8.0, -28.0]], [[58.0, 26.0, -13.0, -18.0, 55.0], [-89.0, 33.0, 64.0, 37.0, -7.0], [43.0, 4.0, 85.0, -71.0, 33.0], [-20.0, 86.0, -44.0, 25.0, -5.0]], [[-16.0, 42.0, 21.0, 39.0, -9.0], [17.0, 5.0, 8.0, 63.0, 5.0], [4.0, -4.0, -53.0, -61.0, 81.0], [-61.0, -100.0, 2.0, 49.0, 91.0]], [[1.0, -82.0, 35.0, 36.0, -20.0], [59.0, -29.0, -58.0, -97.0, -24.0], [12.0, -28.0, 22.0, 13.0, -10.0], [11.0, 15.0, 30.0, 6.0, -23.0]]], [[[20.0, 9.0, 6.0, -28.0, 62.0], [-73.0, 37.0, 64.0, 9.0, 9.0], [65.0, 1.0, 68.0, -75.0, 42.0], [-30.0, 44.0, -30.0, 23.0, 10.0]], [[34.0, -4.0, 72.0, 54.0, 22.0], [36.0, -60.0, 12.0, 0.0, 38.0], [-68.0, -100.0, 10.0, -68.0, 70.0], [12.0, -2.0, 0.0, 2.0, 32.0]], [[74.0, 110.0, 32.0, 13.0, 45.0], [-53.0, 15.0, 62.0, 79.0, -36.0], [-21.0, -32.0, 59.0, -142.0, 22.0], [-34.0, 61.0, -51.0, 26.0, 84.0]], [[-30.0, -12.0, -111.0, -80.0, -14.0], [-66.0, 46.0, 10.0, 24.0, 17.0], [35.0, 100.0, -16.0, 137.0, -69.0], [35.0, 27.0, -7.0, -37.0, -105.0]], [[69.0, 36.0, 7.0, 57.0, -10.0], [6.0, -49.0, 6.0, 74.0, 14.0], [-94.0, -54.0, -3.0, -22.0, 48.0], [19.0, 25.0, -18.0, 7.0, 7.0]]], [[[15.0, 9.0, 12.0, -11.0, 40.0], [-42.0, 22.0, 40.0, 6.0, 2.0], [41.0, -5.0, 44.0, -61.0, 33.0], [-25.0, 24.0, -19.0, 20.0, 18.0]], [[25.0, 54.0, -67.0, 14.0, -58.0], [-9.0, 25.0, -34.0, 71.0, -66.0], [-10.0, 72.0, -30.0, 41.0, -44.0], [-17.0, 3.0, -10.0, 22.0, 7.0]], [[47.0, -7.0, 13.0, 4.0, 2.0], [-6.0, 20.0, -26.0, -64.0, -91.0], [41.0, 11.0, 86.0, -44.0, -70.0], [-7.0, 103.0, -10.0, 13.0, -1.0]], [[-20.0, 100.0, 44.0, -48.0, 63.0], [-42.0, 37.0, 78.0, 38.0, 8.0], [15.0, -14.0, 12.0, -115.0, -2.0], [-34.0, -17.0, -29.0, -9.0, 94.0]], [[10.0, 86.0, 38.0, 15.0, -3.0], [28.0, -23.0, 10.0, 48.0, -6.0], [-80.0, -40.0, -32.0, -51.0, -18.0], [5.0, -21.0, -9.0, -19.0, 70.0]]], [[[19.0, -53.0, 8.0, 47.0, -6.0], [5.0, 4.0, -20.0, -19.0, -20.0], [56.0, 1.0, 25.0, -32.0, 71.0], [-44.0, -10.0, 7.0, 61.0, 10.0]], [[27.0, -83.0, 51.0, 66.0, -43.0], [90.0, -39.0, -96.0, -124.0, -77.0], [2.0, -35.0, 40.0, -3.0, -42.0], [9.0, 44.0, 35.0, 16.0, -9.0]], [[0.0, -15.0, -21.0, 0.0, -24.0], [-2.0, 43.0, -38.0, -38.0, -80.0], [77.0, 61.0, 27.0, -3.0, -43.0], [-38.0, 19.0, 5.0, 35.0, 9.0]], [[12.0, 57.0, -16.0, 24.0, -31.0], [15.0, -18.0, -6.0, 77.0, 3.0], [-68.0, -1.0, -54.0, 14.0, 6.0], [4.0, -35.0, -5.0, -2.0, 26.0]], [[-39.0, -106.0, -54.0, -41.0, -8.0], [-12.0, 5.0, -20.0, -66.0, 41.0], [45.0, 40.0, 1.0, 127.0, -21.0], [42.0, 14.0, 23.0, -28.0, -120.0]]]]) | |
29165 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29166 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
29167 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29168 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29169 | def test_tensor_mult_expandedData_rank4_Symbol_rank2(self): | |
29170 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29171 | arg0=msk_arg0*numarray.array([[[[-6.0, 3.0, -1.0], [-4.0, 5.0, -5.0]], [[-1.0, -2.0, 0.0], [2.0, -3.0, 4.0]], [[-6.0, 5.0, 0.0], [-4.0, -2.0, 1.0]], [[5.0, 3.0, -4.0], [0.0, 5.0, -2.0]], [[-5.0, 2.0, 6.0], [4.0, 7.0, -5.0]]], [[[0.0, -6.0, 3.0], [-4.0, 3.0, -4.0]], [[-6.0, -6.0, 2.0], [5.0, -1.0, 1.0]], [[0.0, 1.0, 7.0], [-4.0, 4.0, 2.0]], [[-3.0, 0.0, -5.0], [5.0, 6.0, 7.0]], [[5.0, -3.0, -3.0], [3.0, -1.0, -4.0]]], [[[-2.0, 1.0, 0.0], [1.0, 0.0, 4.0]], [[0.0, 2.0, 2.0], [2.0, -3.0, -3.0]], [[4.0, -4.0, -3.0], [-1.0, 7.0, -7.0]], [[5.0, 2.0, -3.0], [-4.0, -7.0, 0.0]], [[-5.0, 0.0, -3.0], [7.0, 5.0, -1.0]]], [[[0.0, -1.0, 7.0], [-6.0, 3.0, 5.0]], [[-6.0, 1.0, 6.0], [-6.0, -2.0, 0.0]], [[-2.0, 5.0, -6.0], [0.0, -1.0, -3.0]], [[7.0, 0.0, 5.0], [-4.0, 4.0, -7.0]], [[2.0, 1.0, -4.0], [2.0, 7.0, -2.0]]]])+(1.-msk_arg0)*numarray.array([[[[-4.0, -7.0, 2.0], [3.0, 0.0, 4.0]], [[7.0, -2.0, 0.0], [0.0, -3.0, -6.0]], [[-2.0, -2.0, 5.0], [5.0, -3.0, -7.0]], [[7.0, 0.0, 2.0], [-1.0, -4.0, -1.0]], [[4.0, 7.0, 0.0], [4.0, 2.0, -2.0]]], [[[-3.0, 3.0, 7.0], [-2.0, 0.0, 6.0]], [[-3.0, 2.0, -2.0], [-2.0, -1.0, -7.0]], [[4.0, 5.0, -2.0], [6.0, -2.0, -6.0]], [[-5.0, 6.0, 6.0], [7.0, 0.0, 5.0]], [[-1.0, -1.0, 4.0], [-5.0, 2.0, 0.0]]], [[[-4.0, 4.0, -7.0], [7.0, -1.0, 5.0]], [[4.0, -2.0, -4.0], [0.0, 3.0, 7.0]], [[6.0, 6.0, -3.0], [-1.0, 3.0, -3.0]], [[-7.0, 0.0, 2.0], [6.0, -2.0, -1.0]], [[2.0, -4.0, 4.0], [3.0, -7.0, 2.0]]], [[[7.0, -3.0, 6.0], [-4.0, 3.0, 5.0]], [[-7.0, 4.0, 0.0], [2.0, -7.0, -3.0]], [[5.0, -3.0, -6.0], [7.0, 0.0, 0.0]], [[1.0, 2.0, 3.0], [-7.0, 6.0, -4.0]], [[7.0, 6.0, 5.0], [-7.0, -7.0, 0.0]]]]) | |
29172 | arg1=Symbol(shape=(2, 3)) | |
29173 | res=tensor_mult(arg0,arg1) | |
29174 | s1=numarray.array([[2.0, -1.0, 7.0], [-3.0, 1.0, 4.0]]) | |
29175 | sub=res.substitute({arg1:s1}) | |
29176 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29177 | ref=msk_ref*numarray.array([[-25.0, 7.0, -3.0, -24.0, 5.0], [26.0, -4.0, 72.0, -22.0, -34.0], [8.0, -9.0, -27.0, -8.0, -51.0], [91.0, 45.0, -64.0, 37.0, -32.0]])+(1.-msk_ref)*numarray.array([[20.0, -11.0, -13.0, 23.0, -17.0], [70.0, -45.0, -55.0, 25.0, 44.0], [-63.0, 13.0, -21.0, -24.0, 28.0], [94.0, -43.0, -50.0, 32.0, 57.0]]) | |
29178 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
29179 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
29180 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29181 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29182 | def test_tensor_mult_expandedData_rank4_Symbol_rank3(self): | |
29183 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29184 | arg0=msk_arg0*numarray.array([[[[5.0, -7.0, 0.0], [3.0, 7.0, 5.0]], [[-2.0, 0.0, 2.0], [5.0, 6.0, 0.0]], [[-4.0, 4.0, -2.0], [-3.0, 0.0, -6.0]], [[-6.0, -4.0, -3.0], [0.0, -5.0, 3.0]], [[5.0, 7.0, 4.0], [0.0, 2.0, -6.0]]], [[[-7.0, -3.0, 3.0], [5.0, 1.0, -5.0]], [[4.0, -4.0, -4.0], [-3.0, 4.0, -3.0]], [[-3.0, -6.0, 6.0], [-2.0, -5.0, 7.0]], [[-4.0, 4.0, 4.0], [3.0, -2.0, -1.0]], [[5.0, 0.0, 6.0], [2.0, 2.0, 5.0]]], [[[5.0, -1.0, -3.0], [5.0, -7.0, 5.0]], [[4.0, -7.0, -7.0], [-5.0, -5.0, 2.0]], [[-1.0, -3.0, 0.0], [-6.0, -1.0, -7.0]], [[0.0, -4.0, -6.0], [-5.0, -6.0, -6.0]], [[5.0, 0.0, -7.0], [6.0, 0.0, 3.0]]], [[[-3.0, 7.0, 5.0], [-2.0, -3.0, 0.0]], [[2.0, -2.0, -5.0], [6.0, 1.0, -4.0]], [[3.0, 1.0, 0.0], [7.0, -5.0, 0.0]], [[-7.0, -2.0, 6.0], [-2.0, 6.0, -4.0]], [[2.0, -7.0, 2.0], [-4.0, -1.0, -2.0]]]])+(1.-msk_arg0)*numarray.array([[[[-7.0, 7.0, 0.0], [-2.0, -1.0, -1.0]], [[-4.0, -1.0, 5.0], [-6.0, -7.0, 0.0]], [[6.0, 1.0, -5.0], [-2.0, -7.0, -2.0]], [[3.0, 0.0, 1.0], [0.0, 2.0, 6.0]], [[4.0, -2.0, -3.0], [5.0, 4.0, -4.0]]], [[[1.0, 6.0, 0.0], [-1.0, -6.0, 0.0]], [[-7.0, 7.0, 4.0], [3.0, -3.0, 2.0]], [[1.0, -1.0, 0.0], [-1.0, 3.0, -1.0]], [[4.0, 3.0, -4.0], [1.0, -2.0, 7.0]], [[-4.0, 4.0, -6.0], [4.0, 1.0, 3.0]]], [[[2.0, 3.0, -1.0], [-1.0, -5.0, 0.0]], [[-5.0, -4.0, 6.0], [-1.0, 5.0, 0.0]], [[4.0, -1.0, -1.0], [6.0, 6.0, 1.0]], [[5.0, 1.0, 5.0], [3.0, 1.0, 6.0]], [[7.0, 7.0, 3.0], [2.0, -6.0, -1.0]]], [[[2.0, 0.0, 0.0], [0.0, 0.0, 1.0]], [[-5.0, 0.0, 2.0], [-4.0, -6.0, 0.0]], [[0.0, -4.0, 0.0], [-4.0, -1.0, -3.0]], [[-5.0, -3.0, -3.0], [-5.0, -4.0, 5.0]], [[2.0, 0.0, 7.0], [6.0, -6.0, -3.0]]]]) | |
29185 | arg1=Symbol(shape=(2, 3, 2)) | |
29186 | res=tensor_mult(arg0,arg1) | |
29187 | s1=numarray.array([[[7.0, -4.0], [-6.0, 5.0], [1.0, 1.0]], [[1.0, 7.0], [2.0, 4.0], [-7.0, -4.0]]]) | |
29188 | sub=res.substitute({arg1:s1}) | |
29189 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29190 | ref=msk_ref*numarray.array([[[59.0, -26.0], [5.0, 69.0], [-15.0, 37.0], [-52.0, -31.0], [43.0, 51.0]], [[14.0, 75.0], [74.0, -33.0], [-40.0, -74.0], [-42.0, 57.0], [12.0, -12.0]], [[-6.0, -41.0], [34.0, -121.0], [52.0, -29.0], [43.0, -61.0], [13.0, 3.0]], [[-66.0, 26.0], [57.0, 39.0], [12.0, 22.0], [7.0, 50.0], [66.0, -65.0]]])+(1.-msk_ref)*numarray.array([[[-88.0, 49.0], [-37.0, -54.0], [29.0, -58.0], [-16.0, -27.0], [78.0, 38.0]], [[-42.0, -5.0], [-104.0, 68.0], [25.0, 0.0], [-46.0, -34.0], [-73.0, 50.0]], [[-16.0, -21.0], [4.0, 19.0], [44.0, 40.0], [-3.0, -9.0], [7.0, 4.0]], [[7.0, -12.0], [-49.0, -30.0], [39.0, -40.0], [-68.0, -69.0], [36.0, 29.0]]]) | |
29191 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
29192 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
29193 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29194 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29195 | def test_tensor_mult_expandedData_rank4_Symbol_rank4(self): | |
29196 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29197 | arg0=msk_arg0*numarray.array([[[[-2.0, 2.0, 6.0], [-7.0, 7.0, 2.0]], [[-3.0, 0.0, -6.0], [3.0, -6.0, -6.0]], [[0.0, 6.0, -1.0], [-6.0, 0.0, 0.0]], [[-5.0, 4.0, -6.0], [5.0, -7.0, 0.0]], [[2.0, -6.0, 3.0], [0.0, 7.0, 5.0]]], [[[-3.0, 0.0, -3.0], [-4.0, 4.0, 4.0]], [[3.0, 2.0, 5.0], [0.0, 6.0, 1.0]], [[-1.0, -3.0, 0.0], [-3.0, -6.0, -5.0]], [[2.0, -4.0, -1.0], [-1.0, 7.0, -5.0]], [[-4.0, 2.0, 0.0], [0.0, 3.0, -5.0]]], [[[-5.0, -6.0, -1.0], [-3.0, -2.0, 3.0]], [[1.0, 5.0, -5.0], [6.0, 3.0, 6.0]], [[0.0, 1.0, -2.0], [0.0, -5.0, 4.0]], [[-2.0, -4.0, -1.0], [4.0, 3.0, 1.0]], [[-6.0, -4.0, 1.0], [0.0, -7.0, -5.0]]], [[[-2.0, 4.0, -6.0], [0.0, 5.0, 0.0]], [[1.0, -7.0, 2.0], [3.0, -5.0, -7.0]], [[1.0, 5.0, -6.0], [0.0, 5.0, 1.0]], [[2.0, 1.0, -5.0], [3.0, 3.0, 6.0]], [[-4.0, 4.0, 7.0], [4.0, 6.0, -1.0]]]])+(1.-msk_arg0)*numarray.array([[[[0.0, -4.0, 1.0], [-7.0, -4.0, 6.0]], [[4.0, -6.0, 6.0], [7.0, 7.0, 3.0]], [[6.0, 6.0, 0.0], [-7.0, 3.0, -3.0]], [[5.0, 3.0, -5.0], [2.0, -5.0, 7.0]], [[-5.0, 0.0, -3.0], [-5.0, -2.0, -5.0]]], [[[5.0, 3.0, 1.0], [-5.0, 1.0, -5.0]], [[-4.0, 0.0, -3.0], [2.0, 7.0, 7.0]], [[5.0, -5.0, -2.0], [-4.0, 2.0, -6.0]], [[-1.0, 1.0, 2.0], [0.0, 5.0, -2.0]], [[-5.0, 6.0, -5.0], [-6.0, 6.0, -6.0]]], [[[-7.0, -1.0, 1.0], [-1.0, -4.0, 1.0]], [[5.0, -2.0, 3.0], [0.0, -3.0, -1.0]], [[1.0, 0.0, -2.0], [7.0, 0.0, 5.0]], [[0.0, -1.0, -4.0], [-6.0, -2.0, -2.0]], [[0.0, 4.0, -4.0], [1.0, 5.0, -2.0]]], [[[1.0, 4.0, 0.0], [0.0, 3.0, 5.0]], [[-4.0, -2.0, 3.0], [-7.0, 2.0, -1.0]], [[7.0, -3.0, -5.0], [0.0, -2.0, 2.0]], [[6.0, 2.0, 0.0], [-4.0, 3.0, -2.0]], [[6.0, -6.0, 0.0], [-7.0, 4.0, 3.0]]]]) | |
29198 | arg1=Symbol(shape=(2, 3, 4, 5)) | |
29199 | res=tensor_mult(arg0,arg1) | |
29200 | s1=numarray.array([[[[3.0, -5.0, 0.0, 5.0, 3.0], [-2.0, -2.0, 0.0, 5.0, 0.0], [0.0, 0.0, -6.0, -7.0, -4.0], [4.0, -4.0, -4.0, 4.0, 5.0]], [[7.0, -6.0, 6.0, 2.0, 5.0], [7.0, 1.0, 0.0, 7.0, 7.0], [-3.0, 0.0, -2.0, -6.0, -7.0], [4.0, 0.0, -2.0, 7.0, -7.0]], [[1.0, -1.0, 0.0, 4.0, 2.0], [2.0, -7.0, -4.0, -4.0, 3.0], [3.0, -2.0, -2.0, 2.0, 5.0], [1.0, 7.0, -6.0, 0.0, -1.0]]], [[[-7.0, 2.0, -4.0, 0.0, 0.0], [-5.0, -5.0, -7.0, 7.0, 7.0], [5.0, 7.0, 0.0, -5.0, 5.0], [6.0, 0.0, -6.0, 3.0, 6.0]], [[5.0, 5.0, 0.0, 0.0, 1.0], [1.0, 3.0, 2.0, 0.0, -3.0], [-5.0, -1.0, -1.0, 0.0, 1.0], [5.0, -6.0, 0.0, 7.0, -4.0]], [[2.0, 2.0, 4.0, 2.0, -2.0], [3.0, 0.0, 4.0, 5.0, 0.0], [-4.0, -3.0, -6.0, 7.0, -4.0], [2.0, -3.0, -4.0, 1.0, 6.0]]]]) | |
29201 | sub=res.substitute({arg1:s1}) | |
29202 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29203 | ref=msk_ref*numarray.array([[[[102.0, 17.0, 48.0, 22.0, 19.0], [78.0, 20.0, 47.0, -59.0, -38.0], [-66.0, -74.0, -23.0, 63.0, -12.0], [3.0, 2.0, 2.0, 36.0, -88.0]], [[-78.0, -15.0, -36.0, -51.0, -15.0], [-45.0, 15.0, -33.0, 0.0, 21.0], [51.0, 57.0, 72.0, -48.0, 15.0], [-42.0, 24.0, 54.0, -51.0, -3.0]], [[83.0, -47.0, 60.0, 8.0, 28.0], [70.0, 43.0, 46.0, 4.0, -3.0], [-51.0, -40.0, -10.0, -8.0, -77.0], [-13.0, -7.0, 30.0, 24.0, -77.0]], [[-63.0, -18.0, 4.0, -41.0, -14.0], [-6.0, 10.0, -25.0, 62.0, 66.0], [30.0, 54.0, 41.0, -26.0, -20.0], [-15.0, 20.0, 18.0, -26.0, 11.0]], [[12.0, 68.0, -16.0, 20.0, -21.0], [-18.0, -10.0, 22.0, -19.0, -54.0], [-28.0, -28.0, -43.0, 63.0, 36.0], [32.0, -44.0, -34.0, 20.0, 51.0]]], [[[44.0, 38.0, 32.0, -19.0, -19.0], [36.0, 59.0, 64.0, -11.0, -49.0], [-65.0, -38.0, -4.0, 63.0, -35.0], [-11.0, -45.0, 38.0, 8.0, -28.0]], [[60.0, 0.0, 16.0, 41.0, 33.0], [27.0, -21.0, -4.0, 14.0, 11.0], [-25.0, -19.0, -44.0, -16.0, 1.0], [57.0, -16.0, -50.0, 69.0, -22.0]], [[-43.0, -23.0, -26.0, -21.0, -14.0], [-25.0, -4.0, -11.0, -72.0, -24.0], [44.0, 0.0, 48.0, 5.0, 24.0], [-74.0, 55.0, 48.0, -81.0, -8.0]], [[9.0, 38.0, -40.0, -12.0, 1.0], [-37.0, 25.0, 5.0, -46.0, -59.0], [-11.0, 3.0, 21.0, -22.0, 37.0], [10.0, -42.0, 32.0, 21.0, -25.0]], [[7.0, 13.0, -8.0, -26.0, 11.0], [10.0, 19.0, -14.0, -31.0, 5.0], [-1.0, 12.0, 47.0, -19.0, 25.0], [-3.0, 13.0, 32.0, 14.0, -76.0]]], [[[-41.0, 52.0, -12.0, -35.0, -55.0], [-12.0, 20.0, 33.0, -69.0, -60.0], [-2.0, -26.0, 28.0, 105.0, 28.0], [-67.0, 16.0, 44.0, -82.0, 26.0]], [[18.0, 9.0, 30.0, 7.0, 9.0], [14.0, 17.0, 8.0, 132.0, 53.0], [-39.0, 31.0, -45.0, -35.0, -55.0], [82.0, -75.0, -44.0, 84.0, 35.0]], [[-12.0, -21.0, 22.0, 2.0, -12.0], [10.0, 0.0, 14.0, 35.0, 16.0], [0.0, -3.0, -17.0, 18.0, -38.0], [-15.0, 4.0, -6.0, -24.0, 39.0]], [[-46.0, 60.0, -36.0, -20.0, -27.0], [-40.0, -4.0, -14.0, -1.0, -12.0], [10.0, 24.0, 13.0, 23.0, 50.0], [16.0, -20.0, -6.0, -2.0, 37.0]], [[-90.0, 8.0, -44.0, -44.0, -33.0], [-36.0, -20.0, -38.0, -87.0, -4.0], [70.0, 20.0, 79.0, 33.0, 70.0], [-84.0, 88.0, 46.0, -106.0, -5.0]]], [[[41.0, 17.0, 24.0, -26.0, 7.0], [25.0, 65.0, 34.0, 42.0, -5.0], [-55.0, 7.0, 11.0, -22.0, -45.0], [27.0, -64.0, 36.0, 55.0, -52.0]], [[-104.0, 2.0, -82.0, -15.0, -19.0], [-88.0, -53.0, -67.0, -66.0, -7.0], [95.0, 43.0, 51.0, -25.0, 93.0], [-43.0, 61.0, 8.0, -78.0, 48.0]], [[59.0, -2.0, 34.0, -7.0, 19.0], [29.0, 60.0, 38.0, 69.0, 2.0], [-62.0, 4.0, -15.0, -42.0, -68.0], [45.0, -79.0, 18.0, 75.0, -38.0]], [[14.0, 22.0, 18.0, 4.0, -8.0], [-1.0, 26.0, 29.0, 88.0, 4.0], [-42.0, 10.0, -43.0, -3.0, -46.0], [52.0, -79.0, -22.0, 51.0, 50.0]], [[23.0, 25.0, 4.0, 14.0, 30.0], [33.0, -39.0, -48.0, 3.0, 59.0], [3.0, 11.0, 2.0, -9.0, 53.0], [59.0, 32.0, -54.0, 65.0, -61.0]]]])+(1.-msk_ref)*numarray.array([[[[14.0, 1.0, 28.0, 8.0, -34.0], [23.0, 12.0, 61.0, -51.0, -62.0], [-24.0, -65.0, -26.0, 103.0, -30.0], [-65.0, 13.0, 20.0, -71.0, 37.0]], [[-32.0, 65.0, -52.0, 38.0, -5.0], [-57.0, -70.0, -47.0, 18.0, 4.0], [24.0, 21.0, -49.0, 6.0, 86.0], [81.0, -25.0, -94.0, 47.0, 88.0]], [[118.0, -71.0, 52.0, 36.0, 57.0], [59.0, 38.0, 43.0, 8.0, -16.0], [-56.0, -43.0, -33.0, -64.0, -86.0], [15.0, -33.0, 18.0, 63.0, -84.0]], [[6.0, -45.0, 38.0, 25.0, 1.0], [7.0, 3.0, 24.0, 115.0, 35.0], [-17.0, 8.0, -63.0, -24.0, -89.0], [28.0, -46.0, -36.0, 19.0, 83.0]], [[-3.0, -2.0, 0.0, -47.0, -13.0], [12.0, 50.0, 23.0, -73.0, -38.0], [-4.0, -12.0, 68.0, 19.0, -2.0], [-73.0, 26.0, 88.0, -54.0, -74.0]]], [[[67.0, -59.0, 18.0, 25.0, 43.0], [24.0, 14.0, 13.0, -18.0, -14.0], [-16.0, -23.0, -9.0, -61.0, -40.0], [-2.0, -4.0, 18.0, 28.0, -61.0]], [[20.0, 76.0, 20.0, -18.0, -25.0], [20.0, 40.0, 40.0, 41.0, -16.0], [-62.0, -8.0, -19.0, 61.0, -10.0], [42.0, -68.0, -6.0, 46.0, 9.0]], [[4.0, -3.0, -38.0, -5.0, 0.0], [-45.0, 25.0, 16.0, -60.0, -75.0], [3.0, -8.0, 18.0, -31.0, 11.0], [-28.0, -28.0, 50.0, -19.0, -6.0]], [[27.0, 18.0, -2.0, 1.0, 15.0], [12.0, 4.0, -6.0, -16.0, -2.0], [-14.0, -3.0, 7.0, -9.0, 20.0], [23.0, -6.0, -2.0, 36.0, -46.0]], [[82.0, 0.0, 36.0, -45.0, 23.0], [60.0, 99.0, 50.0, -35.0, -33.0], [-69.0, -20.0, 58.0, -23.0, -47.0], [-19.0, -33.0, 98.0, 40.0, -158.0]]], [[[-38.0, 20.0, 2.0, -31.0, -30.0], [13.0, -1.0, -1.0, -48.0, 1.0], [17.0, -8.0, 40.0, 69.0, 27.0], [-55.0, 56.0, 26.0, -65.0, -13.0]], [[-13.0, -33.0, -16.0, 31.0, 10.0], [-24.0, -42.0, -22.0, -6.0, 4.0], [34.0, 0.0, -23.0, -24.0, 10.0], [-2.0, 22.0, -30.0, -16.0, 42.0]], [[-38.0, 21.0, -8.0, 7.0, -11.0], [-26.0, -23.0, -21.0, 87.0, 43.0], [9.0, 38.0, -32.0, -11.0, 1.0], [54.0, -33.0, -54.0, 30.0, 79.0]], [[17.0, -16.0, 10.0, -22.0, -11.0], [7.0, 51.0, 46.0, -43.0, -55.0], [-21.0, -26.0, 24.0, 14.0, -37.0], [-58.0, -10.0, 70.0, -41.0, -29.0]], [[38.0, 3.0, 12.0, -12.0, 21.0], [14.0, 42.0, 11.0, 41.0, 8.0], [-36.0, 16.0, 7.0, -51.0, -30.0], [39.0, -52.0, 18.0, 64.0, -50.0]]], [[[56.0, -4.0, 44.0, 23.0, 16.0], [44.0, 11.0, 26.0, 58.0, 19.0], [-47.0, -18.0, -47.0, 4.0, -49.0], [45.0, -37.0, -32.0, 58.0, -5.0]], [[34.0, 23.0, 12.0, -14.0, -12.0], [34.0, 26.0, 37.0, -100.0, -60.0], [-26.0, -54.0, 26.0, 74.0, 16.0], [-55.0, 28.0, 48.0, -38.0, -65.0]], [[-11.0, -18.0, -10.0, 13.0, -10.0], [-41.0, 12.0, 24.0, 44.0, -30.0], [-4.0, 6.0, -36.0, -27.0, -42.0], [5.0, -57.0, 0.0, -5.0, 81.0]], [[71.0, -39.0, 20.0, 30.0, 35.0], [19.0, 19.0, 26.0, 6.0, -23.0], [-33.0, -25.0, -31.0, -48.0, -47.0], [19.0, -36.0, 4.0, 45.0, -32.0]], [[51.0, 18.0, 4.0, 24.0, -14.0], [-6.0, 29.0, 69.0, -46.0, -103.0], [-49.0, -62.0, -46.0, 50.0, -25.0], [-16.0, -57.0, 18.0, -8.0, 32.0]]]]) | |
29204 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | |
29205 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
29206 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29207 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29208 | def test_tensor_mult_expandedData_rank4_constData_rank2(self): | |
29209 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29210 | arg0=msk_arg0*numarray.array([[[[3.0, 2.0, 3.0], [4.0, 0.0, 6.0]], [[0.0, -6.0, 1.0], [7.0, 7.0, 5.0]], [[-2.0, -7.0, 4.0], [-2.0, -3.0, 2.0]], [[0.0, 0.0, 4.0], [-6.0, -5.0, 6.0]], [[-3.0, -5.0, 2.0], [7.0, 5.0, 1.0]]], [[[-6.0, -1.0, 1.0], [-7.0, 2.0, -1.0]], [[-6.0, -1.0, -7.0], [2.0, 5.0, -2.0]], [[-1.0, -6.0, -1.0], [3.0, -7.0, -6.0]], [[-5.0, -2.0, 6.0], [1.0, -5.0, -6.0]], [[0.0, 0.0, -2.0], [-7.0, -3.0, 6.0]]], [[[0.0, -7.0, 4.0], [-1.0, -5.0, -5.0]], [[-2.0, 1.0, 7.0], [2.0, 4.0, -3.0]], [[-5.0, -4.0, 7.0], [-7.0, 4.0, 2.0]], [[-6.0, 4.0, 1.0], [-2.0, 0.0, 0.0]], [[5.0, 0.0, -1.0], [0.0, -2.0, 3.0]]], [[[6.0, 2.0, -6.0], [-2.0, -7.0, 3.0]], [[-1.0, 4.0, 6.0], [0.0, 7.0, 7.0]], [[6.0, -1.0, 6.0], [0.0, -4.0, 2.0]], [[5.0, 2.0, 0.0], [0.0, -7.0, 5.0]], [[0.0, 4.0, 4.0], [-2.0, -2.0, 7.0]]]])+(1.-msk_arg0)*numarray.array([[[[-5.0, -7.0, 4.0], [-3.0, -2.0, -3.0]], [[-5.0, -2.0, 5.0], [-1.0, -5.0, -3.0]], [[0.0, -7.0, 5.0], [6.0, -3.0, -2.0]], [[2.0, -7.0, -4.0], [0.0, -2.0, 6.0]], [[1.0, -3.0, -6.0], [0.0, 5.0, -4.0]]], [[[-6.0, -1.0, -5.0], [1.0, -7.0, 2.0]], [[4.0, 0.0, 7.0], [2.0, 2.0, 3.0]], [[0.0, -7.0, 0.0], [3.0, 1.0, 3.0]], [[4.0, -1.0, 3.0], [-1.0, -7.0, -3.0]], [[6.0, 0.0, -7.0], [5.0, 3.0, 4.0]]], [[[6.0, -5.0, -1.0], [-3.0, 1.0, -6.0]], [[4.0, 4.0, 0.0], [-3.0, 2.0, 1.0]], [[3.0, 5.0, 0.0], [6.0, -7.0, 7.0]], [[-7.0, -3.0, -5.0], [-5.0, -4.0, 3.0]], [[-4.0, 0.0, 3.0], [6.0, -4.0, -1.0]]], [[[0.0, -3.0, 0.0], [0.0, 1.0, -7.0]], [[0.0, 3.0, -3.0], [2.0, -3.0, 1.0]], [[-4.0, -1.0, 2.0], [-4.0, 2.0, -5.0]], [[7.0, -2.0, 7.0], [-4.0, 1.0, -2.0]], [[-2.0, 0.0, -7.0], [5.0, 0.0, 7.0]]]]) | |
29211 | arg1=Data(numarray.array([[1.0, -3.0, 0.0], [1.0, -3.0, 1.0]]),self.functionspace) | |
29212 | res=tensor_mult(arg0,arg1) | |
29213 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29214 | ref=msk_ref*numarray.array([[7.0, 9.0, 28.0, 15.0, 5.0], [-17.0, -18.0, 35.0, 11.0, 8.0], [30.0, -18.0, -10.0, -20.0, 14.0], [22.0, -27.0, 23.0, 25.0, -1.0]])+(1.-msk_ref)*numarray.array([[16.0, 12.0, 34.0, 35.0, -9.0], [21.0, 3.0, 24.0, 24.0, 6.0], [9.0, -16.0, 22.0, 12.0, 13.0], [-1.0, 3.0, -16.0, 4.0, 10.0]]) | |
29215 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29216 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
29217 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29218 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29219 | def test_tensor_mult_expandedData_rank4_constData_rank3(self): | |
29220 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29221 | arg0=msk_arg0*numarray.array([[[[-1.0, -5.0, 1.0], [-3.0, -7.0, 3.0]], [[-4.0, -7.0, -3.0], [0.0, -2.0, -7.0]], [[3.0, -3.0, -2.0], [-7.0, 3.0, 0.0]], [[-4.0, -7.0, -2.0], [-2.0, -3.0, -4.0]], [[7.0, 4.0, 0.0], [3.0, 2.0, 0.0]]], [[[-3.0, 5.0, -6.0], [-1.0, 6.0, 4.0]], [[-7.0, -3.0, 1.0], [-1.0, -5.0, 1.0]], [[1.0, -7.0, -3.0], [-3.0, 4.0, -7.0]], [[-4.0, 2.0, -4.0], [-2.0, -5.0, 0.0]], [[7.0, -6.0, -7.0], [-5.0, -1.0, -3.0]]], [[[-1.0, -7.0, 5.0], [3.0, 0.0, -6.0]], [[4.0, 7.0, -2.0], [-4.0, 4.0, -3.0]], [[-4.0, 0.0, -5.0], [0.0, 6.0, 6.0]], [[2.0, 5.0, 2.0], [-5.0, -4.0, 0.0]], [[-1.0, -3.0, -2.0], [3.0, 4.0, 1.0]]], [[[-2.0, -1.0, 7.0], [-4.0, -4.0, 0.0]], [[-3.0, -6.0, 2.0], [2.0, -1.0, 3.0]], [[-7.0, -2.0, -7.0], [1.0, 1.0, 4.0]], [[-1.0, 0.0, 2.0], [-5.0, 7.0, 7.0]], [[-2.0, 1.0, 7.0], [6.0, 1.0, -4.0]]]])+(1.-msk_arg0)*numarray.array([[[[1.0, -7.0, 0.0], [0.0, 3.0, -7.0]], [[7.0, 5.0, -2.0], [0.0, 1.0, -2.0]], [[7.0, -7.0, -7.0], [-3.0, 3.0, -1.0]], [[-3.0, -1.0, 0.0], [0.0, 0.0, 5.0]], [[-5.0, -1.0, -5.0], [1.0, 7.0, 2.0]]], [[[-2.0, 5.0, -4.0], [-4.0, 2.0, 5.0]], [[0.0, 0.0, -3.0], [-5.0, 7.0, -4.0]], [[-4.0, -5.0, 5.0], [-2.0, 0.0, 7.0]], [[4.0, 6.0, 6.0], [0.0, 2.0, -1.0]], [[0.0, -5.0, -5.0], [-3.0, -2.0, -1.0]]], [[[-1.0, 0.0, 0.0], [-1.0, 2.0, 2.0]], [[-1.0, -5.0, -7.0], [7.0, -3.0, 0.0]], [[-4.0, 0.0, 6.0], [1.0, 3.0, -2.0]], [[7.0, -3.0, -3.0], [1.0, 2.0, 5.0]], [[-4.0, 5.0, 4.0], [-6.0, -3.0, -7.0]]], [[[-2.0, 0.0, 5.0], [-2.0, 0.0, 0.0]], [[-5.0, 0.0, -4.0], [-4.0, 2.0, 7.0]], [[1.0, -6.0, 6.0], [-4.0, 3.0, -7.0]], [[-4.0, -2.0, 4.0], [6.0, 1.0, -6.0]], [[-1.0, 2.0, -2.0], [7.0, 0.0, 0.0]]]]) | |
29222 | arg1=Data(numarray.array([[[7.0, -1.0], [-1.0, -4.0], [4.0, -4.0]], [[6.0, -5.0], [4.0, -2.0], [1.0, -6.0]]]),self.functionspace) | |
29223 | res=tensor_mult(arg0,arg1) | |
29224 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29225 | ref=msk_ref*numarray.array([[[-41.0, 28.0], [-48.0, 90.0], [-14.0, 46.0], [-57.0, 80.0], [71.0, -42.0]], [[-28.0, -24.0], [-67.0, 24.0], [-7.0, 88.0], [-78.0, 32.0], [-10.0, 90.0]], [[32.0, 30.0], [2.0, 6.0], [-18.0, -24.0], [-29.0, 3.0], [23.0, -8.0]], [[-25.0, 6.0], [4.0, -7.0], [-61.0, 12.0], [6.0, -38.0], [49.0, -38.0]]])+(1.-msk_ref)*numarray.array([[[19.0, 63.0], [38.0, -9.0], [21.0, 64.0], [-15.0, -23.0], [-18.0, -2.0]], [[-46.0, -16.0], [-18.0, 47.0], [-8.0, -28.0], [53.0, -50.0], [-42.0, 65.0]], [[-3.0, -10.0], [0.0, 20.0], [12.0, -19.0], [59.0, -22.0], [-72.0, 46.0]], [[-6.0, -8.0], [-60.0, -5.0], [18.0, 55.0], [24.0, 0.0], [25.0, -34.0]]]) | |
29226 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29227 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
29228 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29229 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29230 | def test_tensor_mult_expandedData_rank4_constData_rank4(self): | |
29231 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29232 | arg0=msk_arg0*numarray.array([[[[2.0, -3.0, -2.0], [0.0, 5.0, 3.0]], [[3.0, 1.0, -5.0], [-6.0, -3.0, -3.0]], [[-2.0, 4.0, 4.0], [7.0, 7.0, 6.0]], [[-2.0, -5.0, -4.0], [-4.0, -4.0, 2.0]], [[-3.0, -4.0, -2.0], [-4.0, -5.0, 2.0]]], [[[-1.0, -1.0, 6.0], [-3.0, -5.0, 5.0]], [[1.0, 4.0, -2.0], [5.0, -3.0, 0.0]], [[2.0, 7.0, 0.0], [1.0, 5.0, -5.0]], [[-3.0, -4.0, 3.0], [-5.0, 3.0, 5.0]], [[7.0, 3.0, -5.0], [7.0, -4.0, -1.0]]], [[[-6.0, -3.0, -1.0], [1.0, -7.0, -7.0]], [[4.0, 2.0, -4.0], [-3.0, 7.0, -6.0]], [[5.0, 7.0, -3.0], [3.0, -6.0, -6.0]], [[0.0, -5.0, -7.0], [7.0, -1.0, -1.0]], [[3.0, -1.0, -5.0], [-3.0, -7.0, -1.0]]], [[[-5.0, 6.0, 1.0], [2.0, -6.0, 5.0]], [[-4.0, -7.0, 1.0], [6.0, 0.0, -6.0]], [[-2.0, 7.0, 2.0], [-1.0, 5.0, -4.0]], [[-4.0, 1.0, -7.0], [-1.0, 6.0, -3.0]], [[5.0, 0.0, 2.0], [-2.0, 0.0, 2.0]]]])+(1.-msk_arg0)*numarray.array([[[[0.0, -5.0, 5.0], [6.0, 5.0, -1.0]], [[-1.0, 0.0, -7.0], [-6.0, 0.0, 0.0]], [[-5.0, -1.0, -6.0], [0.0, -7.0, 7.0]], [[-6.0, 3.0, 3.0], [-2.0, -5.0, -3.0]], [[0.0, -4.0, 6.0], [-1.0, -5.0, 5.0]]], [[[-2.0, -4.0, 0.0], [-2.0, -1.0, 7.0]], [[-1.0, -4.0, 0.0], [-1.0, -3.0, 1.0]], [[3.0, 3.0, 7.0], [-4.0, -3.0, -3.0]], [[-2.0, 6.0, 4.0], [-5.0, -5.0, -5.0]], [[-3.0, -5.0, 5.0], [7.0, -2.0, 6.0]]], [[[6.0, 1.0, -5.0], [0.0, 0.0, -3.0]], [[1.0, 2.0, -4.0], [2.0, 4.0, 6.0]], [[0.0, -3.0, 4.0], [3.0, 0.0, 2.0]], [[-4.0, 0.0, 1.0], [-1.0, -3.0, 7.0]], [[-6.0, -6.0, -6.0], [6.0, 5.0, -6.0]]], [[[2.0, -3.0, -5.0], [3.0, 5.0, -3.0]], [[0.0, 3.0, 7.0], [3.0, -6.0, 2.0]], [[-1.0, 2.0, 7.0], [7.0, 4.0, -6.0]], [[-7.0, -5.0, -1.0], [-2.0, 7.0, 7.0]], [[-2.0, -3.0, 0.0], [0.0, -6.0, 7.0]]]]) | |
29233 | arg1=Data(numarray.array([[[[-6.0, 5.0, -2.0, -2.0, -1.0], [5.0, -4.0, 2.0, -5.0, -6.0], [-6.0, 0.0, 7.0, 3.0, 3.0], [-7.0, 5.0, 6.0, -4.0, 0.0]], [[-1.0, 5.0, -6.0, -6.0, 0.0], [-4.0, 5.0, 0.0, 3.0, -6.0], [7.0, 0.0, -1.0, -6.0, 4.0], [-3.0, 5.0, 6.0, -4.0, 4.0]], [[4.0, -3.0, 5.0, 5.0, -3.0], [2.0, 6.0, -2.0, 2.0, -2.0], [4.0, -6.0, -4.0, -2.0, -5.0], [3.0, 0.0, -3.0, -5.0, 0.0]]], [[[0.0, -5.0, -6.0, 0.0, 3.0], [5.0, 2.0, 0.0, 0.0, -1.0], [-4.0, -5.0, 0.0, 7.0, 0.0], [6.0, 5.0, 4.0, -7.0, 7.0]], [[-2.0, -3.0, 5.0, -6.0, -5.0], [-2.0, 5.0, -6.0, 2.0, -6.0], [-5.0, 4.0, 0.0, 4.0, -4.0], [4.0, 7.0, -6.0, -5.0, 6.0]], [[6.0, -6.0, 3.0, -7.0, 0.0], [-6.0, 0.0, -4.0, 5.0, 4.0], [0.0, -3.0, 6.0, 0.0, 6.0], [-4.0, 1.0, -5.0, -6.0, 3.0]]]]),self.functionspace) | |
29234 | res=tensor_mult(arg0,arg1) | |
29235 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29236 | ref=msk_ref*numarray.array([[[[-9.0, -32.0, 38.0, -47.0, -21.0], [-10.0, -10.0, -34.0, 2.0, -8.0], [-66.0, 23.0, 43.0, 48.0, 2.0], [-3.0, 33.0, -45.0, -29.0, 27.0]], [[-51.0, 92.0, -25.0, 2.0, 9.0], [-5.0, -64.0, 46.0, -43.0, -2.0], [8.0, 57.0, 22.0, -41.0, 32.0], [-75.0, -34.0, 48.0, 84.0, -65.0]], [[46.0, -94.0, 11.0, -84.0, -24.0], [-33.0, 101.0, -78.0, 74.0, -45.0], [-7.0, -49.0, 2.0, 39.0, -2.0], [60.0, 100.0, -44.0, -148.0, 125.0]], [[21.0, -3.0, 24.0, 24.0, 22.0], [-22.0, -69.0, 20.0, -11.0, 86.0], [-3.0, 22.0, 19.0, -12.0, 22.0], [-31.0, -81.0, -32.0, 84.0, -66.0]], [[36.0, -6.0, 25.0, 36.0, 22.0], [-25.0, -53.0, 20.0, -1.0, 88.0], [23.0, 6.0, 3.0, -29.0, 17.0], [-25.0, -88.0, -32.0, 79.0, -68.0]]], [[[71.0, -28.0, 46.0, 33.0, -1.0], [-24.0, 4.0, -4.0, 29.0, 53.0], [60.0, -56.0, 0.0, -50.0, 13.0], [-30.0, -55.0, -37.0, -6.0, -40.0]], [[-12.0, 15.0, -81.0, -18.0, 35.0], [16.0, -1.0, 24.0, -3.0, -13.0], [9.0, -25.0, 11.0, 6.0, 41.0], [-7.0, 29.0, 74.0, -30.0, 33.0]], [[-59.0, 55.0, -42.0, -41.0, -24.0], [7.0, 54.0, -6.0, -4.0, -105.0], [8.0, 30.0, -23.0, -9.0, -16.0], [11.0, 80.0, 53.0, -38.0, 50.0]], [[58.0, -58.0, 105.0, -8.0, -36.0], [-54.0, 15.0, -50.0, 40.0, 43.0], [7.0, 4.0, 1.0, -14.0, -22.0], [4.0, -34.0, -114.0, 3.0, -18.0]], [[-63.0, 48.0, -122.0, -26.0, 49.0], [62.0, -49.0, 52.0, -49.0, -37.0], [-49.0, -18.0, 60.0, 46.0, 68.0], [-43.0, 56.0, 132.0, -38.0, 34.0]]], [[[7.0, 16.0, -37.0, 116.0, 47.0], [41.0, -30.0, 60.0, -30.0, 69.0], [42.0, -6.0, -77.0, -19.0, -39.0], [54.0, -96.0, 30.0, 111.0, -68.0]], [[-92.0, 72.0, -5.0, -40.0, -36.0], [11.0, -1.0, -2.0, -38.0, -91.0], [-49.0, 85.0, 6.0, 15.0, -24.0], [-12.0, 58.0, 24.0, 18.0, 11.0]], [[-73.0, 108.0, -133.0, 11.0, 43.0], [54.0, -27.0, 76.0, -52.0, -57.0], [25.0, -3.0, 4.0, -24.0, 46.0], [-47.0, 27.0, 159.0, 12.0, -5.0]], [[-27.0, -30.0, -55.0, 8.0, 47.0], [49.0, -58.0, 24.0, -36.0, 39.0], [-86.0, 6.0, 27.0, 89.0, 13.0], [36.0, 2.0, 30.0, 17.0, 20.0]], [[-29.0, 67.0, -45.0, 24.0, 38.0], [14.0, -88.0, 62.0, -47.0, 39.0], [2.0, 20.0, 36.0, -24.0, 52.0], [-75.0, -55.0, 62.0, 79.0, -70.0]]], [[[70.0, -20.0, -48.0, -20.0, 38.0], [-55.0, 30.0, 4.0, 58.0, 46.0], [98.0, -55.0, -15.0, -63.0, 58.0], [-12.0, -22.0, 22.0, -23.0, 17.0]], [[-1.0, -52.0, 1.0, 97.0, 19.0], [76.0, -1.0, 14.0, -29.0, 34.0], [-45.0, -18.0, -61.0, 70.0, -81.0], [112.0, -31.0, -15.0, 33.0, -4.0]], [[-21.0, 33.0, -9.0, -30.0, -32.0], [-25.0, 78.0, -22.0, 25.0, -79.0], [48.0, 25.0, -53.0, -39.0, -32.0], [29.0, 51.0, 10.0, -24.0, 39.0]], [[-35.0, 11.0, -6.0, -48.0, -8.0], [-37.0, 7.0, -18.0, 6.0, -15.0], [-23.0, 80.0, -19.0, 13.0, -15.0], [34.0, 19.0, -22.0, 42.0, 24.0]], [[-10.0, 17.0, 18.0, -14.0, -17.0], [7.0, -12.0, -2.0, -11.0, -24.0], [-14.0, -8.0, 39.0, -3.0, 17.0], [-49.0, 17.0, 6.0, -28.0, -8.0]]]])+(1.-msk_ref)*numarray.array([[[[9.0, -79.0, 41.0, 32.0, -22.0], [56.0, 42.0, -36.0, 0.0, -20.0], [-64.0, -37.0, -21.0, 82.0, -71.0], [90.0, 39.0, -46.0, -66.0, 49.0]], [[-22.0, 46.0, 3.0, -33.0, 4.0], [-49.0, -50.0, 12.0, -9.0, 26.0], [2.0, 72.0, 21.0, -31.0, 32.0], [-50.0, -35.0, -9.0, 81.0, -42.0]], [[63.0, -33.0, -28.0, -21.0, 58.0], [-61.0, -56.0, 16.0, 31.0, 118.0], [34.0, -13.0, 32.0, -25.0, 81.0], [-36.0, -72.0, -11.0, 47.0, -25.0]], [[37.0, 19.0, -13.0, 60.0, 16.0], [-18.0, 28.0, 24.0, 20.0, 32.0], [102.0, -19.0, -75.0, -76.0, -19.0], [22.0, -63.0, 10.0, 54.0, -41.0]], [[68.0, -48.0, 50.0, 49.0, 4.0], [3.0, -11.0, -2.0, 15.0, 63.0], [25.0, -66.0, 10.0, -15.0, 4.0], [-16.0, -55.0, -41.0, -12.0, -38.0]]], [[[60.0, -59.0, 56.0, -15.0, 1.0], [-44.0, -21.0, -26.0, 31.0, 72.0], [-3.0, -15.0, 32.0, 0.0, 24.0], [-18.0, -40.0, -73.0, 1.0, -15.0]], [[22.0, -17.0, 20.0, 37.0, 13.0], [6.0, -33.0, 12.0, -8.0, 53.0], [-3.0, -10.0, 3.0, 2.0, -1.0], [-3.0, -50.0, -21.0, 36.0, -38.0]], [[-5.0, 56.0, 11.0, 50.0, -21.0], [21.0, 22.0, 22.0, -13.0, -40.0], [62.0, -25.0, -28.0, -63.0, -20.0], [-33.0, -14.0, 32.0, 2.0, -43.0]], [[2.0, 78.0, -22.0, 53.0, 0.0], [-11.0, 27.0, 38.0, 1.0, -17.0], [115.0, -4.0, -66.0, -105.0, -12.0], [-22.0, -45.0, 47.0, 54.0, -56.0]], [[83.0, -120.0, 27.0, 31.0, 19.0], [18.0, 21.0, -28.0, 36.0, 67.0], [-15.0, -91.0, 0.0, 52.0, -10.0], [61.0, -13.0, -53.0, -68.0, 35.0]]], [[[-75.0, 68.0, -52.0, -22.0, 9.0], [34.0, -49.0, 34.0, -52.0, -44.0], [-49.0, 39.0, 43.0, 22.0, 29.0], [-48.0, 32.0, 72.0, 15.0, -5.0]], [[4.0, -31.0, -8.0, -100.0, -3.0], [-45.0, 6.0, -38.0, 31.0, -12.0], [-36.0, 12.0, 57.0, 29.0, 51.0], [-21.0, 59.0, -16.0, -62.0, 64.0]], [[31.0, -54.0, 26.0, 24.0, -3.0], [23.0, 15.0, -16.0, 9.0, 15.0], [-17.0, -45.0, -1.0, 31.0, -20.0], [31.0, 2.0, -28.0, -41.0, 15.0]], [[76.0, -51.0, 25.0, -18.0, 13.0], [-59.0, 5.0, -20.0, 51.0, 69.0], [47.0, -34.0, 10.0, -33.0, 37.0], [-15.0, -39.0, -48.0, -9.0, -4.0]], [[-28.0, -51.0, -11.0, 30.0, 17.0], [38.0, -5.0, -6.0, -20.0, 24.0], [-79.0, 44.0, -48.0, 92.0, -68.0], [122.0, -1.0, -30.0, 47.0, 30.0]]], [[[-57.0, -2.0, -13.0, -20.0, -3.0], [35.0, -22.0, -4.0, -34.0, -29.0], [-90.0, 44.0, 19.0, 75.0, -19.0], [30.0, 42.0, 6.0, 1.0, 30.0]], [[49.0, -15.0, -25.0, 39.0, 18.0], [17.0, 33.0, 14.0, 21.0, 9.0], [67.0, -87.0, -19.0, -35.0, 13.0], [-2.0, -10.0, 35.0, -50.0, 3.0]], [[-12.0, -27.0, -15.0, 43.0, -19.0], [64.0, 90.0, -16.0, 3.0, -75.0], [0.0, -43.0, -73.0, 36.0, -82.0], [104.0, 62.0, 19.0, -72.0, 63.0]], [[71.0, -110.0, 107.0, -52.0, -31.0], [-83.0, 28.0, -82.0, 67.0, 62.0], [-24.0, 23.0, 2.0, 25.0, -22.0], [49.0, -14.0, -154.0, -10.0, 29.0]], [[69.0, -49.0, 13.0, 9.0, 32.0], [-28.0, -37.0, 4.0, 24.0, 94.0], [21.0, -45.0, 31.0, -12.0, 48.0], [-29.0, -60.0, -29.0, 8.0, -27.0]]]]) | |
29237 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29238 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
29239 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29240 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29241 | def test_tensor_mult_expandedData_rank4_expandedData_rank2(self): | |
29242 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29243 | arg0=msk_arg0*numarray.array([[[[-6.0, -4.0, 1.0], [3.0, -4.0, -3.0]], [[-4.0, -1.0, 7.0], [-4.0, -2.0, -2.0]], [[-6.0, -5.0, -2.0], [-5.0, -3.0, 0.0]], [[2.0, 0.0, 3.0], [0.0, 2.0, -5.0]], [[-2.0, -2.0, 0.0], [-6.0, 0.0, 0.0]]], [[[7.0, 6.0, 2.0], [-4.0, 7.0, -6.0]], [[7.0, -7.0, -1.0], [0.0, 7.0, 1.0]], [[-6.0, -4.0, 7.0], [-6.0, -3.0, -1.0]], [[7.0, -4.0, 6.0], [2.0, -7.0, -3.0]], [[6.0, 5.0, -1.0], [-6.0, -1.0, 0.0]]], [[[-7.0, -7.0, 2.0], [7.0, 3.0, 2.0]], [[-3.0, -3.0, 2.0], [3.0, -1.0, 2.0]], [[-2.0, -1.0, -2.0], [5.0, -4.0, 7.0]], [[-5.0, -7.0, -6.0], [7.0, -3.0, -3.0]], [[0.0, -2.0, -5.0], [7.0, 0.0, -1.0]]], [[[-4.0, 6.0, -4.0], [-1.0, 0.0, 0.0]], [[6.0, -5.0, 5.0], [2.0, 2.0, -1.0]], [[0.0, 0.0, -1.0], [1.0, 1.0, -6.0]], [[-1.0, 3.0, -1.0], [-1.0, 6.0, 1.0]], [[0.0, -7.0, -1.0], [3.0, 2.0, 1.0]]]])+(1.-msk_arg0)*numarray.array([[[[-7.0, 7.0, -3.0], [-6.0, -7.0, 6.0]], [[5.0, -7.0, 1.0], [-7.0, 0.0, 1.0]], [[-2.0, -1.0, 6.0], [0.0, 0.0, 1.0]], [[-6.0, 5.0, -6.0], [-1.0, 3.0, 3.0]], [[5.0, -5.0, -2.0], [3.0, 7.0, 5.0]]], [[[-6.0, 0.0, 4.0], [3.0, -4.0, -5.0]], [[4.0, 4.0, 0.0], [4.0, 7.0, 3.0]], [[-7.0, 7.0, 3.0], [0.0, 0.0, 3.0]], [[-5.0, 6.0, 6.0], [5.0, -5.0, -3.0]], [[0.0, 4.0, -3.0], [-4.0, -2.0, -5.0]]], [[[0.0, -6.0, 4.0], [6.0, 0.0, 5.0]], [[-5.0, 7.0, 5.0], [4.0, 0.0, -2.0]], [[7.0, -4.0, 7.0], [7.0, 5.0, 2.0]], [[-3.0, -4.0, -5.0], [-7.0, 0.0, 6.0]], [[5.0, 6.0, 3.0], [-4.0, -7.0, 0.0]]], [[[-4.0, -1.0, 0.0], [0.0, 0.0, -6.0]], [[-6.0, 0.0, 5.0], [1.0, 0.0, 0.0]], [[5.0, 0.0, -6.0], [-3.0, 3.0, 0.0]], [[3.0, 0.0, -3.0], [0.0, 5.0, 2.0]], [[-4.0, 1.0, 2.0], [6.0, 2.0, -5.0]]]]) | |
29244 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29245 | arg1=msk_arg1*numarray.array([[3.0, 6.0, 6.0], [0.0, 4.0, 4.0]])+(1.-msk_arg1)*numarray.array([[1.0, -1.0, 7.0], [-4.0, 5.0, -6.0]]) | |
29246 | res=tensor_mult(arg0,arg1) | |
29247 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29248 | ref=msk_ref*numarray.array([[-64.0, 8.0, -72.0, 12.0, -18.0], [73.0, 5.0, -16.0, -7.0, 38.0], [-31.0, -11.0, -12.0, -117.0, -46.0], [0.0, 22.0, -26.0, 37.0, -36.0]])+(1.-msk_ref)*numarray.array([[-82.0, 41.0, 35.0, -52.0, -11.0], [20.0, 1.0, -11.0, 4.0, 11.0], [-20.0, 19.0, 45.0, -42.0, 1.0], [33.0, 25.0, -10.0, -5.0, 25.0]]) | |
29249 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29250 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | |
29251 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29252 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29253 | def test_tensor_mult_expandedData_rank4_expandedData_rank3(self): | |
29254 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29255 | arg0=msk_arg0*numarray.array([[[[4.0, -4.0, -5.0], [5.0, 0.0, -6.0]], [[-5.0, -5.0, 6.0], [5.0, -5.0, 4.0]], [[-2.0, 1.0, 0.0], [6.0, 4.0, -1.0]], [[0.0, 0.0, 0.0], [-5.0, 2.0, 4.0]], [[-1.0, -1.0, 4.0], [-1.0, 1.0, 1.0]]], [[[-3.0, 1.0, 0.0], [0.0, -5.0, -6.0]], [[6.0, 6.0, 2.0], [-3.0, -6.0, 7.0]], [[-4.0, -3.0, 3.0], [-5.0, 3.0, -6.0]], [[0.0, -4.0, -5.0], [4.0, 3.0, -1.0]], [[-3.0, -1.0, 5.0], [2.0, -3.0, -2.0]]], [[[7.0, 0.0, 3.0], [-1.0, -2.0, 0.0]], [[1.0, 7.0, -6.0], [0.0, 0.0, -5.0]], [[4.0, -7.0, -3.0], [0.0, 4.0, 6.0]], [[1.0, 1.0, -6.0], [3.0, 5.0, 4.0]], [[0.0, 3.0, -6.0], [-7.0, -1.0, 7.0]]], [[[7.0, 0.0, -1.0], [-1.0, 4.0, 3.0]], [[-5.0, 0.0, 0.0], [1.0, -5.0, -3.0]], [[-6.0, 0.0, -6.0], [-5.0, -2.0, -2.0]], [[-4.0, 6.0, 7.0], [-7.0, -4.0, 0.0]], [[7.0, -6.0, 4.0], [-7.0, -7.0, 1.0]]]])+(1.-msk_arg0)*numarray.array([[[[7.0, 1.0, 7.0], [3.0, -2.0, -1.0]], [[-7.0, -3.0, 2.0], [7.0, -3.0, 7.0]], [[0.0, 3.0, 3.0], [0.0, 3.0, -6.0]], [[6.0, 6.0, 6.0], [-4.0, -2.0, -1.0]], [[-1.0, 1.0, -6.0], [6.0, 0.0, 6.0]]], [[[3.0, -5.0, -4.0], [2.0, 4.0, -6.0]], [[-5.0, 2.0, -6.0], [-2.0, -5.0, 7.0]], [[3.0, -7.0, -4.0], [7.0, -3.0, -4.0]], [[-3.0, -1.0, -1.0], [0.0, 2.0, 0.0]], [[-5.0, -3.0, -7.0], [-2.0, -3.0, 1.0]]], [[[3.0, 0.0, 2.0], [-2.0, 1.0, 0.0]], [[0.0, 6.0, -7.0], [-6.0, -1.0, -1.0]], [[0.0, -5.0, -4.0], [-3.0, 1.0, -3.0]], [[-6.0, -3.0, 0.0], [1.0, -2.0, -3.0]], [[-1.0, -2.0, 4.0], [5.0, 7.0, -1.0]]], [[[-4.0, 5.0, -3.0], [-2.0, -5.0, -7.0]], [[-1.0, 5.0, 7.0], [-5.0, 0.0, -3.0]], [[-3.0, 6.0, 6.0], [0.0, -1.0, 1.0]], [[4.0, 6.0, 4.0], [7.0, 7.0, -3.0]], [[7.0, -6.0, 3.0], [6.0, 0.0, 4.0]]]]) | |
29256 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29257 | arg1=msk_arg1*numarray.array([[[-5.0, 0.0], [-2.0, -6.0], [-3.0, 6.0]], [[1.0, 5.0], [3.0, 0.0], [5.0, 3.0]]])+(1.-msk_arg1)*numarray.array([[[-7.0, 5.0], [7.0, -2.0], [6.0, 2.0]], [[-7.0, 3.0], [6.0, 0.0], [-7.0, -7.0]]]) | |
29258 | res=tensor_mult(arg0,arg1) | |
29259 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29260 | ref=msk_ref*numarray.array([[[-22.0, 1.0], [27.0, 103.0], [21.0, 21.0], [21.0, -13.0], [2.0, 28.0]], [[-32.0, -24.0], [-34.0, -18.0], [-9.0, -7.0], [31.0, 11.0], [-15.0, 40.0]], [[-51.0, 13.0], [-26.0, -93.0], [45.0, 42.0], [49.0, -15.0], [37.0, -68.0]], [[-6.0, -2.0], [-4.0, -4.0], [27.0, -67.0], [-32.0, -29.0], [-58.0, 28.0]]])+(1.-msk_ref)*numarray.array([[[-26.0, 63.0], [-76.0, -53.0], [99.0, 42.0], [59.0, 25.0], [-106.0, -43.0]], [[-28.0, 65.0], [-52.0, -96.0], [-133.0, 70.0], [20.0, -15.0], [-39.0, -46.0]], [[11.0, 13.0], [43.0, -37.0], [-11.0, 14.0], [23.0, 0.0], [31.0, 29.0]], [[78.0, 7.0], [140.0, 5.0], [86.0, -22.0], [52.0, 58.0], [-143.0, 43.0]]]) | |
29261 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29262 | self.failUnlessEqual(res.getShape(),(4, 5, 2),"wrong shape of result.") | |
29263 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29264 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29265 | def test_tensor_mult_expandedData_rank4_expandedData_rank4(self): | |
29266 | msk_arg0=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29267 | arg0=msk_arg0*numarray.array([[[[4.0, -3.0, -5.0], [0.0, 4.0, -6.0]], [[7.0, -1.0, 2.0], [-5.0, 2.0, -3.0]], [[7.0, -1.0, 0.0], [0.0, -2.0, 0.0]], [[0.0, 7.0, 2.0], [-1.0, 5.0, 2.0]], [[0.0, 6.0, -7.0], [-7.0, 7.0, -7.0]]], [[[2.0, -6.0, 2.0], [-7.0, -5.0, 3.0]], [[-4.0, -1.0, 1.0], [3.0, 1.0, -5.0]], [[5.0, 6.0, -6.0], [-2.0, -7.0, -5.0]], [[7.0, 6.0, 4.0], [-4.0, -3.0, 4.0]], [[-4.0, 6.0, -1.0], [-4.0, -7.0, 4.0]]], [[[7.0, 4.0, 0.0], [2.0, -5.0, 4.0]], [[2.0, 3.0, 0.0], [2.0, 6.0, 2.0]], [[-2.0, 6.0, -1.0], [0.0, 7.0, -7.0]], [[3.0, -5.0, -6.0], [-5.0, -2.0, 7.0]], [[7.0, -6.0, 2.0], [-5.0, 5.0, -7.0]]], [[[4.0, -4.0, -1.0], [-1.0, 0.0, 5.0]], [[0.0, 7.0, 0.0], [2.0, 6.0, -3.0]], [[0.0, 5.0, 6.0], [0.0, -6.0, 0.0]], [[0.0, -2.0, -3.0], [-7.0, 5.0, -5.0]], [[0.0, 5.0, 5.0], [-6.0, 3.0, 5.0]]]])+(1.-msk_arg0)*numarray.array([[[[6.0, -7.0, -2.0], [-1.0, 6.0, -3.0]], [[0.0, 3.0, 0.0], [-4.0, -5.0, 1.0]], [[-5.0, 7.0, 4.0], [3.0, -5.0, 2.0]], [[0.0, -1.0, -3.0], [3.0, 5.0, -4.0]], [[5.0, -6.0, 2.0], [4.0, 4.0, 3.0]]], [[[-4.0, 3.0, 7.0], [-6.0, -7.0, -6.0]], [[-1.0, 0.0, -5.0], [6.0, 2.0, 6.0]], [[2.0, 4.0, 6.0], [-2.0, -2.0, -7.0]], [[-4.0, 2.0, -4.0], [-5.0, 1.0, -7.0]], [[-7.0, -3.0, -5.0], [1.0, 2.0, 7.0]]], [[[-6.0, 6.0, -7.0], [-3.0, -1.0, 3.0]], [[4.0, 2.0, 4.0], [0.0, -2.0, -7.0]], [[4.0, -1.0, 1.0], [0.0, -4.0, 0.0]], [[-5.0, -6.0, 7.0], [0.0, 3.0, 3.0]], [[7.0, -5.0, 7.0], [4.0, -3.0, 4.0]]], [[[7.0, -2.0, 5.0], [5.0, 1.0, 5.0]], [[-5.0, -1.0, 1.0], [-2.0, -5.0, -5.0]], [[-6.0, 5.0, 0.0], [-2.0, 6.0, -5.0]], [[-4.0, 2.0, -6.0], [1.0, -2.0, 1.0]], [[0.0, 0.0, -2.0], [-3.0, -2.0, 5.0]]]]) | |
29268 | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29269 | arg1=msk_arg1*numarray.array([[[[-1.0, -5.0, 2.0, -7.0, -3.0], [-5.0, 7.0, -1.0, -2.0, -6.0], [6.0, -1.0, -1.0, -3.0, -4.0], [6.0, -1.0, -5.0, 0.0, 6.0]], [[-5.0, -1.0, -5.0, -6.0, 5.0], [3.0, 0.0, -3.0, -1.0, 3.0], [7.0, -3.0, 5.0, -1.0, -1.0], [4.0, 6.0, 0.0, -5.0, 0.0]], [[-5.0, 0.0, 3.0, -1.0, 2.0], [-5.0, -6.0, 0.0, 0.0, 1.0], [-4.0, -6.0, 7.0, 4.0, 0.0], [-2.0, 4.0, 1.0, 0.0, -6.0]]], [[[4.0, -2.0, 0.0, -6.0, 5.0], [1.0, -7.0, 0.0, 5.0, -1.0], [-6.0, 0.0, -3.0, -3.0, 4.0], [2.0, -6.0, 0.0, -1.0, 2.0]], [[4.0, -3.0, 6.0, -3.0, 0.0], [-4.0, 2.0, -7.0, 1.0, 7.0], [7.0, 3.0, 1.0, 7.0, -1.0], [-2.0, -1.0, 6.0, -2.0, -1.0]], [[3.0, 7.0, 7.0, 1.0, -4.0], [-4.0, 2.0, -6.0, -7.0, -1.0], [0.0, -6.0, 0.0, -7.0, 4.0], [0.0, -3.0, -7.0, -2.0, 5.0]]]])+(1.-msk_arg1)*numarray.array([[[[6.0, -1.0, 3.0, -4.0, 4.0], [7.0, 4.0, 5.0, 6.0, -1.0], [-2.0, 3.0, -5.0, 7.0, -4.0], [-6.0, 1.0, -5.0, -5.0, 6.0]], [[-6.0, -4.0, -4.0, 3.0, 6.0], [-6.0, 0.0, 6.0, -2.0, 6.0], [-7.0, -3.0, 7.0, -4.0, 3.0], [3.0, -4.0, 1.0, 2.0, -4.0]], [[5.0, 3.0, -2.0, 2.0, -7.0], [1.0, 1.0, 1.0, 2.0, 2.0], [-7.0, 6.0, 2.0, 0.0, -4.0], [6.0, 6.0, 2.0, 5.0, -3.0]]], [[[7.0, -5.0, -4.0, -4.0, 3.0], [-6.0, -2.0, -2.0, 1.0, -6.0], [-5.0, 5.0, -5.0, 4.0, -4.0], [5.0, 1.0, -1.0, 0.0, 2.0]], [[-7.0, -1.0, -4.0, -5.0, 7.0], [7.0, -6.0, -4.0, -7.0, 3.0], [-6.0, -6.0, 7.0, -1.0, 2.0], [1.0, 0.0, 5.0, 1.0, -5.0]], [[-7.0, 0.0, 0.0, -4.0, -1.0], [-1.0, -1.0, 7.0, -2.0, 6.0], [2.0, 0.0, 0.0, 3.0, -7.0], [1.0, -6.0, 1.0, 6.0, 0.0]]]]) | |
29270 | res=tensor_mult(arg0,arg1) | |
29271 | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) | |
29272 | ref=msk_ref*numarray.array([[[[34.0, -71.0, -10.0, -23.0, -13.0], [4.0, 54.0, 13.0, 41.0, -4.0], [51.0, 83.0, -50.0, 41.0, -41.0], [14.0, -28.0, 41.0, 19.0, 20.0]], [[-33.0, -51.0, 16.0, -24.0, -35.0], [-49.0, 70.0, 0.0, -15.0, -21.0], [71.0, 8.0, 19.0, 38.0, -61.0], [20.0, 32.0, 0.0, 12.0, 3.0]], [[-10.0, -28.0, 7.0, -37.0, -26.0], [-30.0, 45.0, 10.0, -15.0, -59.0], [21.0, -10.0, -14.0, -34.0, -25.0], [42.0, -11.0, -47.0, 9.0, 44.0]], [[-23.0, -6.0, 15.0, -51.0, 26.0], [-18.0, 9.0, -68.0, -21.0, 57.0], [82.0, -30.0, 57.0, 25.0, -8.0], [12.0, 45.0, 18.0, -48.0, -9.0]], [[-16.0, -62.0, -58.0, -15.0, 9.0], [46.0, 91.0, -25.0, 15.0, 74.0], [161.0, 87.0, 9.0, 85.0, -69.0], [10.0, 64.0, 84.0, -23.0, -14.0]]], [[[-21.0, 46.0, 31.0, 80.0, -79.0], [-37.0, 47.0, 33.0, -59.0, -59.0], [-31.0, -29.0, -2.0, -27.0, -13.0], [-20.0, 8.0, -59.0, 41.0, 6.0]], [[5.0, -23.0, -29.0, 7.0, 44.0], [31.0, -63.0, 30.0, 60.0, 31.0], [-46.0, 34.0, -2.0, 50.0, 8.0], [-26.0, -2.0, 62.0, 10.0, -50.0]], [[-56.0, -41.0, -115.0, -37.0, 13.0], [69.0, 61.0, 56.0, 2.0, -60.0], [59.0, 22.0, -18.0, -53.0, -47.0], [76.0, 41.0, -38.0, -4.0, 44.0]], [[-73.0, 4.0, 6.0, -52.0, -19.0], [-45.0, 55.0, -28.0, -71.0, -41.0], [71.0, -82.0, 60.0, -48.0, -31.0], [56.0, 60.0, -77.0, -28.0, 33.0]], [[-53.0, 71.0, -55.0, 42.0, 4.0], [51.0, 0.0, 11.0, -53.0, -8.0], [-3.0, -53.0, 32.0, -63.0, 17.0], [8.0, 55.0, -51.0, -20.0, 1.0]]], [[[-27.0, 0.0, -8.0, -66.0, -7.0], [-17.0, 33.0, -8.0, -41.0, -71.0], [23.0, -58.0, 2.0, -94.0, -3.0], [72.0, -2.0, -93.0, -20.0, 71.0]], [[21.0, -21.0, 39.0, -60.0, 11.0], [-31.0, 16.0, -65.0, -5.0, 35.0], [63.0, -5.0, 13.0, 13.0, -1.0], [16.0, -8.0, 12.0, -33.0, 20.0]], [[-16.0, -66.0, -44.0, -49.0, 62.0], [33.0, -8.0, -23.0, 54.0, 85.0], [83.0, 53.0, 32.0, 94.0, -33.0], [0.0, 48.0, 100.0, -30.0, -48.0]], [[45.0, 55.0, 50.0, 58.0, -99.0], [-25.0, 102.0, -16.0, -77.0, -55.0], [23.0, 0.0, -57.0, -76.0, 3.0], [4.0, -46.0, -82.0, 20.0, 81.0]], [[-8.0, -83.0, 31.0, -7.0, -44.0], [-60.0, 68.0, 18.0, 21.0, -11.0], [57.0, 56.0, -3.0, 92.0, -75.0], [-6.0, 11.0, 46.0, 39.0, -20.0]]], [[[32.0, 21.0, 60.0, 8.0, -59.0], [-48.0, 51.0, -22.0, -44.0, -41.0], [6.0, -16.0, -28.0, -44.0, 4.0], [8.0, -41.0, -56.0, 11.0, 53.0]], [[-12.0, -50.0, -20.0, -75.0, 57.0], [11.0, -8.0, -45.0, 30.0, 64.0], [79.0, 15.0, 35.0, 50.0, -17.0], [20.0, 33.0, 57.0, -43.0, -17.0]], [[-79.0, 13.0, -43.0, -18.0, 37.0], [9.0, -48.0, 27.0, -11.0, -21.0], [-31.0, -69.0, 61.0, -23.0, 1.0], [20.0, 60.0, -30.0, -13.0, -30.0]], [[2.0, -34.0, -4.0, 37.0, -31.0], [2.0, 67.0, 1.0, 7.0, 38.0], [75.0, 69.0, -5.0, 81.0, -51.0], [-26.0, 28.0, 62.0, 17.0, -26.0]], [[-47.0, 33.0, 43.0, -3.0, -15.0], [-48.0, 28.0, -66.0, -67.0, 42.0], [72.0, -66.0, 81.0, 19.0, -12.0], [-8.0, 68.0, -12.0, -35.0, -20.0]]]])+(1.-msk_ref)*numarray.array([[[[40.0, 15.0, 30.0, -63.0, 38.0], [133.0, -9.0, -57.0, 9.0, -46.0], [14.0, -14.0, -36.0, 51.0, 0.0], [-71.0, 39.0, -13.0, -66.0, 38.0]], [[-18.0, 13.0, 24.0, 46.0, -30.0], [-30.0, 37.0, 53.0, 23.0, 33.0], [31.0, 1.0, 6.0, -20.0, 8.0], [-15.0, -22.0, -17.0, 7.0, 5.0]], [[-10.0, -21.0, -43.0, 54.0, -34.0], [-128.0, 6.0, 49.0, -2.0, 34.0], [-48.0, 33.0, 32.0, -40.0, -11.0], [87.0, -18.0, 14.0, 66.0, -39.0]], [[5.0, -25.0, -22.0, -30.0, 63.0], [24.0, -35.0, -63.0, -28.0, -39.0], [-25.0, -30.0, 7.0, -1.0, 35.0], [-5.0, 13.0, 11.0, -36.0, -6.0]], [[55.0, 1.0, 3.0, -82.0, 7.0], [74.0, -13.0, -12.0, 16.0, -31.0], [-20.0, 41.0, -55.0, 80.0, -75.0], [-9.0, 27.0, -8.0, -5.0, 36.0]]], [[[42.0, 50.0, 14.0, 122.0, -108.0], [-46.0, 51.0, 3.0, 39.0, 15.0], [-2.0, 33.0, 36.0, -75.0, 49.0], [32.0, 56.0, 2.0, 18.0, -34.0]], [[-45.0, -46.0, -25.0, -64.0, 57.0], [-40.0, -39.0, 12.0, -36.0, -3.0], [7.0, -15.0, -21.0, 33.0, -38.0], [14.0, -61.0, 5.0, 18.0, 11.0]], [[67.0, 12.0, -6.0, 62.0, -23.0], [1.0, 37.0, 3.0, 42.0, -2.0], [-66.0, 32.0, 26.0, -29.0, 33.0], [17.0, 62.0, -9.0, -16.0, -16.0]], [[-49.0, 8.0, 4.0, 57.0, 23.0], [0.0, -9.0, -55.0, -34.0, -1.0], [27.0, -73.0, 58.0, -78.0, 109.0], [-25.0, 1.0, 17.0, -37.0, -35.0]], [[-105.0, -3.0, -11.0, -33.0, -1.0], [-35.0, -54.0, -19.0, -73.0, 21.0], [67.0, -49.0, 13.0, -14.0, -10.0], [17.0, -66.0, 38.0, 48.0, -23.0]]], [[[-142.0, -23.0, -12.0, 33.0, 42.0], [-77.0, -22.0, 30.0, -64.0, 61.0], [46.0, -87.0, 66.0, -68.0, 59.0], [-1.0, -93.0, 23.0, 24.0, -40.0]], [[95.0, 2.0, 4.0, 36.0, -7.0], [13.0, 39.0, -5.0, 56.0, -32.0], [-52.0, 42.0, -12.0, 1.0, 19.0], [-3.0, 62.0, -27.0, -40.0, 14.0]], [[63.0, 7.0, 30.0, 3.0, -25.0], [7.0, 41.0, 31.0, 56.0, -20.0], [16.0, 45.0, -53.0, 36.0, -31.0], [-25.0, 14.0, -39.0, -21.0, 45.0]], [[-1.0, 47.0, -17.0, -11.0, -87.0], [26.0, -34.0, -45.0, -31.0, 10.0], [-9.0, 27.0, 18.0, -5.0, -41.0], [60.0, 43.0, 51.0, 69.0, -42.0]], [[128.0, 17.0, 23.0, -46.0, -64.0], [37.0, 41.0, 44.0, 83.0, -32.0], [-22.0, 116.0, -97.0, 100.0, -121.0], [6.0, 49.0, -41.0, 11.0, 64.0]]], [[[72.0, -10.0, -5.0, -69.0, -2.0], [38.0, 12.0, 49.0, 44.0, -6.0], [-56.0, 76.0, -57.0, 91.0, -107.0], [13.0, 20.0, -22.0, 17.0, 40.0]], [[37.0, 27.0, 15.0, 72.0, -69.0], [-46.0, 20.0, -41.0, 17.0, -32.0], [40.0, 14.0, -5.0, -49.0, 46.0], [13.0, 33.0, -2.0, -7.0, -8.0]], [[-87.0, -10.0, -54.0, 37.0, 47.0], [-13.0, -51.0, -55.0, -80.0, 36.0], [-59.0, -79.0, 117.0, -91.0, 94.0], [42.0, 2.0, 62.0, 16.0, -90.0]], [[-52.0, -25.0, -4.0, 12.0, 26.0], [-67.0, -13.0, -1.0, -27.0, -2.0], [45.0, -37.0, 3.0, -27.0, 31.0], [-2.0, -53.0, 0.0, -2.0, -2.0]], [[-52.0, 11.0, 24.0, -2.0, -14.0], [-3.0, 11.0, 47.0, -3.0, 38.0], [51.0, -15.0, -3.0, 5.0, -19.0], [-24.0, -45.0, -6.0, 18.0, 10.0]]]]) | |
29273 | self.failUnless(isinstance(res,Data),"wrong type of result.") | |
29274 | self.failUnlessEqual(res.getShape(),(4, 5, 4, 5),"wrong shape of result.") | |
29275 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | |
29276 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
29277 | def test_generalTensorProduct_float_rank0_float_rank0_offset0(self): | def test_generalTensorProduct_float_rank0_float_rank0_offset0(self): |
29278 | arg0=-0.816058209277 | arg0=7.0 |
29279 | arg1=-0.334851342127 | arg1=6.0 |
29280 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29281 | ref=0.27325818663014179 | ref=42.0 |
29282 | self.failUnless(isinstance(res,float),"wrong type of result.") | self.failUnless(isinstance(res,float),"wrong type of result.") |
29283 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29284 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29285 | def test_generalTensorProduct_float_rank0_array_rank0_offset0(self): | def test_generalTensorProduct_float_rank0_array_rank0_offset0(self): |
29286 | arg0=-0.0378781468644 | arg0=0.0 |
29287 | arg1=numarray.array(-0.223764515469) | arg1=numarray.array(-6.0) |
29288 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29289 | ref=numarray.array(0.008475785179988933) | ref=numarray.array(-0.0) |
29290 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29291 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | self.failUnlessEqual(res.shape,(),"wrong shape of result.") |
29292 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29293 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29294 | def test_generalTensorProduct_float_rank0_array_rank1_offset0(self): | def test_generalTensorProduct_float_rank0_array_rank1_offset0(self): |
29295 | arg0=0.543146680723 | arg0=-2.0 |
29296 | arg1=numarray.array([-0.92731085296922822, -0.36581780458574942]) | arg1=numarray.array([-7.0, -5.0]) |
29297 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29298 | ref=numarray.array([-0.50366581178893521, -0.19869272631023729]) | ref=numarray.array([14.0, 10.0]) |
29299 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29300 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
29301 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29302 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29303 | def test_generalTensorProduct_float_rank0_array_rank2_offset0(self): | def test_generalTensorProduct_float_rank0_array_rank2_offset0(self): |
29304 | arg0=-0.559404776535 | arg0=-3.0 |
29305 | arg1=numarray.array([[-0.73633376974850639, -0.068583989340989415, -0.58700884536720088, 0.41828463778594793, -0.13130077394080808], [0.21022430355207389, -0.89023705295881594, -0.98599053548811422, -0.011942717529535241, -0.49444669262957119], [0.32064546170075658, 0.68151799398521828, 0.58093384094003797, -0.84765413248022803, -0.53426528691691533], [-0.97631867410054096, -0.76752519044492384, -0.38935877053278678, -0.1817765419702333, -0.63370674570498831]]) | arg1=numarray.array([[0.0, -4.0, 2.0, -7.0, -3.0], [-7.0, 4.0, -1.0, 3.0, 0.0], [3.0, 4.0, -3.0, 7.0, -4.0], [5.0, 4.0, 4.0, 0.0, 3.0]]) |
29306 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29307 | ref=numarray.array([[0.41190862792168437, 0.038366211231207328, 0.32837555196698404, -0.23399042432886874, 0.073450280105292171], [-0.11760047955087297, 0.49800285967402291, 0.55156781517081821, 0.0066808132308359171, 0.27659584159914813], [-0.17937060284982476, -0.38124442113020368, -0.32497716547295497, 0.47418177055947069, 0.29887055343841645], [0.54615732971262076, 0.42935725764618765, 0.21780915602201942, 0.10168666584024907, 0.35449858047011973]]) | ref=numarray.array([[-0.0, 12.0, -6.0, 21.0, 9.0], [21.0, -12.0, 3.0, -9.0, -0.0], [-9.0, -12.0, 9.0, -21.0, 12.0], [-15.0, -12.0, -12.0, -0.0, -9.0]]) |
29308 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29309 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") |
29310 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29311 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29312 | def test_generalTensorProduct_float_rank0_array_rank3_offset0(self): | def test_generalTensorProduct_float_rank0_array_rank3_offset0(self): |
29313 | arg0=-0.959498524214 | arg0=-6.0 |
29314 | arg1=numarray.array([[[0.027563264138124266, -0.86134683154644165], [-0.8117329937722968, -0.82085247002658135]], [[0.16560117669229291, -0.13409471539984441], [0.84610060594912695, 0.27635482631912045]], [[-0.30630109192629895, 0.65944726866182668], [-0.79975424716626953, -0.52724052564802748]], [[-0.71815840628111416, -0.060534894755772006], [-0.32528952507958842, -0.4407791883975869]], [[-0.11672438023008391, 0.98658294864906182], [-0.7586019012956271, -0.70780594519726536]], [[-0.27061897876441532, 0.50264763097728116], [-0.13069146868469272, -0.93327923188153727]]]) | arg1=numarray.array([[[-4.0, 7.0], [-1.0, -3.0]], [[3.0, -1.0], [-5.0, -6.0]], [[-6.0, 6.0], [5.0, -5.0]], [[0.0, 6.0], [7.0, 7.0]], [[-6.0, 7.0], [4.0, 5.0]], [[6.0, 1.0], [-5.0, 2.0]]]) |
29315 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29316 | ref=numarray.array([[[-0.026446911263045492, 0.82646101370504654], [0.77885660958017144, 0.78760673358776034]], [[-0.15889408464432439, 0.12866368153102073], [-0.81183228274459229, -0.2651620480125581]], [[0.29389544566836046, -0.63273868107784637], [0.76736301988975719, 0.50588650626499243]], [[0.68907193097846631, 0.058083142181601162], [0.31211481925607415, 0.42292698077164276]], [[0.11199687057053639, -0.94662488324327765], [0.72787740475893981, 0.67913875984653249]], [[0.25965851074870316, -0.48228966012226587], [0.12539827133029721, 0.89548004566972728]]]) | ref=numarray.array([[[24.0, -42.0], [6.0, 18.0]], [[-18.0, 6.0], [30.0, 36.0]], [[36.0, -36.0], [-30.0, 30.0]], [[-0.0, -36.0], [-42.0, -42.0]], [[36.0, -42.0], [-24.0, -30.0]], [[-36.0, -6.0], [30.0, -12.0]]]) |
29317 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29318 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") |
29319 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29320 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29321 | def test_generalTensorProduct_float_rank0_array_rank4_offset0(self): | def test_generalTensorProduct_float_rank0_array_rank4_offset0(self): |
29322 | arg0=-0.9304595906 | arg0=7.0 |
29323 | arg1=numarray.array([[[[-0.71233817194649296, 0.99590387266544389, -0.54947329367573428, 0.13512463808082553], [-0.0096671503124188263, -0.71547424252371372, -0.87762902434985546, -0.51167011163989562], [-0.53976710827994245, -0.81722257339839532, 0.66609455953777674, -0.3012912274862769]], [[-0.3835829449196122, 0.40197040371247073, -0.35580710017866091, -0.22359872548955528], [0.89475596756920872, -0.038969787629618002, 0.42318904869360141, -0.62860155992094824], [0.18493393151046011, 0.30831212239060291, -0.97294385206858314, 0.34374933089323689]]], [[[0.75135090873481869, 0.84105513930538378, 0.96419194632206584, 0.4852944932936063], [0.91295235140726794, -0.31225039241780017, 0.72482670566986074, -0.86549920269175828], [0.79904918654713297, 0.20271226330974756, 0.86916793104369861, 0.97625696820391017]], [[0.84237487359749474, 0.19875587560825458, -0.1370588278661049, 0.48021237433557817], [0.93576386199601491, -0.29835765385660262, -0.28932131971598651, -0.35577113589894438], [-0.54706437371089223, 0.9747796823610706, -0.69765793608042537, 0.73540906219094726]]], [[[-0.57475948602306959, 0.31447138930161533, 0.55698363425662079, 0.7023790406039192], [-0.49766651685862384, 0.72614255431525354, 0.9196332538458043, 0.21160591767894599], [0.66872133503379083, -0.17608099285829648, -0.43372494211856294, -0.14815693304419097]], [[-0.86705044864551706, 0.55419517665074491, -0.16633978403913985, -0.56691172352847152], [-0.60732289573658971, 0.11286145485281507, -0.2159763164709434, 0.13593235955593097], [-0.43283967020676672, 0.24820403897102916, -0.90853794595044901, -0.50887126866884214]]]]) | arg1=numarray.array([[[[0.0, -7.0, -6.0, 5.0], [-5.0, 2.0, 6.0, 0.0], [0.0, 1.0, -1.0, -1.0]], [[0.0, -2.0, -1.0, 3.0], [-4.0, 0.0, 2.0, -3.0], [-3.0, -6.0, -3.0, -2.0]]], [[[6.0, 7.0, 5.0, 5.0], [5.0, 1.0, 0.0, -3.0], [0.0, 0.0, -1.0, 0.0]], [[-6.0, 1.0, -7.0, -3.0], [7.0, 7.0, -5.0, 6.0], [-7.0, 1.0, 0.0, 0.0]]], [[[2.0, -2.0, 6.0, -6.0], [-7.0, 2.0, 0.0, -2.0], [3.0, -6.0, -3.0, 1.0]], [[-6.0, 1.0, 2.0, 3.0], [-2.0, 5.0, 4.0, 1.0], [4.0, 0.0, -2.0, -2.0]]]]) |
29324 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29325 | ref=numarray.array([[[[0.66280188383834704, -0.92664830963760803, 0.51126269587935846, -0.12572801542870757], [0.0089948927219654223, 0.66571987078372175, 0.81659834269556519, 0.47608836259890092], [0.50223148258969874, 0.7603925810736486, -0.61977407116865091, 0.280339312178363]], [[0.35690842989118515, -0.3740172172717694, 0.33106412876494029, 0.20804957857777526], [-0.83253427127168034, 0.036259812643637576, -0.39376030899400677, 0.584888350094797], [-0.17207355020133885, -0.28687197117669033, 0.90528493827287704, -0.31984486169207099]]], [[[-0.69910165893861242, -0.78256782059042129, -0.8971416436349996, -0.45154691555058102], [-0.84946527112804804, 0.29053637229387003, -0.67442195981379072, 0.80531203380151672], [-0.7434829789842009, -0.18861556952886133, -0.80872563728188707, -0.90836765895576488]], [[-0.78379578001956007, -0.18493431064787386, 0.12752770086446202, -0.4468182092255118], [-0.87069045993142946, 0.27760974045990022, 0.26920179669489441, 0.33103066545595899], [0.50902129319508249, -0.9069931041752366, 0.64914251758448893, -0.68426841492998791]]], [[[0.53479047605870211, -0.29260292014510936, -0.5182507643015194, -0.65353531456660052], [0.46305858353178531, -0.67564630380567492, -0.85568158087584967, -0.19689075553216687], [-0.62221817962127124, 0.16383624852743653, 0.40356353207680556, 0.13785403926490378]], [[0.80675540547657154, -0.51565621717914967, 0.15477244735761136, 0.52748845018084956], [0.56508941292929604, -0.10501302307691202, 0.20095723500292909, -0.1264795676217533], [0.40273982233618566, -0.2309438284863411, 0.8453578452339523, 0.47348415231389973]]]]) | ref=numarray.array([[[[0.0, -49.0, -42.0, 35.0], [-35.0, 14.0, 42.0, 0.0], [0.0, 7.0, -7.0, -7.0]], [[0.0, -14.0, -7.0, 21.0], [-28.0, 0.0, 14.0, -21.0], [-21.0, -42.0, -21.0, -14.0]]], [[[42.0, 49.0, 35.0, 35.0], [35.0, 7.0, 0.0, -21.0], [0.0, 0.0, -7.0, 0.0]], [[-42.0, 7.0, -49.0, -21.0], [49.0, 49.0, -35.0, 42.0], [-49.0, 7.0, 0.0, 0.0]]], [[[14.0, -14.0, 42.0, -42.0], [-49.0, 14.0, 0.0, -14.0], [21.0, -42.0, -21.0, 7.0]], [[-42.0, 7.0, 14.0, 21.0], [-14.0, 35.0, 28.0, 7.0], [28.0, 0.0, -14.0, -14.0]]]]) |
29326 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29327 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") |
29328 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29329 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29330 | def test_generalTensorProduct_float_rank0_Symbol_rank0_offset0(self): | def test_generalTensorProduct_float_rank0_Symbol_rank0_offset0(self): |
29331 | arg0=0.562491357932 | arg0=-4.0 |
29332 | arg1=Symbol(shape=()) | arg1=Symbol(shape=()) |
29333 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29334 | s1=numarray.array(0.00324768537641) | s1=numarray.array(0.0) |
29335 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29336 | ref=numarray.array(0.0018267949575127625) | ref=numarray.array(-0.0) |
29337 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29338 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29339 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29340 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29341 | def test_generalTensorProduct_float_rank0_Symbol_rank1_offset0(self): | def test_generalTensorProduct_float_rank0_Symbol_rank1_offset0(self): |
29342 | arg0=0.91409519904 | arg0=-3.0 |
29343 | arg1=Symbol(shape=(2,)) | arg1=Symbol(shape=(2,)) |
29344 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29345 | s1=numarray.array([0.25097568619682953, 0.66141307495224799]) | s1=numarray.array([4.0, 4.0]) |
29346 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29347 | ref=numarray.array([0.22941566982832673, 0.60459451639622652]) | ref=numarray.array([-12.0, -12.0]) |
29348 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29349 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29350 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29351 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29352 | def test_generalTensorProduct_float_rank0_Symbol_rank2_offset0(self): | def test_generalTensorProduct_float_rank0_Symbol_rank2_offset0(self): |
29353 | arg0=-0.311325649398 | arg0=-3.0 |
29354 | arg1=Symbol(shape=(4, 5)) | arg1=Symbol(shape=(4, 5)) |
29355 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29356 | s1=numarray.array([[-0.53341277380602681, 0.052789259508221553, -0.46627917301069455, 0.40862339417134952, 0.15143180032582815], [0.54096274036698166, -0.82847910456928209, 0.55799114401979533, 0.065333685515621687, -0.4530989159792318], [-0.39265311994330632, 0.24478822309545256, -0.80333346366189651, -0.95364825169535239, 0.96393006642570644], [-0.67841811398166496, -0.080815522855093525, 0.67452861057759494, 0.63833330100743257, -0.60552157272965412]]) | s1=numarray.array([[0.0, 3.0, 4.0, 7.0, -6.0], [3.0, 1.0, 2.0, 1.0, 7.0], [7.0, -6.0, 6.0, 7.0, 7.0], [0.0, 4.0, 6.0, 0.0, 1.0]]) |
29357 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29358 | ref=numarray.array([[0.16606507820234179, -0.01643465049763583, 0.14516466633830988, -0.12721494354960419, -0.047144603575944445], [-0.16841557644486413, 0.25792679524269291, -0.17371695527028735, -0.02034005207071465, 0.1410613142587574], [0.12224298755449474, -0.076208852520170609, 0.25009831225767254, 0.29689516125630866, -0.30009615390422589], [0.21120895989869806, 0.025159945134299692, -0.2099980577255903, -0.19872952946849839, 0.18851439685454879]]) | ref=numarray.array([[-0.0, -9.0, -12.0, -21.0, 18.0], [-9.0, -3.0, -6.0, -3.0, -21.0], [-21.0, 18.0, -18.0, -21.0, -21.0], [-0.0, -12.0, -18.0, -0.0, -3.0]]) |
29359 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29360 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29361 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29362 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29363 | def test_generalTensorProduct_float_rank0_Symbol_rank3_offset0(self): | def test_generalTensorProduct_float_rank0_Symbol_rank3_offset0(self): |
29364 | arg0=0.948217578168 | arg0=-3.0 |
29365 | arg1=Symbol(shape=(6, 2, 2)) | arg1=Symbol(shape=(6, 2, 2)) |
29366 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29367 | s1=numarray.array([[[0.98956741355064559, -0.066566677430423216], [0.18490642626135512, 0.084333580416641851]], [[-0.38416624166659097, 0.8916666431591378], [0.92443095579442658, -0.95236048247261551]], [[0.090214611115947196, 0.32155545842962718], [-0.89091389581014746, -0.13578318477225881]], [[-0.80325400851047579, -0.68882946382410637], [0.67724602964181235, 0.26516640136299263]], [[-0.25182151850795664, 0.60267348542466626], [-0.32739949654327516, 0.9846936281180958]], [[-0.32951069619917894, -0.19958050878192046], [0.22979437488771959, 0.40330955678907743]]]) | s1=numarray.array([[[-2.0, 6.0], [3.0, 4.0]], [[-5.0, 7.0], [7.0, 1.0]], [[1.0, 0.0], [0.0, -7.0]], [[0.0, 5.0], [2.0, 7.0]], [[0.0, -1.0], [-6.0, 0.0]], [[4.0, -1.0], [5.0, -6.0]]]) |
29368 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29369 | ref=numarray.array([[[0.93832521631142629, -0.063119693659797402], [0.17533152369732824, 0.079966583380943729]], [[-0.36427318328717662, 0.84549398490996364], [0.87656168208735175, -0.90304495023353559]], [[0.085543080067773447, 0.30490453803899203], [-0.84478021664173131, -0.12875200262075262]], [[-0.76165957060391598, -0.65316020595837732], [0.64217659005116867, 0.25143544291206438]], [[-0.23878159041032027, 0.57146559277572551], [-0.31044595770583955, 0.93370380729206115]], [[-0.3124478343305907, -0.18924574668682295], [0.21789506563277009, 0.38242521119073652]]]) | ref=numarray.array([[[6.0, -18.0], [-9.0, -12.0]], [[15.0, -21.0], [-21.0, -3.0]], [[-3.0, -0.0], [-0.0, 21.0]], [[-0.0, -15.0], [-6.0, -21.0]], [[-0.0, 3.0], [18.0, -0.0]], [[-12.0, 3.0], [-15.0, 18.0]]]) |
29370 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29371 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
29372 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29373 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29374 | def test_generalTensorProduct_float_rank0_Symbol_rank4_offset0(self): | def test_generalTensorProduct_float_rank0_Symbol_rank4_offset0(self): |
29375 | arg0=-0.830323568577 | arg0=7.0 |
29376 | arg1=Symbol(shape=(3, 2, 3, 4)) | arg1=Symbol(shape=(3, 2, 3, 4)) |
29377 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29378 | s1=numarray.array([[[[0.92676883544399891, -0.95357774937706141, 0.44347735429402935, -0.53674237545550874], [-0.53618249287540465, 0.054049986177377995, 0.72613620912428045, -0.28868935976044963], [0.20433401785227878, 0.27989385328052796, -0.3658661214474892, -0.75219187171324098]], [[-0.63438082192292056, -0.27326168466178813, -0.57030787945284733, 0.91431123438277839], [-0.53016547615535026, 0.29706122745133667, -0.8448922838417019, 0.98820530445796062], [0.65022989699942624, -0.18844283546637386, -0.47823095324118414, -0.51899670756954275]]], [[[-0.3559753902541265, -0.69420800259668458, -0.33725718940187477, -0.72032568863041679], [-0.075850351806678207, 0.99922387833838888, 0.30593283824914952, -0.83367628611194378], [-0.4885046491104339, -0.59346613300382312, 0.33205663307371358, -0.1422627978413098]], [[0.21495156425639994, -0.65773972125079339, -0.76226004103345057, 0.84364839691041404], [-0.55673769626116831, -0.13335088242311155, 0.67181611603927371, -0.21087210630906528], [-0.69602070926428317, -0.81184445666761773, -0.40347003250595415, 0.1046531171453815]]], [[[0.94481376866460276, 0.43015674438105722, 0.95064531378740225, -0.6933804604356999], [-0.30034452340652074, 0.48851034708096575, 0.35779832302502368, -0.39943794345218087], [-0.53735828002736974, -0.96196465128721043, -0.32324088295403741, -0.64525597145923785]], [[0.39078335151136634, -0.76954000771915809, 0.53002063914038744, 0.98370783019272001], [0.61744183260742247, -0.72158480396307612, -0.32831391466301851, -0.54773198963454428], [0.13277046692417094, -0.39115875964425006, 0.28530880796795333, -0.29975932254106996]]]]) | s1=numarray.array([[[[3.0, -4.0, 1.0, 4.0], [-1.0, -1.0, -6.0, 0.0], [-6.0, -4.0, -1.0, -6.0]], [[-4.0, 2.0, 2.0, 7.0], [4.0, -7.0, 0.0, 3.0], [0.0, 3.0, 2.0, 5.0]]], [[[-5.0, -3.0, -2.0, -6.0], [0.0, -5.0, -5.0, 0.0], [-7.0, 1.0, -3.0, -5.0]], [[1.0, -4.0, 1.0, -7.0], [4.0, -3.0, 4.0, -6.0], [4.0, -2.0, 0.0, 3.0]]], [[[-7.0, 5.0, -3.0, -6.0], [-2.0, 5.0, -3.0, -2.0], [5.0, 7.0, -5.0, 5.0]], [[-2.0, -3.0, -6.0, -6.0], [1.0, 4.0, 3.0, 3.0], [-1.0, -4.0, 2.0, -4.0]]]]) |
29379 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29380 | ref=numarray.array([[[[-0.7695180066917473, 0.7917780797783196, -0.36822969940047423, 0.44566984459467673], [0.44520496089278067, -0.044878977404334268, -0.60292800843299688, 0.23970557940648587], [-0.16966335088476636, -0.2324024630786358, 0.3037872635816799, 0.62456263917549903]], [[0.52674134789580573, 0.22689561716371981, 0.47354007365483014, -0.75917416692268691], [0.440208890097598, -0.24665693846323711, 0.70153397618255486, -0.82053015488418601], [-0.53990120847197365, 0.15646852761719493, 0.39708643169916724, 0.43093519830882043]]], [[[0.29557475636137182, 0.57641726605074217, 0.28003259303239042, 0.59810339632124265], [0.062980334789936684, -0.82967913646921176, -0.25402324599990272, 0.69222106892243129], [0.40561692351579676, 0.49276891738528572, -0.27571444854340627, 0.1181241539793348]], [[-0.1784793499045674, 0.54613679254375436, 0.63292247745449226, -0.70050114754686177], [0.46227243072087254, 0.11072438056644067, -0.55782475489722305, 0.17509207982387695], [0.57792239911976584, 0.67409358638965566, 0.33501067720419403, -0.086895949690852722]]], [[[-0.78450114003821148, -0.35716928304191398, -0.78934320939489178, 0.57573013829048558], [0.24938313647743976, -0.40562165467502242, -0.29708838040497898, 0.33166273863224499], [0.44618124467668718, 0.79874192210165917, 0.26839452344435427, 0.53577124086760841]], [[-0.32447662696737073, 0.63896720537209006, -0.44008862851047204, -0.81679579600268848], [-0.51267650583927482, 0.59914886945750623, 0.27260678123645937, 0.45479478025709713], [-0.11024244789810295, 0.32478833718793959, -0.2368986275783812, 0.24889723040650436]]]]) | ref=numarray.array([[[[21.0, -28.0, 7.0, 28.0], [-7.0, -7.0, -42.0, 0.0], [-42.0, -28.0, -7.0, -42.0]], [[-28.0, 14.0, 14.0, 49.0], [28.0, -49.0, 0.0, 21.0], [0.0, 21.0, 14.0, 35.0]]], [[[-35.0, -21.0, -14.0, -42.0], [0.0, -35.0, -35.0, 0.0], [-49.0, 7.0, -21.0, -35.0]], [[7.0, -28.0, 7.0, -49.0], [28.0, -21.0, 28.0, -42.0], [28.0, -14.0, 0.0, 21.0]]], [[[-49.0, 35.0, -21.0, -42.0], [-14.0, 35.0, -21.0, -14.0], [35.0, 49.0, -35.0, 35.0]], [[-14.0, -21.0, -42.0, -42.0], [7.0, 28.0, 21.0, 21.0], [-7.0, -28.0, 14.0, -28.0]]]]) |
29381 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29382 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
29383 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29384 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29385 | def test_generalTensorProduct_float_rank0_constData_rank0_offset0(self): | def test_generalTensorProduct_float_rank0_constData_rank0_offset0(self): |
29386 | arg0=0.492353721328 | arg0=7.0 |
29387 | arg1=Data(-0.437214319534,self.functionspace) | arg1=Data(-4.0,self.functionspace) |
29388 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29389 | ref=Data(-0.21526409724074577,self.functionspace) | ref=Data(-28.0,self.functionspace) |
29390 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29391 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29392 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29393 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29394 | def test_generalTensorProduct_float_rank0_constData_rank1_offset0(self): | def test_generalTensorProduct_float_rank0_constData_rank1_offset0(self): |
29395 | arg0=0.979385563268 | arg0=3.0 |
29396 | arg1=Data(numarray.array([0.22021089255261517, 0.058911120671208295]),self.functionspace) | arg1=Data(numarray.array([-1.0, -6.0]),self.functionspace) |
29397 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29398 | ref=Data(numarray.array([0.21567136904043174, 0.057696701101331072]),self.functionspace) | ref=Data(numarray.array([-3.0, -18.0]),self.functionspace) |
29399 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29400 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29401 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29402 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29403 | def test_generalTensorProduct_float_rank0_constData_rank2_offset0(self): | def test_generalTensorProduct_float_rank0_constData_rank2_offset0(self): |
29404 | arg0=0.893109236094 | arg0=-1.0 |
29405 | arg1=Data(numarray.array([[0.24257610887747383, -0.65008541717841628, 0.48802129697853314, 0.30692856887415387, -0.19693437626450594], [0.13995561961849101, -0.84910283958592947, 0.75493100427342497, -0.49757304316066131, -0.19063332091428498], [-0.79406208009322277, 0.19120266450540702, -0.45800904239997786, 0.97077527365053884, -0.093067565850555312], [-0.48333222905652629, 0.33404120334791765, -0.95795583626960612, -0.73075610350636455, -0.21982935302054085]]),self.functionspace) | arg1=Data(numarray.array([[-7.0, 0.0, -7.0, -1.0, -4.0], [0.0, -4.0, -1.0, 3.0, 0.0], [4.0, -5.0, 6.0, -3.0, 0.0], [0.0, -2.0, 3.0, -2.0, 4.0]]),self.functionspace) |
29406 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29407 | ref=Data(numarray.array([[0.21664696329411298, -0.58059729033178953, 0.43585632774189431, 0.27412073968249034, -0.17588391034615794], [0.12499565652447372, -0.75834158842747634, 0.67423585252999541, -0.44438708047797454, -0.17025637961573875], [-0.70918417776293485, 0.17076486563548052, -0.40905210598179487, 0.86700836306856577, -0.083119502641878118], [-0.4316684778720799, 0.29833528394583791, -0.85555920514213146, -0.65264502537328806, -0.19633162554712047]]),self.functionspace) | ref=Data(numarray.array([[7.0, -0.0, 7.0, 1.0, 4.0], [-0.0, 4.0, 1.0, -3.0, -0.0], [-4.0, 5.0, -6.0, 3.0, -0.0], [-0.0, 2.0, -3.0, 2.0, -4.0]]),self.functionspace) |
29408 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29409 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29410 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29411 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29412 | def test_generalTensorProduct_float_rank0_constData_rank3_offset0(self): | def test_generalTensorProduct_float_rank0_constData_rank3_offset0(self): |
29413 | arg0=-0.924871621274 | arg0=-6.0 |
29414 | arg1=Data(numarray.array([[[-0.49196475442088961, -0.89958484497998437], [0.03667241962030432, -0.91332100267882388]], [[-0.068836761067621488, -0.8937589667158885], [0.352093300296908, -0.81959241996961585]], [[-0.80055182544351133, -0.3773665122896539], [-0.69441106223348092, -0.63654140604730358]], [[0.42481016174814346, -0.45547410821063816], [0.74132831354824424, 0.31652739609917768]], [[0.38927838785348512, 0.61511029145913154], [0.067559642866422021, -0.36889709018737538]], [[-0.71710685925061046, -0.93229262781841427], [-0.14607137297036554, 0.76869118084057808]]]),self.functionspace) | arg1=Data(numarray.array([[[-6.0, 2.0], [4.0, 2.0]], [[-5.0, -2.0], [-4.0, -3.0]], [[-6.0, 2.0], [-1.0, -4.0]], [[0.0, 0.0], [0.0, 3.0]], [[5.0, 5.0], [-7.0, -6.0]], [[0.0, 5.0], [6.0, 3.0]]]),self.functionspace) |
29415 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29416 | ref=Data(numarray.array([[[0.45500424003079537, 0.83200049404994214], [-0.033917280190262501, 0.84470467649093994]], [[0.063665166811845531, 0.82661230457448431], [-0.32564110148523012, 0.75801777024098305]], [[0.74040766471160846, 0.3490155780357565], [0.64224108495831334, 0.58871908221884839]], [[-0.39289486302957366, 0.42125507690899289], [-0.68563351924750693, -0.29274720600780807]], [[-0.36003253370088834, -0.56889805252398207], [-0.062483996430543948, 0.34118244988477031]], [[0.66323178354164614, 0.86225099419199092], [0.13509726754078608, -0.71094065868286649]]]),self.functionspace) | ref=Data(numarray.array([[[36.0, -12.0], [-24.0, -12.0]], [[30.0, 12.0], [24.0, 18.0]], [[36.0, -12.0], [6.0, 24.0]], [[-0.0, -0.0], [-0.0, -18.0]], [[-30.0, -30.0], [42.0, 36.0]], [[-0.0, -30.0], [-36.0, -18.0]]]),self.functionspace) |
29417 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29418 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
29419 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29420 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29421 | def test_generalTensorProduct_float_rank0_constData_rank4_offset0(self): | def test_generalTensorProduct_float_rank0_constData_rank4_offset0(self): |
29422 | arg0=-0.654494887933 | arg0=-6.0 |
29423 | arg1=Data(numarray.array([[[[-0.31265817991493638, -0.56344925108921839, -0.57407369384449813, 0.028201611177590236], [-0.38160761903964802, -0.94776552441561646, 0.12952381532000024, 0.99370451175785579], [-0.45670830806395868, -0.4269561068126726, -0.3197087826645344, -0.56291971481992209]], [[0.0099674773600433308, -0.79509036110792475, 0.12830933951956824, -0.71959824965957853], [-0.057384362906059749, -0.12489982212229056, 0.75546275888631653, 0.60256192749401727], [0.94843178641124792, -0.32002343091073437, 0.36892162742911272, 0.42888548418981642]]], [[[-0.2571586475956773, -0.6554762697408425, -0.80029997202655712, 0.63741645520041756], [-0.96452873606684619, 0.22876390981988015, 0.19455884399440571, -0.030775884405276566], [-0.65171657793426574, -0.91060004615194057, 0.23746336000046475, -0.97272499257481537]], [[0.66919098226677409, -0.79235908747095452, -0.12370863164652168, -0.64863084247180791], [0.07763296595450031, 0.025873684646505968, -0.55172752736832331, 0.30779290739216703], [-0.45176445022090106, -0.36574516631567411, 0.61968281176274198, -0.7996747868985763]]], [[[-0.21325609084379304, -0.92770142734538341, -0.80644823451720549, -0.021573294263919518], [-0.56304400996409343, 0.88063022592481244, 0.53014487801115928, 0.65994018859582404], [-0.23765598450411773, 0.45571357522494549, 0.86787085427924882, 0.33054855747647127]], [[-0.14130841318382781, -0.097733741841565136, -0.90093713704584788, -0.59209444992807092], [-0.9823260800621505, -0.89018187293512185, -0.87797797897766827, -0.66633877208399461], [0.45851185562387342, -0.82922164076306015, 0.27949294872833819, 0.82705868854527842]]]]),self.functionspace) | arg1=Data(numarray.array([[[[7.0, 1.0, -7.0, 0.0], [-6.0, 0.0, -5.0, 4.0], [-6.0, 7.0, 0.0, -5.0]], [[2.0, 3.0, 5.0, -4.0], [7.0, -3.0, 0.0, -6.0], [2.0, -6.0, 7.0, 2.0]]], [[[3.0, 0.0, 1.0, -2.0], [-4.0, -1.0, 0.0, -5.0], [7.0, 3.0, 0.0, -6.0]], [[-7.0, -1.0, 1.0, -7.0], [7.0, 4.0, -1.0, -3.0], [5.0, -2.0, 2.0, 6.0]]], [[[-3.0, -1.0, 7.0, 0.0], [0.0, 6.0, 5.0, 0.0], [2.0, -7.0, 3.0, -4.0]], [[-5.0, 3.0, 5.0, 2.0], [-5.0, 1.0, 3.0, -2.0], [2.0, -3.0, 5.0, -5.0]]]]),self.functionspace) |
29424 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29425 | ref=Data(numarray.array([[[[0.20463318042481957, 0.36877465444767443, 0.37572829791814377, -0.018457810347212149], [0.2497602358578036, 0.62030769068933422, -0.084772674992541971, -0.65037452306165711], [0.29891325290447474, 0.27944058928074866, 0.20924776388127911, 0.36842807566644481]], [[-0.0065236629777381087, 0.52038257679008604, -0.083977806789640674, 0.47097337576786119], [0.037557772169318736, 0.081746295082803178, -0.49444651371499376, -0.39437370120800019], [-0.62074375575949925, 0.20945369954991414, -0.24145731920034499, -0.28070335691098325]]], [[[0.16830902023918198, 0.4290058677068942, 0.52379224050445183, -0.41718581141316469], [0.63127912702040612, -0.14972480952071948, -0.12733776879652839, 0.020142659014876111], [0.42654516863928543, 0.59598307515816651, -0.1554185551917415, 0.63664353500506099]], [[-0.43798207694458963, 0.51859497215714234, 0.080966667005857751, 0.42452557055359263], [-0.05081037935231137, -0.016934194333133468, 0.36110284619458349, -0.20144888443026523], [0.29567752321952512, 0.23937834163988086, -0.40557923243877619, 0.52338306003417645]]], [[[0.13957502127787724, 0.60717584172587158, 0.52781624687425255, 0.014119610811613606], [0.36850942620289984, -0.57636798102723463, -0.34697711252226521, -0.43192747977762819], [0.15554462694467305, -0.29826220534648129, -0.56801703751197363, -0.2163423410820387]], [[0.092485634050765445, 0.063966234413885908, 0.58965875054566586, 0.387522790651533], [0.6429273976841211, 0.58261948516682438, 0.57463209895879241, 0.43611531996064951], [-0.30009366556258327, 0.54272132484298996, -0.18292670615606885, -0.5413056836736081]]]]),self.functionspace) | ref=Data(numarray.array([[[[-42.0, -6.0, 42.0, -0.0], [36.0, -0.0, 30.0, -24.0], [36.0, -42.0, -0.0, 30.0]], [[-12.0, -18.0, -30.0, 24.0], [-42.0, 18.0, -0.0, 36.0], [-12.0, 36.0, -42.0, -12.0]]], [[[-18.0, -0.0, -6.0, 12.0], [24.0, 6.0, -0.0, 30.0], [-42.0, -18.0, -0.0, 36.0]], [[42.0, 6.0, -6.0, 42.0], [-42.0, -24.0, 6.0, 18.0], [-30.0, 12.0, -12.0, -36.0]]], [[[18.0, 6.0, -42.0, -0.0], [-0.0, -36.0, -30.0, -0.0], [-12.0, 42.0, -18.0, 24.0]], [[30.0, -18.0, -30.0, -12.0], [30.0, -6.0, -18.0, 12.0], [-12.0, 18.0, -30.0, 30.0]]]]),self.functionspace) |
29426 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29427 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
29428 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29429 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29430 | def test_generalTensorProduct_float_rank0_expandedData_rank0_offset0(self): | def test_generalTensorProduct_float_rank0_expandedData_rank0_offset0(self): |
29431 | arg0=0.817315288431 | arg0=7.0 |
29432 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29433 | arg1=msk_arg1*(-0.107441089832)+(1.-msk_arg1)*(-0.984717408273) | arg1=msk_arg1*(-6.0)+(1-msk_arg1)*(-3.0) |
29434 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29435 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29436 | ref=msk_ref*numarray.array(-0.087813245324982178)+(1.-msk_ref)*numarray.array(-0.80482459256581285) | ref=msk_ref*numarray.array(-42.0)+(1.-msk_ref)*numarray.array(-21.0) |
29437 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29438 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29439 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29440 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29441 | def test_generalTensorProduct_float_rank0_expandedData_rank1_offset0(self): | def test_generalTensorProduct_float_rank0_expandedData_rank1_offset0(self): |
29442 | arg0=-0.731273459059 | arg0=-6.0 |
29443 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29444 | arg1=msk_arg1*numarray.array([0.32690953465836348, -0.45530172275332514])+(1.-msk_arg1)*numarray.array([-0.88987813857334852, -0.4432112304820599]) | arg1=msk_arg1*numarray.array([7.0, 2.0])+(1.-msk_arg1)*numarray.array([0.0, -5.0]) |
29445 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29446 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29447 | ref=msk_ref*numarray.array([-0.23906026620885493, 0.33295006571315844])+(1.-msk_ref)*numarray.array([0.65074426453515033, 0.32410860960822918]) | ref=msk_ref*numarray.array([-42.0, -12.0])+(1.-msk_ref)*numarray.array([-0.0, 30.0]) |
29448 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29449 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29450 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29451 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29452 | def test_generalTensorProduct_float_rank0_expandedData_rank2_offset0(self): | def test_generalTensorProduct_float_rank0_expandedData_rank2_offset0(self): |
29453 | arg0=0.360959926398 | arg0=-1.0 |
29454 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29455 | arg1=msk_arg1*numarray.array([[0.21279479867851991, -0.79951867079866279, -0.51299350043200365, 0.43341112620605893, 0.43115383961180132], [0.095600939708326615, -0.62487659659900729, -0.8972300314905306, 0.70070531945488557, -0.043889499904746776], [0.036459699641055776, 0.36036292372913703, 0.76467901872563138, -0.94350337048486743, 0.64310715960498266], [-0.52886376314585903, -0.55067938504224667, -0.62817382273271871, -0.28542028247487106, -0.93139070440443028]])+(1.-msk_arg1)*numarray.array([[-0.41945831254126453, 0.74812933596756603, 0.024606024120077175, 0.30230913992714581, -0.83094099057447934], [-0.93950985371619633, 0.1289378703502706, -0.091682152683265628, 0.83274570145517623, -0.78477292031180745], [-0.31532918040306912, -0.73226858806142991, -0.018223951762351032, -0.71913243020658002, 0.99376692794750765], [-0.46929748118089498, 0.49015272355041128, 0.49943394318132239, 0.70263478992839801, 0.64512615939951812]]) | arg1=msk_arg1*numarray.array([[1.0, 6.0, 6.0, 7.0, 0.0], [7.0, -4.0, 4.0, -2.0, 7.0], [-1.0, -6.0, 5.0, -5.0, 7.0], [-2.0, 0.0, -4.0, 3.0, 3.0]])+(1.-msk_arg1)*numarray.array([[-5.0, 4.0, 5.0, -2.0, 7.0], [-6.0, 1.0, -3.0, 3.0, 0.0], [-4.0, 0.0, 5.0, -3.0, 0.0], [-2.0, 6.0, -7.0, 0.0, -1.0]]) |
29456 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29457 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29458 | ref=msk_ref*numarray.array([[0.07681039486886862, -0.28859420056528523, -0.18517009615857116, 0.15644404821539876, 0.15562925821247639], [0.034508108160693995, -0.22555541031618939, -0.32386408612886697, 0.25292654053709901, -0.015842350655260948], [0.013160490498927454, 0.13007657442582526, 0.27601848231727305, -0.34056690716645094, 0.23213591299701974], [-0.1908986250196808, -0.19877319029372675, -0.22674557681873131, -0.10302528415461623, -0.33619472010957319]])+(1.-msk_ref)*numarray.array([[-0.15140764162191003, 0.27004471004701208, 0.0088817886553296428, 0.10912148489753506, -0.29993639879881734], [-0.33912540764756238, 0.046541404191544206, -0.033093583084558675, 0.30058782710548326, -0.28327157555486715], [-0.11382119774942288, -0.26431961565019652, -0.0065781162868183175, -0.25957798907775781, 0.35871003716866551], [-0.16939758426580687, 0.17692549101651922, 0.18027563937137625, 0.25362300205720512, 0.23286469101425278]]) | ref=msk_ref*numarray.array([[-1.0, -6.0, -6.0, -7.0, -0.0], [-7.0, 4.0, -4.0, 2.0, -7.0], [1.0, 6.0, -5.0, 5.0, -7.0], [2.0, -0.0, 4.0, -3.0, -3.0]])+(1.-msk_ref)*numarray.array([[5.0, -4.0, -5.0, 2.0, -7.0], [6.0, -1.0, 3.0, -3.0, -0.0], [4.0, -0.0, -5.0, 3.0, -0.0], [2.0, -6.0, 7.0, -0.0, 1.0]]) |
29459 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29460 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29461 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29462 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29463 | def test_generalTensorProduct_float_rank0_expandedData_rank3_offset0(self): | def test_generalTensorProduct_float_rank0_expandedData_rank3_offset0(self): |
29464 | arg0=0.460701578466 | arg0=7.0 |
29465 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29466 | arg1=msk_arg1*numarray.array([[[0.54899887614412735, 0.61695096532471561], [0.42902761477167273, 0.53516312400600285]], [[0.34321063427267418, 0.74380368798820795], [0.31540686527488004, -0.80432967300638936]], [[0.8394622964445968, 0.28392277440231517], [-0.33424678334360336, -0.066072706587715802]], [[-0.73373584571143158, -0.54187213946866164], [0.20402337375362967, -0.36147631706777439]], [[0.025149006205081648, 0.24833725969162024], [0.11408358615465741, 0.88899127442537362]], [[-0.090389209416217309, 0.26603033945702514], [-0.86492517119016843, -0.76494342510693047]]])+(1.-msk_arg1)*numarray.array([[[0.38159118801718828, -0.17804225869194479], [0.44387615914706902, -0.46254001770783448]], [[0.33391775245439814, 0.90997515595679168], [-0.099210191102322209, 0.63824730355994697]], [[0.94948895681219558, 0.47237233803777778], [0.10390798726523331, 0.51199456724475523]], [[-0.45550582497404379, 0.15986250058221763], [0.3438598995629607, -0.77259614029062695]], [[0.67624092130153546, 0.43614859456114963], [-0.98236612768868814, 0.55899862257148825]], [[-0.74765636708258953, 0.093812196029846584], [-0.20196712295659558, -0.58464411474345512]]]) | arg1=msk_arg1*numarray.array([[[0.0, -5.0], [-6.0, 0.0]], [[3.0, -7.0], [4.0, -1.0]], [[1.0, -6.0], [-6.0, -6.0]], [[0.0, -4.0], [-6.0, 7.0]], [[-3.0, 7.0], [-6.0, 1.0]], [[-2.0, 3.0], [-6.0, 0.0]]])+(1.-msk_arg1)*numarray.array([[[-5.0, -4.0], [2.0, 1.0]], [[0.0, 0.0], [-7.0, -4.0]], [[-6.0, -1.0], [3.0, -3.0]], [[-4.0, -6.0], [5.0, 1.0]], [[-5.0, 7.0], [-4.0, 0.0]], [[7.0, -7.0], [2.0, -3.0]]]) |
29467 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29468 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29469 | ref=msk_ref*numarray.array([[[0.25292464881576143, 0.28423028356133345], [0.19765369933089225, 0.24655049596646056]], [[0.15811768095580175, 0.34267153312513765], [0.1453084406912088, -0.37055594996123453]], [[0.38674160503487481, 0.13080367032964532], [-0.15398802068364323, -0.030439800218493813]], [[-0.33803326229647818, -0.24964134998006152], [0.093993890332293745, -0.16653270985126706]], [[0.011586186855537013, 0.1144093675318965], [0.052558488218533754, 0.40955968337043563]], [[-0.041642451454361927, 0.12256059730774667], [-0.39847239162244641, -0.35241064338409334]]])+(1.-msk_ref)*numarray.array([[[0.17579966264830565, -0.082024349613063929], [0.20449444716256251, -0.21309291626177682]], [[0.15383643563362226, 0.41922699071430736], [-0.045706291640771765, 0.2940415402018543]], [[0.43743106113959046, 0.21762268175776686], [0.047870573748337301, 0.23587670529577037]], [[-0.20985225256608406, 0.073648906355779184], [0.15841679849988005, -0.35593626134877443]], [[0.31154525986704501, 0.20093434596013007], [-0.45257762565789311, 0.25753154777910819]], [[-0.34444646846524291, 0.043219426790329557], [-0.093046572344377784, -0.26934646650327554]]]) | ref=msk_ref*numarray.array([[[0.0, -35.0], [-42.0, 0.0]], [[21.0, -49.0], [28.0, -7.0]], [[7.0, -42.0], [-42.0, -42.0]], [[0.0, -28.0], [-42.0, 49.0]], [[-21.0, 49.0], [-42.0, 7.0]], [[-14.0, 21.0], [-42.0, 0.0]]])+(1.-msk_ref)*numarray.array([[[-35.0, -28.0], [14.0, 7.0]], [[0.0, 0.0], [-49.0, -28.0]], [[-42.0, -7.0], [21.0, -21.0]], [[-28.0, -42.0], [35.0, 7.0]], [[-35.0, 49.0], [-28.0, 0.0]], [[49.0, -49.0], [14.0, -21.0]]]) |
29470 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29471 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
29472 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29473 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29474 | def test_generalTensorProduct_float_rank0_expandedData_rank4_offset0(self): | def test_generalTensorProduct_float_rank0_expandedData_rank4_offset0(self): |
29475 | arg0=0.784374548175 | arg0=3.0 |
29476 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29477 | arg1=msk_arg1*numarray.array([[[[-0.90066927489131876, -0.1878533156916542, -0.59694523049679371, 0.72172638004705458], [0.43240312937102132, -0.13129148954521397, -0.56659689512004441, 0.73070004905350916], [-0.69413612468093455, -0.42386294361359211, -0.16373619790315486, 0.29396503282525854]], [[0.63129930928189593, 0.46134620780199342, -0.54540114997909495, -0.99570985746853435], [-0.42410817885551055, -0.3197610798525401, -0.52261060185934016, 0.3800995849889357], [0.23309633169638544, -0.14220779059692501, 0.67437183748558427, 0.66400661133603367]]], [[[0.95301604528523898, 0.44783390626244168, 0.66854797756177331, -0.73974685438936039], [-0.039463004415484448, -0.51600084748783526, -0.016360924329686499, 0.41712475114362069], [0.53457162281142012, 0.61051584302119832, -0.41824942120758601, 0.93056070139777969]], [[0.24214706167067845, 0.44711603020288027, 0.12713667042831944, -0.45911885553102172], [-0.90454927042871036, 0.92137663178187656, 0.043620737006642374, 0.14858975911746897], [0.091386022828089386, 0.52565798890642301, 0.88050542742087501, 0.17773357292037728]]], [[[0.69079441729603985, -0.2366215804326115, -0.75270404082148401, -0.3064845139073471], [0.030604832318570807, 0.8076694815171781, -0.41126928764355308, -0.60305476385054346], [0.87808093962682476, -0.67989393718579905, -0.30799513849552373, -0.013741421259001019]], [[-0.02352341183500406, 0.94502612799375796, -0.34204026680763322, 0.68878510202234078], [0.69059482886993284, 0.53344010160184108, 0.034253916177040766, 0.33325848459854823], [0.13793314057353512, -0.50974887540980696, -0.37881088325214796, 0.94047672177021813]]]])+(1.-msk_arg1)*numarray.array([[[[0.58649064480268387, 0.1553497755096267, 0.91854259329782217, 0.2567973933780654], [-0.22563953102189838, 0.12872158640774867, -0.88923251502378253, -0.046050599461417541], [0.08360342295121681, -0.094708790395032105, -0.55305030205236494, -0.57352186464112576]], [[-0.86421349852991436, -0.57959800013126106, -0.56765879912871453, -0.5793629140992389], [0.44733466091869878, 0.17296098727803111, -0.38704753152222282, -0.063316911212001559], [-0.80300394716403201, 0.18272341166141337, -0.48077928437016659, 0.8426094766450376]]], [[[-0.42353165706394535, -0.99814635688525977, 0.44639643837548326, 0.17533350802389069], [0.3903526484974027, -0.68762456688689766, 0.059015447607134952, -0.56039875901037384], [0.43364147648970786, -0.34938403943126994, 0.70459617381735562, 0.2564937912679659]], [[0.83741112510024718, -0.23562155256082784, -0.20672187238999595, -0.85959771540048013], [-0.47722342901549109, -0.028854042984841843, 0.44566963226943268, -0.25216641587477873], [0.47805932138545626, -0.35957607104467737, -0.13669450407909722, -0.44083080747298431]]], [[[0.25404535302439712, 0.71750765779505032, -0.78968487605459647, -0.25599841278627555], [0.95030212417116089, 0.16916124879325034, -0.96299006099109752, 0.051273810341706305], [-0.099801382561338636, -0.24966458030138017, -0.58025100729329537, 0.1602631091128075]], [[-0.63613006417582807, -0.56605379211879847, 0.7966572261877094, -0.12946642218948567], [0.097043582654898097, -0.010020676619000302, 0.071892565137961162, 0.78315181813034029], [0.068437370712741918, 0.22446399438934228, 0.49297329176941385, 0.9618124192862052]]]]) | arg1=msk_arg1*numarray.array([[[[3.0, -4.0, -6.0, 7.0], [7.0, 3.0, 3.0, 6.0], [0.0, -7.0, 6.0, 1.0]], [[-7.0, 1.0, 4.0, 4.0], [5.0, 4.0, 1.0, -7.0], [7.0, 0.0, -6.0, 2.0]]], [[[0.0, -7.0, -3.0, 2.0], [1.0, -7.0, 2.0, -6.0], [0.0, 5.0, -1.0, -3.0]], [[-7.0, -1.0, 3.0, 0.0], [5.0, 0.0, 0.0, -6.0], [-5.0, -3.0, 0.0, -5.0]]], [[[-7.0, 0.0, 2.0, -3.0], [0.0, 6.0, -4.0, -1.0], [-4.0, -2.0, 4.0, 7.0]], [[-7.0, 6.0, -5.0, -1.0], [6.0, 2.0, 2.0, -3.0], [-5.0, -7.0, 2.0, 0.0]]]])+(1.-msk_arg1)*numarray.array([[[[0.0, -4.0, 6.0, -6.0], [7.0, 7.0, -3.0, -2.0], [3.0, -5.0, 0.0, 0.0]], [[3.0, 1.0, 0.0, -1.0], [-3.0, -3.0, 0.0, -3.0], [-3.0, -6.0, 6.0, -2.0]]], [[[-2.0, 3.0, 0.0, -2.0], [0.0, 5.0, -4.0, -3.0], [-5.0, -5.0, -7.0, -1.0]], [[-4.0, -5.0, 2.0, -1.0], [2.0, -1.0, 0.0, 1.0], [6.0, 6.0, 3.0, -4.0]]], [[[-7.0, -6.0, 3.0, -2.0], [-6.0, 7.0, 3.0, -3.0], [-1.0, 2.0, -3.0, 1.0]], [[3.0, -3.0, 0.0, -5.0], [2.0, -6.0, -7.0, 5.0], [-2.0, 0.0, 3.0, 1.0]]]]) |
29478 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29479 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29480 | ref=msk_ref*numarray.array([[[[-0.70646205554816099, -0.14734735961885401, -0.46822864545626175, 0.56610380325552934], [0.33916600922993634, -0.10298170279127589, -0.44442418360725466, 0.57314252082794093], [-0.54446270916869066, -0.33246730488512055, -0.12843050625021182, 0.2305786898016193]], [[0.49517511048130142, 0.36186822329702939, -0.42779878058908577, -0.78100946956547201], [-0.33265966116719697, -0.25081245253334944, -0.409922454704988, 0.29814044023727654], [0.18283482985564831, -0.11154417149645617, 0.52896010532983295, 0.52082988575204547]]], [[[0.74752152992432297, 0.35126951788213651, 0.52439201783345812, -0.58023860467567823], [-0.030953776258031442, -0.40473793160628979, -0.012833092628826445, 0.32718203821096919], [0.4193043751099898, 0.47887308852355231, -0.3280642007842382, 0.7299081297084784]], [[0.18993399208989012, 0.35070643417227221, 0.099722768423712069, -0.360121144865859], [-0.70950542529472427, 0.72270437925309483, 0.034214995880654235, 0.11655002517122616], [0.0716808703653109, 0.41231274754315855, 0.69064604679905806, 0.13940969095498446]]], [[[0.54184155894853014, -0.18559994524033083, -0.59040189192899695, -0.24039865211877043], [0.024005651521856661, 0.63351538463993262, -0.32258916167374729, -0.47302080792017048], [0.68874434028104359, -0.53329149978716728, -0.24158354759758383, -0.010778421091313979]], [[-0.018451165529620405, 0.74125444215886038, -0.26828767973496132, 0.54026550318858091], [0.54168500686698151, 0.41841683867247559, 0.026867900024597442, 0.26139947328253732], [0.10819124481575262, -0.39983404383238241, -0.29712961539475108, 0.7376860037078059]]]])+(1.-msk_ref)*numarray.array([[[[0.46002833452608544, 0.12185240997448181, 0.72048143159765354, 0.20142533940348853], [-0.17698590519576501, 0.10096593617897251, -0.697491352194474, -0.036120918145746382], [0.065576397103260631, -0.074287164674322795, -0.43379858079048028, -0.44985595344647983]], [[-0.67786707243630839, -0.454621919476206, -0.44525711408426072, -0.4544375239760563], [0.35087792254120959, 0.13566619624814175, -0.30359023266006907, -0.049664173623762825], [-0.62985585823968782, 0.14332359346295173, -0.37711103394984424, 0.66092142753159111]]], [[[-0.33220745214742486, -0.7829205976945951, 0.35014200465778711, 0.13752714113621164], [0.30618268229414197, -0.53935520896607625, 0.046290215052203522, -0.43956252339670343], [0.34013733719164019, -0.27404794806852778, 0.55266730548396126, 0.2011872016355542]], [[0.65684397288739027, -0.1848155488302379, -0.16214737525383394, -0.67424656962968366], [-0.37432191151264432, -0.022632376929263051, 0.34957191644674274, -0.19779291851673853], [0.37497756421265882, -0.28204231826028153, -0.10721968987507459, -0.34577646543332957]]], [[[0.19926670899452006, 0.56279474489523684, -0.61940871785611107, -0.20079863936280262], [0.74539279927668478, 0.13268577809095791, -0.75534489398709803, 0.040217871819996656], [-0.078281664353810038, -0.19583054236924541, -0.45513412167388184, 0.12570630379951078]], [[-0.49896423166857456, -0.44399818743603975, 0.62487765184149069, -0.10155016640873719], [0.07611851629823814, -0.0078599636954381283, 0.056390698297244246, 0.61428435349857013], [0.053680531731105444, 0.17606384418074045, 0.38667570299407383, 0.75442118180691087]]]]) | ref=msk_ref*numarray.array([[[[9.0, -12.0, -18.0, 21.0], [21.0, 9.0, 9.0, 18.0], [0.0, -21.0, 18.0, 3.0]], [[-21.0, 3.0, 12.0, 12.0], [15.0, 12.0, 3.0, -21.0], [21.0, 0.0, -18.0, 6.0]]], [[[0.0, -21.0, -9.0, 6.0], [3.0, -21.0, 6.0, -18.0], [0.0, 15.0, -3.0, -9.0]], [[-21.0, -3.0, 9.0, 0.0], [15.0, 0.0, 0.0, -18.0], [-15.0, -9.0, 0.0, -15.0]]], [[[-21.0, 0.0, 6.0, -9.0], [0.0, 18.0, -12.0, -3.0], [-12.0, -6.0, 12.0, 21.0]], [[-21.0, 18.0, -15.0, -3.0], [18.0, 6.0, 6.0, -9.0], [-15.0, -21.0, 6.0, 0.0]]]])+(1.-msk_ref)*numarray.array([[[[0.0, -12.0, 18.0, -18.0], [21.0, 21.0, -9.0, -6.0], [9.0, -15.0, 0.0, 0.0]], [[9.0, 3.0, 0.0, -3.0], [-9.0, -9.0, 0.0, -9.0], [-9.0, -18.0, 18.0, -6.0]]], [[[-6.0, 9.0, 0.0, -6.0], [0.0, 15.0, -12.0, -9.0], [-15.0, -15.0, -21.0, -3.0]], [[-12.0, -15.0, 6.0, -3.0], [6.0, -3.0, 0.0, 3.0], [18.0, 18.0, 9.0, -12.0]]], [[[-21.0, -18.0, 9.0, -6.0], [-18.0, 21.0, 9.0, -9.0], [-3.0, 6.0, -9.0, 3.0]], [[9.0, -9.0, 0.0, -15.0], [6.0, -18.0, -21.0, 15.0], [-6.0, 0.0, 9.0, 3.0]]]]) |
29481 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29482 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
29483 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29484 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29485 | def test_generalTensorProduct_array_rank0_float_rank0_offset0(self): | def test_generalTensorProduct_array_rank0_float_rank0_offset0(self): |
29486 | arg0=numarray.array(0.429129135575) | arg0=numarray.array(4.0) |
29487 | arg1=-0.799328581784 | arg1=-5.0 |
29488 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29489 | ref=numarray.array(-0.34301518334135217) | ref=numarray.array(-20.0) |
29490 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29491 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | self.failUnlessEqual(res.shape,(),"wrong shape of result.") |
29492 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29493 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29494 | def test_generalTensorProduct_array_rank0_array_rank0_offset0(self): | def test_generalTensorProduct_array_rank0_array_rank0_offset0(self): |
29495 | arg0=numarray.array(0.546867720148) | arg0=numarray.array(-3.0) |
29496 | arg1=numarray.array(-0.945901917593) | arg1=numarray.array(-7.0) |
29497 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29498 | ref=numarray.array(-0.51728322515706049) | ref=numarray.array(21.0) |
29499 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29500 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | self.failUnlessEqual(res.shape,(),"wrong shape of result.") |
29501 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29502 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29503 | def test_generalTensorProduct_array_rank1_array_rank1_offset1(self): | def test_generalTensorProduct_array_rank1_array_rank1_offset1(self): |
29504 | arg0=numarray.array([0.84720838597731163, 0.96761384931609951, -0.34350404065584983]) | arg0=numarray.array([-4.0, 0.0, -6.0]) |
29505 | arg1=numarray.array([0.14254722554740384, 0.38587156635226205, -0.9756326729326732]) | arg1=numarray.array([-4.0, 4.0, -5.0]) |
29506 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29507 | ref=numarray.array(0.82927564188954528) | ref=numarray.array(46.0) |
29508 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29509 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | self.failUnlessEqual(res.shape,(),"wrong shape of result.") |
29510 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29511 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29512 | def test_generalTensorProduct_array_rank2_array_rank2_offset2(self): | def test_generalTensorProduct_array_rank2_array_rank2_offset2(self): |
29513 | arg0=numarray.array([[-0.75781563843283184, -0.75850235491912232, -0.81113786053232517], [-0.03044399430833189, -0.84899525253564301, 0.6258693367354744]]) | arg0=numarray.array([[-4.0, -6.0, 0.0], [5.0, 0.0, 0.0]]) |
29514 | arg1=numarray.array([[-0.10841119021549361, 0.48014833287233638, -0.84646955254583744], [0.52283861134408616, 0.42335269030510125, 0.2326408917305347]]) | arg1=numarray.array([[1.0, 1.0, 4.0], [5.0, -3.0, 2.0]]) |
29515 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29516 | ref=numarray.array(0.17482663666982518) | ref=numarray.array(15.0) |
29517 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29518 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | self.failUnlessEqual(res.shape,(),"wrong shape of result.") |
29519 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29520 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29521 | def test_generalTensorProduct_array_rank3_array_rank3_offset3(self): | def test_generalTensorProduct_array_rank3_array_rank3_offset3(self): |
29522 | arg0=numarray.array([[[-0.8153269130841081, 0.17933782883732352, -0.43004524333572203], [-0.79659523841190438, -0.54615778391768433, 0.73882102683333684], [-0.062560136120825005, 0.28621797203970023, 0.60181889130122102], [-0.23925977312195656, 0.75413230705168921, 0.6894549260050078]], [[0.86389223650701474, 0.34983088476049984, -0.99072388411935641], [0.97773824089764849, -0.40341579722993282, 0.60824758458576778], [0.13314845911006024, 0.73735869125571529, 0.63607675958349441], [0.64514334408370333, -0.55788020254365867, -0.57393752641692264]]]) | arg0=numarray.array([[[-4.0, 6.0, -7.0], [-1.0, 0.0, -3.0], [0.0, -7.0, 5.0], [4.0, -4.0, -3.0]], [[0.0, 6.0, 5.0], [-4.0, 0.0, -1.0], [0.0, 7.0, 6.0], [-2.0, -6.0, 6.0]]]) |
29523 | arg1=numarray.array([[[0.82509682932791151, 0.34085004075489223, 0.86786217768207141], [-0.074344546420591406, -0.94106264423041486, 0.58087776473158814], [-0.66677170138006336, -0.18820701915956106, -0.46260048175481994], [0.64697907742849048, -0.91375703656948848, -0.54702303697544985]], [[-0.28006947957606276, 0.94695171957122404, -0.41268476423978551], [0.1132248264062643, 0.39040983533108164, -0.5070652190578413], [0.60254179777716166, 0.48166498600982544, -0.6592222787118307], [-0.7615692606536244, -0.14705739460559064, -0.78227235493562408]]]) | arg1=numarray.array([[[-1.0, -6.0, -6.0], [-7.0, 3.0, 0.0], [5.0, 0.0, 1.0], [-6.0, 3.0, -7.0]], [[4.0, 1.0, -3.0], [-3.0, 7.0, -1.0], [5.0, 5.0, -6.0], [6.0, -1.0, 1.0]]]) |
29524 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
29525 | ref=numarray.array(-1.2953232993207786) | ref=numarray.array(10.0) |
29526 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29527 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | self.failUnlessEqual(res.shape,(),"wrong shape of result.") |
29528 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29529 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29530 | def test_generalTensorProduct_array_rank4_array_rank4_offset4(self): | def test_generalTensorProduct_array_rank4_array_rank4_offset4(self): |
29531 | arg0=numarray.array([[[[0.36248549255875262, 0.091838491211693851], [0.7037325270990471, -0.93290932113097402], [0.069265207604657597, 0.84511754541809503]], [[0.19662389575931849, 0.63983092676360642], [-0.53521386731656051, -0.8252813406871593], [0.26226333062458851, 0.46334621698540213]]], [[[-0.30254044787592349, 0.36624814583088572], [-0.17752570771436771, -0.7843303400869146], [-0.72899755849546843, 0.71829546687988821]], [[0.6782946796420346, 0.43148769710793666], [-0.81311833569324543, 0.66649633139730069], [-0.065423058658944599, 0.52043325921384476]]], [[[-0.067084014526594737, 0.85324579597733252], [-0.082612945659737758, -0.64257113348664774], [-0.41051998237559717, -0.38596828641208636]], [[0.090950584098632214, -0.23992873381286217], [-0.52854542430173423, -0.68019908988771016], [0.79703194646529574, 0.84319707625193985]]], [[[-0.25170474336308812, -0.83151570202341762], [0.9207903138368343, 0.52327187743451753], [0.23917637941896719, 0.38391817730861333]], [[-0.57503520340721059, -0.51879943369773929], [0.9870163716709055, -0.1941471308329128], [-0.20307712083518181, 0.41578476595661429]]]]) | arg0=numarray.array([[[[0.0, 5.0], [-6.0, -7.0], [-5.0, 1.0]], [[1.0, 3.0], [-6.0, 1.0], [-3.0, -1.0]]], [[[-4.0, 0.0], [5.0, 7.0], [-3.0, -2.0]], [[5.0, -3.0], [6.0, 0.0], [6.0, -2.0]]], [[[-4.0, -3.0], [3.0, -5.0], [4.0, 6.0]], [[-4.0, -3.0], [5.0, 6.0], [3.0, 2.0]]], [[[-6.0, -2.0], [-2.0, 5.0], [-4.0, 5.0]], [[2.0, -6.0], [-3.0, -2.0], [-1.0, 3.0]]]]) |
29532 | arg1=numarray.array([[[[0.46468570499331086, -0.62470326452016001], [-0.71751051702010571, 0.61937894335259158], [0.8318048107526439, 0.82369383918361017]], [[-0.28511598434234608, 0.34627941816668772], [-0.66600426356686615, 0.41718600873523037], [0.046768800500033514, -0.17335288109212499]]], [[[0.32233606745140531, 0.43868100492599882], [-0.26115011727326709, -0.96866241078491333], [0.9631940136888999, 0.82348226383267886]], [[-0.349958535801556, -0.54169319708263508], [0.47122891718492199, 0.058655956565393685], [-0.37452501463104682, -0.41919398399202534]]], [[[0.16301940524472114, 0.51922895031291905], [0.1796779907351258, -0.45595423564575688], [0.91962363419968907, 0.96543204461471377]], [[0.09251380274804788, 0.23758617600674947], [0.58387993999262733, -0.10837464916271955], [-0.12932247692954668, -0.51497343906113824]]], [[[-0.1518232443562908, 0.90329953208243507], [-0.2605365503636714, 0.29824149005377532], [0.6769406475314439, 0.36945730938732391]], [[0.72412792885087618, 0.18038060746789197], [-0.32591365871103073, 0.081261268277464049], [0.6193115963045166, 0.4999657987136692]]]]) | arg1=numarray.array([[[[-5.0, -5.0], [-6.0, -1.0], [-4.0, -7.0]], [[-7.0, -4.0], [-2.0, -1.0], [-7.0, -2.0]]], [[[2.0, 1.0], [3.0, -6.0], [-7.0, 2.0]], [[7.0, 3.0], [3.0, 7.0], [-3.0, 7.0]]], [[[-5.0, 6.0], [6.0, -5.0], [-2.0, 7.0]], [[5.0, 4.0], [-3.0, -7.0], [-2.0, 4.0]]], [[[-1.0, 6.0], [0.0, 2.0], [1.0, 7.0]], [[-5.0, 1.0], [2.0, -2.0], [5.0, -5.0]]]]) |
29533 | res=generalTensorProduct(arg0,arg1,4) | res=generalTensorProduct(arg0,arg1,axis_offset=4) |
29534 | ref=numarray.array(-2.4776044528835741) | ref=numarray.array(29.0) |
29535 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29536 | self.failUnlessEqual(res.shape,(),"wrong shape of result.") | self.failUnlessEqual(res.shape,(),"wrong shape of result.") |
29537 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29538 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29539 | def test_generalTensorProduct_array_rank0_array_rank1_offset0(self): | def test_generalTensorProduct_array_rank0_array_rank1_offset0(self): |
29540 | arg0=numarray.array(0.430018952533) | arg0=numarray.array(-7.0) |
29541 | arg1=numarray.array([0.17405266481347681, 0.12684725858108425]) | arg1=numarray.array([0.0, -6.0]) |
29542 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29543 | ref=numarray.array([0.074845944608683102, 0.054546725266730989]) | ref=numarray.array([-0.0, 42.0]) |
29544 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29545 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
29546 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29547 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29548 | def test_generalTensorProduct_array_rank1_array_rank2_offset1(self): | def test_generalTensorProduct_array_rank1_array_rank2_offset1(self): |
29549 | arg0=numarray.array([-0.2596702139875493, -0.2895735074501018, -0.88211626259666986]) | arg0=numarray.array([-5.0, -6.0, -2.0]) |
29550 | arg1=numarray.array([[-0.95159197241138482, -0.45620300561671234], [0.17942838282450158, 0.46668790449160968], [-0.56794717501757241, 0.81081773034821758]]) | arg1=numarray.array([[6.0, 6.0], [0.0, 7.0], [-1.0, -6.0]]) |
29551 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29552 | ref=numarray.array([0.69613782433314564, -0.7319136272398028]) | ref=numarray.array([-28.0, -60.0]) |
29553 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29554 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
29555 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29556 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29557 | def test_generalTensorProduct_array_rank2_array_rank3_offset2(self): | def test_generalTensorProduct_array_rank2_array_rank3_offset2(self): |
29558 | arg0=numarray.array([[-0.97489218317706583, -0.045252664981564106, -0.89113304764498258], [-0.3501913135304584, -0.55826461424592799, -0.8654061515474869]]) | arg0=numarray.array([[4.0, 2.0, 5.0], [-5.0, 6.0, -6.0]]) |
29559 | arg1=numarray.array([[[0.2212209414743862, -0.054349150407258406], [-0.2714427214637134, -0.7744767637879284], [0.021192602734496413, 0.52949723477208965]], [[-0.016772505939617766, -0.86275907314487599], [-0.88314137189927888, -0.11775415644726928], [0.46675795463063086, -0.35554943541255901]]]) | arg1=numarray.array([[[4.0, 3.0], [-2.0, -5.0], [-6.0, 6.0]], [[-7.0, 5.0], [-1.0, -6.0], [-6.0, 0.0]]]) |
29560 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29561 | ref=numarray.array([-0.12730353075159806, 0.29174259527508767]) | ref=numarray.array([47.0, -29.0]) |
29562 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29563 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
29564 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29565 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29566 | def test_generalTensorProduct_array_rank3_array_rank4_offset3(self): | def test_generalTensorProduct_array_rank3_array_rank4_offset3(self): |
29567 | arg0=numarray.array([[[0.50878561502983222, -0.14479198118117953, 0.36673894379996397], [0.34487989411006525, -0.52851371261539493, 0.55304935318837289], [0.59081646267938503, -0.80626315077884403, 0.020388460504169093], [0.45589740066146556, -0.60784017956404757, 0.11066067969213056]], [[0.25411533156671218, 0.61497379354121429, 0.66407113202176649], [-0.17271277418374931, -0.088165136251946219, 0.96981177074973979], [0.84958965929853103, 0.87243005824919195, 0.56545158124645556], [-0.47408488299609086, 0.13974289822365438, -0.35740794171351919]]]) | arg0=numarray.array([[[-5.0, -4.0, 7.0], [-6.0, -3.0, 1.0], [4.0, -7.0, 1.0], [7.0, 5.0, 2.0]], [[2.0, 0.0, 0.0], [5.0, -2.0, -4.0], [-4.0, 0.0, -5.0], [1.0, -2.0, 1.0]]]) |
29568 | arg1=numarray.array([[[[0.11551790541956874, -0.15413632243003517], [0.25625731218580516, 0.927856687758978], [0.37594143013173831, 0.096294046812871237]], [[-0.1848865607798087, 0.43615288915744865], [-0.812304374439905, -0.99117632000028477], [0.907063259654181, -0.087549928919734787]], [[0.76742345834864034, 0.8563058102374741], [0.089128802167366183, 0.74698696172226686], [0.4615317283307987, 0.15958079697544769]], [[0.9357672352900428, -0.71813075885429223], [0.61171418377630227, -0.41339745776309056], [0.2597444842508625, -0.72639669475449908]]], [[[0.1013387379838655, 0.22473934630570636], [-0.14823547162087158, -0.50588269052448287], [0.55392022443062272, -0.18689656551671097]], [[-0.15185627741409657, 0.10714820021851423], [-0.056191863739971204, 0.34237024415476913], [-0.10863630473038999, -0.99980719636997906]], [[0.82776942923713159, -0.99778393075254601], [-0.54089965762023295, -0.48381357764476496], [0.17563110482978428, -0.52781836872553356]], [[0.3324304601921122, 0.32728086982667914], [0.789467675087689, -0.42774499808857303], [-0.91733053032511402, 0.30800389436676268]]]]) | arg1=numarray.array([[[[0.0, -2.0], [-1.0, 0.0], [3.0, -1.0]], [[-6.0, 5.0], [-4.0, -1.0], [-7.0, -4.0]], [[0.0, -2.0], [-4.0, 3.0], [2.0, -6.0]], [[3.0, -5.0], [6.0, 0.0], [-5.0, 0.0]]], [[[5.0, 3.0], [0.0, -2.0], [-6.0, -5.0]], [[-5.0, 0.0], [-1.0, 1.0], [-7.0, -3.0]], [[0.0, -4.0], [1.0, 2.0], [-6.0, -5.0]], [[-1.0, 3.0], [6.0, 0.0], [6.0, -3.0]]]]) |
29569 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
29570 | ref=numarray.array([2.340750975303576, -3.0908910578666107]) | ref=numarray.array([175.0, -41.0]) |
29571 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29572 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
29573 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29574 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29575 | def test_generalTensorProduct_array_rank0_array_rank2_offset0(self): | def test_generalTensorProduct_array_rank0_array_rank2_offset0(self): |
29576 | arg0=numarray.array(0.563644591) | arg0=numarray.array(1.0) |
29577 | arg1=numarray.array([[0.24500474080387091, -0.16226262506701583, -0.51786911047006479, -0.74021941654589174, -0.76057283926604691], [0.0044066131645983386, 0.9295484546164996, 0.24351213924959803, -0.23620282130383896, -0.92179962140932048], [0.48070433412714064, 0.96944856929747059, -0.66799958468547249, 0.91640592254796149, -0.036391524613143211], [-0.21129212235996686, -0.53722133447432108, 0.60673583943966247, 0.48039040450883896, -0.46093067578426417]]) | arg1=numarray.array([[0.0, -7.0, 0.0, -2.0, -2.0], [7.0, 1.0, 2.0, -4.0, 3.0], [-7.0, 4.0, 4.0, 5.0, -6.0], [-3.0, 7.0, 4.0, 3.0, -4.0]]) |
29578 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29579 | ref=numarray.array([[0.13809559692354159, -0.091458450940539296, -0.29189412296260842, -0.41722067028951781, -0.42869276691407671], [0.0024837636748567347, 0.52393495851731298, 0.13725430013095699, -0.13313444260692819, -0.51956737059352265], [0.2709463978011819, 0.54642444233753551, -0.37651435269843869, 0.51652724140483297, -0.020511886006453831], [-0.11909366188917685, -0.30280189934643437, 0.34198337406621521, 0.27076945306987138, -0.25980108223193088]]) | ref=numarray.array([[0.0, -7.0, 0.0, -2.0, -2.0], [7.0, 1.0, 2.0, -4.0, 3.0], [-7.0, 4.0, 4.0, 5.0, -6.0], [-3.0, 7.0, 4.0, 3.0, -4.0]]) |
29580 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29581 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") |
29582 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29583 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29584 | def test_generalTensorProduct_array_rank1_array_rank3_offset1(self): | def test_generalTensorProduct_array_rank1_array_rank3_offset1(self): |
29585 | arg0=numarray.array([-0.055353661857031167, -0.58911500691978236, 0.23067676644596946]) | arg0=numarray.array([0.0, 2.0, 4.0]) |
29586 | arg1=numarray.array([[[-0.89547806204576075, -0.4030293427981857, 0.43945118560188035, -0.2407765205686041, -0.7101213828926265], [-0.92741361662773203, -0.48272025345512382, 0.1639226094990256, 0.7053354652879591, 0.33162548844980599], [-0.19077567305995879, -0.69667359146432539, -0.99293341267288548, 0.51713992356824967, -0.5869751307126696], [-0.50223473208053182, -0.5044191409852683, 0.087329520581260311, -0.92793743087045044, 0.93873910856543641]], [[0.10177648203570122, 0.82862807638003422, 0.98554789045537516, -0.9583551777910877, 0.025683658444351165], [-0.017396067806169313, 0.92214054364746767, 0.62702164606076516, 0.23747634052356892, 0.36278252490414165], [0.74660461948563595, 0.74012638853691692, -0.81960422874870487, -0.30238856772085065, 0.48159866903979798], [-0.55527429450489985, 0.99102565989449287, -0.60107446343982751, -0.23025264311510862, -0.60710517046895118]], [[-0.89222526508707611, 0.25954042635560803, -0.86816945818315516, -0.59801247196502905, -0.63342224404360792], [-0.59187664394248785, -0.10742425820274915, 0.24022981085805384, 0.63002278029827452, -0.14248109796902209], [0.54019491748629744, 0.45137450270730706, 0.10176541504494185, -0.57521007247825784, 0.12259261444948], [0.086167133203624457, 0.86833395220043896, -0.83157977981206677, -0.60852604630694662, 0.11018823423717539]]]) | arg1=numarray.array([[[7.0, -5.0, -6.0, 6.0, 0.0], [3.0, 3.0, -6.0, 4.0, 1.0], [-7.0, 3.0, 7.0, 3.0, 5.0], [5.0, -2.0, 6.0, -1.0, 4.0]], [[-7.0, 0.0, 5.0, 7.0, 5.0], [0.0, 0.0, 5.0, -7.0, 2.0], [1.0, -4.0, 5.0, 5.0, 3.0], [-2.0, 0.0, 7.0, -7.0, 0.0]], [[-2.0, 2.0, 2.0, 4.0, 3.0], [-3.0, 4.0, 0.0, 3.0, -7.0], [5.0, -4.0, -6.0, -6.0, -2.0], [-6.0, 1.0, -1.0, -1.0, 0.0]]]) |
29587 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29588 | ref=numarray.array([[-0.21620570216354729, -0.40597813867711757, -0.80519280797671267, 0.43996169597141899, -0.12193860476701268], [-0.074948166017119247, -0.54130677959066154, -0.32304614208220955, -0.03361215908564294, -0.26494439377926826], [-0.30466543666122703, -0.29333451735712057, 0.56127856814101817, 0.016828455156927935, -0.22294651244861929], [0.37479770704340498, -0.35560217363326707, 0.15744184328736791, 0.0466372015547038, 0.33110998508857248]]) | ref=numarray.array([[-22.0, 8.0, 18.0, 30.0, 22.0], [-12.0, 16.0, 10.0, -2.0, -24.0], [22.0, -24.0, -14.0, -14.0, -2.0], [-28.0, 4.0, 10.0, -18.0, 0.0]]) |
29589 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29590 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") |
29591 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29592 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29593 | def test_generalTensorProduct_array_rank2_array_rank4_offset2(self): | def test_generalTensorProduct_array_rank2_array_rank4_offset2(self): |
29594 | arg0=numarray.array([[0.44725799816010214, -0.30781810713277391, -0.42095006385057743], [0.23951656502926255, -0.70741474776970859, 0.82912121602278477]]) | arg0=numarray.array([[2.0, -6.0, -3.0], [-5.0, -5.0, -7.0]]) |
29595 | arg1=numarray.array([[[[-0.45899871970899264, 0.90138237319513981, -0.88486761864911045, 0.91326764012723216, 0.6330995367560559], [-0.98584312311868993, -0.88769403279970627, 0.88503141460828383, -0.078475848210554755, -0.55207750765863217], [0.85710266168441884, -0.68787977782117626, -0.43109610187579839, -0.29472766265280481, -0.69964136094610918], [0.084963159911480846, 0.78201696882933147, 0.21017306762010968, 0.0029497891099103946, 0.78500120370195914]], [[-0.81658605980180421, 0.15752417192889157, 0.24931502361618008, -0.93542356047097819, -0.50180732714728937], [0.74464188574171075, -0.11442604205622997, 0.64010084942366174, -0.69364846236481048, 0.26510763839198437], [0.79928632529201615, 0.36193749110686002, -0.9058319210578345, -0.50328246480883809, -0.78306328087440868], [0.39903589296138131, 0.78519164256929375, -0.35522033660816765, 0.86724063632987725, -0.66653006236768508]], [[0.25585306743771996, -0.64337901935686181, -0.052803226849122087, 0.498546335129749, 0.79227950816184278], [-0.47713335663907452, 0.78417760075495258, 0.42013084877264628, -0.78791206665497637, 0.59906704860464743], [0.89689992123555196, 0.7286365786968787, -0.83325476268992937, 0.91527342231374575, 0.60628167536899524], [0.63533250205997005, 0.063424137848401063, 0.22852083010701318, 0.56652665099407118, -0.18357308988204046]]], [[[-0.22759605447156139, 0.80481113860278497, -0.24327265123693542, -0.13919308406348718, -0.12171689045768574], [-0.032402323837273483, 0.80198761021642073, 0.5358359846116636, -0.25911827883089167, 0.013134937082985854], [-0.84648187757795701, 0.043551710340560712, -0.68644287344765242, 0.11555625407117409, -0.14712685177866569], [-0.95458011575892376, -0.0081606835963243807, 0.24576319422438453, -0.47490439749357716, 0.75409670953211183]], [[-0.96547293480754437, 0.014018860754857698, -0.905098400556825, -0.16378556114177001, -0.51098386854290467], [-0.28232848587187442, 0.88836702158793401, -0.24312610243309707, 0.82668454674738445, 0.50950352877292415], [0.51035153018748858, -0.13746930893447296, -0.1782379191628285, 0.88283679016516747, 0.030395603440791508], [0.26005611848397492, 0.44503666833548827, 0.73884405329601099, 0.081272914408241803, 0.47378420261473875]], [[0.49535985942088212, 0.31601482732470054, -0.94651465562676829, 0.67346224422081558, 0.39352133698367764], [0.53863779912361065, -0.15732598653992702, -0.17036979805672403, 0.68863209612718057, -0.82620984731646763], [-0.29741264158990655, -0.47266815407684382, -0.2905006272000874, -0.39039145987783463, -0.86932976507925197], [-0.63751143745363303, 0.14708387794956779, -0.17722675840809776, 0.88241605499470266, -0.32485554712278386]]]]) | arg1=numarray.array([[[[-5.0, -2.0, 2.0, -2.0, 6.0], [1.0, -6.0, -7.0, -1.0, -5.0], [5.0, 0.0, 2.0, 5.0, 2.0], [-1.0, -5.0, 7.0, 0.0, 3.0]], [[7.0, 4.0, 6.0, -6.0, 0.0], [5.0, -5.0, 3.0, 4.0, -2.0], [7.0, -4.0, 4.0, 5.0, 7.0], [-7.0, 0.0, 7.0, 0.0, 4.0]], [[5.0, 6.0, 6.0, 4.0, 6.0], [5.0, -4.0, 0.0, -6.0, 2.0], [-5.0, -1.0, -2.0, -1.0, 1.0], [0.0, 6.0, -3.0, -1.0, 5.0]]], [[[3.0, -2.0, 6.0, -4.0, -4.0], [3.0, -2.0, 4.0, -6.0, -1.0], [-5.0, -6.0, 0.0, -6.0, -2.0], [-5.0, -4.0, 7.0, -6.0, -2.0]], [[-7.0, 1.0, 7.0, 4.0, 3.0], [1.0, -1.0, -5.0, 5.0, -7.0], [-2.0, 6.0, 0.0, -6.0, 6.0], [0.0, -2.0, -4.0, 3.0, 2.0]], [[-4.0, 7.0, 6.0, -6.0, 1.0], [0.0, 3.0, -3.0, 3.0, -4.0], [-2.0, 0.0, -3.0, -5.0, -7.0], [6.0, -7.0, 0.0, 7.0, -1.0]]]]) |
29596 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29597 | ref=numarray.array([[0.9775578981158688, 1.0703551711428427, -0.65304353199915166, 1.1274505615804493, 0.76271530590722469], [0.16926730775768839, -1.2587023877046706, 0.18102401009024222, 0.43417776142217956, -1.6230157132814935], [-1.0506066238715461, -1.0100102822578922, 0.15759239355005075, -1.282720224426189, -1.104614815851122], [-1.2934528198236481, -0.11346101366247871, -0.50359830985940413, 0.056276260063267469, 0.2096552880880454]]) | ref=numarray.array([[-19.0, -90.0, -157.0, 62.0, -8.0], [-63.0, 24.0, -6.0, -24.0, 64.0], [32.0, 27.0, 7.0, 78.0, -12.0], [23.0, 51.0, -34.0, -31.0, -26.0]]) |
29598 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29599 | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.shape,(4, 5),"wrong shape of result.") |
29600 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29601 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29602 | def test_generalTensorProduct_array_rank0_array_rank3_offset0(self): | def test_generalTensorProduct_array_rank0_array_rank3_offset0(self): |
29603 | arg0=numarray.array(0.484459788449) | arg0=numarray.array(6.0) |
29604 | arg1=numarray.array([[[-0.75859581736483772, -0.66071378873280318], [-0.78537935758374333, -0.46936266139450566]], [[-0.9835100329443871, -0.78474737120841942], [-0.019768759108839351, -0.29063344595908247]], [[0.15080898367774731, -0.89012122626553913], [-0.72128162006096441, -0.78363527564152391]], [[-0.39496668382498301, 0.16948877599172452], [0.6007037490315128, 0.058101560867611424]], [[-0.61627032371103585, 0.10127408641319069], [-0.99337269549800622, 0.79274912503853723]], [[0.38681173819880388, -0.29508915818850312], [0.0017876145256237042, -0.77116990677230168]]]) | arg1=numarray.array([[[-2.0, 6.0], [-7.0, 5.0]], [[5.0, -4.0], [-5.0, 1.0]], [[-5.0, 4.0], [1.0, -1.0]], [[4.0, -1.0], [-4.0, 4.0]], [[2.0, 1.0], [6.0, -2.0]], [[3.0, 6.0], [3.0, -6.0]]]) |
29605 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29606 | ref=numarray.array([[[-0.36750916919911536, -0.32008926231504869], [-0.38048471742749046, -0.22738733564519642]], [[-0.47647106249803073, -0.38017854544179819], [-0.0095771688557740649, -0.1408002177456367]], [[0.073060888328779827, -0.4312279409708607], [-0.34943194106712439, -0.37963977985872455]], [[-0.19134547609038444, 0.082110496561486626], [0.29101681117652572, 0.028147869886498863]], [[-0.29855819065264816, 0.049063222479133459], [-0.48124912591230418, 0.38405507340956069]], [[0.1873947328575099, -0.14295883114969291], [0.00086602735491260799, -0.37360080989339833]]]) | ref=numarray.array([[[-12.0, 36.0], [-42.0, 30.0]], [[30.0, -24.0], [-30.0, 6.0]], [[-30.0, 24.0], [6.0, -6.0]], [[24.0, -6.0], [-24.0, 24.0]], [[12.0, 6.0], [36.0, -12.0]], [[18.0, 36.0], [18.0, -36.0]]]) |
29607 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29608 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") |
29609 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29610 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29611 | def test_generalTensorProduct_array_rank1_array_rank4_offset1(self): | def test_generalTensorProduct_array_rank1_array_rank4_offset1(self): |
29612 | arg0=numarray.array([-0.041265439380634428, -0.54458056973457958, 0.70617486649744965]) | arg0=numarray.array([-3.0, 5.0, 0.0]) |
29613 | arg1=numarray.array([[[[-0.4170322705848184, -0.74155544497018533], [0.61849739185841446, 0.0092847477829254288]], [[-0.41657759742951406, 0.7090979264053161], [0.86382203605428098, 0.33610524375849771]], [[-0.98176093809152198, -0.52574582602174424], [0.28269388763484748, -0.042771475027286288]], [[-0.42339945356073927, -0.23653986422970918], [0.050943526834795083, 0.40928337145601335]], [[-0.1790836685237005, -0.38066539813790179], [-0.24460605803201951, -0.49402831601340735]], [[-0.76429020976031192, 0.90305364048652725], [-0.038626600456146409, 0.54278133275477125]]], [[[0.1658491458321214, -0.80211857071524895], [0.35040521374731615, 0.71226294440115412]], [[0.75377567117819644, -0.43266857566179429], [0.29333777422524987, 0.95491135959627238]], [[-0.99300199547058132, -0.10794098411486774], [-0.52314096741700356, -0.52337325665206369]], [[-0.90316468829125429, 0.39073466422364289], [-0.22759988867688108, -0.47039532691207286]], [[-0.36854310572321891, -0.8854187838778198], [0.52757626416524461, -0.27777773850411469]], [[0.66568793993691133, -0.11465488314176109], [0.31017566150088172, -0.66331138663872169]]], [[[0.09960176563284473, -0.075231296466667708], [0.25230304074464316, 0.77570554577439488]], [[0.78271851360361433, -0.713061202065157], [-0.89185163150359692, 0.84373582655898627]], [[0.69415653208388006, 0.26029843826331822], [-0.017582406242760973, 0.6602623431358261]], [[0.75365039178655757, 0.72386216222676025], [-0.024108328291647885, 0.017580674971473309]], [[0.66029932923188395, 0.71418533200066525], [0.063878472413904541, -0.55997900024276004]], [[-0.96481934361787158, -0.52789893250496922], [-0.68175538292192428, 0.455996112764677]]]]) | arg1=numarray.array([[[[-7.0, 0.0], [-7.0, 2.0]], [[7.0, 4.0], [0.0, 6.0]], [[-7.0, 6.0], [-6.0, -4.0]], [[-4.0, 3.0], [-2.0, -1.0]], [[7.0, 0.0], [-4.0, 1.0]], [[6.0, -5.0], [-1.0, 4.0]]], [[[-6.0, 6.0], [-2.0, -2.0]], [[-1.0, 0.0], [5.0, 6.0]], [[2.0, 0.0], [-6.0, 0.0]], [[-5.0, 7.0], [0.0, 0.0]], [[3.0, 2.0], [3.0, 1.0]], [[6.0, 4.0], [-1.0, 0.0]]], [[[-6.0, 5.0], [2.0, 4.0]], [[-7.0, 7.0], [6.0, -7.0]], [[-7.0, -4.0], [-5.0, 3.0]], [[1.0, 2.0], [3.0, 0.0]], [[0.0, 6.0], [-7.0, 3.0]], [[-3.0, 6.0], [-5.0, 2.0]]]]) |
29614 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29615 | ref=numarray.array([[[-0.0027729388969794933, 0.4142923487578144], [-0.038176371456545483, 0.15951606096895421]], [[0.15943481498088519, -0.2971842372297363], [-0.82519525488929935, 0.061929331862617842]], [[1.0714782852907008, 0.26429391003040115], [0.26081066522279361, 0.75304456201861725]], [[1.0415266698041328, 0.30814768114355118], [0.1048195745159147, 0.2516939277768559]], [[0.6743781714227095, 1.0022299221690529], [-0.23210463432874362, -0.22378444111688439]], [[-1.0123131174497126, -0.34761504186060899], [-0.64876021133715467, 0.66084137671836873]]]) | ref=numarray.array([[[-9.0, 30.0], [11.0, -16.0]], [[-26.0, -12.0], [25.0, 12.0]], [[31.0, -18.0], [-12.0, 12.0]], [[-13.0, 26.0], [6.0, 3.0]], [[-6.0, 10.0], [27.0, 2.0]], [[12.0, 35.0], [-2.0, -12.0]]]) |
29616 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29617 | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.shape,(6, 2, 2),"wrong shape of result.") |
29618 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29619 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29620 | def test_generalTensorProduct_array_rank0_array_rank4_offset0(self): | def test_generalTensorProduct_array_rank0_array_rank4_offset0(self): |
29621 | arg0=numarray.array(-0.973401265831) | arg0=numarray.array(6.0) |
29622 | arg1=numarray.array([[[[0.29457907415024165, 0.59612672000769606, -0.97060769583117157, 0.34621761283149932], [0.14003651050408683, 0.75675005310813948, -0.59491556001480639, -0.063692721275949937], [0.27215179353355268, 0.69169291689012646, 0.19450308319120313, 0.65046646267289598]], [[0.099753186595325172, 0.92051284383895604, 0.40137756555728887, -0.17524568831164333], [0.38146357238411022, -0.061413244035389392, 0.29554225117261557, 0.96623464403978399], [0.72136374896844679, 0.61756218303544586, -0.40419387511891269, 0.41307714541879959]]], [[[0.7830517807063484, 0.86353049401392545, 0.26936582709991086, -0.29994497467351189], [0.15545490072968282, -0.48233268791808492, 0.39862782016647103, 0.37169686347355113], [0.33658081581419452, 0.59511350313196809, 0.59136325019446279, -0.92660144923781207]], [[0.98818897330454503, -0.62652958861622032, 0.87415763036782979, -0.35689869665194074], [0.86461890456231427, -0.5684511336678657, 0.18767643730743999, 0.19866587632229638], [-0.43293767514707837, 0.40870353851520402, -0.19472418988420936, 0.75672439002930947]]], [[[-0.40216349448253053, -0.15298171315937537, 0.17111822737596372, 0.33854776785494756], [0.83777613798703765, 0.30789202676449867, 0.14632897062032701, 0.71038490896197293], [0.042356956471918172, 0.23916418386304406, 0.91086116710781795, 0.87638578464510575]], [[-0.73560531190415168, -0.37363420558312632, -0.67995148535918126, 0.47199115413336212], [-0.27194112419103589, -0.15001767237490915, 0.66188213671241125, 0.94485387402579413], [0.30443864615145677, 0.31743724195591216, -0.98475066295825453, 0.33545579885065679]]]]) | arg1=numarray.array([[[[-3.0, 5.0, 5.0, 0.0], [-3.0, -2.0, 4.0, 4.0], [-1.0, 1.0, 6.0, 3.0]], [[-6.0, -5.0, -5.0, -3.0], [5.0, 3.0, -2.0, 7.0], [0.0, 6.0, -5.0, -1.0]]], [[[2.0, -4.0, 7.0, 7.0], [3.0, -5.0, -7.0, -7.0], [0.0, 5.0, -1.0, 6.0]], [[4.0, 4.0, -3.0, 0.0], [0.0, -4.0, -4.0, -4.0], [-3.0, -4.0, 5.0, 1.0]]], [[[2.0, -3.0, -7.0, -5.0], [-7.0, 3.0, 5.0, 3.0], [-3.0, -2.0, 1.0, 7.0]], [[1.0, 2.0, -1.0, 0.0], [0.0, 5.0, 4.0, 3.0], [6.0, -3.0, -5.0, 4.0]]]]) |
29623 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29624 | ref=numarray.array([[[[-0.28674364366502592, -0.58027050385088352, 0.94479075974690052, -0.33700866258300011], [-0.13631171658716612, -0.73662145961277137, 0.57909155918068145, 0.061998575514199752], [-0.26491290032360476, -0.67329476086684936, -0.18932954738625482, -0.63316487814609346]], [[-0.09709987810251694, -0.89602836740608571, -0.39070143038943494, 0.17058437483389324], [-0.37131712422692265, 0.059779729482806271, -0.28768120139782355, -0.94053402559762145], [-0.70217638637013091, -0.60113581069575828, 0.39344282968169014, -0.40208981623631462]]], [[[-0.76222359455039723, -0.84056167595640374, -0.26220103707053649, 0.29196681802669783], [-0.15131999714983008, 0.4695032489708979, -0.3880248247453012, -0.36181019741038623], [-0.32762819216780387, -0.57928423726148903, -0.57563373630493675, 0.90195502360847457]], [[-0.96190439749439971, 0.60986469463929982, -0.85090614393544772, 0.34740564309425959], [-0.84162113616194867, 0.5533310530750909, -0.1826844816416231, -0.19338161548945154], [0.42142208101388579, -0.39783254174010962, 0.18954477292111069, -0.73659647913935311]]], [[[0.39146645460011797, 0.14891259323825651, -0.16656669913443672, -0.32954282577410082], [-0.81549235319918145, -0.29970248859168536, -0.14243680522950233, -0.69148956961047858], [-0.041230315046493111, -0.23280271931360877, -0.88663341305860899, -0.85307503212941382]], [[0.71603914175915095, 0.36369600867219348, 0.66186563655196495, -0.45943678689421974], [0.26470783451892721, 0.14602739218668384, -0.64427690970646612, -0.91972195700157255], [-0.29634096353155581, -0.30899381314163193, 0.95855754185100239, -0.32653309923141544]]]]) | ref=numarray.array([[[[-18.0, 30.0, 30.0, 0.0], [-18.0, -12.0, 24.0, 24.0], [-6.0, 6.0, 36.0, 18.0]], [[-36.0, -30.0, -30.0, -18.0], [30.0, 18.0, -12.0, 42.0], [0.0, 36.0, -30.0, -6.0]]], [[[12.0, -24.0, 42.0, 42.0], [18.0, -30.0, -42.0, -42.0], [0.0, 30.0, -6.0, 36.0]], [[24.0, 24.0, -18.0, 0.0], [0.0, -24.0, -24.0, -24.0], [-18.0, -24.0, 30.0, 6.0]]], [[[12.0, -18.0, -42.0, -30.0], [-42.0, 18.0, 30.0, 18.0], [-18.0, -12.0, 6.0, 42.0]], [[6.0, 12.0, -6.0, 0.0], [0.0, 30.0, 24.0, 18.0], [36.0, -18.0, -30.0, 24.0]]]]) |
29625 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
29626 | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.shape,(3, 2, 3, 4),"wrong shape of result.") |
29627 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29628 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29629 | def test_generalTensorProduct_array_rank0_Symbol_rank0_offset0(self): | def test_generalTensorProduct_array_rank0_Symbol_rank0_offset0(self): |
29630 | arg0=numarray.array(-0.957462297702) | arg0=numarray.array(-1.0) |
29631 | arg1=Symbol(shape=()) | arg1=Symbol(shape=()) |
29632 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29633 | s1=numarray.array(-0.559707298165) | s1=numarray.array(4.0) |
29634 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29635 | ref=numarray.array(0.53589863574133045) | ref=numarray.array(-4.0) |
29636 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29637 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29638 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29639 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29640 | def test_generalTensorProduct_array_rank1_Symbol_rank1_offset1(self): | def test_generalTensorProduct_array_rank1_Symbol_rank1_offset1(self): |
29641 | arg0=numarray.array([-0.36386467030272707, 0.79053000390700823, 0.49949697175291008]) | arg0=numarray.array([-2.0, 1.0, 1.0]) |
29642 | arg1=Symbol(shape=(3,)) | arg1=Symbol(shape=(3,)) |
29643 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29644 | s1=numarray.array([-0.41668251834151615, -0.84458361932879855, -0.81891948201294307]) | s1=numarray.array([-3.0, -2.0, -1.0]) |
29645 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29646 | ref=numarray.array(-0.92510044610547126) | ref=numarray.array(3.0) |
29647 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29648 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29649 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29650 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29651 | def test_generalTensorProduct_array_rank2_Symbol_rank2_offset2(self): | def test_generalTensorProduct_array_rank2_Symbol_rank2_offset2(self): |
29652 | arg0=numarray.array([[0.24921109239870542, 0.070069423064783365, 0.18377777086430602], [-0.62079299114141939, 0.69372333437842615, 0.18995102366798089]]) | arg0=numarray.array([[5.0, -5.0, 0.0], [-3.0, 7.0, -3.0]]) |
29653 | arg1=Symbol(shape=(2, 3)) | arg1=Symbol(shape=(2, 3)) |
29654 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29655 | s1=numarray.array([[0.21185241787837517, -0.47522346439650831, 0.15044667792382516], [-0.96445248594758759, 0.24322056182988483, 0.43116514893080304]]) | s1=numarray.array([[0.0, 2.0, 7.0], [7.0, 0.0, 0.0]]) |
29656 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29657 | ref=numarray.array(0.89649947772901273) | ref=numarray.array(-31.0) |
29658 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29659 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29660 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29661 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29662 | def test_generalTensorProduct_array_rank3_Symbol_rank3_offset3(self): | def test_generalTensorProduct_array_rank3_Symbol_rank3_offset3(self): |
29663 | arg0=numarray.array([[[0.89951661489407675, 0.57634448615134071, -0.53622729711472106], [-0.43350107796423099, -0.080051592191078047, -0.15553247466126097], [0.72180063867107735, -0.82980647180863376, -0.59717174549223451], [-0.83995910214212777, -0.8011097028059524, 0.48642967841411688]], [[0.032209410767552127, -0.29174761516294923, 0.60698244153542502], [-0.16082619446803559, 0.90130271430612341, 0.61908893637597195], [0.5316196866201981, -0.7645309286542088, 0.86841619625011068], [-0.046878997260848765, -0.21160695253715578, 0.58711713241006014]]]) | arg0=numarray.array([[[6.0, -1.0, 5.0], [6.0, -7.0, -2.0], [-2.0, 7.0, -1.0], [0.0, -6.0, -5.0]], [[-7.0, 6.0, 3.0], [-7.0, 3.0, 1.0], [3.0, 0.0, 6.0], [0.0, 5.0, -6.0]]]) |
29664 | arg1=Symbol(shape=(2, 4, 3)) | arg1=Symbol(shape=(2, 4, 3)) |
29665 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
29666 | s1=numarray.array([[[0.91690796541437947, 0.93895712717412416, 0.4960289759729275], [0.57518708286608367, -0.3607057205398787, 0.7394114541246426], [-0.31410764644321443, -0.29420028545817356, 0.75700165987390822], [-0.33725518282725941, 0.069572583101098928, 0.6692500078886463]], [[-0.10731293521792296, 0.80789326974389519, -0.51130078623618203], [0.56766444048947928, -0.43024591812978841, 0.63463592438763272], [-0.46509124824695425, 0.87273573225039591, -0.19057357437390876], [-0.42004672769206963, -0.80433128985257563, -0.92474583620338513]]]) | s1=numarray.array([[[-2.0, 0.0, 5.0], [-5.0, 0.0, 7.0], [3.0, 7.0, 2.0], [-7.0, 0.0, 5.0]], [[-7.0, 2.0, -2.0], [1.0, 3.0, 7.0], [3.0, -3.0, 2.0], [5.0, 0.0, -5.0]]]) |
29667 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29668 | ref=numarray.array(-1.185796687546163) | ref=numarray.array(100.0) |
29669 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29670 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29671 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29672 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29673 | def test_generalTensorProduct_array_rank4_Symbol_rank4_offset4(self): | def test_generalTensorProduct_array_rank4_Symbol_rank4_offset4(self): |
29674 | arg0=numarray.array([[[[0.5070106039208957, -0.80093573762737025], [0.96275336071758555, 0.075439570813181422], [0.49472379237646691, -0.43458105274270808]], [[0.72718767173515753, 0.80846558074432373], [-0.64809196852926876, -0.43919101455912912], [-0.893415135600508, -0.53830852436619581]]], [[[-0.7144096015445689, 0.46424273455446419], [0.87470571392874574, 0.73127223646986539], [0.44580582735968366, 0.09358399253891192]], [[-0.47531949689131281, 0.80987197534344246], [0.22102468059979441, 0.011807204402863203], [-0.25714838425275377, -0.63922489846208608]]], [[[-0.33241159141299415, 0.77011505826981685], [0.99202765676214599, -0.16610877114467915], [0.92115394272001705, -0.91405724352793505]], [[0.97188471308071089, 0.30319183123524751], [0.37241323053622089, 0.73658498120101434], [0.65837281703545369, 0.29231746666974989]]], [[[0.098894799684311918, -0.070761173565578872], [-0.91516821529268766, 0.44476922635848548], [-0.89095186965196538, -0.94200176632887711]], [[0.72634719623762956, -0.97327084224425731], [-0.96179619381454295, 0.52766972623475761], [-0.9488934329813703, -0.70402900917681022]]]]) | arg0=numarray.array([[[[7.0, -2.0], [3.0, 5.0], [1.0, 4.0]], [[0.0, 4.0], [-5.0, 4.0], [-6.0, 5.0]]], [[[5.0, -2.0], [-4.0, 3.0], [-7.0, 5.0]], [[-2.0, -4.0], [-4.0, 5.0], [-5.0, 4.0]]], [[[7.0, 0.0], [4.0, -2.0], [3.0, 6.0]], [[6.0, 0.0], [-5.0, 2.0], [7.0, -6.0]]], [[[-3.0, 7.0], [0.0, -5.0], [0.0, -3.0]], [[-2.0, -6.0], [7.0, -3.0], [-1.0, -5.0]]]]) |
29675 | arg1=Symbol(shape=(4, 2, 3, 2)) | arg1=Symbol(shape=(4, 2, 3, 2)) |
29676 | res=generalTensorProduct(arg0,arg1,4) | res=generalTensorProduct(arg0,arg1,axis_offset=4) |
29677 | s1=numarray.array([[[[-0.11820066798291351, -0.51258557543222039], [-0.098364895518923579, -0.75261766421768717], [-0.063909470910654687, -0.73607442780090548]], [[-0.38847542547631408, 0.67314170861984213], [-0.089021817061877506, -0.36081485475815711], [0.85601942110178308, -0.079874643934933598]]], [[[-0.22567418092861158, 0.44842015216882913], [0.47159266399869981, -0.032362209916325435], [-0.23592039935287534, -0.92821348171903462]], [[-0.99825597347382367, -0.014365429430939214], [0.24509461408578925, 0.79747699887960977], [-0.44637938871932281, 0.35195013915421569]]], [[[-0.85809446703075554, 0.020878136895004173], [-0.67634718571481112, -0.60950223946435922], [0.50291952025652686, -0.10535591431772939]], [[0.97430474404201473, 0.18572127273504013], [0.47253795512498886, 0.63623230687133225], [-0.51874893042992887, 0.77155986057556136]]], [[[-0.30687039741377387, 0.32128067060991428], [0.50377807631485538, -0.6559782356049495], [-0.5583444443570067, 0.95056487885272278]], [[-0.56413370947964347, -0.3141119685197773], [-0.26123657655870547, 0.91755715991922915], [-0.5567270925980643, -0.59222723358438967]]]]) | s1=numarray.array([[[[3.0, 1.0], [-6.0, -5.0], [6.0, 3.0]], [[-4.0, -5.0], [-2.0, -7.0], [0.0, 4.0]]], [[[7.0, -1.0], [-4.0, -7.0], [-6.0, 0.0]], [[4.0, -7.0], [-3.0, 0.0], [3.0, 5.0]]], [[[-6.0, -2.0], [-3.0, 3.0], [4.0, 3.0]], [[-3.0, -5.0], [-1.0, 4.0], [4.0, 7.0]]], [[[-3.0, -2.0], [-7.0, 1.0], [0.0, -5.0]], [[-4.0, 3.0], [7.0, 3.0], [-2.0, 3.0]]]]) |
29678 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29679 | ref=numarray.array(3.4217241320311644) | ref=numarray.array(60.0) |
29680 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29681 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29682 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29683 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29684 | def test_generalTensorProduct_array_rank0_Symbol_rank1_offset0(self): | def test_generalTensorProduct_array_rank0_Symbol_rank1_offset0(self): |
29685 | arg0=numarray.array(0.108487093181) | arg0=numarray.array(-7.0) |
29686 | arg1=Symbol(shape=(2,)) | arg1=Symbol(shape=(2,)) |
29687 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29688 | s1=numarray.array([0.84138252420927007, -0.92070896817838488]) | s1=numarray.array([1.0, -7.0]) |
29689 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29690 | ref=numarray.array([0.091279144304962714, -0.099885039623576935]) | ref=numarray.array([-7.0, 49.0]) |
29691 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29692 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29693 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29694 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29695 | def test_generalTensorProduct_array_rank1_Symbol_rank2_offset1(self): | def test_generalTensorProduct_array_rank1_Symbol_rank2_offset1(self): |
29696 | arg0=numarray.array([-0.88164918266823733, 0.51849070402116149, 0.21407376222612973]) | arg0=numarray.array([7.0, -7.0, 7.0]) |
29697 | arg1=Symbol(shape=(3, 2)) | arg1=Symbol(shape=(3, 2)) |
29698 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29699 | s1=numarray.array([[-0.66753189134297752, 0.63604973587224611], [0.24368306203710977, 0.90997330527638165], [-0.98449387680117129, -0.47340125794576626]]) | s1=numarray.array([[-6.0, 2.0], [6.0, -7.0], [-7.0, -2.0]]) |
29700 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29701 | ref=numarray.array([0.5041220407057575, -0.19030281840593222]) | ref=numarray.array([-133.0, 49.0]) |
29702 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29703 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29704 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29705 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29706 | def test_generalTensorProduct_array_rank2_Symbol_rank3_offset2(self): | def test_generalTensorProduct_array_rank2_Symbol_rank3_offset2(self): |
29707 | arg0=numarray.array([[-0.48368367521376232, 0.30609630853711667, -0.26702652782848735], [0.41384989253050808, -0.50719047280485663, 0.23578081638741089]]) | arg0=numarray.array([[-2.0, 0.0, 2.0], [7.0, 0.0, 0.0]]) |
29708 | arg1=Symbol(shape=(2, 3, 2)) | arg1=Symbol(shape=(2, 3, 2)) |
29709 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29710 | s1=numarray.array([[[0.94427607440082362, 0.73859626063120443], [0.68317458423465416, -0.99520231028946493], [-0.20997916005756068, 0.88242044704976808]], [[0.76525228434960391, 0.78715761878550694], [0.40871097191938799, 0.19907179685124388], [0.68637205898056397, -0.78263837970114158]]]) | s1=numarray.array([[[7.0, -1.0], [5.0, 2.0], [-1.0, -3.0]], [[1.0, 6.0], [-6.0, -1.0], [-7.0, 0.0]]]) |
29711 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29712 | ref=numarray.array([0.079694931224933291, -0.85723771425921702]) | ref=numarray.array([-9.0, 38.0]) |
29713 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29714 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29715 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29716 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29717 | def test_generalTensorProduct_array_rank3_Symbol_rank4_offset3(self): | def test_generalTensorProduct_array_rank3_Symbol_rank4_offset3(self): |
29718 | arg0=numarray.array([[[-0.019572223955578893, -0.9250431623941755, 0.44113863083036331], [0.16475833916322835, 0.18179350359368796, 0.61858296572780058], [-0.2720849224062758, -0.76724652269718852, 0.79207356062815881], [-0.23899953264169271, 0.017892682882899358, -0.37426572707749517]], [[0.41051117825823735, -0.032439543670818693, 0.6211335817861523], [0.77419812491244255, -0.36484297441721059, 0.32162185231108009], [0.89581390224822743, 0.86956478253874758, -0.10849549467724673], [-0.42880379570159, -0.49982493514413084, -0.052879122591514394]]]) | arg0=numarray.array([[[-6.0, -4.0, -3.0], [1.0, 5.0, 7.0], [3.0, 7.0, 3.0], [-4.0, -2.0, -3.0]], [[0.0, -3.0, 7.0], [7.0, -7.0, -4.0], [5.0, -6.0, -7.0], [7.0, 1.0, -2.0]]]) |
29719 | arg1=Symbol(shape=(2, 4, 3, 2)) | arg1=Symbol(shape=(2, 4, 3, 2)) |
29720 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
29721 | s1=numarray.array([[[[0.87391667386784877, -0.6471677646729681], [-0.34183333619232692, 0.2618328015568907], [0.268334890441561, -0.28080804553410532]], [[-0.99864903808059657, -0.33782866020730462], [-0.88664715155393736, 0.11667158103125796], [0.59964444832918185, -0.62609715880501171]], [[0.22723251258215482, -0.4424072035615052], [0.77129609805160704, 0.8371606647229084], [-0.93328965088392013, 0.24195753531013242]], [[0.10584444738563992, 0.95898293264234202], [-0.54401506237790409, -0.34627867521321964], [-0.7302680224080853, -0.2290542842136678]]], [[[-0.6898420381456476, -0.16576591511921568], [-0.16678612923474789, 0.43246154039245743], [-0.58526569874414802, -0.36747268410116618]], [[-0.58344182130098132, -0.36469539378659577], [-0.68872653593994215, 0.092812389150101371], [-0.86846350365516822, 0.62743490904714494]], [[-0.25855664260307276, -0.9492244487968462], [-0.92969704766912842, 0.36333565697076509], [-0.073467842205704237, 0.73319138103443526]], [[0.40778032771627637, -0.34401855672469117], [0.2543827332672941, 0.43552413714033089], [0.30669085716473932, -0.069296006825886325]]]]) | s1=numarray.array([[[[-6.0, 0.0], [-2.0, 4.0], [2.0, 5.0]], [[-6.0, -1.0], [3.0, 0.0], [1.0, 4.0]], [[2.0, 6.0], [6.0, -5.0], [0.0, -4.0]], [[3.0, -7.0], [0.0, 0.0], [6.0, -2.0]]], [[[-4.0, 0.0], [-6.0, -1.0], [-6.0, -7.0]], [[-1.0, -6.0], [-3.0, 0.0], [-1.0, 6.0]], [[4.0, -2.0], [3.0, 4.0], [0.0, 7.0]], [[-5.0, -2.0], [-6.0, 0.0], [-2.0, 4.0]]]]) |
29722 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29723 | ref=numarray.array([-3.1632114345394542, -2.3602881471017327]) | ref=numarray.array([31.0, -216.0]) |
29724 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29725 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29726 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29727 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29728 | def test_generalTensorProduct_array_rank0_Symbol_rank2_offset0(self): | def test_generalTensorProduct_array_rank0_Symbol_rank2_offset0(self): |
29729 | arg0=numarray.array(0.455040090646) | arg0=numarray.array(-6.0) |
29730 | arg1=Symbol(shape=(4, 5)) | arg1=Symbol(shape=(4, 5)) |
29731 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29732 | s1=numarray.array([[0.18689217676364223, 0.43741941176715082, 0.14945398547643274, -0.26067257495533847, -0.60874095714372567], [0.55554155897958468, -0.55346823947274082, 0.31980465520665247, 0.70796260301073999, 0.24071914382063953], [-0.44601774141459916, 0.13052963266249162, -0.43045278573316748, 0.31729655731190576, -0.77333782351433955], [-0.72070257520136849, -0.77044763579497211, -0.04139231794665621, -0.091555910165080245, 0.47241932906674289]]) | s1=numarray.array([[0.0, 6.0, 4.0, 2.0, 4.0], [-7.0, -3.0, -2.0, 7.0, 5.0], [5.0, 5.0, 1.0, -7.0, 0.0], [4.0, -6.0, -1.0, 3.0, 7.0]]) |
29733 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29734 | ref=numarray.array([[0.085043433055538617, 0.19904336878080359, 0.06800755509858801, -0.11861647213657918, -0.27700154031855706], [0.25279368135563862, -0.25185023785930649, 0.14552393929421814, 0.3221513670479193, 0.10953686102434891], [-0.20295595348298187, 0.059396215878717115, -0.19587327463880366, 0.14438265420084379, -0.35189971331187342], [-0.32794856514836923, -0.35058456203006877, -0.018835164110490639, -0.041661609660686626, 0.2149697343214092]]) | ref=numarray.array([[-0.0, -36.0, -24.0, -12.0, -24.0], [42.0, 18.0, 12.0, -42.0, -30.0], [-30.0, -30.0, -6.0, 42.0, -0.0], [-24.0, 36.0, 6.0, -18.0, -42.0]]) |
29735 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29736 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29737 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29738 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29739 | def test_generalTensorProduct_array_rank1_Symbol_rank3_offset1(self): | def test_generalTensorProduct_array_rank1_Symbol_rank3_offset1(self): |
29740 | arg0=numarray.array([0.69261168472180512, 0.25365734042241272, 0.84943826521908639]) | arg0=numarray.array([6.0, -6.0, -3.0]) |
29741 | arg1=Symbol(shape=(3, 4, 5)) | arg1=Symbol(shape=(3, 4, 5)) |
29742 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29743 | s1=numarray.array([[[0.68885706909213917, -0.65202153072428182, 0.6261285538208996, 0.34721912808941968, -0.089315251083961655], [0.80381675905121908, -0.57216740190522941, 0.82470959561442947, 0.27246398430511132, -0.9972757144407598], [-0.22169304397082157, 0.37234701973945517, -0.66935271898725701, 0.93278354992490553, -0.52458317948156341], [0.50398300848981581, -0.77543421503402299, -0.18608364241577902, -0.26294305822629416, -0.54765425234742993]], [[0.7093795777051215, 0.2705953748419847, 0.49310825191934216, 0.43517647000100101, 0.10419151917614733], [0.27389239246670538, -0.2303115997373768, -0.329250102164383, 0.89127380373365095, -0.91200365016766849], [0.23890238241051676, -0.98515286709664185, -0.29358318884600765, 0.71671700644000724, 0.57486481575414028], [0.83986326924122401, 0.59444101381262837, 0.85187919309651039, 0.21375159163354041, 0.98681298894840097]], [[0.92019060411747078, 0.21872878646329008, 0.36924088100677022, -0.66670264741451568, 0.63721942293971989], [0.4618475495949228, 0.72805243234044648, -0.46132130777896729, -0.42828611469801903, -0.11860992183089802], [-0.13459197354298946, 0.29963478116170505, -0.23995949401169159, 0.07645975667540994, -0.85338422976148531], [-0.42775379707854544, 0.85155800233404433, -0.015298622995842281, -0.13410285391723598, 0.60928767765959324]]]) | s1=numarray.array([[[1.0, -3.0, -1.0, 7.0, -7.0], [6.0, -5.0, -6.0, -4.0, -7.0], [5.0, 3.0, -3.0, -6.0, 4.0], [-2.0, -6.0, -5.0, 0.0, 3.0]], [[0.0, -4.0, -1.0, 0.0, 4.0], [0.0, -7.0, -5.0, 7.0, 5.0], [6.0, 6.0, 0.0, -6.0, -1.0], [-2.0, 7.0, 0.0, -3.0, 4.0]], [[-2.0, 1.0, 4.0, -3.0, 2.0], [0.0, 3.0, 0.0, 1.0, 2.0], [7.0, 7.0, 4.0, -6.0, 0.0], [-6.0, -2.0, 7.0, -7.0, 7.0]]]) |
29744 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29745 | ref=numarray.array([[1.4386949026195341, -0.19716262682995825, 0.87239181364688412, -0.21544900896824143, 0.50584671831000161], [1.0185186768527195, 0.16372553908151177, 0.095822825787557353, 0.050987267552316029, -1.0228130393058292], [-0.20727542225167622, 0.26252188917493779, -0.74190182156243534, 0.89280515875279409, -0.94241097914475347], [0.19875156044422004, 0.33705548077213021, 0.074206469631460034, -0.24180986989158129, 0.38855289183805991]]) | ref=numarray.array([[12.0, 3.0, -12.0, 51.0, -72.0], [36.0, 3.0, -6.0, -69.0, -78.0], [-27.0, -39.0, -30.0, 18.0, 30.0], [18.0, -72.0, -51.0, 39.0, -27.0]]) |
29746 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29747 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29748 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29749 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29750 | def test_generalTensorProduct_array_rank2_Symbol_rank4_offset2(self): | def test_generalTensorProduct_array_rank2_Symbol_rank4_offset2(self): |
29751 | arg0=numarray.array([[0.3039031119878608, -0.46902944817620895, -0.44578563165877094], [-0.80408081597354619, 0.25386737228506684, 0.67140851967585236]]) | arg0=numarray.array([[0.0, 4.0, -2.0], [3.0, 3.0, -1.0]]) |
29752 | arg1=Symbol(shape=(2, 3, 4, 5)) | arg1=Symbol(shape=(2, 3, 4, 5)) |
29753 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29754 | s1=numarray.array([[[[-0.7263198493755374, 0.41904505539463011, 0.62028771669774407, 0.3399262059509971, 0.77016983399369865], [0.61404312962626517, 0.89616485410854163, -0.68019137772344873, 0.16692385359091166, 0.8493678342931037], [-0.44709754369522159, -0.97629085323232334, 0.89129750684206099, 0.90458110464850172, 0.88105135078018559], [0.7773611433790939, 0.46510160723654459, 0.17770531005480272, -0.64727757502491245, 0.65450344044478048]], [[-0.55275453692537346, 0.04580544549354526, 0.88315714627967568, -0.19976922382794315, -0.93320819590088133], [-0.59604629038500878, 0.26722391030409054, -0.51704885626719332, 0.89797871613171276, -0.82316582800822435], [-0.42709666311894368, -0.19737072428338598, -0.53187264500240472, 0.3941846918094376, -0.23130808509598322], [-0.4703798656484568, -0.80834752615263628, 0.79231878041242454, 0.31063362607484923, 0.81711403637294655]], [[0.52648144284381293, 0.72207380343518701, -0.78353420303272348, -0.076693518541859795, -0.47001685584179387], [-0.76843681971154343, -0.9895347885157586, 0.88163402522052969, -0.12693131163753169, 0.33380827597641671], [-0.3222421039510619, 0.75106816768685447, 0.84282915735514985, 0.59382684882384917, -0.19922655262290134], [-0.52714059312842299, -0.98166350594347263, -0.30681161042064753, 0.73300771282988264, 0.95340535851031061]]], [[[-0.052278161619904395, 0.63409984871791414, -0.51065188116020144, 0.66473745611932111, 0.43562785427842066], [-0.12208923066493016, 0.3732032006981516, 0.10885065610075229, 0.40488446751220653, -0.14025724107980087], [0.91619382187166654, -0.38057512677947702, -0.85375638984117419, -0.44377333923125728, 0.65135742691899678], [-0.086367612992696907, 0.74519488858450966, -0.68393350024952237, -0.45417846856628397, -0.95934406298597197]], [[0.51957119310746447, -0.32270541491288429, 0.81484723489763278, 0.096250871173069852, -0.95029164011783007], [-0.38276064312286895, -0.55473818935587738, -0.91309027789119468, -0.87640582593842975, 0.62339088180769453], [-0.9466807402305879, -0.87893287805822551, 0.3081486631688175, 0.80360638114146465, 0.12486797541643435], [0.8909434794049067, -0.46117744168311603, 0.50373971600741707, -0.35581016383564457, -0.53680159160692842]], [[-0.31832036380648088, 0.45836580426357942, 0.90480600953309942, -0.22878050845203379, -0.98953245101753917], [0.32769362994007945, 0.75323594687200446, -0.98573717113446935, -0.96261733160912311, 0.6601996860915138], [0.54893410536584719, -0.37750642947621627, 0.43557336829842952, -0.23466449436952375, 0.24491067970190938], [0.35792431433305527, -0.14927724289874322, 0.49926138099833861, 0.90623067822960146, -0.0040842419516855522]]]]) | s1=numarray.array([[[[2.0, 0.0, -6.0, -5.0, -1.0], [1.0, 2.0, 1.0, -1.0, -2.0], [-5.0, -6.0, 6.0, 0.0, 4.0], [5.0, 0.0, -3.0, 7.0, 5.0]], [[-1.0, 0.0, -7.0, 5.0, 2.0], [-5.0, -3.0, 0.0, 0.0, -7.0], [5.0, 2.0, -5.0, 5.0, -7.0], [3.0, -6.0, 4.0, -6.0, 0.0]], [[6.0, 6.0, -3.0, -3.0, 1.0], [6.0, 0.0, -5.0, -2.0, -4.0], [-4.0, 5.0, -6.0, 2.0, -3.0], [3.0, -7.0, 5.0, 6.0, -7.0]]], [[[5.0, 3.0, -1.0, 4.0, 1.0], [-3.0, -1.0, -2.0, 5.0, 1.0], [2.0, 2.0, 3.0, 3.0, 2.0], [-3.0, 7.0, 0.0, 1.0, -1.0]], [[5.0, 4.0, -2.0, -2.0, 3.0], [-2.0, -5.0, 1.0, 5.0, 0.0], [0.0, 4.0, 1.0, -2.0, 7.0], [-3.0, -3.0, 0.0, 6.0, 2.0]], [[-5.0, -3.0, 1.0, 2.0, 2.0], [1.0, 0.0, -6.0, -4.0, -5.0], [2.0, 0.0, 0.0, 3.0, -3.0], [-1.0, 3.0, 3.0, -3.0, 6.0]]]]) |
29755 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29756 | ref=numarray.array([[-0.23595553353137594, -0.50006632635561277, 1.3485319191584209, -0.43248171363355531, -0.37462266478061279], [1.0297464382360819, 0.65294536705185269, -1.3383818062720076, -1.5082257829228833, 1.2097080648270018], [-0.40036871552609365, -0.70952079882714991, 1.2017765873272452, 0.22858463563347567, 0.13744789582420677], [1.2277976364526209, 0.14159527400356242, 0.83218579365567358, 0.21414830656459077, 0.023012229433182374]]) | ref=numarray.array([[19.0, 12.0, -32.0, 30.0, 16.0], [-48.0, -30.0, 13.0, 38.0, -12.0], [32.0, 16.0, 4.0, 16.0, 8.0], [-11.0, -1.0, 3.0, -12.0, 11.0]]) |
29757 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29758 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29759 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29760 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29761 | def test_generalTensorProduct_array_rank0_Symbol_rank3_offset0(self): | def test_generalTensorProduct_array_rank0_Symbol_rank3_offset0(self): |
29762 | arg0=numarray.array(0.890045711116) | arg0=numarray.array(7.0) |
29763 | arg1=Symbol(shape=(6, 2, 2)) | arg1=Symbol(shape=(6, 2, 2)) |
29764 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29765 | s1=numarray.array([[[0.49254859843576848, -0.87591437650742887], [0.65951944732768886, 0.62391289331539457]], [[0.56006360504326724, 0.25580615479271751], [0.81538317307965458, -0.42091246260962034]], [[-0.041061181788684786, -0.41035548527018695], [0.71939662130420423, 0.37291912317303932]], [[0.86828122599620094, 0.76141592812588854], [-0.38080320814229718, 0.63409187587724269]], [[0.42738473899131413, -0.32958638811270657], [0.76318734863948845, -0.83807304191658871]], [[-0.79738808556006968, -0.81656788454722151], [0.60156187537550854, -0.98408669269014215]]]) | s1=numarray.array([[[5.0, 7.0], [0.0, 6.0]], [[-2.0, 1.0], [3.0, -3.0]], [[0.0, 7.0], [7.0, -1.0]], [[5.0, -2.0], [3.0, 0.0]], [[-5.0, 2.0], [5.0, -1.0]], [[1.0, -6.0], [7.0, 5.0]]]) |
29766 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29767 | ref=numarray.array([[[0.4383907675541347, -0.77960383411560596], [0.58700245549184782, 0.555310994805572]], [[0.49848220962113232, 0.22767917095042836], [0.72572829611600298, -0.37463133210112182]], [[-0.03654632874438847, -0.36523513969780647], [0.64029587738341409, 0.3319150661734408]], [[0.77280998124078182, 0.67769498120413696], [-0.33893226218640576, 0.56437075457827324]], [[0.38039195393580816, -0.29334695118204968], [0.67927162643485017, -0.74592331656010913]], [[-0.70971184564803269, -0.72678274347662131], [0.53541756714909139, -0.87588214019555377]]]) | ref=numarray.array([[[35.0, 49.0], [0.0, 42.0]], [[-14.0, 7.0], [21.0, -21.0]], [[0.0, 49.0], [49.0, -7.0]], [[35.0, -14.0], [21.0, 0.0]], [[-35.0, 14.0], [35.0, -7.0]], [[7.0, -42.0], [49.0, 35.0]]]) |
29768 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29769 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
29770 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29771 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29772 | def test_generalTensorProduct_array_rank1_Symbol_rank4_offset1(self): | def test_generalTensorProduct_array_rank1_Symbol_rank4_offset1(self): |
29773 | arg0=numarray.array([0.67072802523959729, 0.59461710689684333, -0.16300700133972379]) | arg0=numarray.array([-3.0, -6.0, 4.0]) |
29774 | arg1=Symbol(shape=(3, 6, 2, 2)) | arg1=Symbol(shape=(3, 6, 2, 2)) |
29775 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29776 | s1=numarray.array([[[[0.49821714413461771, 0.80260117129412767], [-0.2685890917723317, -0.71656715065610177]], [[0.67394122903184828, -0.14517418062465337], [-0.81135731591198779, -0.38467070393599778]], [[-0.13181904535409261, -0.14043244159422108], [0.65318246231755639, 0.85055397524611576]], [[0.25868965591758908, 0.51066328218361678], [0.84809238904361317, 0.76705402769879205]], [[-0.12740704486405785, -0.70236977382568555], [-0.168964587730285, -0.98844892460350597]], [[-0.49806733863097352, 0.78279804813564513], [0.41669567229466309, -0.30208857559768898]]], [[[-0.71869152579169149, -0.87885492135497922], [0.33985067924909851, -0.20039734809753118]], [[0.52573356595897236, -0.38845082770242856], [0.084116831936275283, 0.73565996928047461]], [[-0.13412399355825033, 0.10177238322584614], [0.98289441645331066, 0.5382233798734064]], [[-0.57089446816259537, -0.53034613162130273], [-0.52586582175554319, -0.52164496435518548]], [[-0.47574911626276029, -0.75126572539751479], [-0.14923656277625552, 0.32918282612656014]], [[-0.8546900413028411, -0.20575588644458942], [-0.35993460099361729, 0.14811324060177355]]], [[[0.99919179315869955, -0.91703684167820243], [0.38520927955450524, 0.77081562040274343]], [[0.24281899809330842, -0.10449645566089116], [0.9525423503592465, 0.35634470582752775]], [[-0.70607945128034144, -0.65904715761561561], [-0.081889162310331498, 0.95174225620630648]], [[-0.98301995159609001, -0.63795520002123141], [-0.7611225240219055, -0.81512912067127719]], [[-0.39858370564805412, -0.44448601105154517], [-0.4704990616544924, -0.64947765146816039]], [[0.14267517123892426, -0.27951838491077852], [-0.4038009311306261, -0.71137402893167945]]]]) | s1=numarray.array([[[[-4.0, -3.0], [1.0, 5.0]], [[4.0, 4.0], [-2.0, -6.0]], [[-1.0, 4.0], [5.0, 5.0]], [[-3.0, 7.0], [0.0, -5.0]], [[-1.0, 0.0], [4.0, 7.0]], [[-1.0, 0.0], [-1.0, 1.0]]], [[[0.0, 5.0], [7.0, 0.0]], [[-7.0, 0.0], [4.0, 0.0]], [[-3.0, -2.0], [5.0, 3.0]], [[3.0, -2.0], [1.0, -6.0]], [[6.0, 0.0], [-2.0, -2.0]], [[4.0, -3.0], [-6.0, 1.0]]], [[[-7.0, 0.0], [-7.0, 0.0]], [[3.0, -2.0], [3.0, 0.0]], [[-7.0, 4.0], [-4.0, 7.0]], [[-2.0, 4.0], [-5.0, 7.0]], [[-1.0, 1.0], [7.0, -7.0]], [[2.0, -5.0], [4.0, 4.0]]]]) |
29777 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29778 | ref=numarray.array([[[-0.25605333255767082, 0.16522835363896238], [-0.040861013001742261, -0.72542970413435581]], [[0.72506024491765741, -0.31131824493834132], [-0.64945385519922505, 0.12133989903462757]], [[-0.053071254933571066, 0.073752926750072278], [1.0359021241583499, 0.73538656594858898]], [[-0.0057140803719399891, 0.13115445652734165], [0.38021882006867547, 0.33717736738361359]], [[-0.30337210408361037, -0.84536021173374554], [-0.12537325629155027, -0.36137325113502028]], [[-0.86553809395862225, 0.44826207280638397], [0.13128857321098306, 0.0014103401487729206]]]) | ref=numarray.array([[[-16.0, -21.0], [-73.0, -15.0]], [[42.0, -20.0], [-6.0, 18.0]], [[-7.0, 16.0], [-61.0, -5.0]], [[-17.0, 7.0], [-26.0, 79.0]], [[-37.0, 4.0], [28.0, -37.0]], [[-13.0, -2.0], [55.0, 7.0]]]) |
29779 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29780 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
29781 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29782 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29783 | def test_generalTensorProduct_array_rank0_Symbol_rank4_offset0(self): | def test_generalTensorProduct_array_rank0_Symbol_rank4_offset0(self): |
29784 | arg0=numarray.array(-0.400251875744) | arg0=numarray.array(0.0) |
29785 | arg1=Symbol(shape=(3, 2, 3, 4)) | arg1=Symbol(shape=(3, 2, 3, 4)) |
29786 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29787 | s1=numarray.array([[[[-0.22197379460122835, -0.10398529612468255, 0.059085870828096798, -0.017020343031995955], [0.14794601501598792, -0.37637653830071294, -0.080078380627205181, 0.75906007920591634], [-0.84380727698036684, -0.18871835732459563, 0.55510187324873805, 0.45065510434797451]], [[0.38813306746694654, -0.92749223673246739, -0.69012284027771775, 0.91009148738457446], [0.34231741346424971, 0.71945900893965464, 0.63636166211955958, -0.26713803142744941], [-0.47881479842994445, 0.46198399733436202, 0.52143954006095505, -0.087831548652862912]]], [[[-0.049482141878419705, 0.020405158789798872, -0.83890927247519254, 0.49583829636983268], [-0.25613180995076035, -0.79931270295807133, -0.43883411017454255, 0.73382185566986968], [-0.67910496127373299, -0.82638174316309976, -0.46368660790294269, -0.059914211794997341]], [[0.75389399630623366, 0.27288699324460652, -0.90093152494903528, 0.34740945300647708], [-0.030591423029421971, 0.015320153615452359, 0.79899710335876839, 0.054552176701410771], [-0.031661857391701576, -0.7171520089613348, -0.18398512942605239, 0.21148092032953492]]], [[[0.13482430473744555, -0.72854703723588199, -0.69388277527948605, -0.66260185041589281], [-0.83733354172273988, -0.59474295465065108, -0.90619106544835804, -0.71436982067592547], [-0.27260558132720769, -0.50066883889989855, -0.46238560157498787, 0.56476116340530247]], [[0.43038927632611834, 0.025885145824974698, 0.60281390710033378, -0.17385516645046395], [0.16214980639303644, 0.97610905254347702, 0.57091119642593968, -0.400630520972733], [0.34644307872452762, 0.98092242059827872, 0.24847789255006858, -0.72936194577577429]]]]) | s1=numarray.array([[[[5.0, -5.0, 2.0, 1.0], [-6.0, 4.0, -3.0, -7.0], [-1.0, 0.0, -1.0, 4.0]], [[0.0, 1.0, -2.0, 6.0], [4.0, 4.0, -7.0, 3.0], [4.0, 0.0, 1.0, -3.0]]], [[[6.0, 7.0, 3.0, -1.0], [-3.0, 5.0, -4.0, 2.0], [6.0, -1.0, -3.0, -7.0]], [[7.0, 0.0, 2.0, 0.0], [-2.0, 1.0, -5.0, 5.0], [-3.0, -4.0, -1.0, -4.0]]], [[[-4.0, 6.0, 5.0, -1.0], [2.0, -2.0, 6.0, 0.0], [2.0, -1.0, 0.0, -6.0]], [[-4.0, -7.0, -6.0, -5.0], [1.0, -3.0, -7.0, 7.0], [-3.0, -5.0, 4.0, 6.0]]]]) |
29788 | sub=res.substitute({arg1:s1}) | sub=res.substitute({arg1:s1}) |
29789 | ref=numarray.array([[[[0.088845427655083728, 0.041620309823666088, -0.023649230628894458, 0.0068124242243572343], [-0.059215670018951637, 0.15064541544077292, 0.032051522052555147, -0.30381522050431342], [0.33773544537755779, 0.075534876506435228, -0.22218056599663724, -0.1803755508287401]], [[-0.1553509882917932, 0.3712305074898703, 0.2762229613147118, -0.36426582492403053], [-0.13701318683879041, -0.28796481784878497, -0.2547049489147189, 0.10692249816131044], [0.19164652120541675, -0.1849099614966411, -0.20870715399631842, 0.035154742097780564]]], [[[0.019805320102652329, -0.0081672030804646138, 0.33577500988696074, -0.19846020818757565], [0.10251723737041529, 0.319926408664718, 0.17564417573766886, -0.29371357419357247], [0.27181303457665001, 0.3307608427813617, 0.18559143457037655, 0.023980775654651731]], [[-0.30174748613346808, -0.10922353091220637, 0.36059953277746432, -0.13905128521692789], [0.012244274449194518, -0.0061319202212661095, -0.31980008933311305, -0.021834611050640274], [0.012672717810557418, 0.28704143678012184, 0.073640393161720982, -0.084645635045895853]]], [[[-0.053963680866999944, 0.29160231822116156, 0.27772788235184387, 0.26520763350019361], [0.33514432069762456, 0.23804698318426079, 0.36270467372786813, 0.28592786070021464], [0.10911089526441087, 0.20039364189609415, 0.18507070434725822, -0.22604671500015461]], [[-0.17226411514949336, -0.010360578170344779, -0.24127739704128434, 0.069585856479527697], [-0.0649007641602872, -0.39068947921091185, -0.22850827725255021, 0.16035311749950365], [-0.13866449209790715, -0.39261603880349089, -0.099453742574001233, 0.29192848689281303]]]]) | ref=numarray.array([[[[0.0, -0.0, 0.0, 0.0], [-0.0, 0.0, -0.0, -0.0], [-0.0, 0.0, -0.0, 0.0]], [[0.0, 0.0, -0.0, 0.0], [0.0, 0.0, -0.0, 0.0], [0.0, 0.0, 0.0, -0.0]]], [[[0.0, 0.0, 0.0, -0.0], [-0.0, 0.0, -0.0, 0.0], [0.0, -0.0, -0.0, -0.0]], [[0.0, 0.0, 0.0, 0.0], [-0.0, 0.0, -0.0, 0.0], [-0.0, -0.0, -0.0, -0.0]]], [[[-0.0, 0.0, 0.0, -0.0], [0.0, -0.0, 0.0, 0.0], [0.0, -0.0, 0.0, -0.0]], [[-0.0, -0.0, -0.0, -0.0], [0.0, -0.0, -0.0, 0.0], [-0.0, -0.0, 0.0, 0.0]]]]) |
29790 | self.failUnless(isinstance(res,Symbol),"wrong type of result.") | self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
29791 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
29792 | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29793 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29794 | def test_generalTensorProduct_array_rank0_constData_rank0_offset0(self): | def test_generalTensorProduct_array_rank0_constData_rank0_offset0(self): |
29795 | arg0=numarray.array(0.276030930635) | arg0=numarray.array(3.0) |
29796 | arg1=Data(0.525251086603,self.functionspace) | arg1=Data(-6.0,self.functionspace) |
29797 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29798 | ref=Data(0.14498554625225879,self.functionspace) | ref=Data(-18.0,self.functionspace) |
29799 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29800 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29801 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29802 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29803 | def test_generalTensorProduct_array_rank1_constData_rank1_offset1(self): | def test_generalTensorProduct_array_rank1_constData_rank1_offset1(self): |
29804 | arg0=numarray.array([0.65548645255509275, 0.37351981102482612, 0.66146316938990646]) | arg0=numarray.array([-4.0, -7.0, -5.0]) |
29805 | arg1=Data(numarray.array([0.35738251475002025, 0.75375267320042005, -0.61347308966363956]),self.functionspace) | arg1=Data(numarray.array([-1.0, -3.0, 4.0]),self.functionspace) |
29806 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29807 | ref=Data(0.11001109862765807,self.functionspace) | ref=Data(5.0,self.functionspace) |
29808 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29809 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29810 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29811 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29812 | def test_generalTensorProduct_array_rank2_constData_rank2_offset2(self): | def test_generalTensorProduct_array_rank2_constData_rank2_offset2(self): |
29813 | arg0=numarray.array([[-0.088883398927412705, 0.36597586224843726, 0.74959282604165689], [-0.718337701269115, 0.33607066789476403, 0.59912096183685004]]) | arg0=numarray.array([[2.0, 5.0, 3.0], [-3.0, -2.0, 0.0]]) |
29814 | arg1=Data(numarray.array([[0.87315550347073834, -0.79911382372503281, 0.79698915770889056], [0.15146867556573818, -0.66249741709046073, 0.63805916366214133]]),self.functionspace) | arg1=Data(numarray.array([[3.0, 5.0, -1.0], [3.0, 7.0, 3.0]]),self.functionspace) |
29815 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29816 | ref=Data(0.27817496562025817,self.functionspace) | ref=Data(5.0,self.functionspace) |
29817 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29818 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29819 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29820 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29821 | def test_generalTensorProduct_array_rank3_constData_rank3_offset3(self): | def test_generalTensorProduct_array_rank3_constData_rank3_offset3(self): |
29822 | arg0=numarray.array([[[0.20153302766859094, -0.35116008004588184, 0.61696012433723024], [-0.05050693882863988, 0.17570848078988477, 0.013076273091135571], [0.54811545087018798, -0.42637441096587958, -0.91509586562792244], [-0.41703211918250305, -0.87458651401154675, -0.62989316067326073]], [[-0.71145712499219438, 0.51640319295618808, -0.12182181241786361], [0.49157866232808334, -0.58888312538001397, -0.98499655751430581], [-0.26482063804407496, -0.1466661401594116, 0.92787635744693953], [0.95426503021711473, 0.067265994082578828, 0.93571655790151809]]]) | arg0=numarray.array([[[5.0, -7.0, 6.0], [4.0, -4.0, -2.0], [-2.0, 3.0, -7.0], [1.0, -7.0, 7.0]], [[6.0, -2.0, -6.0], [6.0, -4.0, -1.0], [5.0, 2.0, -6.0], [1.0, -2.0, 2.0]]]) |
29823 | arg1=Data(numarray.array([[[0.083191577418960216, -0.13267380908779791, -0.31670651125183591], [0.9166435728700093, 0.24487144548334538, -0.74832471275995438], [0.45797771718162483, -0.31279505052245482, 0.56265825341334263], [0.049587341838397192, 0.54572386172700593, -0.591555012574563]], [[0.44597368905115276, 0.49570325682287963, 0.52033626676325362], [0.68429154349511578, 0.52206119042946031, 0.28696799887961721], [-0.63491171842396965, 0.004967136652360038, -0.27973878578647238], [0.42734667668017412, 0.24291755554837136, -0.029733817555185338]]]),self.functionspace) | arg1=Data(numarray.array([[[5.0, -6.0, 4.0], [-4.0, -4.0, -7.0], [-3.0, -6.0, -6.0], [0.0, 4.0, 6.0]], [[-1.0, 1.0, 1.0], [3.0, 2.0, -7.0], [-1.0, -6.0, -2.0], [-4.0, -2.0, 1.0]]]),self.functionspace) |
29824 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
29825 | ref=Data(-0.47517867398842628,self.functionspace) | ref=Data(149.0,self.functionspace) |
29826 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29827 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29828 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29829 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29830 | def test_generalTensorProduct_array_rank4_constData_rank4_offset4(self): | def test_generalTensorProduct_array_rank4_constData_rank4_offset4(self): |
29831 | arg0=numarray.array([[[[0.19606611084966263, -0.57209293064277844], [-0.91377015519165106, -0.47965416825477725], [0.51485687228874144, 0.67502333423066507]], [[-0.76214296278296612, 0.42849950905965351], [-0.49718152947669325, 0.54073334578167409], [0.17217128360555489, -0.66245225909123451]]], [[[-0.28535614441819601, 0.85992886810876312], [-0.3213074749318201, -0.42641881450285668], [-0.92216566064416483, -0.34139385499820341]], [[-0.52182995244734465, -0.90889392707604855], [-0.14249809236581235, 0.69591411936717362], [-0.16624564353948501, 0.35208457246133285]]], [[[0.1216281235985992, -0.81813485876810765], [-0.52879636746006531, -0.58187557546012547], [0.17248644658489098, -0.73232107870650198]], [[-0.1812890888821197, -0.76142628835072901], [0.479650948229281, -0.39383250923388169], [-0.33843160474005596, 0.0072349045599295891]]], [[[0.52484917029162292, 0.78567887353182542], [0.73580273137643371, -0.031129059645950585], [0.093085161075552314, 0.95974042816664906]], [[-0.0042247192709699011, -0.50307277029470732], [0.444377708951877, -0.64356695364233896], [-0.13286936695674534, -0.05066623610144938]]]]) | arg0=numarray.array([[[[-7.0, 6.0], [4.0, -1.0], [-6.0, 3.0]], [[1.0, -7.0], [-1.0, 3.0], [-7.0, -1.0]]], [[[4.0, -6.0], [4.0, 6.0], [6.0, 1.0]], [[3.0, -4.0], [-3.0, 6.0], [0.0, -7.0]]], [[[0.0, 7.0], [1.0, -4.0], [-6.0, -6.0]], [[-6.0, -1.0], [6.0, 0.0], [-7.0, -6.0]]], [[[-7.0, -3.0], [-5.0, 0.0], [0.0, 3.0]], [[3.0, 0.0], [0.0, -1.0], [0.0, -4.0]]]]) |
29832 | arg1=Data(numarray.array([[[[-0.84558794158576056, 0.61527033930440034], [0.3300136532175415, 0.5046018054928294], [0.42254055880201125, -0.71873864169112323]], [[-0.41746039598975671, -0.58155491346085508], [-0.4813844311354738, 0.18592613876929676], [0.53196416475296071, -0.26252843037889284]]], [[[-0.92314660674941784, -0.79235729537482924], [-0.86399177081949974, 0.25356797810273535], [-0.18129818928386343, 0.15861633373894635]], [[-0.44908184547489838, -0.08178109500798203], [-0.10699307061693131, 0.78887274022102449], [-0.23064213944708545, 0.87519484904768596]]], [[[-0.12010238048508115, -0.61521787096104763], [-0.16162015905453231, -0.41322167296921308], [0.96103403207348626, -0.81427566071653334]], [[-0.099513083940893976, 0.16603620159907706], [-0.40862285561102119, 0.34826516787038209], [-0.42677499726753076, -0.58137530337764143]]], [[[0.70399993629948465, 0.34036547607039669], [-0.50794955273895703, 0.41846445655739406], [0.128196254038766, -0.38060413423278394]], [[-0.44402887336181052, -0.025572509319359948], [0.16890980895514462, 0.72622285390064367], [0.72494568508485191, 0.70969468805643099]]]]),self.functionspace) | arg1=Data(numarray.array([[[[-4.0, 4.0], [-3.0, 3.0], [5.0, 1.0]], [[-3.0, 0.0], [0.0, 5.0], [-7.0, -7.0]]], [[[5.0, -6.0], [-6.0, 1.0], [-3.0, -7.0]], [[-6.0, 3.0], [5.0, -4.0], [-4.0, -3.0]]], [[[4.0, 5.0], [7.0, -5.0], [7.0, 5.0]], [[0.0, -2.0], [-1.0, 4.0], [-2.0, -5.0]]], [[[2.0, 3.0], [6.0, 0.0], [-7.0, 2.0]], [[0.0, -4.0], [5.0, 1.0], [-6.0, 7.0]]]]),self.functionspace) |
29833 | res=generalTensorProduct(arg0,arg1,4) | res=generalTensorProduct(arg0,arg1,axis_offset=4) |
29834 | ref=Data(1.0916478580238695,self.functionspace) | ref=Data(-3.0,self.functionspace) |
29835 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29836 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29837 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29838 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29839 | def test_generalTensorProduct_array_rank0_constData_rank1_offset0(self): | def test_generalTensorProduct_array_rank0_constData_rank1_offset0(self): |
29840 | arg0=numarray.array(-0.259974017677) | arg0=numarray.array(-5.0) |
29841 | arg1=Data(numarray.array([-0.044411300170266399, -0.8714302585888849]),self.functionspace) | arg1=Data(numarray.array([-2.0, 2.0]),self.functionspace) |
29842 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29843 | ref=Data(numarray.array([0.011545784135536585, 0.22654922545091835]),self.functionspace) | ref=Data(numarray.array([10.0, -10.0]),self.functionspace) |
29844 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29845 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29846 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29847 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29848 | def test_generalTensorProduct_array_rank1_constData_rank2_offset1(self): | def test_generalTensorProduct_array_rank1_constData_rank2_offset1(self): |
29849 | arg0=numarray.array([0.25002746419177746, 0.56003262174718937, -0.38411653061655926]) | arg0=numarray.array([4.0, 3.0, 1.0]) |
29850 | arg1=Data(numarray.array([[-0.25220197912710396, -0.51956798157298234], [-0.92297279746096805, -0.36259445263568946], [-0.45338691929511876, -0.038077564179096912]]),self.functionspace) | arg1=Data(numarray.array([[-1.0, 0.0], [-2.0, 1.0], [0.0, 1.0]]),self.functionspace) |
29851 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29852 | ref=Data(numarray.array([-0.40579888640212991, -0.31834476500168113]),self.functionspace) | ref=Data(numarray.array([-10.0, 4.0]),self.functionspace) |
29853 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29854 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29855 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29856 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29857 | def test_generalTensorProduct_array_rank2_constData_rank3_offset2(self): | def test_generalTensorProduct_array_rank2_constData_rank3_offset2(self): |
29858 | arg0=numarray.array([[0.80780440839221423, -0.29207184993427804, 0.47539604196932705], [-0.32342927832232093, 0.36904363909067373, 0.17617657281137911]]) | arg0=numarray.array([[-3.0, 1.0, 3.0], [-3.0, 4.0, 7.0]]) |
29859 | arg1=Data(numarray.array([[[0.74769328224227594, -0.32948341167934925], [0.75317506354554919, 0.78253366336224439], [-0.74366133755081543, 0.35163398761741416]], [[-0.57198519061406028, 0.37619672855306896], [0.82869637346523017, 0.53243348061751039], [-0.83147507703100421, -0.14754680843174905]]]),self.functionspace) | arg1=Data(numarray.array([[[1.0, 7.0], [-6.0, -3.0], [2.0, 2.0]], [[-4.0, -2.0], [0.0, 0.0], [-6.0, 5.0]]]),self.functionspace) |
29860 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29861 | ref=Data(numarray.array([0.37481049227597868, -0.27872493940663351]),self.functionspace) | ref=Data(numarray.array([-33.0, 23.0]),self.functionspace) |
29862 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29863 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29864 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29865 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29866 | def test_generalTensorProduct_array_rank3_constData_rank4_offset3(self): | def test_generalTensorProduct_array_rank3_constData_rank4_offset3(self): |
29867 | arg0=numarray.array([[[-0.24110012719903873, -0.18767619263315161, -0.0023263200028647013], [-0.16745303525596622, -0.081208880408232043, 0.76180141657215583], [0.22392874424529996, -0.90664253147371476, 0.95586755866967299], [-0.77004766332563279, -0.72194418968870044, -0.41632757437658507]], [[0.38522645465910199, -0.13216896105274212, -0.55066562058746626], [0.74643262667383459, -0.73519018574612116, -0.1666972069940782], [-0.12167653683237334, 0.63633427501506423, 0.36224201095372277], [0.94315180298726076, -0.52860157184070178, 0.63695906002259473]]]) | arg0=numarray.array([[[6.0, 5.0, 1.0], [-2.0, 5.0, 1.0], [0.0, -4.0, -6.0], [-6.0, 2.0, -1.0]], [[-7.0, -5.0, 0.0], [6.0, 6.0, -5.0], [-7.0, -2.0, 7.0], [-2.0, 7.0, 1.0]]]) |
29868 | arg1=Data(numarray.array([[[[-0.10386758710448762, 0.49459681435541136], [-0.57247650577650155, -0.91506181599997216], [0.24131754746756551, 0.32019397726294696]], [[0.14650617363916774, 0.75743908141412408], [-0.52744783814012308, 0.50178758777395371], [-0.7781074949616511, 0.63112146572169614]], [[-0.46518782328154473, -0.20056089250458453], [-0.76360408062036988, -0.64617573279573759], [-0.49403710427308201, 0.69635162430467124]], [[0.68717921862273146, -0.57062955669372273], [-0.44852558485973271, -0.44895330232946962], [-0.16040098753067511, 0.236634091121674]]], [[[-0.91168574887596909, 0.47032605755320178], [-0.88021956487570652, -0.1344789731642575], [0.41736033090124636, -0.29049394722160526]], [[-0.19043893518805333, 0.45666179206782131], [-0.52033102345351812, 0.40490536270689215], [0.36478983733555137, 0.021961012917905309]], [[-0.87459991171516593, 0.22055198755113836], [-0.95421798597476437, 0.64566339556818741], [-0.25283035488290162, 0.45839489280139634]], [[0.75599636361661271, -0.66524871378964723], [-0.58073190678603837, -0.25496267982118814], [-0.41126607738373178, -0.069735987982464609]]]]),self.functionspace) | arg1=Data(numarray.array([[[[7.0, 5.0], [-2.0, 6.0], [6.0, -3.0]], [[0.0, 1.0], [-1.0, 0.0], [-2.0, -4.0]], [[-4.0, -4.0], [-5.0, -2.0], [-7.0, 0.0]], [[1.0, -7.0], [1.0, -6.0], [7.0, -3.0]]], [[[-3.0, -1.0], [-5.0, -1.0], [-5.0, -1.0]], [[-2.0, 0.0], [-7.0, 0.0], [5.0, -5.0]], [[-2.0, -7.0], [2.0, -6.0], [7.0, -4.0]], [[-1.0, -5.0], [3.0, -1.0], [-6.0, 7.0]]]]),self.functionspace) |
29869 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
29870 | ref=Data(numarray.array([-0.58464390506716768, 2.647960905222289]),self.functionspace) | ref=Data(numarray.array([125.0, 172.0]),self.functionspace) |
29871 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29872 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29873 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29874 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29875 | def test_generalTensorProduct_array_rank0_constData_rank2_offset0(self): | def test_generalTensorProduct_array_rank0_constData_rank2_offset0(self): |
29876 | arg0=numarray.array(-0.544185299417) | arg0=numarray.array(3.0) |
29877 | arg1=Data(numarray.array([[-0.98078244900179024, 0.8612932216239495, -0.40578309224856213, 0.47011167948573584, 0.71368417960651587], [0.36095971146134653, -0.082453576134518425, -0.21455791741457064, 0.31298648068387958, 0.98312794572841744], [-0.088915225329776471, -0.97810755656232362, 0.96698295910836785, -0.31739213445418368, -0.90954767450916862], [0.27052720601589275, -0.50384275667463885, 0.72541118412285566, 0.078921147029740846, -0.46753049705881922]]),self.functionspace) | arg1=Data(numarray.array([[6.0, -3.0, -5.0, -3.0, 0.0], [1.0, 6.0, 6.0, 3.0, 0.0], [-6.0, 3.0, 7.0, -5.0, 1.0], [6.0, -1.0, 2.0, 0.0, -2.0]]),self.functionspace) |
29878 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29879 | ref=Data(numarray.array([[0.53372739067249519, -0.46870310969483769, 0.22082119355344024, -0.2558278650601426, -0.38837643896799667], [-0.19642896865888917, 0.044870024016724741, 0.11675926453043051, -0.17032264170427608, -0.53500377551095524], [0.048386358518770684, 0.53227175352941702, -0.52621791113304806, 0.17272013372039449, 0.49496247358636042], [-0.14721692860606994, 0.27418382139982711, -0.39475810243197978, -0.042947728026673772, 0.25442322352830232]]),self.functionspace) | ref=Data(numarray.array([[18.0, -9.0, -15.0, -9.0, 0.0], [3.0, 18.0, 18.0, 9.0, 0.0], [-18.0, 9.0, 21.0, -15.0, 3.0], [18.0, -3.0, 6.0, 0.0, -6.0]]),self.functionspace) |
29880 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29881 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29882 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29883 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29884 | def test_generalTensorProduct_array_rank1_constData_rank3_offset1(self): | def test_generalTensorProduct_array_rank1_constData_rank3_offset1(self): |
29885 | arg0=numarray.array([0.80321090298129461, 0.75733336332953161, -0.43955933605807429]) | arg0=numarray.array([-6.0, 0.0, -1.0]) |
29886 | arg1=Data(numarray.array([[[0.78879034368954803, -0.96360675680855756, -0.84472039581731684, 0.09269639329379209, -0.88687967608738894], [0.79891982880015688, 0.82615559491626334, 0.43870962789013146, -0.25776922865703966, 0.67159680941934141], [0.15766345982285435, 0.94565467500035094, -0.8168137099869337, -0.65770921213262823, -0.45484089804148842], [0.30783009097762659, -0.74026449285791296, 0.50469441556734496, -0.62387506102580259, 0.55606803499423529]], [[-0.69476518669236187, 0.096269932704859063, 0.840466296413374, 0.28100748815042675, 0.89485512724460081], [-0.49494734703497656, 0.32846002879809877, -0.47440701189166701, 0.72065242250436712, -0.16056243259888681], [-0.15293388856941381, -0.18054680962975578, -0.53864585972941614, -0.49240229154519533, -0.66400626488214631], [-0.94437636064801156, -0.69962040250207069, 0.059472100896275526, -0.7258679313156231, 0.67604426321411459]], [[0.064574213796787738, -0.5203881815066389, -0.49359998905171554, -0.25143418573699838, 0.78064423023386498], [0.14841764339904073, -0.83705000950241049, -0.306281157712468, 0.73238623711186346, -0.19822909711796322], [0.6673079453890467, -0.24900668833512962, 0.54201352219333332, 0.96799468027414459, -0.87287769856111841], [-0.47388722998885946, -0.94423009160263582, -0.22079035169225558, -0.7919366924753577, -0.56314753453910193]]]),self.functionspace) | arg1=Data(numarray.array([[[-7.0, 6.0, -2.0, -4.0, -7.0], [1.0, 1.0, -1.0, -7.0, 7.0], [5.0, -4.0, -4.0, 0.0, -3.0], [5.0, -2.0, -4.0, 0.0, -2.0]], [[2.0, -7.0, 0.0, 3.0, -1.0], [1.0, -7.0, -4.0, 6.0, -2.0], [-4.0, 7.0, 5.0, 1.0, 0.0], [7.0, -1.0, -5.0, 7.0, 6.0]], [[-3.0, -5.0, 4.0, -1.0, 6.0], [5.0, -3.0, -7.0, -1.0, -4.0], [7.0, 2.0, 7.0, 3.0, -5.0], [5.0, -6.0, 6.0, 5.0, -3.0]]]),self.functionspace) |
29887 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29888 | ref=Data(numarray.array([[0.079011950112823109, -0.47232953777667286, 0.17499101860255675, 0.39779134362721968, -0.37778724179624451], [0.20162261730742118, 1.2802640661490039, 0.12772084079238172, 0.016803859893432249, 0.50496804294514286], [-0.28250636368735516, 0.7322792374388043, -1.3022552621083121, -1.3266829927123065, -0.48452572464437749], [-0.25965368393920485, -0.70938923208333882, 0.54746672385139006, -0.7027240861258599, 1.2061675405110834]]),self.functionspace) | ref=Data(numarray.array([[45.0, -31.0, 8.0, 25.0, 36.0], [-11.0, -3.0, 13.0, 43.0, -38.0], [-37.0, 22.0, 17.0, -3.0, 23.0], [-35.0, 18.0, 18.0, -5.0, 15.0]]),self.functionspace) |
29889 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29890 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29891 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29892 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29893 | def test_generalTensorProduct_array_rank2_constData_rank4_offset2(self): | def test_generalTensorProduct_array_rank2_constData_rank4_offset2(self): |
29894 | arg0=numarray.array([[-0.11565043696176636, -0.25516973814347077, -0.54480447818461442], [0.68830407667880444, -0.30647666874713475, -0.013222647666291332]]) | arg0=numarray.array([[-2.0, 0.0, 0.0], [6.0, 3.0, 0.0]]) |
29895 | arg1=Data(numarray.array([[[[-0.33446284196041032, -0.92363008646930722, 0.88230430807039961, 0.051649702155052601, -0.23592181457866568], [0.5104971278349808, 0.43729394737044691, 0.74147148905349103, 0.679887233437517, -0.37964722697630826], [-0.64163119845483507, 0.95243799257993, -0.16694744160255892, 0.39604762563365425, -0.88007651506299212], [-0.0037020293161897921, -0.1880764388967513, -0.94277606167241479, -0.21767848564536085, 0.86977286446058022]], [[-0.73501155027385368, -0.3663203593692046, 0.82214899285811827, 0.27689196615328382, 0.54518051623971897], [0.019286576294491153, -0.25146027753347844, 0.83568832160044115, 0.3106642413049252, 0.47505190873515324], [-0.39292161117350854, -0.43719499734442269, 0.99190052560446107, 0.85336334151266713, 0.63343006213304576], [0.50340344988815167, -0.84122407791744069, 0.86751806824640409, 0.90579274672227883, -0.9621102266168795]], [[0.62326775177626104, 0.12008759026684923, 0.069631861735134581, 0.97900205683156449, -0.89083965983886837], [-0.69668647900055825, -0.74950149073381267, 0.2675896848146746, -0.51872180189847761, -0.94953751629793781], [0.28091433991839621, -0.27113159959604527, -0.011931951002468466, 0.53630770624257829, 0.35087185995834824], [-0.44314547583921393, 0.94373890147914818, -0.73493654942927988, 0.31550405206769172, 0.26665247900793876]]], [[[0.59710385642002928, -0.12803887338848163, -0.26402126307209817, -0.29285538855288817, -0.9064713920873344], [-0.52544425912004522, 0.94038667193528358, -0.26726556609141006, 0.95974674726009668, 0.55320788782618457], [0.12637911941808322, 0.30456684761940678, 0.35529275308681108, 0.65517009603341125, -0.40606428176396325], [0.62521639928593564, -0.18755646596338837, 0.11061943165104826, 0.28533153784040355, 0.57006195458453957]], [[0.26493418753075915, 0.87833071304902588, -0.28298919539362388, -0.50222990586325378, -0.040632910187410776], [0.85031249695503019, -0.54277990316861335, -0.39245923661963866, 0.93823378468563878, 0.45872698390685795], [0.40659927131778484, -0.67382992392399799, 0.72293711733828392, -0.00022653513814963055, -0.96594616937093059], [-0.78774281559253456, -0.28763697021436418, 0.62067361646158936, 0.70164775941175339, 0.48050239096492908]], [[0.60489714316840892, -0.67682837903376747, 0.36440483682611147, 0.42290277667298759, 0.38434238375069252], [-0.53933850671613781, -0.59922409185675152, -0.074875557481751454, -0.77479980947992466, -0.29673585949412118], [-0.30083987286477942, -0.93721644162017936, 0.39522845320463862, -0.37890757332334468, 0.95180902376140253], [-0.93407456650595577, 0.59397835129938792, -0.63282679890401039, -0.43212635295645985, -0.30920570180851015]]]]),self.functionspace) | arg1=Data(numarray.array([[[[1.0, -5.0, -1.0, -5.0, -4.0], [0.0, -4.0, -2.0, 7.0, 2.0], [4.0, 5.0, 0.0, 2.0, -4.0], [1.0, -2.0, 1.0, -5.0, 0.0]], [[-1.0, -1.0, 4.0, 6.0, -1.0], [-7.0, 4.0, 2.0, -4.0, 1.0], [-3.0, 1.0, -3.0, -1.0, -6.0], [1.0, -4.0, 4.0, 0.0, 0.0]], [[0.0, 1.0, 1.0, -7.0, 6.0], [-7.0, -1.0, 3.0, 3.0, 3.0], [3.0, -6.0, 0.0, 6.0, 6.0], [7.0, 0.0, 2.0, 7.0, 6.0]]], [[[-3.0, -2.0, -5.0, -7.0, 0.0], [0.0, -3.0, 1.0, -1.0, 0.0], [-3.0, -5.0, 2.0, 4.0, -1.0], [-7.0, 3.0, 5.0, -1.0, -5.0]], [[-2.0, 0.0, 4.0, -3.0, 0.0], [-3.0, -6.0, 0.0, -7.0, -3.0], [4.0, -6.0, 4.0, 4.0, 2.0], [-5.0, 4.0, -4.0, -1.0, -6.0]], [[0.0, 1.0, -5.0, -7.0, 4.0], [3.0, -3.0, -2.0, -4.0, 2.0], [-1.0, -3.0, 4.0, -3.0, 2.0], [2.0, 1.0, 3.0, 0.0, -2.0]]]]),self.functionspace) |
29896 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29897 | ref=Data(numarray.array([[0.20846894590466161, -0.21350025001741069, -0.44957789465373454, -0.66323616957152021, -0.24305261213454371], [-0.29953753690788193, 1.2434682712086529, -0.5074682566220704, 0.50799633064472838, 0.68410954788752487], [-0.012224784713239064, 0.57766300862504949, -0.20953474812807624, -0.099702584310622941, -0.24704868185486306], [0.79751718381823189, -0.32654295589095927, 0.1823502976995823, -0.39077425918854786, 0.24884005131956072]]),self.functionspace) | ref=Data(numarray.array([[-26.0, -2.0, -16.0, -41.0, 8.0], [-9.0, -28.0, 10.0, -41.0, -13.0], [-14.0, -58.0, 24.0, 32.0, 8.0], [-59.0, 34.0, 16.0, 1.0, -48.0]]),self.functionspace) |
29898 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29899 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
29900 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29901 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29902 | def test_generalTensorProduct_array_rank0_constData_rank3_offset0(self): | def test_generalTensorProduct_array_rank0_constData_rank3_offset0(self): |
29903 | arg0=numarray.array(0.729161045519) | arg0=numarray.array(0.0) |
29904 | arg1=Data(numarray.array([[[0.78719542466743553, 0.85234295949470962], [0.032104578750040469, -0.096502278551340526]], [[0.50764567626009982, -0.96185965444300359], [-0.70501450359437245, -0.10132955328153126]], [[-0.098014097359040653, -0.62284231841207283], [0.1461389597728926, 0.26782573714588076]], [[0.14730407961037217, -0.98677718952359195], [0.87529773002735833, -0.95658399969991681]], [[0.016469832836842668, 0.18102407337026372], [-0.96921997530625692, 0.36289790352438445]], [[0.84420760731995115, -0.82125974198117713], [0.65036851244544325, 0.36285009148825909]]]),self.functionspace) | arg1=Data(numarray.array([[[0.0, -1.0], [-3.0, -1.0]], [[5.0, 2.0], [-4.0, 6.0]], [[-5.0, 4.0], [0.0, 7.0]], [[-2.0, -2.0], [5.0, 6.0]], [[0.0, 5.0], [1.0, -6.0]], [[-1.0, -3.0], [4.0, 7.0]]]),self.functionspace) |
29905 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29906 | ref=Data(numarray.array([[[0.57399223887856909, 0.62149528348623362], [0.023409408207338351, -0.070365702323496607]], [[0.37015545205520034, -0.70135059127655719], [-0.5140691125471899, -0.073885563012771702]], [[-0.071468061705955072, -0.45415235608705329], [0.10655883669911503, 0.1952880945142855]], [[0.10740839669796699, -0.71951948720768455], [0.63823300796747695, -0.69750378934828883]], [[0.012009160530841397, 0.13199570260283602], [-0.70671745053256507, 0.26461101475062643]], [[0.61556330158881856, -0.59883061210596045], [0.47422338450759466, 0.26457615207637686]]]),self.functionspace) | ref=Data(numarray.array([[[0.0, -0.0], [-0.0, -0.0]], [[0.0, 0.0], [-0.0, 0.0]], [[-0.0, 0.0], [0.0, 0.0]], [[-0.0, -0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, -0.0]], [[-0.0, -0.0], [0.0, 0.0]]]),self.functionspace) |
29907 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29908 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
29909 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29910 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29911 | def test_generalTensorProduct_array_rank1_constData_rank4_offset1(self): | def test_generalTensorProduct_array_rank1_constData_rank4_offset1(self): |
29912 | arg0=numarray.array([0.094563644000015712, -0.40340577007888978, 0.37726109420617804]) | arg0=numarray.array([-2.0, 0.0, 1.0]) |
29913 | arg1=Data(numarray.array([[[[0.52449117797578659, -0.03086789820496838], [0.72570865973216425, -0.13543779489257046]], [[-0.89695118409168506, 0.79734696922266357], [0.22829213541540572, 0.90054010866700551]], [[-0.71596739611373761, -0.53162155555951718], [0.49237680321488253, -0.06317598151523085]], [[0.071880420235407305, 0.71774717019061041], [0.75001622324878681, 0.97946643306530001]], [[0.28594511097352382, 0.73873074829495167], [0.8977634773163321, 0.68508955799222271]], [[0.27209850366205202, 0.33717685000667652], [0.0082416426035361035, 0.3967960145540661]]], [[[-0.16146967042462879, 0.68172064478711825], [0.15474410825306673, -0.098125172279253325]], [[-0.37227015838659416, -0.79802890461166176], [-0.88581970642908892, -0.25082943693023929]], [[-0.89724165678961332, 0.2649908483519805], [-0.34656675884808252, -0.61942744507352399]], [[0.54869740807191691, -0.29205289135149659], [0.50705660033365318, -0.16284580162474138]], [[0.12910234770898432, -0.034040965132912548], [-0.87819921235137355, -0.98840803021110291]], [[0.21126303819558889, -0.93376861633183461], [0.18709519470671587, -0.46152886596377307]]], [[[0.13783755981776658, 0.068615740197387698], [0.26784700445533405, 0.68335128305684067]], [[0.96758007764405951, 0.75300911337638987], [-0.7056423401530143, -0.8805732619896891]], [[0.2247290198120071, 0.79305270266743566], [0.44992426858646883, 0.81832617635379923]], [[0.90106460974855263, -0.69437719254417174], [0.030768346999636709, 0.50095539564394653]], [[0.26969627168110932, -0.34462639139242168], [-0.96896154396936418, -0.96178212370333616]], [[0.40550249449244569, 0.96839729629400972], [-0.79417057858038054, 0.73121170834781246]]]]),self.functionspace) | arg1=Data(numarray.array([[[[0.0, 6.0], [5.0, 2.0]], [[-2.0, 2.0], [3.0, 0.0]], [[-2.0, 1.0], [4.0, -6.0]], [[-5.0, 5.0], [-6.0, 4.0]], [[-2.0, -5.0], [5.0, 2.0]], [[-2.0, 2.0], [-7.0, 0.0]]], [[[-1.0, -4.0], [-4.0, -2.0]], [[3.0, -6.0], [-7.0, 4.0]], [[-6.0, -3.0], [-6.0, -3.0]], [[5.0, -2.0], [4.0, -5.0]], [[4.0, -6.0], [7.0, 6.0]], [[-7.0, -4.0], [-4.0, 5.0]]], [[[3.0, -2.0], [-3.0, 0.0]], [[4.0, 4.0], [-4.0, 1.0]], [[-4.0, -3.0], [0.0, 2.0]], [[6.0, -3.0], [0.0, -6.0]], [[-1.0, 2.0], [5.0, -3.0]], [[6.0, 7.0], [6.0, 4.0]]]]),self.functionspace) |
29914 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29915 | ref=Data(numarray.array([[[0.16673634241684321, -0.25204297339927473], [0.10724924317230783, 0.28457862204028717]], [[0.43038727628759221, 0.68141054181174454], [0.11272151568017424, -0.14586163593991391]], [[0.37902949145651482, 0.14201702160552981], [0.3561068968467791, 0.55262908317131842]], [[0.12538619465037187, -0.076272890027687806], [-0.1220175909456483, 0.3473058318040193]], [[0.07670529023885185, -0.046424736261731325], [0.073614923084848072, 0.10067109127331092]], [[0.093486212196292551, 0.77391094298210361], [-0.37430558280317422, 0.4995636138363328]]]),self.functionspace) | ref=Data(numarray.array([[[3.0, -14.0], [-13.0, -4.0]], [[8.0, 0.0], [-10.0, 1.0]], [[0.0, -5.0], [-8.0, 14.0]], [[16.0, -13.0], [12.0, -14.0]], [[3.0, 12.0], [-5.0, -7.0]], [[10.0, 3.0], [20.0, 4.0]]]),self.functionspace) |
29916 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29917 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
29918 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29919 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29920 | def test_generalTensorProduct_array_rank0_constData_rank4_offset0(self): | def test_generalTensorProduct_array_rank0_constData_rank4_offset0(self): |
29921 | arg0=numarray.array(0.170303473899) | arg0=numarray.array(5.0) |
29922 | arg1=Data(numarray.array([[[[0.16299614924257644, -0.30845749390788568, -0.29566630182680487, -0.80474190718593475], [0.2691016779449793, 0.43343326414717098, 0.86610946466404282, 0.81037943192221773], [-0.48333691021318304, -0.93480833528417273, 0.64644802086374153, 0.42800956590349348]], [[0.27107237158946917, -0.71924977764247067, 0.72958046337734372, -0.72403719104310249], [0.51262790161186866, -0.22953137082167485, 0.051206987484119448, 0.76489736035255773], [-0.32139134156416738, -0.88271154058596157, -0.96827294084859949, 0.46828011189819208]]], [[[0.87325381066079522, 0.63526408153623026, 0.29502896569193537, -0.41121828371592239], [0.87735333166929808, 0.44805437770807965, 0.42715426653695743, -0.45014923033183574], [0.11122058746477959, 0.088540294825875998, 0.39149149869779998, -0.046853466676531896]], [[-0.40441908731245513, -0.3433187459279825, 0.30970231829985795, -0.80645845620245682], [0.38256980770787696, 0.34446182387752167, 0.37387781617472959, -0.97420202442236437], [-0.59495769997476544, 0.73108455992733701, -0.20589021086236658, -0.46280286594007647]]], [[[0.87429316932515166, -0.018918611841412858, -0.55004861432449981, -0.27876119151367029], [0.50604470531747281, 0.72284043538395015, 0.80737913912957571, 0.13914446576183637], [0.44080224562244452, 0.77483530802879219, -0.1424378513885598, 0.66516119595599488]], [[0.063231228478993318, 0.097353731085751738, -0.91350557376842412, 0.86784298996285969], [0.78632995224149438, 0.84541641731413542, -0.79676254907989241, 0.66234153400905438], [0.65361805846747334, 0.62813428609632793, 0.093673501161051886, 0.88227414180589481]]]]),self.functionspace) | arg1=Data(numarray.array([[[[0.0, -3.0, -4.0, -5.0], [7.0, 4.0, 4.0, -2.0], [-6.0, 1.0, 6.0, 3.0]], [[2.0, 0.0, 6.0, 7.0], [3.0, 7.0, -1.0, -2.0], [6.0, 5.0, 3.0, 5.0]]], [[[-2.0, 1.0, 4.0, 1.0], [6.0, -6.0, -1.0, -4.0], [1.0, 3.0, 7.0, 7.0]], [[7.0, -6.0, 0.0, 5.0], [-1.0, -7.0, 3.0, -3.0], [-1.0, 1.0, 2.0, -3.0]]], [[[3.0, -4.0, 6.0, -2.0], [4.0, -2.0, 5.0, 6.0], [4.0, -3.0, -2.0, 1.0]], [[1.0, 0.0, -2.0, -4.0], [0.0, -7.0, -6.0, 5.0], [7.0, 7.0, -2.0, 2.0]]]]),self.functionspace) |
29923 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29924 | ref=Data(numarray.array([[[[0.027758810448241404, -0.052531382762826505, -0.050352998316103507, -0.13705034238622077], [0.045828950586196737, 0.073815190587834312, 0.14750145060946576, 0.13801043243300376], [-0.082313954873123998, -0.15920110692904169, 0.11009234364850912, 0.072891515935553777]], [[0.046164566559844904, -0.12249073573390838, 0.12425008740232059, -0.12330604886702869], [0.087302312462278611, -0.039089989819830466, 0.0087207278564703922, 0.13026467764454797], [-0.054734061949577334, -0.15032884181291067, -0.16490024550933788, 0.0797497298142779]]], [[[0.14871815755145223, 0.10818767992915346, 0.050244457758293594, -0.07003190224778473], [0.14941632022052398, 0.076305217019535188, 0.072745855482208702, -0.076661977698668199], [0.018941252414387832, 0.015078719788926784, 0.06667236223033117, -0.0079793081392447607]], [[-0.068873975480549715, -0.058468375086332659, 0.05274338068117413, -0.13734267664685312], [0.065152967261689995, 0.058663045232077021, 0.063672690908490537, -0.16590998903899012], [-0.10132336312891989, 0.12450624026986459, -0.035063818151748055, -0.078816935800209167]]], [[[0.14889516394261959, -0.0032219053179475821, -0.093675189833032413, -0.047473999303123536], [0.086181171263981116, 0.12310223722086623, 0.13749947214770136, 0.02369678589312162], [0.075070153732173975, 0.13195714465724148, -0.024257660906243084, 0.11327926237440823]], [[0.010768497868901401, 0.016579678600974861, -0.15557317263925852, 0.14779667598994684], [0.13391472249790271, 0.14397735276021106, -0.13569142998127415, 0.11279906414962222], [0.11131342596041423, 0.10697345099754574, 0.015952922660049822, 0.15025435128118594]]]]),self.functionspace) | ref=Data(numarray.array([[[[0.0, -15.0, -20.0, -25.0], [35.0, 20.0, 20.0, -10.0], [-30.0, 5.0, 30.0, 15.0]], [[10.0, 0.0, 30.0, 35.0], [15.0, 35.0, -5.0, -10.0], [30.0, 25.0, 15.0, 25.0]]], [[[-10.0, 5.0, 20.0, 5.0], [30.0, -30.0, -5.0, -20.0], [5.0, 15.0, 35.0, 35.0]], [[35.0, -30.0, 0.0, 25.0], [-5.0, -35.0, 15.0, -15.0], [-5.0, 5.0, 10.0, -15.0]]], [[[15.0, -20.0, 30.0, -10.0], [20.0, -10.0, 25.0, 30.0], [20.0, -15.0, -10.0, 5.0]], [[5.0, 0.0, -10.0, -20.0], [0.0, -35.0, -30.0, 25.0], [35.0, 35.0, -10.0, 10.0]]]]),self.functionspace) |
29925 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29926 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
29927 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29928 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29929 | def test_generalTensorProduct_array_rank0_expandedData_rank0_offset0(self): | def test_generalTensorProduct_array_rank0_expandedData_rank0_offset0(self): |
29930 | arg0=numarray.array(-0.501038685672) | arg0=numarray.array(5.0) |
29931 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29932 | arg1=msk_arg1*(-0.37497860758)+(1.-msk_arg1)*(0.886271009021) | arg1=msk_arg1*(1.0)+(1-msk_arg1)*(6.0) |
29933 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29934 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29935 | ref=msk_ref*numarray.array(0.18787878869669156)+(1.-msk_ref)*numarray.array(-0.44405606150884158) | ref=msk_ref*numarray.array(5.0)+(1.-msk_ref)*numarray.array(30.0) |
29936 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29937 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29938 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29939 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29940 | def test_generalTensorProduct_array_rank1_expandedData_rank1_offset1(self): | def test_generalTensorProduct_array_rank1_expandedData_rank1_offset1(self): |
29941 | arg0=numarray.array([0.44038262808839268, -0.80364141181592696, -0.35078298317395173]) | arg0=numarray.array([1.0, -7.0, 5.0]) |
29942 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29943 | arg1=msk_arg1*numarray.array([0.71915786866679077, -0.24226928051609842, -0.52239122903446766])+(1.-msk_arg1)*numarray.array([0.80851332796867226, 0.23987618213601136, 0.93431506683977128]) | arg1=msk_arg1*numarray.array([4.0, -2.0, -6.0])+(1.-msk_arg1)*numarray.array([-3.0, -1.0, -2.0]) |
29944 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
29945 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29946 | ref=msk_ref*numarray.array(0.69464821255213227)+(1.-msk_ref)*numarray.array(-0.16446103582788724) | ref=msk_ref*numarray.array(-12.0)+(1.-msk_ref)*numarray.array(-6.0) |
29947 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29948 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29949 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29950 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29951 | def test_generalTensorProduct_array_rank2_expandedData_rank2_offset2(self): | def test_generalTensorProduct_array_rank2_expandedData_rank2_offset2(self): |
29952 | arg0=numarray.array([[-0.70824728644205526, -0.12630675377204637, 0.4347607103368023], [-0.89056712613274125, 0.010820129422368874, -0.90039689321841987]]) | arg0=numarray.array([[-6.0, 0.0, 0.0], [7.0, -3.0, 5.0]]) |
29953 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29954 | arg1=msk_arg1*numarray.array([[0.93739717147838908, -0.77123682199279786, -0.86427598943106121], [-0.91576441578160006, 0.13385047078992351, 0.76249883166202981]])+(1.-msk_arg1)*numarray.array([[-0.39496786944253803, 0.66327871398525273, 0.18532728600071824], [0.6362315985772391, -0.77080221962759832, 0.94099837319284996]]) | arg1=msk_arg1*numarray.array([[-7.0, 2.0, 6.0], [7.0, 1.0, 2.0]])+(1.-msk_arg1)*numarray.array([[-6.0, 7.0, -6.0], [-7.0, -2.0, 0.0]]) |
29955 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
29956 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29957 | ref=msk_ref*numarray.array(-0.8118034424514643)+(1.-msk_ref)*numarray.array(-1.1456877747602543) | ref=msk_ref*numarray.array(98.0)+(1.-msk_ref)*numarray.array(-7.0) |
29958 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29959 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29960 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29961 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29962 | def test_generalTensorProduct_array_rank3_expandedData_rank3_offset3(self): | def test_generalTensorProduct_array_rank3_expandedData_rank3_offset3(self): |
29963 | arg0=numarray.array([[[0.63350363851439639, 0.012863304921566288, -0.46484188959811634], [-0.44497572695987198, 0.7313619267681537, -0.7824611232916332], [-0.93700843427874925, -0.44281317878576698, -0.053511743398166445], [-0.21279837170704141, -0.71697082293404168, 0.91122771589265805]], [[-0.15825541058242831, 0.44839519324233112, 0.93358871086947182], [-0.37114035164923109, 0.78805681132652072, -0.8138475994924752], [0.52088536280998121, -0.77960719617666063, 0.54954337829857813], [-0.46568975258154666, -0.54470171069547657, 0.58430452780377817]]]) | arg0=numarray.array([[[-5.0, 1.0, -7.0], [5.0, 1.0, -5.0], [7.0, -5.0, -4.0], [-7.0, 0.0, -7.0]], [[2.0, -1.0, 7.0], [2.0, -6.0, -2.0], [-3.0, -7.0, 4.0], [-6.0, 0.0, 6.0]]]) |
29964 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29965 | arg1=msk_arg1*numarray.array([[[-0.40379817428308384, 0.60389726258914656, 0.43953608931572186], [0.4838417639649768, 0.97973014911472811, 0.38509984207315728], [-0.33557566738890166, 0.74565707877513576, -0.42293605603757567], [0.93428852170931109, 0.20392914562930908, -0.19015381696316624]], [[-0.28771663480511722, -0.11363849155085948, 0.15885662403426482], [-0.61281402347548886, -0.19979936417795652, 0.18520201905341604], [-0.26478689551969237, -0.26876353904713635, -0.42756925441662252], [-0.10336812618250768, -0.62661268118795377, -0.50758733772388442]]])+(1.-msk_arg1)*numarray.array([[[-0.67885234584521226, -0.2383304710343972, -0.95102911225053433], [-0.77162854554669535, -0.18252965123420073, -0.057560358501999254], [-0.28069888586616965, -0.60672292004101647, -0.37769655089940013], [-0.59269449422648113, -0.27619032325379833, 0.013919747588113873]], [[-0.038406445356485186, -0.62545888435942398, -0.34531503961876164], [0.83724853491667051, 0.61060148536269532, 0.33308338973850815], [0.42834232810198802, -0.24493617999638184, 0.75888014236571077], [-0.84795287270528363, 0.62773712077388999, 0.27063716628400281]]]) | arg1=msk_arg1*numarray.array([[[-6.0, 2.0, -2.0], [-5.0, 4.0, 7.0], [1.0, -1.0, 1.0], [2.0, 6.0, -6.0]], [[-7.0, -5.0, -4.0], [0.0, -6.0, 3.0], [-5.0, 3.0, -4.0], [7.0, 3.0, -6.0]]])+(1.-msk_arg1)*numarray.array([[[-2.0, 6.0, -1.0], [7.0, 1.0, -5.0], [7.0, -1.0, 3.0], [2.0, -6.0, -2.0]], [[5.0, -1.0, -3.0], [-5.0, -3.0, 1.0], [5.0, 4.0, 2.0], [-7.0, 1.0, -2.0]]]) |
29966 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
29967 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29968 | ref=msk_ref*numarray.array(-0.77220523654832762)+(1.-msk_ref)*numarray.array(1.497391405841505) | ref=msk_ref*numarray.array(-81.0)+(1.-msk_ref)*numarray.array(117.0) |
29969 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29970 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29971 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29972 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29973 | def test_generalTensorProduct_array_rank4_expandedData_rank4_offset4(self): | def test_generalTensorProduct_array_rank4_expandedData_rank4_offset4(self): |
29974 | arg0=numarray.array([[[[0.66692221453488321, 0.70236643546384081], [0.78031380564159125, 0.51817208183024732], [-0.73155397777526199, 0.41333534504253611]], [[-0.050532058185003947, 0.61603390263605085], [0.1468977566735139, 0.92574095795931521], [-0.2111592868010268, 0.96299120541748384]]], [[[-0.37394494763727648, -0.014102034485046877], [-0.10581395189470788, 0.80096492843200551], [0.89288408725661816, -0.34044229611468313]], [[0.47426149830902542, 0.39436501306897065], [-0.14167997130606569, -0.62207238623596672], [-0.37185543809384591, -0.060608338166359799]]], [[[0.26383584038706931, 0.050438879214178556], [0.75974254183593204, 0.64834976706573566], [-0.87058844559025128, -0.51116367530358953]], [[-0.23990103772999727, -0.15064442054769689], [0.21915152648611569, 0.91076111295643902], [-0.86736114625524463, 0.15192583520059211]]], [[[-0.19437893616374713, -0.34856783741186081], [0.64470469827147725, -0.28657566195229722], [0.040736307101837843, -0.81189918724736865]], [[-0.43138598569616682, 0.6569786694570392], [-0.88548264551389533, 0.22424181301194968], [0.49028931081399829, 0.12533075955312345]]]]) | arg0=numarray.array([[[[7.0, -1.0], [-7.0, 3.0], [5.0, 4.0]], [[-4.0, 6.0], [-2.0, -4.0], [1.0, -1.0]]], [[[1.0, 0.0], [3.0, -3.0], [0.0, 6.0]], [[6.0, -7.0], [-1.0, 7.0], [7.0, 2.0]]], [[[0.0, 4.0], [-4.0, 5.0], [5.0, -3.0]], [[2.0, -3.0], [0.0, 5.0], [4.0, 4.0]]], [[[-7.0, 7.0], [-5.0, -1.0], [2.0, -6.0]], [[-3.0, -5.0], [-6.0, 3.0], [6.0, -5.0]]]]) |
29975 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29976 | arg1=msk_arg1*numarray.array([[[[-0.46340779133960219, 0.36431041531567199], [0.26951798090514512, -0.39609372305210022], [0.28526948474899316, -0.75551992572189408]], [[-0.54305547329011117, 0.26118735978137364], [0.94607798188040948, -0.50746815991997085], [0.668461028276504, 0.17534199507844028]]], [[[0.69954540197006621, -0.58989378545627336], [-0.77491029045897619, -0.76545382519911498], [-0.25250868270646687, -0.46481158423696556]], [[-0.76607140109887029, 0.55118334352692822], [-0.626460377392007, -0.9811309325713633], [0.3686601252945938, 0.074166702980152044]]], [[[0.60599601425914873, -0.55895950980763032], [-0.73036937902853416, 0.44910078910514262], [0.72914971761458025, 0.29351120043732104]], [[0.26115112507488458, -0.1804659513394633], [-0.46578546574459878, -0.54589922469878194], [-0.2109275840716307, 0.20216313022050536]]], [[[-0.93791559744495201, -0.27942365974895433], [0.98190776398441426, -0.10901959474963396], [0.24203914236980006, 0.083994807064014632]], [[-0.18910747704590225, 0.77000442816012948], [-0.58626375608555215, 0.82046002639811633], [0.38046723009345196, -0.29851908605949395]]]])+(1.-msk_arg1)*numarray.array([[[[-0.063843541440743001, 0.82579210086531196], [-0.75392928943450777, 0.96515854653631816], [0.04513414472199373, -0.58391601323413722]], [[0.51050537414761421, -0.39055883895901622], [-0.035983227726216871, -0.67985051461074297], [-0.46202605176115275, -0.32058592584661327]]], [[[-0.94295560179225624, -0.95635626340976576], [-0.56137374534821216, -0.95428648114901637], [0.90744174531924093, 0.12944161238629848]], [[-0.89864854245762937, -0.57163922613177331], [-0.59408436108929119, -0.69495540700078506], [-0.43417863882441132, -0.47493704913215007]]], [[[-0.52757591056894726, 0.46829257906798505], [0.77931221581068466, 0.83301505980319068], [-0.96930280734831697, 0.10868224224462741]], [[-0.62766844886146278, -0.40104067060462034], [-0.51320226272568847, -0.37356414336340404], [0.97201855282411853, 0.94271809432690068]]], [[[-0.032280060413461653, -0.36020188198684688], [-0.41169336168295434, 0.61931290291263963], [-0.57962639671584393, 0.78323224929846846]], [[-0.66356437187182316, 0.1114302921832302], [0.22662244560360123, -0.36488034809040859], [0.12382732557364684, 0.81246926773550343]]]]) | arg1=msk_arg1*numarray.array([[[[-3.0, 5.0], [-7.0, 0.0], [-5.0, 4.0]], [[6.0, 3.0], [6.0, 4.0], [-3.0, -6.0]]], [[[-4.0, 3.0], [1.0, 1.0], [-2.0, -5.0]], [[5.0, 2.0], [0.0, 6.0], [3.0, -1.0]]], [[[-4.0, -1.0], [7.0, -6.0], [7.0, -1.0]], [[-1.0, 0.0], [-6.0, -3.0], [-6.0, -4.0]]], [[[0.0, 0.0], [-5.0, 5.0], [-3.0, 7.0]], [[6.0, 1.0], [-6.0, -3.0], [-2.0, -2.0]]]])+(1.-msk_arg1)*numarray.array([[[[4.0, -3.0], [3.0, -1.0], [-4.0, -7.0]], [[7.0, -7.0], [2.0, 6.0], [-7.0, 6.0]]], [[[6.0, 0.0], [-1.0, -7.0], [-3.0, -7.0]], [[-7.0, 0.0], [4.0, -4.0], [-6.0, -1.0]]], [[[-6.0, 0.0], [-7.0, 7.0], [-7.0, -6.0]], [[5.0, -5.0], [-7.0, 1.0], [3.0, 0.0]]], [[[-2.0, -5.0], [0.0, 2.0], [7.0, 6.0]], [[4.0, 2.0], [1.0, 3.0], [7.0, -5.0]]]]) |
29977 | res=generalTensorProduct(arg0,arg1,4) | res=generalTensorProduct(arg0,arg1,axis_offset=4) |
29978 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29979 | ref=msk_ref*numarray.array(-0.13645802998092274)+(1.-msk_ref)*numarray.array(-0.3226720375795763) | ref=msk_ref*numarray.array(-81.0)+(1.-msk_ref)*numarray.array(-197.0) |
29980 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29981 | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
29982 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29983 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29984 | def test_generalTensorProduct_array_rank0_expandedData_rank1_offset0(self): | def test_generalTensorProduct_array_rank0_expandedData_rank1_offset0(self): |
29985 | arg0=numarray.array(-0.874708255678) | arg0=numarray.array(-3.0) |
29986 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29987 | arg1=msk_arg1*numarray.array([0.14654086700981339, 0.29310796739100886])+(1.-msk_arg1)*numarray.array([-0.9215158534245409, -0.30896457872014915]) | arg1=msk_arg1*numarray.array([-4.0, 7.0])+(1.-msk_arg1)*numarray.array([0.0, -2.0]) |
29988 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
29989 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29990 | ref=msk_ref*numarray.array([-0.1281805061677056, -0.25638395888193338])+(1.-msk_ref)*numarray.array([0.80605752472866621, 0.27025386771861076]) | ref=msk_ref*numarray.array([12.0, -21.0])+(1.-msk_ref)*numarray.array([-0.0, 6.0]) |
29991 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
29992 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
29993 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
29994 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29995 | def test_generalTensorProduct_array_rank1_expandedData_rank2_offset1(self): | def test_generalTensorProduct_array_rank1_expandedData_rank2_offset1(self): |
29996 | arg0=numarray.array([0.2892485283016033, -0.20014935288134739, 0.087006388727603357]) | arg0=numarray.array([-6.0, -6.0, -4.0]) |
29997 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
29998 | arg1=msk_arg1*numarray.array([[0.98893987430714647, -0.88028128897717206], [0.88844404657015219, -0.28295984513968886], [0.45513009395447646, -0.70192724421712316]])+(1.-msk_arg1)*numarray.array([[0.084565234308185522, 0.82592053483818861], [-0.1001636044559262, 0.73723539179415098], [-0.40814274945400886, 0.97632878400553325]]) | arg1=msk_arg1*numarray.array([[-4.0, 5.0], [7.0, -4.0], [-1.0, 0.0]])+(1.-msk_arg1)*numarray.array([[1.0, 6.0], [6.0, -1.0], [1.0, 5.0]]) |
29999 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
30000 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30001 | ref=msk_ref*numarray.array([0.1478271281060469, -0.25905799210082081])+(1.-msk_ref)*numarray.array([0.0089970234678914754, 0.17628595431432692]) | ref=msk_ref*numarray.array([-14.0, -6.0])+(1.-msk_ref)*numarray.array([-46.0, -50.0]) |
30002 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30003 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
30004 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30005 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30006 | def test_generalTensorProduct_array_rank2_expandedData_rank3_offset2(self): | def test_generalTensorProduct_array_rank2_expandedData_rank3_offset2(self): |
30007 | arg0=numarray.array([[-0.3779633899829653, -0.88393082872430706, -0.31590593488209229], [-0.027735783300006034, 0.18453001551873927, -0.38062223999076217]]) | arg0=numarray.array([[-1.0, -3.0, -5.0], [5.0, -7.0, 5.0]]) |
30008 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30009 | arg1=msk_arg1*numarray.array([[[0.65241925838380443, -0.93810039747206297], [0.20699238934346043, -0.28729202466167036], [-0.73017695169441343, 0.40255584953621404]], [[0.59613475429153584, 0.11806038179459866], [0.26628809400784981, 0.78577158973314765], [-0.30370944851659898, 0.69330371535762203]]])+(1.-msk_arg1)*numarray.array([[[0.83772175836918339, 0.60287463850061318], [-0.18527744936965096, 0.54931735571376561], [-0.37167308309872249, 0.73168804739011128]], [[-0.46383496026335846, -0.39094945287159288], [-0.4114599857806287, -0.83457293926382259], [0.49096479229265522, 0.81391664509909445]]]) | arg1=msk_arg1*numarray.array([[[-3.0, 7.0], [3.0, 0.0], [-2.0, 3.0]], [[-7.0, 0.0], [6.0, -5.0], [3.0, 3.0]]])+(1.-msk_arg1)*numarray.array([[[6.0, -4.0], [0.0, 6.0], [-6.0, -3.0]], [[2.0, -7.0], [-4.0, 3.0], [-4.0, -5.0]]]) |
30010 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
30011 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30012 | ref=msk_ref*numarray.array([-0.050687863928685628, 0.35918123517652517])+(1.-msk_ref)*numarray.array([-0.2853759841192921, -1.3975229289751401]) | ref=msk_ref*numarray.array([-58.0, 28.0])+(1.-msk_ref)*numarray.array([42.0, -80.0]) |
30013 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30014 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
30015 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30016 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30017 | def test_generalTensorProduct_array_rank3_expandedData_rank4_offset3(self): | def test_generalTensorProduct_array_rank3_expandedData_rank4_offset3(self): |
30018 | arg0=numarray.array([[[-0.43001183753684313, -0.67833462383068355, -0.84552602616504191], [-0.58683473152759102, -0.60386885707976745, -0.61327103323861998], [0.61468312546560844, -0.75492434588748036, -0.78818981309419578], [-0.54034954365244792, 0.52022532947355415, -0.57477303982479921]], [[-0.65648081838552241, 0.80790367863986634, -0.03074902541822655], [-0.88980529844214606, 0.091391289713685708, 0.34903087642085073], [-0.54438954610923873, -0.64383004912714759, 0.30601151055436326], [0.38803860206514162, 0.80139910770437583, -0.77980376439441423]]]) | arg0=numarray.array([[[-5.0, 3.0, 6.0], [-2.0, 7.0, -4.0], [0.0, 4.0, 5.0], [0.0, -7.0, -5.0]], [[0.0, -6.0, 3.0], [-1.0, -3.0, 5.0], [-6.0, 0.0, -2.0], [-6.0, -7.0, 6.0]]]) |
30019 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30020 | arg1=msk_arg1*numarray.array([[[[-0.52631928814506224, 0.52114146151519081], [0.92539527175661851, -0.28115407372136247], [0.13068516078127912, -0.21000051854384694]], [[0.88002789810803805, 0.28365158093793186], [0.81529253278395974, 0.44416599290101022], [-0.19322585923808755, -0.0086189852172304793]], [[0.59776010693329362, 0.39550010260117485], [-0.22191964410150256, 0.91173026317810102], [0.80754985806063218, -0.32152153998509747]], [[0.26670484968560548, -0.27662395810407614], [0.18357345701842753, -0.84421981535555868], [0.085582139456202189, 0.13902170637390454]]], [[[-0.13696484377814966, -0.76083195907288292], [0.69804413089398709, -0.4149668879314421], [0.72484293975385339, 0.51710470976854084]], [[0.53872850448765086, 0.58001248605062394], [-0.97359855532336947, 0.34719604209795807], [-0.022826739261370799, 0.81616552372115692]], [[0.5906989436878114, 0.75409887638106921], [0.22312151836905403, -0.012909715589096038], [-0.37827158040829789, 0.36754054624002785]], [[-0.050944348130106398, 0.15249839291881218], [-0.39456849710011177, 0.74654477024305721], [0.11126598640053387, -0.22730210487646541]]]])+(1.-msk_arg1)*numarray.array([[[[-0.95312417667446159, 0.95479440417988259], [0.6437071563109682, 0.42987924404781164], [-0.1499709638358957, 0.43023213230326296]], [[0.93140872857267154, -0.89037057424834876], [-0.11728818817059539, -0.83920015046545027], [-0.10646147420581453, 0.011809961683704628]], [[0.65330829646027699, 0.7347028036831309], [-0.51628909010371493, 0.78489332676857981], [-0.58510280417275307, -0.32208582652772799]], [[0.69176337155418688, -0.41703379415680497], [0.44919833195877223, 0.28016566960863321], [-0.62420723416190027, -0.23459325986858892]]], [[[0.0657887446833334, -0.5078899406539823], [-0.14155361249305343, -0.87099688187411051], [-0.9516783982658148, 0.051991011281497634]], [[-0.3214501297041279, 0.94726305461156812], [0.78684050949034612, -0.51127235557511885], [-0.51139598833539557, 0.6176469440750012]], [[0.54197304987078243, -0.72835240064770468], [-0.63469061263345949, -0.68225774302319264], [-0.72040690925145934, 0.30787449549031676]], [[-0.90305329024928471, 0.11589149416066991], [-0.98976197368375352, 0.2721992361129435], [-0.54406110828611021, 0.5184134839815393]]]]) | arg1=msk_arg1*numarray.array([[[[0.0, -4.0], [-5.0, 6.0], [2.0, 6.0]], [[-6.0, 0.0], [1.0, 6.0], [0.0, -5.0]], [[-2.0, -4.0], [-1.0, -4.0], [-7.0, -6.0]], [[2.0, 2.0], [-3.0, 5.0], [-7.0, -1.0]]], [[[6.0, 6.0], [-2.0, -6.0], [4.0, -5.0]], [[2.0, 5.0], [7.0, -5.0], [0.0, -3.0]], [[2.0, 1.0], [7.0, 4.0], [1.0, 4.0]], [[-2.0, -6.0], [3.0, -1.0], [4.0, 3.0]]]])+(1.-msk_arg1)*numarray.array([[[[5.0, 2.0], [-1.0, -5.0], [3.0, -3.0]], [[6.0, 5.0], [-6.0, 0.0], [6.0, 2.0]], [[3.0, -1.0], [6.0, 4.0], [4.0, 0.0]], [[-7.0, 4.0], [-2.0, -1.0], [-4.0, -2.0]]], [[[-3.0, -6.0], [-3.0, -6.0], [1.0, 4.0]], [[-3.0, -7.0], [-5.0, -5.0], [2.0, 4.0]], [[7.0, -4.0], [-6.0, -4.0], [-2.0, -7.0]], [[-4.0, 7.0], [-6.0, 2.0], [5.0, 1.0]]]]) |
30021 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
30022 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30023 | ref=msk_ref*numarray.array([-2.5499534018495988, -0.3528016548882395])+(1.-msk_ref)*numarray.array([0.38566076603801253, 0.3178879452215792]) | ref=msk_ref*numarray.array([35.0, 123.0])+(1.-msk_ref)*numarray.array([97.0, 50.0]) |
30024 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30025 | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.") |
30026 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30027 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30028 | def test_generalTensorProduct_array_rank0_expandedData_rank2_offset0(self): | def test_generalTensorProduct_array_rank0_expandedData_rank2_offset0(self): |
30029 | arg0=numarray.array(0.246720077242) | arg0=numarray.array(-6.0) |
30030 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30031 | arg1=msk_arg1*numarray.array([[-0.90606308924596823, -0.41069377717229494, 0.52409905991619588, 0.82402330879009367, -0.029874051064125773], [0.075536381703545041, -0.85747704312966011, 0.14046776773330616, 0.74443505055412396, -0.81767919596405192], [-0.79611289784131944, -0.19503473823432049, 0.44762448588483883, -0.45671928577572496, -0.61527798064175143], [0.97183668249216892, 0.47513629707242799, -0.82237067477448278, 0.92125554787705632, -0.99368761422211782]])+(1.-msk_arg1)*numarray.array([[0.71563952655324181, -0.36819307717015937, -0.60098500904966734, 0.24922312481795217, 0.32024626460365546], [0.52397777755136032, 0.012686857024190701, 0.99978450698005839, -0.41594934988402432, -0.21161406541893024], [-0.47691438338475045, 0.58504726934022555, 0.87044255777491752, -0.32328077177959025, 0.17285650560197818], [-0.34784494744696026, 0.61632440573505276, 0.6052446913779741, 0.78601098711335626, -0.49589140523425912]]) | arg1=msk_arg1*numarray.array([[3.0, -3.0, -5.0, 4.0, 3.0], [-3.0, -7.0, 1.0, 0.0, 4.0], [-1.0, 5.0, -3.0, 5.0, 3.0], [-1.0, -3.0, -1.0, 0.0, -7.0]])+(1.-msk_arg1)*numarray.array([[0.0, 4.0, 5.0, -5.0, -6.0], [4.0, 2.0, 0.0, 1.0, 0.0], [5.0, 1.0, 0.0, -6.0, 5.0], [1.0, 0.0, -3.0, -1.0, 3.0]]) |
30032 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
30033 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30034 | ref=msk_ref*numarray.array([[-0.22354395536474614, -0.10132640042669194, 0.12930576054489998, 0.20330309439376909, -0.0073705281860678056], [0.0186363419284678, -0.21155680231405496, 0.034656218505150244, 0.18366707317424708, -0.20173787438729712], [-0.196417035648636, -0.048118985682013747, 0.11043794773284669, -0.1126818174644252, -0.15180143090913673], [0.23977162137092217, 0.11722566391411163, -0.2028953564017851, 0.22729223993170167, -0.24516268493514137]])+(1.-msk_ref)*numarray.array([[0.17656263926853016, -0.090840624439332746, -0.14827506785392228, 0.061488348605538076, 0.079011183139424845], [0.12927583775047968, 0.0031301023449645197, 0.24666691078731567, -0.10262305573207993, -0.05220943856561841], [-0.11766435350643048, 0.14434290748174847, 0.21475565508881309, -0.079759856984262398, 0.042647170413874738], [-0.085820332302298075, 0.15205960498898383, 0.14932601700698783, 0.19392469145354274, -0.12234636580296136]]) | ref=msk_ref*numarray.array([[-18.0, 18.0, 30.0, -24.0, -18.0], [18.0, 42.0, -6.0, -0.0, -24.0], [6.0, -30.0, 18.0, -30.0, -18.0], [6.0, 18.0, 6.0, -0.0, 42.0]])+(1.-msk_ref)*numarray.array([[-0.0, -24.0, -30.0, 30.0, 36.0], [-24.0, -12.0, -0.0, -6.0, -0.0], [-30.0, -6.0, -0.0, 36.0, -30.0], [-6.0, -0.0, 18.0, 6.0, -18.0]]) |
30035 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30036 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
30037 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30038 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30039 | def test_generalTensorProduct_array_rank1_expandedData_rank3_offset1(self): | def test_generalTensorProduct_array_rank1_expandedData_rank3_offset1(self): |
30040 | arg0=numarray.array([-0.45898756380933037, 0.88983535078897669, -0.93601582386512105]) | arg0=numarray.array([6.0, 7.0, 7.0]) |
30041 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30042 | arg1=msk_arg1*numarray.array([[[0.85242562280855316, 0.81174138665070905, -0.34012550800122687, 0.34758312551507897, 0.26793731579633984], [-0.22156781629023947, -0.33053084124743548, -0.9232944731653745, 0.1068871638491351, -0.49779757627283239], [-0.78537035377840958, -0.21886959538687889, 0.52247528432916046, -0.52722844717407402, -0.96038601029480741], [0.029908729932515365, -0.61732773958940257, -0.19929118801933221, -0.27953522474954773, 0.90108371942625731]], [[0.084225678094832279, -0.023714294740967423, 0.21836023456079601, 0.94385311099605307, 0.11021975958514818], [-0.10698176723360175, 0.58192355928131878, 0.71031788640458982, -0.048329163621356308, -0.061722169078396005], [0.38733073278731878, -0.52072790429793914, 0.41516080090406215, 0.33751425915179234, -0.23451160480295163], [-0.31754221530628568, -0.62142882926223897, 0.26735178472188759, 0.605302787951701, 0.45754720795975157]], [[0.36684565227343136, -0.96975721436593609, 0.22078755039429643, -0.79362315968720742, 0.3667120169226652], [-0.94967278938118627, -0.68731033549091536, -0.0051219726794407006, -0.4970685936575685, -0.97365752935427241], [0.93857640099798578, -0.79974261569970606, 0.4713594604980047, 0.28733078923508604, 0.698123283943757], [-0.67384865621491841, -0.79939314063274058, 0.35458508209965145, 0.95301187439504198, -0.97831639629936129]]])+(1.-msk_arg1)*numarray.array([[[0.72714071831087601, -0.069880915555535772, 0.63661806717395186, 0.91652507007398865, 0.43388651012901036], [-0.43994170474778538, 0.50193110150742548, 0.012195024468751647, -0.81011667336280713, 0.35867188021786234], [0.63456002432073988, 0.12686757195357812, -0.31753861162141606, -0.2713929291157926, 0.0062677001459554571], [0.28240715099030056, 0.96490579712169278, -0.80554150665350055, 0.39297250550849117, -0.92586690440310981]], [[0.24093560956733051, 0.73574827125879128, -0.29589772664313663, 0.68855053836914593, -0.50420649671382933], [-0.41570011382358185, -0.11849406919389804, 0.70934019905166501, 0.14959503558013476, 0.55658836091190578], [0.21647538656634957, -0.36103768109385581, -0.087766955544852587, -0.35080045403584581, 0.69133554630830929], [0.24625237634091124, 0.8186658776186384, -0.88284083282306636, -0.81056468701951134, -0.6613670526779627]], [[0.5843108954601135, -0.26934257233015146, 0.42756771750303102, -0.68148742930164796, 0.88067974610692179], [0.077404089928057696, 0.50384458646633989, -0.91409329566927866, 0.92145702282272657, 0.19650029237078437], [0.074281284173659312, -0.31617866194376565, 0.87744747244144938, 0.54492479150563344, 0.51327357845032595], [0.60913616523699399, -0.14723265662421592, -0.30131458551603196, 0.91534161518928614, -0.16136397835280158]]]) | arg1=msk_arg1*numarray.array([[[6.0, -5.0, -7.0, -5.0, 5.0], [2.0, 2.0, 0.0, 0.0, -3.0], [-2.0, 4.0, -4.0, 4.0, -6.0], [-3.0, 0.0, -5.0, -6.0, 4.0]], [[-2.0, 7.0, 6.0, 5.0, 5.0], [-6.0, 0.0, -3.0, 2.0, 5.0], [1.0, 1.0, -2.0, 6.0, 7.0], [-1.0, -6.0, -4.0, 5.0, -2.0]], [[-5.0, -5.0, 5.0, -2.0, 4.0], [0.0, -4.0, -3.0, 0.0, 4.0], [0.0, -6.0, 5.0, 3.0, 4.0], [-5.0, -4.0, -4.0, 1.0, 2.0]]])+(1.-msk_arg1)*numarray.array([[[1.0, 7.0, 7.0, -3.0, 6.0], [3.0, 1.0, 5.0, -5.0, 0.0], [6.0, -5.0, -7.0, 1.0, 4.0], [-1.0, 0.0, 3.0, 5.0, 0.0]], [[3.0, 7.0, -7.0, 4.0, 7.0], [2.0, -5.0, 7.0, -7.0, 1.0], [-2.0, -3.0, 4.0, 1.0, 6.0], [1.0, 6.0, -4.0, 3.0, 5.0]], [[1.0, 0.0, -6.0, -5.0, 3.0], [-5.0, 2.0, 4.0, -1.0, 5.0], [-6.0, -5.0, 7.0, -6.0, -3.0], [-6.0, -1.0, 5.0, -2.0, 4.0]]]) |
30043 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
30044 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30045 | ref=msk_ref*numarray.array([[-0.65967910957264797, 0.51402707867231801, 0.14375739334418389, 1.4231813677681031, -0.3681507080377549], [0.89540947219819222, 1.3128590500190129, 1.0606408940146683, 0.3731991920079154, 1.0849191833313432], [-0.17338655939051062, 0.38566806830619932, -0.31158481475318872, 0.27337725432032672, -0.42132592172218375], [0.33444498147167767, 0.47862104411059431, -0.0025260017320665185, -0.22511118430788257, 0.90927508681257729]])+(1.-msk_ref)*numarray.array([[-0.66627976839463887, 0.93887820197710825, -0.95571018247106188, 0.82990601835371725, -1.4721394552408742], [-0.2404283383314556, -0.80742685080986487, 1.481204409515817, -0.35754992510386352, 0.14671868381582179], [-0.16815616551488571, -0.083546498633702226, -0.75365658472707486, -0.69764689336965802, 0.131865820540083], [-0.48065839010178329, 0.42341017365332678, -0.13381422847539171, -1.7584128416179854, -0.012507151316245857]]) | ref=msk_ref*numarray.array([[-13.0, -16.0, 35.0, -9.0, 93.0], [-30.0, -16.0, -42.0, 14.0, 45.0], [-5.0, -11.0, -3.0, 87.0, 41.0], [-60.0, -70.0, -86.0, 6.0, 24.0]])+(1.-msk_ref)*numarray.array([[34.0, 91.0, -49.0, -25.0, 106.0], [-3.0, -15.0, 107.0, -86.0, 42.0], [-20.0, -86.0, 35.0, -29.0, 45.0], [-41.0, 35.0, 25.0, 37.0, 63.0]]) |
30046 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30047 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
30048 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30049 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30050 | def test_generalTensorProduct_array_rank2_expandedData_rank4_offset2(self): | def test_generalTensorProduct_array_rank2_expandedData_rank4_offset2(self): |
30051 | arg0=numarray.array([[-0.15567837122009331, -0.99458185572550151, -0.33226843547045659], [0.92930130927476728, -0.37142212420915421, -0.96245710875878232]]) | arg0=numarray.array([[-6.0, -2.0, 0.0], [-2.0, 0.0, 0.0]]) |
30052 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30053 | arg1=msk_arg1*numarray.array([[[[-0.35127871779755471, -0.97956450989628086, -0.60744994194165369, -0.038418047339281669, -0.10029756097954978], [-0.6369298408416797, 0.44643445887674393, 0.21964290198361081, 0.92953218811876437, 0.97103733264071934], [-0.0084197182499485823, -0.043538373006895004, 0.6786658762552189, 0.90131480922601503, 0.54793303378730029], [-0.47112100116818256, -0.37272322946487479, -0.18755038677313451, 0.42443008032841334, 0.48097249500434125]], [[0.34855610480392829, 0.33060143769110972, 0.23547431013984288, 0.53782333559518292, -0.079353483176874073], [0.23698099293470309, -0.1667415355358739, -0.20272943860278869, -0.96054949810501178, -0.40383757079019023], [0.020374036923875849, -0.060923575007736153, 0.11376424710596056, -0.58646147084217004, 0.23177634402632163], [0.59762081954918722, 0.86850410144418344, -0.15526430031954841, 0.60439399241076419, 0.2833946544584125]], [[0.85295491254935207, -0.43042679554314067, -0.49819931812536455, 0.094055101122851203, -0.36880858083543644], [0.85797239083026411, -0.76918517380349716, -0.90024063221013351, -0.22339105759424061, -0.046532099466895849], [0.7614283619803015, 0.80185876338157525, 0.82994826285351597, 0.75516258598893016, -0.97670968888752507], [0.75955635097176355, -0.90881364204951831, 0.32602819230807079, 0.083173009841529977, 0.501732633561361]]], [[[0.2650940311750436, -0.0059478044912930628, -0.41191591020874063, -0.12014053171499217, 0.20117563104180558], [-0.85257783450818647, 0.51007282849774804, 0.14245159715060685, -0.63328211292436287, -0.8697637267495868], [-0.0026202687159828653, -0.73209555573520801, -0.76351605990178295, -0.29674919348051088, 0.39078919825820035], [-0.58449899116503756, -0.94379815050822558, 0.81377078572032402, -0.70125898657220076, 0.7117592064496423]], [[-0.93085731079390865, -0.48006211845588509, 0.51975508101155743, 0.8443893547227741, -0.093203952092502762], [-0.73419105384658745, 0.44366335500045739, -0.54432407567258778, 0.034936359584416099, 0.6516213147001535], [0.58736121590976542, 0.83114917192559545, 0.28065847836369651, 0.022859303816783472, 0.859996216145823], [-0.73778138930524029, -0.15574464335337601, 0.75031664084905025, 0.54855170139855747, -0.32672276272079714]], [[-0.16299372657036959, 0.72747842680200403, 0.57758779444496366, -0.1864924392052687, 0.082207658998947553], [0.25507613542080221, 0.8765126238226757, 0.051137225946723097, -0.26589640779286383, -0.3912484901216835], [0.33466537029520227, 0.089808154574321897, -0.58495623444226363, 0.13068829255844583, 0.02863071040379106], [0.88114852531025889, 0.031716523229728733, -0.35560578463881942, -0.037972535794119189, 0.1953933902403584]]]])+(1.-msk_arg1)*numarray.array([[[[-0.5400576969613653, 0.54390449059242485, 0.64252932691754272, -0.67716585248690264, 0.62032550673818077], [0.38686651228491309, 0.70562149983910283, -0.3797375428798222, 0.42131084317286249, -0.23401239469472968], [-0.81222205619556331, -0.31477452773598213, 0.65523992331279235, 0.84485811902262431, 0.85372296262510772], [-0.8153916842378639, 0.90033465417130198, -0.42657592639282749, 0.97028575035532749, -0.27057293549112438]], [[0.052779171139729408, 0.36233793941474812, 0.86944888051629454, -0.17889593274284032, -0.29398276355410724], [0.78490974759228194, -0.79157704322053202, -0.080138009805514665, 0.45356570526421947, -0.034120451956423548], [-0.53448585528819592, -0.77887668081327566, -0.33583358701952992, -0.92924300429544981, 0.55815450679709055], [-0.67832365077414014, 0.58981723503723815, -0.47808607678761939, -0.36774208196354441, 0.56454027091525583]], [[0.30531597496592267, -0.5137220047053348, 0.5399701460049755, 0.62699661456074529, -0.33008771690995675], [0.4038318412213413, 0.71665310930417392, 0.17155433840257439, 0.49938460899411519, 0.76594724141017734], [0.093659296418102445, 0.69852696787255919, 0.97343788252166186, -0.73352088248911596, 0.24457026362353562], [-0.05159937476167098, 0.0089173339495294268, 0.63630412968308092, 0.19929173696907432, -0.6899602289422393]]], [[[-0.041410357421850952, -0.38889962330894945, 0.76265307793920667, -0.6172823784055359, 0.75349588051567595], [0.43340267750760852, 0.90213377312990706, -0.30519183664875094, -0.45301089881026768, -0.25485997032818175], [0.1028116379592845, 0.46583104682036325, 0.23805065016850846, 0.12116867505618378, -0.73215373850345622], [-0.61450129597264058, -0.21160824510167164, 0.2740254445277146, -0.73326188821149674, -0.65848204769696772]], [[0.05465618403094008, 0.73479651092063558, -0.11624751259705235, -0.96407216617836444, -0.71692326121970029], [-0.39937135886439812, 0.95816590731535523, -0.77458905285943214, -0.28840726524892157, 0.41894583661925133], [-0.95805087709319592, 0.39999600705773086, -0.91177445190169304, 0.22938168173475115, -0.95555272902848776], [0.10882185573061198, -0.39229951167354637, -0.3916511170457424, -0.76865359478173878, -0.97727821625370059]], [[0.40999321198896133, -0.88135565882772182, 0.63565529375876584, -0.37317089007892901, 0.555290126540674], [-0.29038581494590576, 0.42164379201880831, -0.44899645286707468, 0.43518447818908657, 0.57581862344993118], [0.742256366774243, 0.20714822805684063, 0.51816577049514523, -0.4792865629173042, -0.68267272302722626], [-0.20661401354081876, -0.044969253011393873, -0.72969509807854416, -0.58480750239810297, -0.94644086867131372]]]]) | arg1=msk_arg1*numarray.array([[[[7.0, 3.0, 7.0, -7.0, 3.0], [-2.0, -2.0, 0.0, -7.0, 2.0], [-2.0, -6.0, 4.0, 2.0, -2.0], [-4.0, 4.0, 3.0, 7.0, -3.0]], [[5.0, 1.0, 0.0, -1.0, 7.0], [5.0, 2.0, 0.0, 4.0, 0.0], [5.0, -7.0, 3.0, 5.0, -4.0], [3.0, -1.0, 7.0, 0.0, -2.0]], [[4.0, -7.0, 3.0, 0.0, 0.0], [3.0, 2.0, 4.0, 3.0, -2.0], [5.0, -2.0, -6.0, 5.0, -4.0], [-4.0, -6.0, 0.0, -7.0, -2.0]]], [[[5.0, 7.0, -2.0, 5.0, 3.0], [7.0, 0.0, 5.0, 1.0, -2.0], [0.0, 7.0, 1.0, 5.0, -4.0], [5.0, 7.0, 0.0, 2.0, 5.0]], [[6.0, 6.0, 4.0, -4.0, -6.0], [-3.0, 0.0, -4.0, 7.0, 4.0], [7.0, 3.0, 0.0, -6.0, -7.0], [6.0, 3.0, 0.0, -7.0, 4.0]], [[-2.0, 2.0, 0.0, 2.0, 0.0], [-4.0, 0.0, 0.0, 2.0, 3.0], [-7.0, -6.0, 1.0, -7.0, -4.0], [7.0, 4.0, 0.0, 0.0, -3.0]]]])+(1.-msk_arg1)*numarray.array([[[[7.0, 7.0, 2.0, -7.0, 0.0], [1.0, -7.0, 0.0, -4.0, 5.0], [-7.0, -3.0, 0.0, 3.0, -3.0], [5.0, -4.0, 7.0, -1.0, 3.0]], [[5.0, 4.0, 5.0, 4.0, 3.0], [2.0, 4.0, -7.0, 1.0, -5.0], [-1.0, -7.0, 5.0, 0.0, -3.0], [-2.0, 1.0, 1.0, 0.0, 6.0]], [[-3.0, 0.0, 7.0, -5.0, -5.0], [3.0, -4.0, 3.0, 5.0, -7.0], [-7.0, -2.0, 7.0, 7.0, -4.0], [0.0, -3.0, 0.0, -7.0, -4.0]]], [[[-3.0, -4.0, 0.0, -7.0, -1.0], [-7.0, 6.0, -7.0, 6.0, 6.0], [7.0, 0.0, 6.0, -3.0, 0.0], [0.0, 4.0, 1.0, 1.0, -2.0]], [[0.0, 0.0, 4.0, 4.0, 7.0], [0.0, -5.0, 2.0, -7.0, 4.0], [-3.0, -4.0, -3.0, 2.0, 7.0], [-1.0, -7.0, -7.0, 7.0, 0.0]], [[-7.0, 5.0, -3.0, 1.0, 3.0], [-6.0, -1.0, -6.0, -5.0, -6.0], [-2.0, 6.0, -3.0, 4.0, 0.0], [0.0, -1.0, -2.0, 6.0, -7.0]]]]) |
30054 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
30055 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30056 | ref=msk_ref*numarray.array([[0.17357662755437517, -0.56068434011508095, -1.1058417604311526, -0.80596068079916849, 0.35953058702351004], [-1.1867246763814974, -0.18246697340244233, 0.75189599198649326, 0.53929069680721775, -0.40779809418743429], [-0.81464652432281048, -1.2745419377179736, -0.74535102121815788, -0.21798971586117438, 0.024891393064954859], [-1.8906310830059134, -1.3535550326000345, 0.89510108868401261, -1.5137078435385907, 0.071286954422171256]])+(1.-msk_ref)*numarray.array([[-0.52324886143927274, -0.060412889488976718, -1.0040605900159618, 0.21861292691146322, 0.73755932643826372], [-0.1444833899391284, 0.51597296627785161, 0.51804280694792126, -1.4153361263447299, -1.1307820248483642], [0.36390967761232795, 0.67652048804950649, -0.030273718808280836, 1.5251054682606959, -0.43773431244205419], [0.40611351058859685, -0.73740522531452113, 1.43290093380566, 0.31540459956650063, 0.37185611346040481]]) | ref=msk_ref*numarray.array([[-62.0, -34.0, -38.0, 34.0, -38.0], [-12.0, 8.0, -10.0, 32.0, -8.0], [2.0, 36.0, -32.0, -32.0, 28.0], [8.0, -36.0, -32.0, -46.0, 12.0]])+(1.-msk_ref)*numarray.array([[-46.0, -42.0, -22.0, 48.0, -4.0], [4.0, 22.0, 28.0, 10.0, -32.0], [30.0, 32.0, -22.0, -12.0, 24.0], [-26.0, 14.0, -46.0, 4.0, -26.0]]) |
30057 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30058 | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.") |
30059 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30060 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30061 | def test_generalTensorProduct_array_rank0_expandedData_rank3_offset0(self): | def test_generalTensorProduct_array_rank0_expandedData_rank3_offset0(self): |
30062 | arg0=numarray.array(0.397935405161) | arg0=numarray.array(-5.0) |
30063 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30064 | arg1=msk_arg1*numarray.array([[[0.64855136176452, 0.2042764526055143], [0.57156517001528928, 0.113069690854112]], [[-0.46322457785304105, -0.58741275123160652], [-0.34660809943833559, -0.070136876600527254]], [[0.93904108736278591, 0.0978246757865604], [0.90358035912154144, 0.58162970040061435]], [[-0.0044565980623507695, 0.37244165415216379], [0.63865927635948805, 0.87488924597310436]], [[0.12941567762514139, 0.18188069069073864], [-0.041115943834846069, -0.96717599327038872]], [[-0.39484846078645952, -0.22972143995780026], [0.80257758473262064, 0.11524735232116123]]])+(1.-msk_arg1)*numarray.array([[[-0.11353099149817547, 0.14689562504283704], [-0.52872914834391271, 0.91405375689433854]], [[-0.091757433519643827, 0.28429622420916467], [-0.84808463946975055, 0.070875029823600944]], [[0.44839088032488283, -0.84297869442304929], [0.23290100156517934, 0.82996096337244207]], [[0.39393350042807462, -0.74292813703585603], [0.9539033621723203, 0.86285011420744029]], [[0.50084397874038711, 0.61907542037323404], [0.41962142966880744, 0.41222973493565696]], [[-0.081781889957842857, 0.64626820347226288], [0.80126051994452197, -0.11848439795557497]]]) | arg1=msk_arg1*numarray.array([[[-5.0, 0.0], [2.0, -6.0]], [[-4.0, 0.0], [-1.0, -5.0]], [[-2.0, 6.0], [-2.0, -4.0]], [[-4.0, 4.0], [-2.0, -6.0]], [[0.0, 3.0], [2.0, -1.0]], [[6.0, 7.0], [-3.0, 7.0]]])+(1.-msk_arg1)*numarray.array([[[7.0, 4.0], [5.0, 5.0]], [[-5.0, -1.0], [-1.0, 2.0]], [[2.0, -2.0], [0.0, 6.0]], [[-5.0, 6.0], [-2.0, 0.0]], [[4.0, 4.0], [0.0, 5.0]], [[-5.0, -3.0], [4.0, 2.0]]]) |
30065 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
30066 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30067 | ref=msk_ref*numarray.array([[[0.25808154891149304, 0.081288832932430458], [0.22744601750595925, 0.044994433241461913]], [[-0.18433346006849058, -0.23375233115809657], [-0.13792763448208387, -0.02790994640675901]], [[0.37367769556255143, 0.038927901993869966], [0.35956661630256714, 0.23145105048259895]], [[-0.0017734381555813534, 0.14820772054388037], [0.25414513789795429, 0.34814940656732324]], [[0.051499080109948102, 0.072376766340984555], [-0.016361489768497058, -0.38487357074406042]], [[-0.15712418222026339, -0.091414294283779299], [0.31937403635372524, 0.045861001839655677]]])+(1.-msk_ref)*numarray.array([[[-0.045178001100158342, 0.058454970067802078], [-0.21040004786667396, 0.36373435208869764]], [[-0.03651353148417448, 0.11313153316642105], [-0.33748290461822955, 0.02820368370865375]], [[0.17843060663258697, -0.33545106830734062], [0.092679554420246113, 0.33027085222744007]], [[0.15676008709934322, -0.29563740921688236], [0.37959192091049787, 0.34335860979036686]], [[0.19930355160251134, 0.24635202823144933], [0.16698222362950177, 0.16404080659103898]], [[-0.032543909515207844, 0.25717299939141702], [0.31884992964364989, -0.047149136905710806]]]) | ref=msk_ref*numarray.array([[[25.0, -0.0], [-10.0, 30.0]], [[20.0, -0.0], [5.0, 25.0]], [[10.0, -30.0], [10.0, 20.0]], [[20.0, -20.0], [10.0, 30.0]], [[-0.0, -15.0], [-10.0, 5.0]], [[-30.0, -35.0], [15.0, -35.0]]])+(1.-msk_ref)*numarray.array([[[-35.0, -20.0], [-25.0, -25.0]], [[25.0, 5.0], [5.0, -10.0]], [[-10.0, 10.0], [-0.0, -30.0]], [[25.0, -30.0], [10.0, -0.0]], [[-20.0, -20.0], [-0.0, -25.0]], [[25.0, 15.0], [-20.0, -10.0]]]) |
30068 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30069 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
30070 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30071 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30072 | def test_generalTensorProduct_array_rank1_expandedData_rank4_offset1(self): | def test_generalTensorProduct_array_rank1_expandedData_rank4_offset1(self): |
30073 | arg0=numarray.array([0.58094125486846315, -0.70531568726399341, 0.33962817234815112]) | arg0=numarray.array([-5.0, -6.0, -3.0]) |
30074 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30075 | arg1=msk_arg1*numarray.array([[[[0.80357271142620523, 0.35558076743542011], [-0.43626897980642543, -0.85549536630258305]], [[-0.26754631653407501, 0.51743370193875693], [0.51753892488071562, 0.572824830754044]], [[0.97802273451540866, -0.74073345776348076], [0.41953325134180197, 0.7159440736068543]], [[-0.49036398122427816, 0.16694033660312968], [-0.89027232449679583, 0.91717194477620434]], [[0.25437986062316043, -0.00032194374216909516], [-0.62727316519705067, 0.96501042929144187]], [[-0.30576117185470064, 0.71147194680507875], [-0.8685379364364334, -0.9799141708690291]]], [[[-0.5383524028113742, 0.93935638517202324], [-0.40058327869371579, 0.169001438718964]], [[0.89779941446224787, -0.59221892360934625], [-0.97768845916725589, -0.081232361131200026]], [[0.49596054779976373, 0.28221056664423583], [0.083800757378065027, 0.28310349410868851]], [[-0.7560893507215658, -0.10090400663602206], [0.25474857558133479, -0.19606517118931222]], [[-0.69278299536328758, -0.35485094837221354], [-0.5456964771558821, 0.20984835862543139]], [[-0.8549814931696289, 0.33794492467712778], [0.36372574439646055, -0.22652827274814791]]], [[[-0.93422963907949774, 0.39846342895261011], [-0.070648900709936679, 0.46837319791630705]], [[0.032549671152720672, 0.96148955261804536], [-0.70687807605514852, 0.81748535012338919]], [[-0.64116199224960324, -0.02727827115942083], [-0.43022179668698768, -0.10802839892530125]], [[-0.67840300363556549, -0.56043397572882103], [-0.87204383998131041, 0.38368378844084194]], [[-0.89762178008906024, -0.51113241729478442], [0.22367035129835267, 0.6899640311800832]], [[0.48373441406902007, -0.10496738262185956], [0.40700201672702718, 0.21849992849304889]]]])+(1.-msk_arg1)*numarray.array([[[[-0.6252940686336419, -0.93451677888993334], [-0.14336387160241482, 0.66170242429170933]], [[-0.075909979796753957, 0.1029834249310142], [0.0019371382625155142, -0.35648770504344762]], [[-0.64392168474876854, 0.86879994937514926], [0.71800682712291364, -0.54147309355287843]], [[-0.26550760514699556, -0.34165457051337755], [-0.9361129944281994, -0.66826907994971707]], [[0.2993232633527716, 0.69894974758462025], [0.15523651580784414, 0.83774155108624115]], [[0.66048860953118727, 0.36808214664022665], [-0.79256479641945399, -0.47391112872752794]]], [[[0.020578229008302973, -0.12657871373282181], [-0.24339439264094431, 0.1049992497018053]], [[-0.66158434727238991, 0.39006901220476586], [0.010907168410064561, 0.87973022625247665]], [[-0.13464073186116621, 0.71767880499566128], [0.72032828223356082, 0.7876183104671588]], [[0.66001431464881066, 0.48557099561277561], [0.69659179969725282, 0.78918487272905424]], [[0.91896245160112944, -0.85352109578245883], [-0.74121612227355405, 0.86130125487461084]], [[0.74853381218847259, 0.9715538622996307], [-0.50918578502972944, -0.58292738572585412]]], [[[-0.85450489940620789, 0.91158194984001839], [0.678538801711281, 0.028877641832678824]], [[0.086414830881134996, 0.7798651220646573], [0.26810304672424934, 0.64519421687674172]], [[0.1071921599369059, -0.20721273450354616], [-0.6286256537829138, -0.90842770005264128]], [[-0.34685350204025611, 0.59014494374069204], [-0.84383192775778637, -0.94621546980649129]], [[-0.47166175955858858, -0.89620995115135282], [0.60116289046449523, 0.19581635274526943]], [[-0.42171845838347832, 0.41656989319770021], [-0.2106968213483944, 0.13888209876526769]]]]) | arg1=msk_arg1*numarray.array([[[[6.0, 0.0], [-5.0, 0.0]], [[6.0, -3.0], [4.0, -4.0]], [[-3.0, 6.0], [0.0, 4.0]], [[-6.0, -4.0], [-7.0, 7.0]], [[7.0, -7.0], [-7.0, 1.0]], [[-4.0, 5.0], [0.0, 0.0]]], [[[0.0, 2.0], [0.0, 2.0]], [[-2.0, 0.0], [-5.0, -1.0]], [[5.0, 5.0], [-7.0, -3.0]], [[-7.0, 0.0], [7.0, -5.0]], [[1.0, -7.0], [5.0, 2.0]], [[-2.0, 4.0], [-3.0, -3.0]]], [[[-6.0, 7.0], [1.0, 6.0]], [[0.0, 5.0], [4.0, -1.0]], [[-6.0, -3.0], [5.0, -1.0]], [[0.0, 5.0], [2.0, -1.0]], [[-3.0, 5.0], [7.0, 2.0]], [[6.0, 0.0], [-5.0, 1.0]]]])+(1.-msk_arg1)*numarray.array([[[[1.0, -2.0], [-6.0, -2.0]], [[-3.0, 0.0], [4.0, 0.0]], [[-4.0, 1.0], [2.0, 3.0]], [[0.0, 2.0], [-4.0, -2.0]], [[2.0, 0.0], [3.0, 4.0]], [[0.0, 7.0], [2.0, -7.0]]], [[[2.0, 2.0], [7.0, 5.0]], [[-2.0, 7.0], [0.0, 3.0]], [[4.0, 7.0], [0.0, 1.0]], [[-3.0, 5.0], [6.0, 4.0]], [[-4.0, 0.0], [4.0, -5.0]], [[-2.0, 6.0], [3.0, -1.0]]], [[[7.0, -1.0], [4.0, 7.0]], [[-6.0, 0.0], [-3.0, 1.0]], [[-1.0, 1.0], [6.0, -3.0]], [[-4.0, 1.0], [0.0, -1.0]], [[1.0, 7.0], [4.0, 4.0]], [[-4.0, -3.0], [-2.0, 7.0]]]]) |
30076 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
30077 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30078 | ref=msk_ref*numarray.array([[[0.52924622945907696, -0.32064185102964965], [0.0050966649028711536, -0.45711918434747367]], [[-0.77760591857525996, 1.0448488207193125], [0.75016301092751858, 0.66771309000119361]], [[0.00060832444521816131, -0.63863463362070383], [0.038502742197060208, 0.17955462533400071]], [[0.018004241202196819, -0.022187459476025323], [-0.99304474361382078, 0.80142068532213695]], [[0.33155282531160718, 0.076499941412134731], [0.096444178707782061, 0.64693625336426197]], [[0.58969241553777563, 0.13931566845859278], [-0.62288164099583243, -0.33528989233766221]]])+(1.-msk_ref)*numarray.array([[[-0.66798720587737304, -0.1440224861847651], [0.31883478894274869, 0.32016027946925457]], [[0.4518754907352947, 0.049569692771371465], [0.084487714309758447, -0.60845981116184855]], [[-0.24271097387915697, -0.071843669067361907], [-0.30443803217179921, -1.1786112478742805]], [[-0.7375639922223034, -0.34053222674852002], [-1.3217328770211167, -1.266210979440948]], [[-0.63445902226276885, 0.70367241396816671], [0.81714650875932926, -0.054305908580975726]], [[-0.28747502780293577, -0.32993920445600089], [-0.17285544183730611, 0.18300157724465718]]]) | ref=msk_ref*numarray.array([[[-12.0, -33.0], [22.0, -30.0]], [[-18.0, 0.0], [-2.0, 29.0]], [[3.0, -51.0], [27.0, 1.0]], [[72.0, 5.0], [-13.0, -2.0]], [[-32.0, 62.0], [-16.0, -23.0]], [[14.0, -49.0], [33.0, 15.0]]])+(1.-msk_ref)*numarray.array([[[-38.0, 1.0], [-24.0, -41.0]], [[45.0, -42.0], [-11.0, -21.0]], [[-1.0, -50.0], [-28.0, -12.0]], [[30.0, -43.0], [-16.0, -11.0]], [[11.0, -21.0], [-51.0, -2.0]], [[24.0, -62.0], [-22.0, 20.0]]]) |
30079 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30080 | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.") |
30081 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30082 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30083 | def test_generalTensorProduct_array_rank0_expandedData_rank4_offset0(self): | def test_generalTensorProduct_array_rank0_expandedData_rank4_offset0(self): |
30084 | arg0=numarray.array(0.230590279322) | arg0=numarray.array(-1.0) |
30085 | msk_arg1=whereNegative(self.functionspace.getX()[0]-0.5) | msk_arg1=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30086 | arg1=msk_arg1*numarray.array([[[[-0.066312470382497768, -0.89062977701329626, 0.71362735820116852, -0.8510953245363897], [0.28293774090969026, 0.25097979621619571, 0.066933085142837356, -0.56967672184500784], [0.1986033484055707, 0.76155575799023101, 0.55852074431443355, -0.71500202987886063]], [[-0.62331344986469928, -0.20106746777405515, 0.55102394367851693, -0.98232334137965815], [-0.67658601924861972, 0.92317739758478545, 0.93351836962236034, -0.20589570828355885], [0.90470062450224575, 0.66723967147848429, -0.033936107455468267, 0.55318521774224605]]], [[[0.60894484824072981, 0.13287283422764329, -0.13321078710786471, -0.82165783919443536], [0.13368845696530918, -0.59334064706858936, 0.11519758697474081, -0.35471586137804523], [0.58688784183441478, 0.56827715360873454, 0.94988912711576612, 0.024453360032851146]], [[-0.45298593929664333, -0.88380857939677937, 0.41042957905037114, -0.5833823328762251], [-0.67171125068743298, 0.39935136685719619, -0.53134853308929642, 0.93408659260593163], [0.1951446842154847, -0.84017953630497177, -0.44662380908267529, -0.65508078680812609]]], [[[0.21054665031300557, -0.16075862406915165, -0.11940924337577585, 0.71458184133956326], [-0.11249420009883448, -0.72194668061515088, 0.43551686843447701, -0.65726238063840325], [0.57020742614208064, -0.78711907270448789, 0.43212511342249726, 0.0013358666819349718]], [[-0.67954467636278171, 0.15950351051049738, -0.89383827696316875, -0.8840920624626798], [-0.95076218521268774, -0.67804964568320436, -0.81092815217985925, -0.54797049686525989], [0.61486303043574275, -0.14290653565480405, 0.69133390362967218, 0.024550324593437756]]]])+(1.-msk_arg1)*numarray.array([[[[0.63494465698856972, -0.48488631109074665, -0.94806337724031264, -0.41820750929885575], [-0.44235661868574261, -0.51810596353317306, 0.51911006914000302, -0.98759912447853693], [0.72870517333516971, -0.91489474875045085, 0.89603074496374435, 0.86497307424604974]], [[-0.035096579189960231, 0.14285616178492155, 0.70734963342151569, -0.62420641584175662], [0.95768549343851794, -0.93878301478876325, -0.50688263601359429, -0.43973229011588288], [-0.42389449784277122, -0.51673090989498061, 0.5661720369298191, -0.16556170575614515]]], [[[0.48334167705674269, -0.60079239828936437, -0.75011328001800304, -0.24713665339883883], [0.82345167794282959, 0.86168709898201046, -0.39365753159365813, 0.56891341758443326], [-0.17891976579371804, -0.28997290343372595, -0.7460995910027961, 0.14226008593460104]], [[-0.16544575140619178, 0.79101784387278862, 0.3373194453076529, 0.67183289286145609], [0.7156256283509812, -0.75593140722953955, -0.15867260258076077, 0.20469527257985543], [0.30181817583862958, 0.058883413713779031, 0.62227232187781278, -0.79758012149488478]]], [[[-0.38962504256609698, -0.047658553830109751, 0.55656226850951573, -0.028622882565748409], [0.64843964854655312, -0.5511453419056811, 0.37189718058596233, 0.50932018272054336], [0.18260360814565457, 0.35757469805554387, 0.37342919652878703, -0.082727729105125158]], [[-0.83731026720650648, 0.61874667386645266, -0.68483960244566688, 0.99026183453543593], [0.196325542135388, 0.92663897567289788, -0.34059772678603073, 0.53975735224831722], [-0.79781723482887945, 0.9180424353548009, 0.87670650811699713, -0.52528550909828664]]]]) | arg1=msk_arg1*numarray.array([[[[-2.0, -3.0, 4.0, -1.0], [7.0, 1.0, -3.0, 1.0], [2.0, -3.0, 0.0, 5.0]], [[3.0, 4.0, 4.0, 1.0], [-7.0, 0.0, 6.0, -6.0], [4.0, -4.0, -2.0, 1.0]]], [[[-7.0, 5.0, 0.0, -5.0], [-5.0, 0.0, 5.0, -5.0], [-4.0, 1.0, -6.0, -1.0]], [[-7.0, -5.0, -3.0, 2.0], [-2.0, 0.0, -7.0, -7.0], [0.0, -6.0, -1.0, 5.0]]], [[[-2.0, 6.0, 5.0, -5.0], [2.0, 4.0, -6.0, -4.0], [-5.0, 4.0, -6.0, 7.0]], [[5.0, 4.0, 4.0, -2.0], [7.0, 3.0, -1.0, -2.0], [-1.0, 6.0, 6.0, 0.0]]]])+(1.-msk_arg1)*numarray.array([[[[-3.0, -7.0, 0.0, -5.0], [4.0, 5.0, -1.0, 5.0], [5.0, 2.0, 7.0, 1.0]], [[7.0, 0.0, -6.0, 6.0], [-5.0, 0.0, 0.0, 5.0], [-5.0, 7.0, -5.0, 1.0]]], [[[0.0, -1.0, 5.0, 5.0], [4.0, 1.0, 5.0, 2.0], [0.0, -2.0, 3.0, 5.0]], [[-5.0, 4.0, 2.0, -4.0], [0.0, 0.0, -2.0, -6.0], [7.0, 6.0, 0.0, 5.0]]], [[[-3.0, 5.0, 0.0, -6.0], [7.0, -2.0, -5.0, -4.0], [-2.0, 7.0, -4.0, -2.0]], [[-4.0, 1.0, 6.0, 0.0], [1.0, 3.0, 7.0, 0.0], [-3.0, -1.0, -2.0, -3.0]]]]) |
30087 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
30088 | msk_ref=whereNegative(self.functionspace.getX()[0]-0.5) | msk_ref=1-whereZero(self.functionspace.getX()[0],1.e-8) |
30089 | ref=msk_ref*numarray.array([[[[-0.015291011068021282, -0.20537056905384243, 0.1645555318593129, -0.19625430861435661], [0.065242692707055364, 0.057873501313630595, 0.015434118798959243, -0.13136191441338946], [0.045796001583092889, 0.17560735495412155, 0.1287894544385062, -0.16487251778544776]], [[-0.1437300225093596, -0.046364203556554073, 0.12706076508585004, -0.22651421367309676], [-0.1560141591637898, 0.21287573397268333, 0.21526026160328704, -0.047477548884273545], [0.20861516970661428, 0.15385898222083524, -0.0078253364972523422, 0.12755913387589637]]], [[[0.14041676264742425, 0.030639183958836566, -0.030717112607884445, -0.18946631064682284], [0.030827258633736185, -0.13681858554054621, 0.026563443757707229, -0.081794029555049885], [0.13533063137918849, 0.13103918758285724, 0.21903519914640157, 0.0056387071203326195]], [[-0.10445415427127822, -0.20379766719014034, 0.094641071275169547, -0.13452229508935432], [-0.15489008491963643, 0.092086543231158738, -0.12252380666230983, 0.21539128829978585], [0.044998467241420523, -0.19373723395705592, -0.10298710888815742, -0.15105526160845531]]], [[[0.048550010905953338, -0.037069376027500059, -0.02753461078362951, 0.16477562639280335], [-0.025940069022876999, -0.16647388673852154, 0.10042595634167831, -0.15155831593914573], [0.13148428966548878, -0.18150200683447412, 0.099643850606074641, 0.00030803787132412233]], [[-0.15669639673416197, 0.03677995904142934, -0.20611041795348764, -0.20386303562948935], [-0.2192365178568349, -0.15635165719216351, -0.18699214912109585, -0.12635666993228672], [0.14178143793284981, -0.032952857973557494, 0.15941487794262285, 0.005661066205442605]]]])+(1.-msk_ref)*numarray.array([[[[0.14641206580890304, -0.11181006991375099, -0.21861419897264894, -0.096434586383713383], [-0.10200313626260925, -0.11947019884942447, 0.11970173584177202, -0.22773075797150866], [0.16803232946262528, -0.21096583566444943, 0.20661597976214455, 0.19945438279626568]], [[-0.008092929998653943, 0.032941242248830764, 0.16310794954886715, -0.14393593178343414], [0.22083296543446027, -0.21647423760273826, -0.11688220862176434, -0.10139799160465301], [-0.097745950660554942, -0.11915312484691117, 0.13055376813986105, -0.038176919975309496]]], [[[0.1114538923204, -0.1385368869359816, -0.17296883076237154, -0.056987309937902554], [0.1898799524248734, 0.19869666884228621, -0.090773600167326968, 0.13118590387073603], [-0.04125715877057131, -0.066864932798547272, -0.17204331309124399, 0.032803792952008359]], [[-0.038150182029365161, 0.18240102556718452, 0.077782585114179195, 0.15491813442252175], [0.16501631353131871, -0.17431043434120974, -0.036588359749820644, 0.047200740080048667], [0.069596337471037259, 0.013577942815683664, 0.14348994851605365, -0.1839142229970511]]], [[[-0.089843747396099391, -0.010989599239759867, 0.12833784895560513, -0.0066001584858320977], [0.14952387968170427, -0.12708875833696101, 0.085755874750321148, 0.11744428319777975], [0.042106617007481972, 0.082453249503049802, 0.086109142734502611, -0.019076210162012171]], [[-0.1930756083941913, 0.14267696835632362, -0.15791735521860295, 0.22834475302728208], [0.045270761599010431, 0.21367394023091554, -0.078538524955973951, 0.12446279862095527], [-0.18396889902696786, 0.21169166159776412, 0.20215999858997175, -0.12112573226668788]]]]) | ref=msk_ref*numarray.array([[[[2.0, 3.0, -4.0, 1.0], [-7.0, -1.0, 3.0, -1.0], [-2.0, 3.0, -0.0, -5.0]], [[-3.0, -4.0, -4.0, -1.0], [7.0, -0.0, -6.0, 6.0], [-4.0, 4.0, 2.0, -1.0]]], [[[7.0, -5.0, -0.0, 5.0], [5.0, -0.0, -5.0, 5.0], [4.0, -1.0, 6.0, 1.0]], [[7.0, 5.0, 3.0, -2.0], [2.0, -0.0, 7.0, 7.0], [-0.0, 6.0, 1.0, -5.0]]], [[[2.0, -6.0, -5.0, 5.0], [-2.0, -4.0, 6.0, 4.0], [5.0, -4.0, 6.0, -7.0]], [[-5.0, -4.0, -4.0, 2.0], [-7.0, -3.0, 1.0, 2.0], [1.0, -6.0, -6.0, -0.0]]]])+(1.-msk_ref)*numarray.array([[[[3.0, 7.0, -0.0, 5.0], [-4.0, -5.0, 1.0, -5.0], [-5.0, -2.0, -7.0, -1.0]], [[-7.0, -0.0, 6.0, -6.0], [5.0, -0.0, -0.0, -5.0], [5.0, -7.0, 5.0, -1.0]]], [[[-0.0, 1.0, -5.0, -5.0], [-4.0, -1.0, -5.0, -2.0], [-0.0, 2.0, -3.0, -5.0]], [[5.0, -4.0, -2.0, 4.0], [-0.0, -0.0, 2.0, 6.0], [-7.0, -6.0, -0.0, -5.0]]], [[[3.0, -5.0, -0.0, 6.0], [-7.0, 2.0, 5.0, 4.0], [2.0, -7.0, 4.0, 2.0]], [[4.0, -1.0, -6.0, -0.0], [-1.0, -3.0, -7.0, -0.0], [3.0, 1.0, 2.0, 3.0]]]]) |
30090 | self.failUnless(isinstance(res,Data),"wrong type of result.") | self.failUnless(isinstance(res,Data),"wrong type of result.") |
30091 | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") | self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.") |
30092 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30093 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30094 | def test_generalTensorProduct_array_rank1_float_rank0_offset0(self): | def test_generalTensorProduct_array_rank1_float_rank0_offset0(self): |
30095 | arg0=numarray.array([-0.27625195823531112, -0.75078696241622422]) | arg0=numarray.array([4.0, -3.0]) |
30096 | arg1=0.427691913345 | arg1=3.0 |
30097 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
30098 | ref=numarray.array([-0.11815072858291316, -0.32110551247013941]) | ref=numarray.array([12.0, -9.0]) |
30099 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30100 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
30101 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30102 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30103 | def test_generalTensorProduct_array_rank1_array_rank0_offset0(self): | def test_generalTensorProduct_array_rank1_array_rank0_offset0(self): |
30104 | arg0=numarray.array([0.53938078068318251, -0.49824063116272055]) | arg0=numarray.array([3.0, 5.0]) |
30105 | arg1=numarray.array(-0.832775572875) | arg1=numarray.array(4.0) |
30106 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
30107 | ref=numarray.array([-0.44918313863132658, 0.41492262704625121]) | ref=numarray.array([12.0, 20.0]) |
30108 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30109 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
30110 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30111 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30112 | def test_generalTensorProduct_array_rank2_array_rank1_offset1(self): | def test_generalTensorProduct_array_rank2_array_rank1_offset1(self): |
30113 | arg0=numarray.array([[0.88539183799797438, -0.40982751242758342, 0.59340415310638051], [0.2778157681814577, -0.15842581033003245, 0.36342429966143941]]) | arg0=numarray.array([[0.0, 3.0, -3.0], [3.0, 5.0, 0.0]]) |
30114 | arg1=numarray.array([0.20672442496420129, -0.34180190599784144, -0.54398285808314895]) | arg1=numarray.array([3.0, 3.0, -1.0]) |
30115 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
30116 | ref=numarray.array([0.00031025625101116505, -0.08611504037333928]) | ref=numarray.array([12.0, 24.0]) |
30117 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30118 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
30119 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30120 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30121 | def test_generalTensorProduct_array_rank3_array_rank2_offset2(self): | def test_generalTensorProduct_array_rank3_array_rank2_offset2(self): |
30122 | arg0=numarray.array([[[0.41240187517243743, 0.80149388213518225, 0.6745878855975842], [-0.98079352271344677, -0.31453045490141163, -0.23603500511791431]], [[0.35323881651995603, 0.18772913395415314, 0.59815792024827741], [-0.79788231528322928, -0.74692529231152172, 0.30335981519358346]]]) | arg0=numarray.array([[[-3.0, -7.0, 5.0], [2.0, -2.0, 0.0]], [[-1.0, 0.0, 0.0], [-6.0, -5.0, -1.0]]]) |
30123 | arg1=numarray.array([[-0.88221591813325406, 0.93087345105456332, 0.10605621958128308], [-0.33744894794646707, -0.50807432404282804, -0.69305432358433916]]) | arg1=numarray.array([[-3.0, -4.0, 0.0], [-1.0, -7.0, -5.0]]) |
30124 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
30125 | ref=numarray.array([1.1081637895104819, 0.36505080704249099]) | ref=numarray.array([49.0, 49.0]) |
30126 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30127 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
30128 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30129 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30130 | def test_generalTensorProduct_array_rank4_array_rank3_offset3(self): | def test_generalTensorProduct_array_rank4_array_rank3_offset3(self): |
30131 | arg0=numarray.array([[[[-0.57169923177964632, 0.30353363141778189, 0.26377102110166706], [0.56413783485466262, -0.76690392370295712, -0.9667075191575647], [-0.66186644532876637, -0.11993329259543017, 0.61828017839465632], [-0.49127889096237021, 0.23976236080820978, 0.42256666962081479]], [[-0.090544527580306511, 0.13413440802242604, -0.1457797722237657], [-0.031536035831397191, 0.58066610576011146, 0.62949072806729101], [-0.22234525084722767, 0.73703517301187871, 0.89236045129088493], [0.78402134351733999, 0.86083626405088864, 0.10499665521946655]]], [[[-0.56604889463766028, -0.56565123509415005, 0.50932781624734358], [0.25808680279858298, 0.017644158605391924, 0.8888513859936682], [-0.64207509069485647, 0.031789934675000353, -0.44571603689781503], [-0.52036437236378696, 0.020123607670690546, -0.74895536700886289]], [[0.01446271912075181, -0.51124159183720974, -0.59399690628094826], [0.99231918980516998, 0.91169617539924164, -0.014796197189341775], [0.41444067023573261, -0.18067184403240177, 0.60913632480383262], [-0.4307741668346976, -0.68664281942059002, -0.48116283104473023]]]]) | arg0=numarray.array([[[[4.0, -5.0, 6.0], [7.0, 5.0, 0.0], [0.0, -5.0, -3.0], [-3.0, -2.0, -2.0]], [[4.0, 1.0, -4.0], [-1.0, -1.0, 0.0], [1.0, 0.0, 6.0], [-5.0, 2.0, -6.0]]], [[[1.0, 2.0, 6.0], [2.0, 7.0, -6.0], [7.0, -6.0, 0.0], [-3.0, 0.0, -6.0]], [[2.0, 1.0, 3.0], [4.0, -4.0, 7.0], [5.0, 0.0, -4.0], [1.0, 0.0, 4.0]]]]) |
30132 | arg1=numarray.array([[[0.35362784529244751, 0.72816504699497409, -0.17615592910788802], [0.16239863539338728, -0.39673750318313439, -0.014115918626133039], [-0.37396256237417758, 0.071779395090337816, 0.10643531664487171], [0.77871767983666884, 0.58389496873888214, -0.85725801390774103]], [[0.71358517268545563, -0.82189444544790136, -0.88778623487270658], [-0.75100881454701196, 0.46903068813805393, -0.011983138755741196], [-0.024651679718989739, 0.36703157575218559, -0.16848622192977247], [0.44186275788820839, 0.85182694343056875, -0.41831469678362354]]]) | arg1=numarray.array([[[-1.0, 7.0, 2.0], [-3.0, -4.0, -6.0], [7.0, -5.0, -5.0], [0.0, -1.0, -4.0]], [[6.0, -3.0, -5.0], [-2.0, 2.0, -1.0], [4.0, -1.0, -7.0], [-4.0, 5.0, -3.0]]]) |
30133 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
30134 | ref=numarray.array([1.4862950482934913, -0.348605050085871]) | ref=numarray.array([33.0, 133.0]) |
30135 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30136 | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2,),"wrong shape of result.") |
30137 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30138 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30139 | def test_generalTensorProduct_array_rank1_array_rank1_offset0(self): | def test_generalTensorProduct_array_rank1_array_rank1_offset0(self): |
30140 | arg0=numarray.array([-0.86119269783132357, 0.70989525090873573]) | arg0=numarray.array([-2.0, 0.0]) |
30141 | arg1=numarray.array([-0.94133810017909458, 0.23299903772206854]) | arg1=numarray.array([-2.0, -1.0]) |
30142 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
30143 | ref=numarray.array([[0.81067349806464717, -0.20065706988797052], [-0.66825144681659099, 0.16540491034520183]]) | ref=numarray.array([[4.0, 2.0], [0.0, 0.0]]) |
30144 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30145 | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") |
30146 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30147 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30148 | def test_generalTensorProduct_array_rank2_array_rank2_offset1(self): | def test_generalTensorProduct_array_rank2_array_rank2_offset1(self): |
30149 | arg0=numarray.array([[-0.55121571333120323, 0.96947139195929588, -0.29668652541182272], [-0.48483467722216389, -0.68798570197690379, 0.086192052612611647]]) | arg0=numarray.array([[-3.0, 4.0, 6.0], [-1.0, 2.0, -1.0]]) |
30150 | arg1=numarray.array([[-0.039211707293509868, 0.727938931848223], [0.37579996279226902, 0.30903452193668368], [0.57623481940432675, -0.35460484107182633]]) | arg1=numarray.array([[-4.0, -1.0], [-6.0, -7.0], [7.0, -7.0]]) |
30151 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
30152 | ref=numarray.array([[0.21498031584282018, 0.0035552287569717012], [-0.18986694388423817, -0.59610548868813584]]) | ref=numarray.array([[30.0, -67.0], [-15.0, -6.0]]) |
30153 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30154 | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") |
30155 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30156 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30157 | def test_generalTensorProduct_array_rank3_array_rank3_offset2(self): | def test_generalTensorProduct_array_rank3_array_rank3_offset2(self): |
30158 | arg0=numarray.array([[[-0.1167849162299901, -0.12587612894959044, -0.93701822746438213], [0.80741578523027324, 0.84714030734228074, 0.29496940505371971]], [[0.90392589500660381, -0.6397391043368359, -0.17587324514101499], [0.82339662710377781, 0.067099746735601595, 0.31459211686975563]]]) | arg0=numarray.array([[[-4.0, 7.0, 7.0], [-7.0, -7.0, -5.0]], [[-6.0, 0.0, -3.0], [-3.0, 4.0, 4.0]]]) |
30159 | arg1=numarray.array([[[-0.8027362920122334, 0.65782392850876259], [0.30355767269824918, 0.68172162124158708], [0.22426878281267215, -0.73047874315358796]], [[0.90693084036385807, 0.12367868713529018], [-0.27543085519071697, -0.83829683025419111], [0.94140892842895818, -0.22220054899303565]]]) | arg1=numarray.array([[[-2.0, 7.0], [2.0, -6.0], [-1.0, 7.0]], [[3.0, 6.0], [7.0, 0.0], [5.0, 0.0]]]) |
30160 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
30161 | ref=numarray.array([[0.62202141735356897, -0.15400176785301534], [0.065187568504999405, 0.26265633877401284]]) | ref=numarray.array([[-80.0, -63.0], [54.0, -81.0]]) |
30162 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30163 | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") |
30164 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30165 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30166 | def test_generalTensorProduct_array_rank4_array_rank4_offset3(self): | def test_generalTensorProduct_array_rank4_array_rank4_offset3(self): |
30167 | arg0=numarray.array([[[[0.14718802616207727, -0.72418403744145765, 0.029787271532923709], [-0.4194914416843798, 0.033539699792270783, -0.41345755052795585], [0.29793467417858288, -0.024086341810864775, 0.20107547406029402], [-0.32926862780565025, -0.087885591522340212, -0.96049633447200877]], [[0.48755603515508228, 0.58360455947452583, 0.96051393888586056], [-0.09339097647682526, -0.7289505467954871, 0.50694871812914433], [-0.23153994242379516, -0.69178924344132864, -0.35010591080392217], [0.76117083899516769, 0.91906409624905328, -0.068145540073345945]]], [[[0.28888775893902707, 0.56072260710203503, 0.3004380109898086], [-0.77690231820952871, -0.19105902948192943, 0.061097601125626344], [0.49902935768302692, -0.2575791504356848, 0.34552364335407915], [-0.76979488857722389, -0.089599824812399254, 0.18209335158166828]], [[-0.0022515113036907231, 0.95159538282261225, -0.53265411615683833], [-0.77182961005442197, 0.25080041087390881, -0.8898487749784727], [-0.78690292782915039, -0.11261393265289898, -0.95298748093132546], [0.52841967991646666, -0.41384006986314237, 0.30463914538153691]]]]) | arg0=numarray.array([[[[-6.0, -2.0, -4.0], [1.0, -5.0, -2.0], [0.0, -3.0, -2.0], [0.0, -5.0, 5.0]], [[-3.0, 0.0, 7.0], [-4.0, 4.0, -7.0], [-1.0, 0.0, 5.0], [0.0, -1.0, 6.0]]], [[[-4.0, 4.0, 4.0], [-4.0, -7.0, 5.0], [3.0, 4.0, 5.0], [0.0, -3.0, 0.0]], [[-7.0, -6.0, -5.0], [-5.0, -6.0, 0.0], [-7.0, -6.0, -7.0], [-4.0, -6.0, -1.0]]]]) |
30168 | arg1=numarray.array([[[[-0.14609311274113113, -0.073722987046462407], [-0.78742135171642258, -0.48291552383766301], [0.81207326183018891, 0.42985929476124451]], [[0.85045298915616385, 0.23020552261700811], [0.88744870021567324, -0.75314953189505118], [0.13110082004798085, 0.10264629590578944]], [[0.56749603335850285, 0.97712891214284459], [0.21204273490462522, 0.13016206253703966], [-0.28810992515358103, 0.22154260349347887]], [[-0.47127258934981042, -0.92833308834208794], [-0.53100947916267249, 0.86920042049278767], [-0.63104371922734082, 0.7329136152644169]]], [[[-0.61161254251146913, 0.54367778091596342], [0.5116880975065683, -0.48461481818601149], [0.080267075199626836, -0.35821005714133203]], [[-0.52631555752873749, 0.9354736941695847], [0.077835296819701805, -0.19328874304048815], [0.95185455107436723, -0.31423264712043197]], [[-0.56560635419659167, -0.60637112174268637], [-0.085211102592329002, 0.79595540543851939], [0.20174594705332338, -0.52497571340199878]], [[0.60148618323817704, 0.3731951934078912], [0.92174719978809905, 0.38607719889902881], [-0.73169489496198992, 0.7088746633475238]]]]) | arg1=numarray.array([[[[-7.0, 0.0], [3.0, -4.0], [7.0, 5.0]], [[7.0, -1.0], [7.0, -4.0], [-7.0, 4.0]], [[-6.0, 1.0], [1.0, 7.0], [1.0, -4.0]], [[-7.0, 3.0], [1.0, -7.0], [7.0, -1.0]]], [[[7.0, -4.0], [-1.0, 3.0], [-6.0, 6.0]], [[-7.0, -2.0], [-5.0, 0.0], [-4.0, 6.0]], [[4.0, 0.0], [-1.0, -1.0], [5.0, 0.0]], [[0.0, -4.0], [0.0, 3.0], [1.0, -6.0]]]]) |
30169 | res=generalTensorProduct(arg0,arg1,3) | res=generalTensorProduct(arg0,arg1,axis_offset=3) |
30170 | ref=numarray.array([[3.1323213977016477, -0.058175766091763288], [-0.6373593664946231, 1.4879611045290597]]) | ref=numarray.array([[19.0, -3.0], [-62.0, 88.0]]) |
30171 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30172 | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2, 2),"wrong shape of result.") |
30173 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30174 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30175 | def test_generalTensorProduct_array_rank1_array_rank2_offset0(self): | def test_generalTensorProduct_array_rank1_array_rank2_offset0(self): |
30176 | arg0=numarray.array([-0.2829757697975257, -0.9280442578646535]) | arg0=numarray.array([0.0, -5.0]) |
30177 | arg1=numarray.array([[0.45705394095659591, 0.64164022405665966, 0.56271284330506521, 0.037291411324969603, -0.033294294288899628], [-0.86552957408790854, -0.38831505443909253, -0.27081057004302544, -0.58214120847120077, 0.26580142569351506], [-0.9404040393213684, -0.51017277509298808, 0.2411135895592369, 0.4822196083653203, 0.81444259978873679], [-0.16124737486506158, -0.54199546950110533, 0.69075909128233892, -0.52795776423665997, 0.47484827191606827]]) | arg1=numarray.array([[-4.0, 0.0, -6.0, -3.0, 0.0], [1.0, 5.0, -4.0, 6.0, 0.0], [7.0, -6.0, 0.0, -4.0, 5.0], [-6.0, 2.0, -6.0, 0.0, -6.0]]) |
30178 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
30179 | ref=numarray.array([[[-0.12933519078118558, -0.18156863633549014, -0.15923410000920529, -0.010552565826519441, 0.0094214785562667363], [0.24492389751005048, 0.1098837514538703, 0.076632829527231883, 0.16473185659799994, -0.075215363048902251], [0.26611155694766686, 0.14436653376167824, -0.06822930361416972, -0.13645646488863789, -0.23046752163111595], [0.045629100030271, 0.15337158520884664, -0.19546808560025919, 0.14939925475544943, -0.13437055528247421]], [[-0.42416628543917922, -0.59547052555077273, -0.52222242305595834, -0.034608080147806954, 0.030898578634469227], [0.80324975124432274, 0.36037355651460018, 0.25132419449748333, 0.5402528057880881, -0.24667548684710502], [0.87273656876492178, 0.47346291444392291, -0.22376408228358466, -0.44752113857317755, -0.75583877809429723], [0.14964470033926966, 0.50299578325915772, -0.64105500823238071, 0.4899681714948928, -0.44068021210866076]]]) | ref=numarray.array([[[0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0]], [[20.0, 0.0, 30.0, 15.0, 0.0], [-5.0, -25.0, 20.0, -30.0, 0.0], [-35.0, 30.0, 0.0, 20.0, -25.0], [30.0, -10.0, 30.0, 0.0, 30.0]]]) |
30180 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30181 | self.failUnlessEqual(res.shape,(2, 4, 5),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2, 4, 5),"wrong shape of result.") |
30182 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30183 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30184 | def test_generalTensorProduct_array_rank2_array_rank3_offset1(self): | def test_generalTensorProduct_array_rank2_array_rank3_offset1(self): |
30185 | arg0=numarray.array([[0.88719262810266786, -0.85937267417991481, 0.73515009090045735], [-0.23577510922465361, 0.6157923906886702, -0.93175714362701467]]) | arg0=numarray.array([[-6.0, 3.0, -1.0], [2.0, -2.0, -4.0]]) |
30186 | arg1=numarray.array([[[0.11853687352620845, 0.54474769893396746, -0.53408456582157404, -0.52080414425198729, 0.66924101532374536], [-0.7007414023151477, -0.66438231939808712, -0.14904956236780054, -0.22947865919670796, 0.99846052869418722], [0.33888881644046331, -0.00031577792383874481, 0.87596962843829895, 0.71952174391961088, 0.16633546339573657], [0.52175818312352318, -0.46494510236282216, -0.9610286498729097, 0.74410717847739982, 0.23958643790713152]], [[-0.13232126826929247, -0.59982716495887822, -0.78356723297672159, -0.27983244591080836, -0.79720067865560185], [0.49259242892666433, -0.41266595101286963, -0.32380592655236651, 0.31683917808299467, -0.71950642541440679], [-0.10069242888550201, -0.4370528481118563, -0.65981149099369074, -0.91018898826121619, -0.9931329895944192], [-0.56133196761047066, 0.80424266626351737, 0.47938410014283361, 0.1268699672527942, 0.49718987423226135]], [[0.98288504853562686, -0.68950422210454088, 0.97574404646092594, 0.66361095476121168, -0.17518517341335893], [-0.05203293377551188, 0.15818470879819646, -0.70472708899718461, -0.64661206715994402, 0.86275555828532147], [-0.73383007291520341, 0.83314154990625688, -0.43955888677422705, -0.73076003813304724, 0.7599995212761459], [-0.58020266746887739, 0.31973218337920595, 0.85968617253301116, -0.66097830149569581, -0.78009107511971387]]]) | arg1=numarray.array([[[7.0, 2.0, -5.0, -1.0, -4.0], [-5.0, 7.0, -1.0, -2.0, -7.0], [4.0, 3.0, -2.0, -6.0, -4.0], [0.0, 0.0, -4.0, -3.0, 7.0]], [[4.0, 0.0, 0.0, -2.0, 0.0], [6.0, 7.0, 7.0, 0.0, 7.0], [0.0, 0.0, 2.0, 5.0, 0.0], [-7.0, 0.0, 3.0, -3.0, 0.0]], [[-2.0, -7.0, -4.0, 4.0, -5.0], [-3.0, -5.0, -4.0, -5.0, -3.0], [4.0, -5.0, -1.0, 0.0, 7.0], [1.0, 4.0, -5.0, 6.0, -5.0]]]) |
30187 | res=generalTensorProduct(arg0,arg1,1) | res=generalTensorProduct(arg0,arg1,axis_offset=1) |
30188 | ref=numarray.array([[[0.94144635528991671, 0.49188212591017311, 0.91685870327397678, 0.26628041361424026, 1.1500507781342357], [-1.0832650952626968, -0.11851175109475108, -0.3720458914743241, -0.95123162645031867, 2.1384058085053144], [-0.15228326323567903, 0.98779520514021946, 1.0210360066939999, 0.88332762335627546, 1.5597566671512508], [0.51875732409708197, -0.86858889441017495, -0.63258876177827517, 0.065219561804482629, -0.78819609507446242]], [[-1.0252406397665506, 0.14464353238082384, -1.2657473784597557, -0.66785028455191275, -0.48547044846810294], [0.51703410786218496, -0.24486147104229458, 0.49237945069691097, 0.85169792360410035, -1.4823573766674358], [0.5418442334281578, -1.0453449563992463, -0.20327659746875576, -0.049241885014419506, -1.3589164830863569], [0.071926433245943444, 0.30695625053426601, -0.27923101655810034, 0.51855486336189893, 0.97653265463585537]]]) | ref=numarray.array([[[-28.0, -5.0, 34.0, -4.0, 29.0], [51.0, -16.0, 31.0, 17.0, 66.0], [-28.0, -13.0, 19.0, 51.0, 17.0], [-22.0, -4.0, 38.0, 3.0, -37.0]], [[14.0, 32.0, 6.0, -14.0, 12.0], [-10.0, 20.0, 0.0, 16.0, -16.0], [-8.0, 26.0, -4.0, -22.0, -36.0], [10.0, -16.0, 6.0, -24.0, 34.0]]]) |
30189 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30190 | self.failUnlessEqual(res.shape,(2, 4, 5),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2, 4, 5),"wrong shape of result.") |
30191 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30192 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30193 | def test_generalTensorProduct_array_rank3_array_rank4_offset2(self): | def test_generalTensorProduct_array_rank3_array_rank4_offset2(self): |
30194 | arg0=numarray.array([[[-0.72636443734631384, -0.10129037220852277, -0.76103264008177463], [-0.62211664895623797, 0.74055294283976392, 0.22378684113861991]], [[-0.49449308446778195, -0.4800922502304803, -0.8142076213634839], [-0.59421856346920943, 0.25373138063886547, 0.76836625176738882]]]) | arg0=numarray.array([[[-3.0, 7.0, 0.0], [7.0, 0.0, -7.0]], [[7.0, 4.0, -2.0], [-1.0, 6.0, 1.0]]]) |
30195 | arg1=numarray.array([[[[-0.28606000983853774, 0.832293463867112, -0.38210008231366821, -0.80872241224790686, -0.39386402809701671], [0.30915525779939879, -0.80432806932912326, 0.71662557187266707, -0.18927788789830635, -0.56917166246185658], [0.91439609030448343, -0.81399455811778654, 0.80159942642177273, -0.015384705908555452, -0.32681502176368071], [-0.70482385685773052, -0.35840875893840796, 0.034817809865170579, 0.95873063151322313, -0.45393884246224037]], [[0.068381781039508871, -0.032444353356714917, 0.88047026038742282, 0.22437347832417087, 0.74799582435792367], [-0.36498208826738421, -0.82439193967280011, -0.57587169823019679, -0.20792327665099952, 0.60649948098650142], [0.72884784989216556, -0.49664028336757737, 0.46297465888271927, -0.48328890206807484, -0.95834051384511065], [-0.18321846831087374, 0.52746329346511023, -0.21258913004052338, 0.1809080486285688, 0.018078632568951702]], [[-0.34336791527801358, 0.48326169169677491, -0.5666636980183799, -0.40668718209236299, -0.14926019819729652], [0.49782511192504875, -0.93537622095049033, -0.30683351992535224, -0.91873643616826173, 0.086549161284091625], [0.68097091087599293, -0.25587578765688312, 0.87844892869387525, -0.63531327186546838, 0.386605125189879], [0.44733965756998928, 0.618511744553087, -0.91401605492061178, 0.40652578475023349, 0.81411805308364493]]], [[[0.67850191422639705, -0.22623127604774629, 0.73517777781004767, -0.2199460295329263, -0.47532216530712423], [-0.39117756210063814, -0.44873732822108625, -0.39516810539570035, -0.29173394873203273, 0.36245659725894019], [0.21962464991068931, -0.98737107742219066, -0.894818366933674, -0.42809625337109503, -0.53142888685762801], [-0.18578339421834866, 0.18355841816478269, 0.271135090145038, 0.97382421304952382, 0.71306276049109618]], [[-0.10029831084213314, 0.52632836745412548, 0.40666636090434349, 0.046623171281902298, 0.67834313251900324], [-0.3268832248099538, -0.70725487874989201, -0.18859846728163676, -0.40278228695924856, 0.25019540844372523], [-0.010096473713268717, -0.82595056670808864, 0.14958822238207259, -0.3532399500190746, -0.62779542812365352], [0.16216320785059857, -0.15616923957404261, 0.014607249734463812, 0.52325164343339559, 0.6357234988098468]], [[0.98409545719298719, -0.83481648471335879, 0.97778669770809423, -0.87561525778350857, -0.75916117663142257], [0.12180598143746568, 0.39015872113454875, -0.058869046220418886, 0.45713098128261231, -0.57234648655361631], [0.11102136377660909, -0.50158013728182493, -0.62414895107162982, -0.016758991639415077, 0.45023237632991209], [0.040805237233795033, 0.19005641883988966, -0.63160760683823813, -0.81837258747001695, -0.70118744722329862]]]]) | arg1=numarray.array([[[[0.0, -6.0, 1.0, -1.0, -6.0], [1.0, 5.0, -2.0, -5.0, -7.0], [6.0, -4.0, 0.0, -7.0, -5.0], [0.0, 0.0, 4.0, -1.0, -6.0]], [[-4.0, 1.0, 1.0, 5.0, -4.0], [5.0, -4.0, 3.0, -3.0, 7.0], [-2.0, -7.0, -3.0, 7.0, -3.0], [7.0, -1.0, 0.0, -2.0, -6.0]], [[1.0, 3.0, 0.0, -7.0, 2.0], [0.0, 0.0, 5.0, -6.0, 0.0], [-2.0, -5.0, 1.0, -2.0, -4.0], [-7.0, 0.0, 6.0, 3.0, -7.0]]], [[[-6.0, 4.0, 1.0, 1.0, 0.0], [7.0, -4.0, -2.0, 0.0, 3.0], [-1.0, -3.0, -3.0, -4.0, 4.0], [-7.0, 5.0, -2.0, 0.0, 0.0]], [[-6.0, 0.0, -7.0, -7.0, -6.0], [-2.0, -1.0, 6.0, 0.0, 3.0], [-5.0, -3.0, 0.0, -5.0, -7.0], [5.0, -7.0, -5.0, -3.0, -2.0]], [[0.0, 3.0, -6.0, 5.0, 0.0], [2.0, -2.0, -4.0, 6.0, 4.0], [-1.0, -3.0, 6.0, 6.0, 2.0], [0.0, 3.0, 4.0, 1.0, -1.0]]]]) |
30196 | res=generalTensorProduct(arg0,arg1,2) | res=generalTensorProduct(arg0,arg1,axis_offset=2) |
30197 | ref=numarray.array([[[0.18601566042244522, -0.62534467332599475, 0.68221775223882553, 0.84961038763323604, 0.95208048445738391], [-0.5379090567407564, 1.2223097756787735, -0.1356913582606423, 0.84324460511297528, 0.11783580954184175], [-1.3755151660203135, 0.72664423322593952, -0.76989341925204946, 0.54460403285559389, 0.0066894453864743686], [0.43487822903103707, -0.45111341500763735, 0.39263318149902787, -1.4255691984654943, -0.42141440184002543]], [[0.71571638318121789, -1.1629303980766468, 0.64524683551769635, 0.093048036895923114, -0.17156680338673058], [-0.13988702271998471, 1.9420893851102949, 0.31366122645442046, 1.3638604095421463, -0.67186097308278425], [-1.4042902200484617, 0.84103124297567078, -1.243797810704689, 0.90878543199006789, 0.80935965497641593], [0.25516013461902143, -0.58226328124053195, 0.18633091000231633, -1.9666435521494512, -1.2482518152866606]]]) | ref=numarray.array([[[-70.0, 32.0, 53.0, 10.0, -10.0], [67.0, -57.0, 41.0, -48.0, 63.0], [-32.0, -37.0, -84.0, 0.0, 8.0], [0.0, 7.0, -54.0, -18.0, -17.0]], [[-48.0, -45.0, -38.0, -11.0, -98.0], [10.0, 15.0, 22.0, -29.0, -2.0], [8.0, -64.0, -5.0, -37.0, -83.0], [79.0, -48.0, -8.0, -38.0, -65.0]]]) |
30198 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30199 | self.failUnlessEqual(res.shape,(2, 4, 5),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2, 4, 5),"wrong shape of result.") |
30200 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30201 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30202 | def test_generalTensorProduct_array_rank1_array_rank3_offset0(self): | def test_generalTensorProduct_array_rank1_array_rank3_offset0(self): |
30203 | arg0=numarray.array([-0.10853748989477352, 0.27834309849207006]) | arg0=numarray.array([1.0, 5.0]) |
30204 | arg1=numarray.array([[[-0.36996470997559849, 0.62604099130254198], [-0.72837431218177939, 0.15795724318798321]], [[-0.81627257263074759, -0.75179644840510051], [0.19004534005575913, -0.7187506521753273]], [[-0.5509004522495915, 0.22283216225380054], [-0.77273613271687114, -0.16415059713725833]], [[-0.50917795307069347, 0.20972370103547666], [-0.70561560257966605, -0.8506773758558186]], [[-0.74448550124953772, -0.054835132199751779], [-0.33766244205511864, 0.50694644628308283]], [[0.26345238610895128, -0.33914884332376483], [0.66325736581644645, 0.93041865540431035]]]) | arg1=numarray.array([[[4.0, 3.0], [6.0, 0.0]], [[0.0, 0.0], [5.0, 4.0]], [[-5.0, 1.0], [-7.0, -2.0]], [[4.0, -7.0], [7.0, -2.0]], [[5.0, 2.0], [-3.0, 1.0]], [[0.0, 4.0], [-1.0, -5.0]]]) |
30205 | res=generalTensorProduct(arg0,arg1,0) | res=generalTensorProduct(arg0,arg1,axis_offset=0) |
30206 | ref=numarray.array([[[[0.04015504097039934, -0.067948917767213651], [0.079055919548042489, -0.01714428268632201]], [[0.088596176103290555, 0.081598099421695214], [-0.020627044175850755, 0.078011391647341458]], [[0.059793352269066201, -0.024185643558852409], [0.083870840196083776, 0.017816493778006214]], [[0.055264896936051855, -0.022762884081832552], [0.076585746334585036, 0.092330387085663365]], [[0.080804587568677103, 0.0059516676070091286], [0.03664903389240199, -0.055022694790641452]], [[-0.02859446069505427, 0.036810364155077255], [-0.071988289639936656, -0.1009853054088541]]], [[[-0.10297712370732814, 0.17425418930219663], [-0.2027379629147068, 0.043966308498208671]], [[-0.22720383708013558, -0.20925735288440936], [0.05289780880509911, -0.20005928356967673]], [[-0.153339338839834, 0.062023794485410538], [-0.21508576949719338, -0.045690185826508009]], [[-0.14172616914154665, 0.058375144773439136], [-0.19640323316637334, -0.23678017661281181]], [[-0.20722240120021823, -0.015262980602701192], [-0.093986010366020792, 0.14110504462797702]], [[0.073330153454694694, -0.094399739900738314], [0.1846131102990381, 0.25897561144006137]]]]) | ref=numarray.array([[[[4.0, 3.0], [6.0, 0.0]], [[0.0, 0.0], [5.0, 4.0]], [[-5.0, 1.0], [-7.0, -2.0]], [[4.0, -7.0], [7.0, -2.0]], [[5.0, 2.0], [-3.0, 1.0]], [[0.0, 4.0], [-1.0, -5.0]]], [[[20.0, 15.0], [30.0, 0.0]], [[0.0, 0.0], [25.0, 20.0]], [[-25.0, 5.0], [-35.0, -10.0]], [[20.0, -35.0], [35.0, -10.0]], [[25.0, 10.0], [-15.0, 5.0]], [[0.0, 20.0], [-5.0, -25.0]]]]) |
30207 | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") | self.failUnless(isinstance(res,numarray.NumArray),"wrong type of result.") |
30208 | self.failUnlessEqual(res.shape,(2, 6, 2, 2),"wrong shape of result.") | self.failUnlessEqual(res.shape,(2, 6, 2, 2),"wrong shape of result.") |
30209 | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") | self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
30210 | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30211 | def test_generalTensorProduct_array_rank2_array_rank4_offset1(self): | def test_generalTensorProduct_array_rank2_array_rank4_offset1(self): |
30212 | arg0=numarray.array([[0.0078035188859546523, -0.85228540660692742, -0.67849544792883698], [0.15092314754829839, 0.49233214806070325, 0.093137282528565013]]) | arg0=numarray.array([[-7.0, 4.0, -6.0], [-2.0, -3.0, -7.0]]) |
30213 | arg1=numarray.array([[[[0.12017388805777252, -0.9430103459798842], [-0.11371451892203477, 0.33651740736939484]], [[-0.31085031016254461, 0.45867044866512363], [-0.27603052372300985, -0.45076616037594608]], [[-0.53981957899116306, -0.070306842819090054], [-0.93860389517573894, 0.93558901853748089]], [[0.74802844573897365, 0.21899443386586781], [0.10732264201234232, -0.88588929307979591]], [[-0.88513743469563178, 0.84934293267765337], [-0.45868453965338651, -0.46782169518892003]], [[-0.28151973413459364, 0.83937657538757215], [0.8744249127243684, 0.41248182962656021]]], [[[-0.78059611961578512, -0.27495714631707369], [-0.28073381516961171, 0.63439512465272574]], [[-0.70273359478204123, -0.20009279507917022], [0.79041542048899904, 0.40387131731046799]], [[0.35335763910871743, -0.60224707362059449], [0.3 |