Overview
Comment:Eliminated argument list too long warnings.
Now get a Segmentation Fault with very long equations!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/optimise-algebraic-equations | trunk
Files: files | file ages | folders
SHA3-256: 933d9dfb7c501a8ff97ba617bef0929da9bf8998a0c7006a47a46ba2ad9464b7
User & Date: geraint@users.sourceforge.net on 2002-06-05 23:34:33
Other Links: branch diff | manifest | tags
Context
2002-06-06
16:28:45
Eliminated use of variable to pass rhs expression to optimise check-in: e76e07bbf8 user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
2002-06-05
23:34:33
Eliminated argument list too long warnings.
Now get a Segmentation Fault with very long equations!
check-in: 933d9dfb7c user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
18:23:38
Cosmetic change. check-in: 8732fbf4bf user: geraint@users.sourceforge.net tags: origin/optimise-algebraic-equations, trunk
Changes

Modified mttroot/mtt/bin/trans/def2write_r from [4b36af9cb9] to [793816fd35].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15



16
17
18
19
20
21
22
#!/bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: def2write.r
# Generates r code to write matrices
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.11.2.2  2002/06/05 17:57:47  geraint
## Main part of optimisation routine moved to separate file.
##
## 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.
##

|













>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
set -x
     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: def2write.r
# Generates r code to write matrices
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.11.2.3  2002/06/05 18:23:38  geraint
## Cosmetic change.
##
## Revision 1.11.2.2  2002/06/05 17:57:47  geraint
## Main part of optimisation routine moved to separate file.
##
## 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.
##
166
167
168
169
170
171
172

173
174
175

176
177
178


179
180
181
182
183
184
185
186
{
    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







>

|
|
>
|


>
>
|







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
{
    sys="$1"
    lhs="$2"

    lhs=`echo $lhs | sed 's/MTTEdX/MTTdX/'`
    
    dae="${sys}_dae.r"
    tmp=mtt_optimise.tmp

    rhs=`eval "grep -i -e \"^$lhs\"" $dae`
    rhs=`eval echo "\"$rhs"\" | gawk -v FS=":=" '{ print $2 }'`
    rhs=`eval echo "\"$rhs"\" | eval "sed 's/\([.]*\)[;$]*$/\1/'"`
    rhs=`eval echo "\"$rhs"\" | eval "sed 's/\ //g'"`

    if [ ! -z "${rhs}" ]; then
	eval echo \"$lhs\" \"$rhs\" > $tmp
	eval mtt_optimise.sh $tmp
	cat $tmp #| mtt_fix_integers
    fi

    return
}


# Remove log files

Modified mttroot/mtt/bin/trans/mtt_optimise.sh from [a0808806c8] to [3b8f7df6f9].

1
2
3


4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh

set -e



# get expression to optimise

lhs="$1"
rhs="$2"

create_reduce_script ()
{
    lhs="$1"

    rhs="$2"

    cat <<EOF
off echo$
load scope$
on double$
on noconvert$
on rounded$
off int$
off nat$

out "${tmp}"$
optimize mtt_tmp0 :=: ${rhs} iname mtt_tmp$
write "${lhs} := mtt_tmp0 $"$
shut "${tmp}"$

;end;
EOF
    return
}


# set work file names

tmp="$0.tmp"
log="$0.log"

create_reduce_script "${lhs}" "${rhs}" | reduce > ${log}

cat ${tmp}
rm -f ${tmp}

exit 0



>
>



|
|

|
|
|
>
|

|










|




<
|
<
<
<
<
<
<
<
<
<
|
<


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34









35

36
37
#! /bin/sh

set -e

filename="$1"

# get expression to optimise

lhs=`cat ${filename} | gawk '{ print $1 }'`
rhs=`cat ${filename} | gawk '{ print $2 }'`

# set work file names

tmp="$0.tmp"
log="$0.log"


cat <<EOF | reduce > $log
off echo$
load scope$
on double$
on noconvert$
on rounded$
off int$
off nat$

out "${tmp}"$
optimize mtt_tmp0 :=: ${rhs} iname mtt_tmp$
write "${lhs} := mtt_tmp0"$
shut "${tmp}"$

;end;
EOF











mv ${tmp} ${filename}


exit 0


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