︙ | | | ︙ | |
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.18 2000/08/24 17:11:40 peterg
## Now optimises as well as segmenting - uses the SCOPE package
##
## Revision 1.17 2000/05/20 15:23:56 peterg
## Paramererised version of sm etc etc (using -parameter switch)
##
## Revision 1.16 2000/04/18 11:14:18 peterg
|
>
>
>
>
>
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.19 2000/08/28 20:17:59 peterg
## Put in Winfried Neun's bug fix
## -- prevents segmentation violation using optimised gentran when matrix
## comtains a number
##
## Revision 1.18 2000/08/24 17:11:40 peterg
## Now optimises as well as segmenting - uses the SCOPE package
##
## Revision 1.17 2000/05/20 15:23:56 peterg
## Paramererised version of sm etc etc (using -parameter switch)
##
## Revision 1.16 2000/04/18 11:14:18 peterg
|
︙ | | | ︙ | |
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
% Load the general translator package
LOAD GENTRAN;
LOAD SCOPE;
GENTRANLANG!* := '$codegenerator;
ON GENTRANSEG; % Segmentation
ON GENTRANOPT; % Code optimise using scope
OFF GENDECS; % No declarations
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_s;
% Matrix output function
in"$MTTPATH/trans/lang_matrix.r";
%Read the reduce definitions file
in "$1_def.r";
%Read the reduce $REP file
in "$1_$rep.r";
|
>
>
>
|
|
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
% Load the general translator package
LOAD GENTRAN;
LOAD SCOPE;
GENTRANLANG!* := '$codegenerator;
ON GENTRANSEG; % Segmentation
ON GENTRANOPT; % Code optimise using scope
ON GETDECS; % Create decrarations automatically
DEFTYPE!* := 'REAL; % and default to real
OFF GENDECS; % No declarations
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_s;
INAME(mtt_o);
% Matrix output function
%in"$MTTPATH/trans/lang_matrix.r";
%Read the reduce definitions file
in "$1_def.r";
%Read the reduce $REP file
in "$1_$rep.r";
|
︙ | | | ︙ | |
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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
250
251
252
253
254
255
|
$SYMBOLIC > mtt_r2m.log <<EOF
%Set up the code generator
in"mtt_setreduce.r";
% The body of the odeo function
GENTRANOUT "mtt_odeo";
mtt_matrix := MTTy$
mtt_matrix_n := MTTNy$
mtt_matrix_m := 1$
lang_matrix();
GENTRANSHUT "mtt_odeo";
END;;
EOF
if [ "$rep" = "ode" ]; then
# Use reduce to accomplish the transformation
$SYMBOLIC >> mtt_r2m.log <<EOF
%Set up the code generator
in"mtt_setreduce.r";
% The body of the ode function
GENTRANOUT "mtt_ode";
mtt_matrix := MTTdX$
mtt_matrix_n := MTTNx$
mtt_matrix_m := 1$
lang_matrix();
GENTRANSHUT "mtt_ode";
END;;
EOF
else
## cse representation
$SYMBOLIC >> mtt_r2m.log <<EOF
%Set up the code generator
in"mtt_setreduce.r";
% The body of the cse function
GENTRANOUT "mtt_ode";
mtt_matrix := MTTEdX$
mtt_matrix_n := MTTNx$
mtt_matrix_m := 1$
lang_matrix();
GENTRANSHUT "mtt_ode";
% GENTRANOUT "mtt_odee";
% mtt_matrix := MTTE$
% mtt_matrix_n := MTTNx$
% mtt_matrix_m := MTTNx$
% lang_matrix();
% GENTRANSHUT "mtt_odee";
END;;
EOF
fi
#if [ "$rep" = "ode" ]; then
# touch mtt_odee
#fi
sed 's/mtt_matrix/mttdx/' <mtt_ode >> $1_$2.pas
#sed 's/mtt_matrix/mtte/' <mtt_odee >> $1_$2.pas
sed 's/mtt_matrix/mtty/' <mtt_odeo >> $1_$2o.pas
#rm -f mtt_odeo mtt_ode #mtt_odee
# Convert from Pascal syntax to Octave syntax
mtt_p2m<$1_$2o.pas > $1_$2o.m
rm -f $1_odeo.pas
fi
|
|
|
|
|
<
>
>
>
|
|
|
|
>
<
>
>
|
|
|
|
>
<
>
|
|
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
$SYMBOLIC > mtt_r2m.log <<EOF
%Set up the code generator
in"mtt_setreduce.r";
% The body of the odeo function
GENTRANOUT "mtt_odeo";
%mtt_matrix := MTTy$
%mtt_matrix_n := MTTNy$
%mtt_matrix_m := 1$
%lang_matrix();
GENTRAN MTT_matrix :=: MTTy$
GENTRANSHUT "mtt_odeo";
END;;
EOF
mtt_vectorise mtt_odeo; # Its really a vector
if [ "$rep" = "ode" ]; then
# Use reduce to accomplish the transformation
$SYMBOLIC >> mtt_r2m.log <<EOF
%Set up the code generator
in"mtt_setreduce.r";
% The body of the ode function
GENTRANOUT "mtt_ode";
%mtt_matrix := MTTdX$
%mtt_matrix_n := MTTNx$
%mtt_matrix_m := 1$
%lang_matrix();
GENTRAN MTT_matrix :=: MTTdX$
GENTRANSHUT "mtt_ode";
END;;
EOF
mtt_vectorise mtt_ode; # Its really a vector
else
## cse representation
$SYMBOLIC >> mtt_r2m.log <<EOF
%Set up the code generator
in"mtt_setreduce.r";
% The body of the cse function
GENTRANOUT "mtt_ode";
% mtt_matrix := MTTEdX$
% mtt_matrix_n := MTTNx$
% mtt_matrix_m := 1$
% lang_matrix();
GENTRAN MTT_matrix :=: MTTEdX$
GENTRANSHUT "mtt_ode";
% GENTRANOUT "mtt_odee";
% mtt_matrix := MTTE$
% mtt_matrix_n := MTTNx$
% mtt_matrix_m := MTTNx$
% lang_matrix();
% GENTRANSHUT "mtt_odee";
END;;
EOF
mtt_vectorise mtt_ode; # Its really a vector
fi
#if [ "$rep" = "ode" ]; then
# touch mtt_odee
#fi
sed 's/mtt_matrix/mttdx/' <mtt_ode >> $1_$2.pas
#sed 's/mtt_matrix/mtte/' <mtt_odee >> $1_$2.pas
sed 's/mtt_matrix/mtty/' <mtt_odeo >> $1_$2o.pas
rm -f mtt_odeo mtt_ode #mtt_odee
# Convert from Pascal syntax to Octave syntax
mtt_p2m<$1_$2o.pas > $1_$2o.m
rm -f $1_odeo.pas
fi
|
︙ | | | ︙ | |
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
in"mtt_setreduce.r";
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";
END;
EOF
echo "%$Symbol matrix#" >> $outfile.pas
cat mtt_zero.m >> $outfile.pas
|
|
|
|
>
|
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
in"mtt_setreduce.r";
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();
GENTRAN mtt_matrix :=: mtt_matrix;
GENTRANSHUT "$outfile.1";
END;
EOF
echo "%$Symbol matrix#" >> $outfile.pas
cat mtt_zero.m >> $outfile.pas
|
︙ | | | ︙ | |
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
|
fi
# Convert from Pascal syntax to Octave syntax
mtt_p2m <$outfile.pas > $outfile.m
rm -f $outfile.pas
rm -f mtt_zero.m
#rm -f $outfile.1
# Now invoke the standard error handling.
mtt_error_r mtt_r2m.log
|
|
|
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
fi
# Convert from Pascal syntax to Octave syntax
mtt_p2m <$outfile.pas > $outfile.m
rm -f $outfile.pas
rm -f mtt_zero.m
rm -f $outfile.1
# Now invoke the standard error handling.
mtt_error_r mtt_r2m.log
|