Differences From Artifact [24c886d294]:

To Artifact [de9308bd30]:


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
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.12  2002/06/28 10:13:40  geraint
## Includes fix_c.r in ese2rdae and def2write_r to eliminate occurrances of x**y.
##
## 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.
##
## 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.
##
82
83
84
85
86
87
88





89
90
91
92
93
94
95
Nu=`mtt_getsize $sys u` # Inputs 
Ny=`mtt_getsize $sys y` # Outputs 
Nyz=`mtt_getsize $sys yz` # Zero outputs
#Npar=`wc -l $sys\_sympar.txt | gawk '{print $1}'`

# Set up representation-specific stuff
case $rep in





    cse)
        matrices='EdX E'
        ns="$Nx $Nx"
        ms="1 $Nx"
	;;
    csex)
        matrices='EdX'







>
>
>
>
>







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Nu=`mtt_getsize $sys u` # Inputs 
Ny=`mtt_getsize $sys y` # Outputs 
Nyz=`mtt_getsize $sys yz` # Zero outputs
#Npar=`wc -l $sys\_sympar.txt | gawk '{print $1}'`

# Set up representation-specific stuff
case $rep in
    ae)
	matrices='Yz'
	ns="$Nyz"
	ms="1"
	;;
    cse)
        matrices='EdX E'
        ns="$Nx $Nx"
        ms="1 $Nx"
	;;
    csex)
        matrices='EdX'
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
	sed -e 's/:=/:=/g' >> $tmp
    {
	cat <<EOF

shut "$tmp2"$
EOF
    } >> $tmp
 
    ${SYMBOLIC:-reduce} < $tmp >> def2write_r1.log 2>> def2write_r2.log
    cat $tmp2 | gawk -v RS=';' '($2 == ":=") {print $0}' > $tmp3
    cat $tmp3 | mtt_fix_integers
    rm -f $tmp $tmp2 $tmp3
    return
}








|







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
	sed -e 's/:=/:=/g' >> $tmp
    {
	cat <<EOF

shut "$tmp2"$
EOF
    } >> $tmp
    echo "%%% $lhs %%%" >> def2write_r1.log
    ${SYMBOLIC:-reduce} < $tmp >> def2write_r1.log 2>> def2write_r2.log
    cat $tmp2 | gawk -v RS=';' '($2 == ":=") {print $0}' > $tmp3
    cat $tmp3 | mtt_fix_integers
    rm -f $tmp $tmp2 $tmp3
    return
}

208
209
210
211
212
213
214

215
216
217
218
219
220
221
222
223
224
225
226
227

228
229
fi >> $1_$2_write.r

for matrix in $matrices; do
    n=`first "$ns"`; ns=`rest "$ns"` 
    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" "$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







>
|
|
|
|
|
|
|
|
|
|
|
|
|
>


220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
fi >> $1_$2_write.r

for matrix in $matrices; do
    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" ]; then
		    name=`echo MTT$matrix'('$i','$j')'`
		    mtt_optimise $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
done
echo ';END;'                           >>$1_$2_write.r

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]