690 |
out[i0,i1,i2,i3]=arg0[i0,i1,i2,i3] |
out[i0,i1,i2,i3]=arg0[i0,i1,i2,i3] |
691 |
return out |
return out |
692 |
#======================================================================================================= |
#======================================================================================================= |
693 |
|
# inverse |
694 |
|
#======================================================================================================= |
695 |
|
name="inverse" |
696 |
|
for case0 in ["array","Symbol","constData","taggedData","expandedData"]: |
697 |
|
for sh0 in [ (1,1), (2,2), (3,3)]: |
698 |
|
text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" |
699 |
|
tname="test_%s_%s_dim%s"%(name,case0,sh0[0]) |
700 |
|
text+=" def %s(self):\n"%tname |
701 |
|
a_0=makeArray(sh0,[-1.,1]) |
702 |
|
for i in range(sh0[0]): a_0[i,i]+=2 |
703 |
|
if case0 in ["taggedData", "expandedData"]: |
704 |
|
a1_0=makeArray(sh0,[-1.,1]) |
705 |
|
for i in range(sh0[0]): a1_0[i,i]+=3 |
706 |
|
else: |
707 |
|
a1_0=a_0 |
708 |
|
|
709 |
|
text+=mkText(case0,"arg",a_0,a1_0) |
710 |
|
text+=" res=%s(arg)\n"%name |
711 |
|
if case0=="Symbol": |
712 |
|
text+=mkText("array","s",a_0,a1_0) |
713 |
|
text+=" sub=res.substitute({arg:s})\n" |
714 |
|
res="sub" |
715 |
|
ref="s" |
716 |
|
else: |
717 |
|
ref="arg" |
718 |
|
res="res" |
719 |
|
text+=mkTypeAndShapeTest(case0,sh0,"res") |
720 |
|
text+=" self.failUnless(Lsup(matrixmult(%s,%s)-kronecker(%s))<=self.RES_TOL,\"wrong result\")\n"%(res,ref,sh0[0]) |
721 |
|
|
722 |
|
if case0 == "taggedData" : |
723 |
|
t_prog_with_tags+=text |
724 |
|
else: |
725 |
|
t_prog+=text |
726 |
|
|
727 |
|
print test_header |
728 |
|
# print t_prog |
729 |
|
print t_prog_with_tags |
730 |
|
print test_tail |
731 |
|
1/0 |
732 |
|
|
733 |
|
#======================================================================================================= |
734 |
# trace |
# trace |
735 |
#======================================================================================================= |
#======================================================================================================= |
736 |
def traceTest(r,offset): |
def traceTest(r,offset): |