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.16 2002/09/03 19:34:15 geraint
## Write EdX regardless - csex is needed to create ode when not optimised.
##
## Revision 1.15 2002/08/29 15:45:20 geraint
## Tests for existence of matrix before entering shell loop.
## Tests for existence of expression before attempting to write or optimise.
##
|
>
>
>
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# Copyright (C) 2000 by Peter J. Gawthrop
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.16.2.1 2002/09/03 23:44:43 geraint
## adding global optimisation (-optg).
##
## Revision 1.16 2002/09/03 19:34:15 geraint
## Write EdX regardless - csex is needed to create ode when not optimised.
##
## Revision 1.15 2002/08/29 15:45:20 geraint
## Tests for existence of matrix before entering shell loop.
## Tests for existence of expression before attempting to write or optimise.
##
|
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
for matrix in $matrices; do
matrix_exists=`grep -i MTT${matrix} ${sys}_dae.r | wc -l | gawk '{print $1}'`
if [ "$matrix" = "EdX" -o $matrix_exists -gt 0 ]; then
n=`first "$ns"`; ns=`rest "$ns"`
m=`first "$ms"`; ms=`rest "$ms"`
is=`n2m 1 $n`;
js=`n2m 1 $m`;
if [ $n -ge 1 ]; then
for i in $is; do
for j in $js; do
if [ ${opt:-""} = "-optimise_local" ]; then
name=`echo MTT$matrix'('$i','$j')'`
mtt_optimise_local $1 "$comma$name" "$name"
comma=''
else
echo 'write'
name=`echo MTT$matrix'('$i','$j')'`
echo ' '$comma$name ':=' $name '$'
fi >> $1_$2_write.r
done
done
fi
fi
done
echo ';END;' >>$1_$2_write.r
|
>
>
|
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
for matrix in $matrices; do
matrix_exists=`grep -i MTT${matrix} ${sys}_dae.r | wc -l | gawk '{print $1}'`
if [ "$matrix" = "EdX" -o $matrix_exists -gt 0 ]; then
n=`first "$ns"`; ns=`rest "$ns"`
m=`first "$ms"`; ms=`rest "$ms"`
is=`n2m 1 $n`;
js=`n2m 1 $m`;
echo "write \"% Begin Matrix MTT${matrix}\"$" >> $1_$2_write.r
if [ $n -ge 1 ]; then
for i in $is; do
for j in $js; do
if [ ${opt:-""} = "-optimise_local" ]; then
name=`echo MTT$matrix'('$i','$j')'`
mtt_optimise_local $1 "$comma$name" "$name"
comma=''
else
echo 'write'
name=`echo MTT$matrix'('$i','$j')'`
echo ' '$comma$name ':=' $name '$'
fi >> $1_$2_write.r
done
done
fi
echo "write \"% End Matrix MTT${matrix}\"$" >> $1_$2_write.r
fi
done
echo ';END;' >>$1_$2_write.r
|