Overview
Comment: | Preliminary support for Matlab dynamically linked shared objects: invoke with: mtt -cc sys rep mexglx ode2odes support is not yet included. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
db3acb3909480e01013a6df0d6545754 |
User & Date: | geraint@users.sourceforge.net on 2002-05-07 23:50:34 |
Other Links: | branch diff | manifest | tags |
Context
2002-05-08
| ||
10:14:21 | Idetification now OK (Moved data range in ppp_optimise by one sample interval) check-in: 2584b3af97 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
2002-05-07
| ||
23:50:34 |
Preliminary support for Matlab dynamically linked shared objects: invoke with: mtt -cc sys rep mexglx ode2odes support is not yet included. check-in: db3acb3909 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
16:28:26 | Trying to fix parameter identification problem ... check-in: 73256b3545 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/mtt from [e0453def2b] to [c87980939a].
︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + + + + | # Copyright (C) 2001 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ ## Revision 1.335 2002/05/01 17:30:55 geraint ## Improved pre-processor directives to better accommodate future alternatives (matlab) ## if necessary. ## ## Revision 1.334 2002/05/01 14:10:22 gawthrop ## Added -dr foo (reads from dir foo) option ## ## Revision 1.333 2002/04/28 18:41:26 geraint ## Fixed [ 549658 ] awk should be gawk. ## Replaced calls to awk with call to gawk. ## |
︙ | |||
1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 | 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 | + + + | rm -f *_rep.tex rm -f *_unique_raw_list *_raw_list rm -f mtt_error.txt mtt_info.txt *_ode2odes.out rm -f *_*_write.r *_simpar.m *_simpar.p rm -f *_cseo.oct *_input.oct *_simpar.oct *_smxax.oct rm -f *_csex.oct *_numpar.oct *_smxa.oct *_state.oct rm -f *_ode.oct *_odeo.oct rm -f *_cseo.mexglx *_input.mexglx *_simpar.mexglx *_smxax.mexglx rm -f *_csex.mexglx *_numpar.mexglx *_smxa.mexglx *_state.mexglx rm -f *_ode.mexglx *_odeo.mexglx rm -f *_cseo.cc *_input.cc *_simpar.cc *_smxax.cc rm -f *_csex.cc *_numpar.cc *_smxa.cc *_state.cc rm -f *_ode.cc *_odeo.cc rm -f *_logic.m *_logic.cc *_logic.oct rm -f *_state.m *_state.cc *_state.oct rm -f *_ode2odes.* *.dat2 MTT.core rm -f *_modpar.txt *_modpar.r |
︙ | |||
1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 | 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 | + + + | rm -f $1_rep.tex rm -f $1_unique_raw_list $1_raw_list rm -f mtt_error.txt mtt_info.txt $1_ode2odes.out rm -f $1_*_write.r $1_simpar.m $1_simpar.p rm -f $1_cseo.oct $1_input.oct $1_simpar.oct $1_smxax.oct rm -f $1_csex.oct $1_numpar.oct $1_smxa.oct $1_state.oct rm -f $1_ode.oct $1_odeo.oct rm -f $1_cseo.mexglx $1_input.mexglx $1_simpar.mexglx $1_smxax.mexglx rm -f $1_csex.mexglx $1_numpar.mexglx $1_smxa.mexglx $1_state.mexglx rm -f $1_ode.mexglx $1_odeo.mexglx rm -f $1_cseo.cc $1_input.cc $1_simpar.cc $1_smxax.cc rm -f $1_csex.cc $1_numpar.cc $1_smxa.cc $1_state.cc rm -f $1_ode.cc $1_odeo.cc rm -f $1_logic.m $1_logic.cc $1_logic.oct rm -f $1_state.m $1_state.cc $1_state.oct rm -f $1_ode2odes.* $1.dat2 rm -f $1_modpar.txt $1_modpar.r |
︙ | |||
2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 | 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 | + + + + + + + | echo Creating $1_\$*.oct; $MKOCTFILE -DCODEGENTARGET=OCTAVEDLD $1_\$*.cc .PRECIOUS: mtt_%.oct mtt_%.oct: mtt_%.cc echo Compiling \$< ${MKOCTFILE} -DCODEGENTARGET=OCTAVEDLD $define_octave_dev \$< ## .mex files $1_%.mexglx: $1_%.cc $1_def.h $1_sympar.h $1_cr.h echo Creating $1_\$*.mexglx ${MTT_CXX} -shared -o $1_\$*.mexglx $1_\$*.cc \ ${MTT_MATLAB_FLAGS} -DCODEGENTARGET=MATLABMEX \ ${MTT_CXXINCS} ${MTT_CXXLIBS} ${MTT_CXXFLAGS} ${MTT_LIB}/cc/mtt_kpathsea.cc ## .cc files .PRECIOUS: %.cc # Don't let mtt delete them $1_%.cc: $1_%.m mtt_m2cc.sh $1 \$* cat mtt_%.cc: ${MTT_LIB}/cc/mtt_%.cc cp ${MTT_LIB}/cc/mtt_\$*.cc mtt_\$*.cc |
︙ |
Modified mttroot/mtt/bin/mttrc from [2c21fd523c] to [72b878e5c8].
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | + + + + | ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.31 2002/05/02 20:12:45 geraint ## Added -Wl,--rpath to MTT_CXXLIBS. Sets the runtime linker path so that the ## sys-admin does not have to ldconfig the octave directory for -cc to work. ## ## Revision 1.30 2002/05/02 11:10:11 geraint ## s/loctave/loctinterp/ ## ## Revision 1.29 2002/05/02 11:03:46 geraint ## Reinstated -liboctinterp and -lncurses; needed by xleftdiv. ## ## Revision 1.28 2002/05/01 12:21:29 geraint |
︙ | |||
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | + + + + + + + + + | # compiler options DEBUG="-g" OPTIM="-O3" FLAGS="-fno-rtti -fno-exceptions -fno-implicit-templates" # matlab flags MATLAB_ARCH="glnx86" MATLAB_ROOT="/usr/local/matlab6p1" MATLAB_FLAGS="-shared -fPIC -ansi -D_GNU_SOURCE -pthread" MATLAB_INCS="-I${MATLAB_ROOT}/extern/include" MATLAB_LIBS="-Wl,--rpath-link,${MATLAB_ROOT}/extern/lib/${MATLAB_ARCH},--rpath-link,${MATLAB_ROOT}/bin/${MATLAB_ARCH} -L${MATLAB_ROOT}/bin/${MATLAB_ARCH} -lmx -lmex -lm" # exported variables export MTT_CXX="g++" export MTT_CXXFLAGS="${DEBUG} ${OPTIM} ${FLAGS}" export MTT_CXXLIBS="${LOCTAVE} ${LSYSTEM}" export MTT_CXXINCS="-I. ${IOCTAVE}" export MTT_LDFLAGS=" " export MTT_MATLAB_FLAGS="${MATLAB_FLAGS} ${MATLAB_INCS} ${MATLAB_LIBS}" fi |
Modified mttroot/mtt/bin/trans/mtt_header from [6bf6a9a964] to [aeb001e855].
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 8 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.46 2002/05/07 13:48:43 geraint ## Improved clarity of code generated for -cc and -oct (except ode2odes). ## Octave DEFUN_DLDs now call (rather than replace) their .cc equivalents. ## ## Revision 1.45 2002/05/02 09:30:22 gawthrop ## _ssim.m now returns t as 4th arg ## ## Revision 1.44 2002/05/01 17:30:56 geraint ## Improved pre-processor directives to better accommodate future alternatives (matlab) ## if necessary. ## |
︙ | |||
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | ;; ColumnVector | Matrix | *) printf " ${arg_type}\t${w}\t= args(${j}).%s ();\n" ${vector_value} ;; esac done } map_mex_inputs () { s=${1:-""} # comma separated input list if [ -z ${s:-""} ];then return; fi c=`get_field ${s} 0` # count of inputs i=0 cat <<EOF if (${c} != nrhs) { std::cerr << "${fun_name} expected " << ${c} << " argument(s): ${s}" << std::endl; return; } EOF while [ ${i} -lt ${c} ]; do j=${i} i=`expr ${i} + 1` w=`get_field ${s} ${i}` # argument name get_arg_specific_stuff ${w} case ${arg_type} in "const double") printf " ${arg_type}\t${w}\t= mtt_double (prhs [${j}]);\n" ;; ColumnVector | Matrix | *) printf " ${arg_type}\t${w}\t= mtt_${arg_type} (prhs [${j}]);\n" ;; esac done } write_oct() { func=${1:-"<insert function name>"} args=${2:-""} cat <<EOF #if (CODEGENTARGET == OCTAVEDLD) DEFUN_DLD (${system}_${rep}, args, , "Usage: [$output] = ${system}_${rep}($args)\nOctave ${rep} representation of system ${system}\nGenerated by MTT on `date`") { static octave_value_list retval; EOF map_oct_inputs ${args} cat <<EOF retval (0) = ${func} (${args}); return (retval); } #endif // (CODEGENTARGET == OCTAVEDLD) EOF } write_mex () { func=${1:-"<insert function name>"} args=${2:-""} cat <<EOF #if (CODEGENTARGET == MATLABMEX) #include "mex.h" Matrix mtt_Matrix (const mxArray *m) { const unsigned long int nrows = mxGetM (m); const unsigned long int ncols = mxGetN (m); Matrix o (nrows, ncols); const double *p = mxGetPr (m); for (unsigned long int row = 0; row < nrows; row++) for (unsigned long int col = 0; col < ncols; col++) o (row, col) = p[row + nrows*col]; return (o); } ColumnVector mtt_ColumnVector (const mxArray *m) { const unsigned long int nrows = mxGetM (m); ColumnVector o (nrows); const double *p = mxGetPr (m); for (unsigned long int row = 0; row < nrows; row++) o (row) = p[row]; return (o); } const double mtt_double (const mxArray *m) { const double *p = mxGetPr (m); return (*p); } mxArray * mtt_mxArray (const Matrix &o) { const unsigned long int nrows = o.rows (); const unsigned long int ncols = o.columns (); mxArray *m; m = mxCreateDoubleMatrix (nrows, ncols, mxREAL); double *p = mxGetPr (m); for (unsigned long int row = 0; row < nrows; row++) for (unsigned long int col = 0; col < ncols; col++) p [row + nrows*col] = o (row, col); return (m); } mxArray * mtt_mxArray (const ColumnVector &o) { const unsigned long int nrows = o.length (); mxArray *m; m = mxCreateDoubleMatrix (nrows, 1, mxREAL); double *p = mxGetPr (m); for (unsigned long int row = 0; row < nrows; row++) p [row] = o (row); return (m); } extern "C" { void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { EOF map_mex_inputs ${args} cat <<EOF plhs[0] = mtt_mxArray (${func} (${args})); } } #endif EOF } # Header information cat<<EOF $modeline $function $declaration $Lc $declaration $Lc System $system, representation $rep, language $language; $Rc |
︙ | |||
861 862 863 864 865 866 867 | 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | - + + | fi if [ ${language} = "oct" ];then # standalone write_cc_header array2constant write_cc_footer |
︙ |