Index: mttroot/mtt/bin/trans/mtt_r2m ================================================================== --- mttroot/mtt/bin/trans/mtt_r2m +++ mttroot/mtt/bin/trans/mtt_r2m @@ -14,10 +14,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.6 1999/03/15 07:29:25 peterg +## Fixed various obscure reduce bugs +## THIS NEEDS A MAJOR REWRITE!!!! +## ## Revision 1.5 1998/08/13 16:25:07 peterg ## Removed some documentation form odeo.m ## ## Revision 1.4 1998/08/13 15:10:47 peterg ## Change temp var name to mtt_t1 etc @@ -42,12 +46,11 @@ Rc='#'; Lb='('; Rb=')'; outfile=$1"_"$rep -echo $outfile -rm -fv $outfile.[123] + #Set up gentran cat <mtt_setreduce.r % Set up the code generator % Load the general translator package LOAD GENTRAN; @@ -81,38 +84,39 @@ if [ "$rep" = "ode" ]; then #echo Creating $1_odea.$ext outfileo=$outfile"o" echo Creating $outfileo.m - rm ode odeo + #rm -f $1_odea.$ext.1; #Header lang_header $1 $rep $ext 'mttx,mttu,t' mttdx > $1_ode.p - lang_header $1 odeo $ext 'mttx,mttu,t' mtty > $1_odeo.p + lang_header $1 odeo $ext 'mttx,mttu,t' mtty > $1_odeo.p +rm -f mtt_ode mtt_odeo # Use reduce to accomplish the transformation $SYMBOLIC > mtt_r2m.log <> $1_ode.p -sed 's/mtt_matrix/mtty/' > $1_odeo.p +sed 's/mtt_matrix/mttdx/' > $1_ode.p +sed 's/mtt_matrix/mtty/' > $1_odeo.p + +rm -f mtt_odeo mtt_ode # Convert from Pascal syntax to Octave syntax - mtt_p2m<$1_odeo.p > $1_odeo.m - mtt_p2m<$1_ode.p > $1_ode.m -# mv $1_odea.m mtt_junk; mtt_p2m $1_odea.m + mtt_p2m<$1_odeo.p > $1_odeo.m + +#rm -f $1_odeo.p fi if [ "$rep" = "sm" ]||[ "$rep" = "dm" ]; then if [ "$rep" = "sm" ]; then #Header - lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd] > $outfile.A + lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd] > $outfile.p Symbols='a b c d' fi if [ "$rep" = "dm" ]; then #Header - lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd,mtte] > $outfile.A + lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd,mtte] > $outfile.p Symbols='a b c d e' fi for Symbol in $Symbols; do rm -f $outfile.1 @@ -267,43 +273,50 @@ ;; *) esac fi - $SYMBOLIC << EOF >mtt_r2m.log + +# Set up the matrices + + rm -f mtt_zero.m + + $SYMBOLIC << EOF >mtt_r2m.log %Set up the code generator in"mtt_setreduce.r"; - - out "$outfile.2"; - write "mtt$Symbol = zeros(", $N, ",", $M, ");"; - shut "$outfile.2"; + + OUT "mtt_zero.m"; + write "mtt$Symbol = zeros(", $N, ",", $M , ");" ; + SHUT "mtt_zero.m"; GENTRANOUT "$outfile.1"; mtt_matrix := MTT$Symbol; mtt_matrix_n := $N; mtt_matrix_m := $M; lang_matrix(); GENTRANSHUT "$outfile.1"; EOF -echo "%$Symbol matrix#" > $outfile.$Symbol -cat "$outfile.2" >> $outfile.$Symbol + +echo "%$Symbol matrix#" >> $outfile.p +cat mtt_zero.m >> $outfile.p + sed "s/mtt_matrix/mtt$Symbol/" < $outfile.1 |\ -grep -v '=0\.0;' >> $outfile.$Symbol +grep -v '=0\.0;' >> $outfile.p done fi # Convert from Pascal syntax to Octave syntax -cat $outfile.? | mtt_p2m > $outfile + mtt_p2m <$outfile.p > $outfile.m -#rm -f $outfile.? - - +rm -f $outfile.p +rm -f mtt_zero.m +rm -f $outfile.1