Differences From Artifact [83e084d8bc]:
- Executable file
mttroot/mtt/bin/trans/def2write_r
— part of check-in
[ea9834becc]
at
2002-06-05 11:14:51
on branch origin/optimise-algebraic-equations
— ae.r now generated using def2write_r like cse?.r
fix_c.r called at ese2rdae stage so that pow gets fixed in ae.r.These changes produce the desired result (optimised algebraic equations) but
have highlighted a problem; when optimisation fails, Reduce does not write
a result. For complicated systems, this can lead to missing assignments in
the resultant code. (user: geraint@users.sourceforge.net, size: 5046) [annotate] [blame] [check-ins using] [more...]
To Artifact [99d73e586c]:
- Executable file mttroot/mtt/bin/trans/def2write_r — part of check-in [9e8650bb26] at 2002-06-05 17:57:50 on branch origin/optimise-algebraic-equations — Main part of optimisation routine moved to separate file. (user: geraint@users.sourceforge.net, size: 5103) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.11 2002/05/17 09:14:58 geraint ## Optimises each line in a separate session. Allows larger models to be built. ## ## Revision 1.10 2002/04/28 18:41:27 geraint ## Fixed [ 549658 ] awk should be gawk. ## Replaced calls to awk with call to gawk. ## | > > > > > > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.11.2.1 2002/06/05 11:14:51 geraint ## ae.r now generated using def2write_r like cse?.r ## fix_c.r called at ese2rdae stage so that pow gets fixed in ae.r. ## ## These changes produce the desired result (optimised algebraic equations) but ## have highlighted a problem; when optimisation fails, Reduce does not write ## a result. For complicated systems, this can lead to missing assignments in ## the resultant code. ## ## Revision 1.11 2002/05/17 09:14:58 geraint ## Optimises each line in a separate session. Allows larger models to be built. ## ## Revision 1.10 2002/04/28 18:41:27 geraint ## Fixed [ 549658 ] awk should be gawk. ## Replaced calls to awk with call to gawk. ## |
︙ | ︙ | |||
150 151 152 153 154 155 156 | }' } mtt_optimise () { sys="$1" lhs="$2" | < | < < < < < | | < < < < < < < < | < < < | < | | | | < | | < < > | < < < < | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | }' } mtt_optimise () { sys="$1" lhs="$2" lhs=`echo $lhs | sed 's/MTTEdX/MTTdX/'` dae="${sys}_dae.r" exp=`grep -i -e "^$lhs" $dae` rhs=`echo $exp | sed 's/.*:=\ \(.*\)/\1/'` rhs=`echo $rhs | sed 's/[;$]*$//'` if [ ! -z "${rhs}" ]; then mtt_optimise.sh "$lhs" "$rhs" | mtt_fix_integers fi return } # Remove log files rm -f def2write_r1.log def2write_r2.log |
︙ | ︙ | |||
214 215 216 217 218 219 220 | m=`first "$ms"`; ms=`rest "$ms"` is=`n2m 1 $n`; js=`n2m 1 $m`; for i in $is; do for j in $js; do if [ ${opt:-""} = "-optimise" ]; then name=`echo MTT$matrix'('$i','$j')'` | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | m=`first "$ms"`; ms=`rest "$ms"` is=`n2m 1 $n`; js=`n2m 1 $m`; for i in $is; do for j in $js; do if [ ${opt:-""} = "-optimise" ]; then name=`echo MTT$matrix'('$i','$j')'` mtt_optimise $1 "$comma$name" comma='' else echo 'write' name=`echo MTT$matrix'('$i','$j')'` echo ' '$comma$name ':=' $name '$' fi >> $1_$2_write.r done done done echo ';END;' >>$1_$2_write.r |