550 |
out=out.replace("%%a%s%%"%c,r) |
out=out.replace("%%a%s%%"%c,r) |
551 |
return out |
return out |
552 |
#======================================================================================================= |
#======================================================================================================= |
553 |
|
# nonsymmetric part |
554 |
|
#======================================================================================================= |
555 |
|
from esys.escript import * |
556 |
|
for name in ["symmetric", "nonsymmetric"]: |
557 |
|
f=1. |
558 |
|
if name=="nonsymmetric": f=-1 |
559 |
|
for case0 in ["array","Symbol","constData","taggedData","expandedData"]: |
560 |
|
for sh0 in [ (3,3), (2,3,2,3)]: |
561 |
|
text=" #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" |
562 |
|
tname="test_%s_%s_rank%s"%(name,case0,len(sh0)) |
563 |
|
text+=" def %s(self):\n"%tname |
564 |
|
a_0=makeNumberedArray(sh0,s=1.) |
565 |
|
r_0=(a_0+f*transpose(a_0))/2. |
566 |
|
if case0 in ["taggedData", "expandedData"]: |
567 |
|
a1_0=makeNumberedArray(sh0,s=-1.) |
568 |
|
r1_0=(a1_0+f*transpose(a1_0))/2. |
569 |
|
else: |
570 |
|
a1_0=a_0 |
571 |
|
r1_0=r_0 |
572 |
|
text+=mkText(case0,"arg",a_0,a1_0) |
573 |
|
text+=" res=%s(arg)\n"%name |
574 |
|
if case0=="Symbol": |
575 |
|
text+=mkText("array","s",a_0,a1_0) |
576 |
|
text+=" sub=res.substitute({arg:s})\n" |
577 |
|
res="sub" |
578 |
|
text+=mkText("array","ref",r_0,r1_0) |
579 |
|
else: |
580 |
|
res="res" |
581 |
|
text+=mkText(case0,"ref",r_0,r1_0) |
582 |
|
text+=mkTypeAndShapeTest(case0,sh0,"res") |
583 |
|
text+=" self.failUnless(Lsup(%s-ref)<=self.RES_TOL*Lsup(ref),\"wrong result\")\n"%res |
584 |
|
|
585 |
|
if case0 == "taggedData" : |
586 |
|
t_prog_with_tags+=text |
587 |
|
else: |
588 |
|
t_prog+=text |
589 |
|
print test_header |
590 |
|
print t_prog |
591 |
|
# print t_prog_with_tags |
592 |
|
print test_tail |
593 |
|
1/0 |
594 |
|
|
595 |
|
#======================================================================================================= |
596 |
# eigenvalues |
# eigenvalues |
597 |
#======================================================================================================= |
#======================================================================================================= |
598 |
import numarray.linear_algebra |
import numarray.linear_algebra |