Overview
Comment:Now does matrix version of smxa
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: a82ebd773f2a4b06b1a245c01dabe9ad28a32ac24406635e2cb516f43006301d
User & Date: gawthrop@users.sourceforge.net on 2000-05-18 09:27:07.000
Other Links: branch diff | manifest | tags
Context
2000-05-18
09:39:38
Removed fifth argument from _input check-in: 1fb8f2e128 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
09:27:07
Now does matrix version of smxa check-in: a82ebd773f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-05-17
17:20:49
Fixed bugs with ny>1. Could be made faster by not generating y when
y_sim >1
check-in: f2956c2724 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Heading
date=`date`

cat > $sys_rep.cc <<EOF
#include <octave/oct.h>

DEFUN_DLD ($sys_rep, args, ,
	   "$sys_rep was generated by MTT on $date")
{
  ColumnVector mttx = args(0).vector_value ();
  ColumnVector mttu = args(1).vector_value ();
  double mttt = args(2).double_value ();
  ColumnVector mttpar = args(3).vector_value ();

EOF







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Heading
date=`date`

cat > $sys_rep.cc <<EOF
#include <octave/oct.h>

DEFUN_DLD ($sys_rep, args, ,
	   "Usage: $sys_rep(x,u,t,par)\n$sys_rep was generated by MTT on $date")
{
  ColumnVector mttx = args(0).vector_value ();
  ColumnVector mttu = args(1).vector_value ();
  double mttt = args(2).double_value ();
  ColumnVector mttpar = args(3).vector_value ();

EOF
︙︙
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	echo "  ColumnVector mttdx ($Nx);" >> $sys_rep.cc
	;;
    cseo)
	echo "  ColumnVector mtty ($Ny);" >> $sys_rep.cc
	;;
    smx | smxa | smxax)
        Nxx=`echo "$Nx*$Nx" | bc`
	echo "  ColumnVector mtta ($Nxx);" >> $sys_rep.cc
	echo "  ColumnVector mttax ($Nx);" >> $sys_rep.cc
	;;
    *)
	
esac

#Extract Type info
echo '/* Types */'                >> $sys_rep.cc
grep typedef $sys_rep.C              >> $sys_rep.cc

#Extract the rep code and  converting [] to () and deleting mtt variables etc

echo "/* Representation $rep information */" >> $sys_rep.cc
awk '{
  if ($1=="}") writing=0;
  if ( (writing)&&(match($2,"mtt")!=1) ) print $0;
  if (match($1,"{")==1) writing=1;
}' <$sys_rep.C |\
sed 's/\[\([0-9]*\)\]/(\1)/g' |\
sed 's/\[\(mmtti\)\]/(\1)/g' >> $sys_rep.cc

# Tail
cat >> $sys_rep.cc <<EOF

EOF

case "$rep" in







|










|
>


|
|


|
|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	echo "  ColumnVector mttdx ($Nx);" >> $sys_rep.cc
	;;
    cseo)
	echo "  ColumnVector mtty ($Ny);" >> $sys_rep.cc
	;;
    smx | smxa | smxax)
        Nxx=`echo "$Nx*$Nx" | bc`
	echo "  Matrix mtta ($Nx,$Nx);" >> $sys_rep.cc
	echo "  ColumnVector mttax ($Nx);" >> $sys_rep.cc
	;;
    *)
	
esac

#Extract Type info
echo '/* Types */'                >> $sys_rep.cc
grep typedef $sys_rep.C              >> $sys_rep.cc

#Extract the rep code converting [] to () and deleting mtt variables etc
#The awk part detects the begin and end of the relevant code.
echo "/* Representation $rep information */" >> $sys_rep.cc
awk '{
  if ( (match($1,"}")==1)&&(NF>1)) writing=0;
  if ( (writing) && !(match($2,"mtt[a-z]")==1) ) print $0;
  if (match($1,"{")==1) writing=1;
}' <$sys_rep.C |\
sed 's/\[\([a-z0-9_]*\)\]\[\([a-z0-9_]*\)\]/(\1,\2)/g' |\
sed 's/\[\([a-z_0-9]*\)\]/(\1)/g' >> $sys_rep.cc

# Tail
cat >> $sys_rep.cc <<EOF

EOF

case "$rep" in
︙︙
107
108
109
110
111
112
113

114
115
116
117
	;;
    *)
	
esac

# Terminating }
echo "}" >> $sys_rep.cc;

# Convert to octave loadable code
echo Creating $sys_rep.oct
mkoctfile $sys_rep.cc








>




108
109
110
111
112
113
114
115
116
117
118
119
	;;
    *)
	
esac

# Terminating }
echo "}" >> $sys_rep.cc;

# Convert to octave loadable code
echo Creating $sys_rep.oct
mkoctfile $sys_rep.cc


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