Index: mttroot/mtt/bin/trans/mtt_optimise_global ================================================================== --- mttroot/mtt/bin/trans/mtt_optimise_global +++ mttroot/mtt/bin/trans/mtt_optimise_global @@ -23,17 +23,28 @@ exit $E_REP_NOT_SUPPORTED;; esac # Generate a command of the form # optimise mtt?(1,1) :=: mtt?(1,1), mtt?(2,1) :=: mtt?(2,1), ..., INAME mtt_tmp$ -command="optimize" -counter=1 -while [ $counter -le $nmatrix ]; do - command="$command mtt$matrix($counter,1) :=: mtt$matrix($counter,1)," - counter=`expr $counter + 1` -done -command="$command INAME mtt_tmp$" +if [ $nmatrix -gt 0 ]; then + command="optimize" + counter=1 + while [ $counter -le $nmatrix ]; do + command="$command mtt$matrix($counter,1) :=: mtt$matrix($counter,1)," + counter=`expr $counter + 1` + done + command="$command INAME mtt_tmp" +else + command="" +fi + +# Generate matrix declaration +if [ $nmatrix -gt 0 ]; then + matrix_declaration="matrix mtt$matrix($nmatrix,1)" +else + matrix_declaration="matrix mtt$matrix" +fi logfile=${system}_${representation}_global_optimisation.log tmpfile=${system}_${representation}_global_optimisation.tmp outfile=${system}_${representation}.r @@ -41,23 +52,22 @@ exit $E_FILE_NOT_EXIST fi # Use Reduce to perform the optimisation ${SYMBOLIC:-reduce} < $logfile 2>&1 -off nat$ -in "${system}_def.r"$ -matrix mtt$matrix($nmatrix,1)$ -in "$outfile"$ -load scope$ -out "$tmpfile"$ -$command -shut "$tmpfile"$ -$end$ +off nat; +in "${system}_def.r"; +in "$outfile"; +load scope; +out "$tmpfile"; +$command; +shut "$tmpfile"; +$end; EOF cp $outfile $outfile.unoptimised cp $tmpfile $outfile.tmp cat $tmpfile | mtt_fix_integers > $outfile #cp $tmpfile $outfile echo ";end;" >> $outfile mtt_error_r $logfile