├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── acinclude.m4 ├── aclocal.m4 ├── config.guess ├── config.sub ├── configure ├── configure.ac ├── cronos-scrawls1.pdf ├── data ├── airpass.dat ├── airpass.dat~ ├── ausx9904-nomissing.dat ├── ausx9904.dat ├── cat1.dat ├── cat1.wav ├── djlong.dat ├── dowjones2000.dat ├── fexxr.dat ├── fexxr.txt ├── hdisk.dat ├── lynx.dat ├── maxelec.dat ├── nab02-04.dat ├── nabprice.dat ├── pigs.dat ├── pm252.dat ├── rainfall.dat ├── sunspots.dat ├── wine.dat ├── xrx.dat └── xrx00-03.dat ├── depcomp ├── install-sh ├── libtool ├── ltmain.sh ├── missing ├── reconf └── src ├── Makefile.am ├── Makefile.in ├── main ├── Makefile.am ├── Makefile.in ├── cronos.cc ├── cronos_win.cc ├── cubespline.cc ├── cubespline.h ├── dialogs.cc ├── dialogs.h ├── epsdc.cc ├── epsdc.h ├── farma.xpm ├── fdiff.xpm ├── fegarch.xpm ├── ffore.xpm ├── fgarch.xpm ├── fintegrate.xpm ├── flogs.xpm ├── fmle.xpm ├── fopen.xpm ├── fresids.xpm ├── fsvm.xpm ├── ftreverse.xpm ├── fundo.xpm ├── gc1.xpm ├── includes.h ├── link_win ├── mainicon.ico ├── mainicon.obj ├── mainicon.xcf ├── mainwin.cc ├── mainwin.h ├── newabout.xpm ├── otherplots.cc ├── otherplots.h ├── otherpopups.cc ├── otherpopups.h ├── ots.h ├── rect.h ├── textrender.cc ├── textrender.h ├── transform.cc ├── transform.h ├── tsinterface.cc ├── tsinterface.h ├── tsmrender.cc ├── tsmrender.h ├── xyplot.cc └── xyplot.h └── mslib ├── Makefile.am ├── Makefile.in ├── abrand.cc ├── abrand.h ├── garch.cc ├── garch.h ├── glm.cc ├── glm.h ├── heapsort.h ├── matrix.cc ├── matrix.h ├── poly.cc ├── poly.h ├── svm.cc ├── svm.h ├── timeseries.cc └── timeseries.h /AUTHORS: -------------------------------------------------------------------------------- 1 | Author: 2 | 3 | Anthony Brockwell 4 | abrock@stat.cmu.edu 5 | http://www.stat.cmu.edu/~abrock 6 | 7 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | Version 1.0, July 2004. 2 | ----------------------------------------------------------------- 3 | This version handles basic univariate ARIMA modeling (actually 4 | it just does ARMA modeling, but it allows you to difference the 5 | data before fitting the model, which is functionally equivalent 6 | to fitting an ARIMA model. 7 | 8 | It also handles GARCH modeling. 9 | 10 | Both families of models can be fit using either maximum-likelihood 11 | estimation or Markov chain Monte Carlo methods. The MCMC approach 12 | is not sophisticated at this point. 10000 iterations of a chain are 13 | run, taking posteriors to be uniform over the space of allowable 14 | parameter values (theta, phi), and uninformative (very high 15 | variance) over the variance of the process. 16 | 17 | Parameters can be "held" at specific values when parameter 18 | estimation (either MLE or MCMC) is carried out. This is handled 19 | within the model specification dialog boxes. 20 | 21 | Missing values are allowed. In data files, these are 22 | encoded as NA. 23 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software 2 | Foundation, Inc. 3 | 4 | This file is free documentation; the Free Software Foundation gives 5 | unlimited permission to copy, distribute and modify it. 6 | 7 | Basic Installation 8 | ================== 9 | 10 | These are generic installation instructions, with a few additional 11 | comments (next section) on dependencies for the OSUTSAP package. 12 | 13 | The `configure' shell script attempts to guess correct values for 14 | various system-dependent variables used during compilation. It uses 15 | those values to create a `Makefile' in each directory of the package. 16 | It may also create one or more `.h' files containing system-dependent 17 | definitions. Finally, it creates a shell script `config.status' that 18 | you can run in the future to recreate the current configuration, and a 19 | file `config.log' containing compiler output (useful mainly for 20 | debugging `configure'). 21 | 22 | It can also use an optional file (typically called `config.cache' 23 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 24 | the results of its tests to speed up reconfiguring. (Caching is 25 | disabled by default to prevent problems with accidental use of stale 26 | cache files.) 27 | 28 | If you need to do unusual things to compile the package, please try 29 | to figure out how `configure' could check whether to do them, and mail 30 | diffs or instructions to the address given in the `README' so they can 31 | be considered for the next release. If you are using the cache, and at 32 | some point `config.cache' contains results you don't want to keep, you 33 | may remove or edit it. 34 | 35 | The file `configure.ac' (or `configure.in') is used to create 36 | `configure' by a program called `autoconf'. You only need 37 | `configure.ac' if you want to change it or regenerate `configure' using 38 | a newer version of `autoconf'. 39 | 40 | The simplest way to compile this package is: 41 | 42 | 1. `cd' to the directory containing the package's source code and type 43 | `./configure' to configure the package for your system. If you're 44 | using `csh' on an old version of System V, you might need to type 45 | `sh ./configure' instead to prevent `csh' from trying to execute 46 | `configure' itself. 47 | 48 | Running `configure' takes awhile. While running, it prints some 49 | messages telling which features it is checking for. 50 | 51 | 2. Type `make' to compile the package. 52 | 53 | 3. Optionally, type `make check' to run any self-tests that come with 54 | the package. 55 | 56 | 4. Type `make install' to install the programs and any data files and 57 | documentation. 58 | 59 | 5. You can remove the program binaries and object files from the 60 | source code directory by typing `make clean'. To also remove the 61 | files that `configure' created (so you can compile the package for 62 | a different kind of computer), type `make distclean'. There is 63 | also a `make maintainer-clean' target, but that is intended mainly 64 | for the package's developers. If you use it, you may have to get 65 | all sorts of other programs in order to regenerate files that came 66 | with the distribution. 67 | 68 | Dependencies 69 | ============ 70 | 71 | In order to compile, this program requires the following packages: 72 | 73 | 1. gsl-1.4 (or later) (http://www.gnu.org/software/gsl) 74 | 2. gtkmm-2.4.1 (or later) (http://www.gtkmm.org) 75 | 3. glibmm-2.4.1 (or later) (also http://www.gtkmm.org) 76 | 77 | While the gsl (GNU scientific library) package is pretty much self-contained, 78 | the gtkmm and glibmm libraries have further dependences. If you download 79 | them and install, the ./configure program will tell you if you need to 80 | install further packages. 81 | 82 | To get these libraries working on a Redhat 8 system, I had to 83 | download and install, in order, 84 | 85 | libsigc++-2.03 86 | libiconv-1.9.2 87 | glib-2.4.1 88 | atk-1.6.0 89 | pango-1.4.0 90 | gtk+-2.4.2 91 | glibmm-2.4.1 92 | gtkmm-2.4.1 93 | 94 | Since I didn't have root priveleges on the system, I had to 95 | use 96 | 97 | ./configure --prefix=/home/abrock/local 98 | 99 | with all these packages. Furthermore, when configuring glib-2.4.1, 100 | I had to use 101 | 102 | ./configure --prefix=/home/abrock/local --with-libiconv 103 | 104 | to avoid compile errors. 105 | 106 | If you are running as root, obviously, you can leave out 107 | the --prefix=... option. 108 | 109 | Getting these libraries working on a Fedora Core 2 system was 110 | much easier, since the libraries supplied in the Fedora distribution 111 | were much more up-to-date. I haven't recorded exactly what I did, 112 | but if you start by installing gtkmm and glibmm, you'll find out 113 | what is missing (if anything). 114 | 115 | 116 | 117 | Compilers and Options 118 | ===================== 119 | 120 | Some systems require unusual options for compilation or linking that 121 | the `configure' script does not know about. Run `./configure --help' 122 | for details on some of the pertinent environment variables. 123 | 124 | You can give `configure' initial values for configuration parameters 125 | by setting variables in the command line or in the environment. Here 126 | is an example: 127 | 128 | ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix 129 | 130 | *Note Defining Variables::, for more details. 131 | 132 | Compiling For Multiple Architectures 133 | ==================================== 134 | 135 | You can compile the package for more than one kind of computer at the 136 | same time, by placing the object files for each architecture in their 137 | own directory. To do this, you must use a version of `make' that 138 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 139 | directory where you want the object files and executables to go and run 140 | the `configure' script. `configure' automatically checks for the 141 | source code in the directory that `configure' is in and in `..'. 142 | 143 | If you have to use a `make' that does not support the `VPATH' 144 | variable, you have to compile the package for one architecture at a 145 | time in the source code directory. After you have installed the 146 | package for one architecture, use `make distclean' before reconfiguring 147 | for another architecture. 148 | 149 | Installation Names 150 | ================== 151 | 152 | By default, `make install' will install the package's files in 153 | `/usr/local/bin', `/usr/local/man', etc. You can specify an 154 | installation prefix other than `/usr/local' by giving `configure' the 155 | option `--prefix=PATH'. 156 | 157 | You can specify separate installation prefixes for 158 | architecture-specific files and architecture-independent files. If you 159 | give `configure' the option `--exec-prefix=PATH', the package will use 160 | PATH as the prefix for installing programs and libraries. 161 | Documentation and other data files will still use the regular prefix. 162 | 163 | In addition, if you use an unusual directory layout you can give 164 | options like `--bindir=PATH' to specify different values for particular 165 | kinds of files. Run `configure --help' for a list of the directories 166 | you can set and what kinds of files go in them. 167 | 168 | If the package supports it, you can cause programs to be installed 169 | with an extra prefix or suffix on their names by giving `configure' the 170 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 171 | 172 | Optional Features 173 | ================= 174 | 175 | Some packages pay attention to `--enable-FEATURE' options to 176 | `configure', where FEATURE indicates an optional part of the package. 177 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 178 | is something like `gnu-as' or `x' (for the X Window System). The 179 | `README' should mention any `--enable-' and `--with-' options that the 180 | package recognizes. 181 | 182 | For packages that use the X Window System, `configure' can usually 183 | find the X include and library files automatically, but if it doesn't, 184 | you can use the `configure' options `--x-includes=DIR' and 185 | `--x-libraries=DIR' to specify their locations. 186 | 187 | Specifying the System Type 188 | ========================== 189 | 190 | There may be some features `configure' cannot figure out 191 | automatically, but needs to determine by the type of machine the package 192 | will run on. Usually, assuming the package is built to be run on the 193 | _same_ architectures, `configure' can figure that out, but if it prints 194 | a message saying it cannot guess the machine type, give it the 195 | `--build=TYPE' option. TYPE can either be a short name for the system 196 | type, such as `sun4', or a canonical name which has the form: 197 | 198 | CPU-COMPANY-SYSTEM 199 | 200 | where SYSTEM can have one of these forms: 201 | 202 | OS KERNEL-OS 203 | 204 | See the file `config.sub' for the possible values of each field. If 205 | `config.sub' isn't included in this package, then this package doesn't 206 | need to know the machine type. 207 | 208 | If you are _building_ compiler tools for cross-compiling, you should 209 | use the `--target=TYPE' option to select the type of system they will 210 | produce code for. 211 | 212 | If you want to _use_ a cross compiler, that generates code for a 213 | platform different from the build platform, you should specify the 214 | "host" platform (i.e., that on which the generated programs will 215 | eventually be run) with `--host=TYPE'. 216 | 217 | Sharing Defaults 218 | ================ 219 | 220 | If you want to set default values for `configure' scripts to share, 221 | you can create a site shell script called `config.site' that gives 222 | default values for variables like `CC', `cache_file', and `prefix'. 223 | `configure' looks for `PREFIX/share/config.site' if it exists, then 224 | `PREFIX/etc/config.site' if it exists. Or, you can set the 225 | `CONFIG_SITE' environment variable to the location of the site script. 226 | A warning: not all `configure' scripts look for a site script. 227 | 228 | Defining Variables 229 | ================== 230 | 231 | Variables not defined in a site shell script can be set in the 232 | environment passed to `configure'. However, some packages may run 233 | configure again during the build, and the customized values of these 234 | variables may be lost. In order to avoid this problem, you should set 235 | them in the `configure' command line, using `VAR=value'. For example: 236 | 237 | ./configure CC=/usr/local2/bin/gcc 238 | 239 | will cause the specified gcc to be used as the C compiler (unless it is 240 | overridden in the site shell script). 241 | 242 | `configure' Invocation 243 | ====================== 244 | 245 | `configure' recognizes the following options to control how it 246 | operates. 247 | 248 | `--help' 249 | `-h' 250 | Print a summary of the options to `configure', and exit. 251 | 252 | `--version' 253 | `-V' 254 | Print the version of Autoconf used to generate the `configure' 255 | script, and exit. 256 | 257 | `--cache-file=FILE' 258 | Enable the cache: use and save the results of the tests in FILE, 259 | traditionally `config.cache'. FILE defaults to `/dev/null' to 260 | disable caching. 261 | 262 | `--config-cache' 263 | `-C' 264 | Alias for `--cache-file=config.cache'. 265 | 266 | `--quiet' 267 | `--silent' 268 | `-q' 269 | Do not print messages saying which checks are being made. To 270 | suppress all normal output, redirect it to `/dev/null' (any error 271 | messages will still be shown). 272 | 273 | `--srcdir=DIR' 274 | Look for the package's source code in directory DIR. Usually 275 | `configure' can determine that directory automatically. 276 | 277 | `configure' also accepts some other, not widely useful, options. Run 278 | `configure --help' for more details. 279 | 280 | 281 | 282 | Other Notes: 283 | -------------------- 284 | 285 | muParser: to compile this in msys, for some reason you 286 | have to run 287 | ./configure --??? --??? 288 | so as to disable samples and force it into static mode 289 | 290 | 291 | to make windows icon, you just compile and link it in 292 | unfortunately, I've forgotten how to do it 293 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = reconf data/* libtool src/main/mainicon.* src/main/cronos_win.cc src/main/link_win cronos-scrawls1.pdf 2 | SUBDIRS = src 3 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemedic/cronos/e55ab6b3b7a64a5edb2f7c371fe9461c1bd62d78/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is a place holder for cronos to make it build in a modern C++ compiler. There is no intention to add or remove any featured to it, at least for now. 2 | 3 | But if you feel driven to take it further by adding features; feel free to fork it. 4 | 5 | Please refer to the link below for more details. 6 | http://www.stat.cmu.edu/~abrock/oldcronos/ 7 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([ACX_LAPACK], [ 2 | AC_REQUIRE([ACX_BLAS]) 3 | acx_lapack_ok=no 4 | 5 | AC_ARG_WITH(lapack, 6 | [AC_HELP_STRING([--with-lapack=], [use LAPACK library ])]) 7 | case $with_lapack in 8 | yes | "") ;; 9 | no) acx_lapack_ok=disable ;; 10 | -* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;; 11 | *) LAPACK_LIBS="-l$with_lapack" ;; 12 | esac 13 | 14 | # Get fortran linker name of LAPACK function to check for. 15 | AC_F77_FUNC(cheev) 16 | 17 | # We cannot use LAPACK if BLAS is not found 18 | if test "x$acx_blas_ok" != xyes; then 19 | acx_lapack_ok=noblas 20 | fi 21 | 22 | # First, check LAPACK_LIBS environment variable 23 | if test "x$LAPACK_LIBS" != x; then 24 | save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" 25 | AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) 26 | AC_TRY_LINK_FUNC($cheev, [acx_lapack_ok=yes], [LAPACK_LIBS=""]) 27 | AC_MSG_RESULT($acx_lapack_ok) 28 | LIBS="$save_LIBS" 29 | if test acx_lapack_ok = no; then 30 | LAPACK_LIBS="" 31 | fi 32 | fi 33 | 34 | # LAPACK linked to by default? (is sometimes included in BLAS lib) 35 | if test $acx_lapack_ok = no; then 36 | save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" 37 | AC_CHECK_FUNC($cheev, [acx_lapack_ok=yes]) 38 | LIBS="$save_LIBS" 39 | fi 40 | 41 | # Generic LAPACK library? 42 | for lapack in lapack lapack_rs6k; do 43 | if test $acx_lapack_ok = no; then 44 | save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" 45 | AC_CHECK_LIB($lapack, $cheev, 46 | [acx_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) 47 | LIBS="$save_LIBS" 48 | fi 49 | done 50 | 51 | AC_SUBST(LAPACK_LIBS) 52 | 53 | # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: 54 | if test x"$acx_lapack_ok" = xyes; then 55 | ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) 56 | : 57 | else 58 | acx_lapack_ok=no 59 | $2 60 | fi 61 | ])dnl ACX_LAPACK 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | AC_DEFUN([ACX_BLAS], [ 73 | AC_PREREQ(2.50) 74 | AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) 75 | acx_blas_ok=no 76 | 77 | AC_ARG_WITH(blas, 78 | [AC_HELP_STRING([--with-blas=], [use BLAS library ])]) 79 | case $with_blas in 80 | yes | "") ;; 81 | no) acx_blas_ok=disable ;; 82 | -* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;; 83 | *) BLAS_LIBS="-l$with_blas" ;; 84 | esac 85 | 86 | # Get fortran linker names of BLAS functions to check for. 87 | AC_F77_FUNC(sgemm) 88 | AC_F77_FUNC(dgemm) 89 | 90 | acx_blas_save_LIBS="$LIBS" 91 | LIBS="$LIBS $FLIBS" 92 | 93 | # First, check BLAS_LIBS environment variable 94 | if test $acx_blas_ok = no; then 95 | if test "x$BLAS_LIBS" != x; then 96 | save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" 97 | AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS]) 98 | AC_TRY_LINK_FUNC($sgemm, [acx_blas_ok=yes], [BLAS_LIBS=""]) 99 | AC_MSG_RESULT($acx_blas_ok) 100 | LIBS="$save_LIBS" 101 | fi 102 | fi 103 | 104 | # BLAS linked to by default? (happens on some supercomputers) 105 | if test $acx_blas_ok = no; then 106 | save_LIBS="$LIBS"; LIBS="$LIBS" 107 | AC_CHECK_FUNC($sgemm, [acx_blas_ok=yes]) 108 | LIBS="$save_LIBS" 109 | fi 110 | 111 | # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) 112 | if test $acx_blas_ok = no; then 113 | AC_CHECK_LIB(atlas, ATL_xerbla, 114 | [AC_CHECK_LIB(f77blas, $sgemm, 115 | [AC_CHECK_LIB(cblas, cblas_dgemm, 116 | [acx_blas_ok=yes 117 | BLAS_LIBS="-lcblas -lf77blas -latlas"], 118 | [], [-lf77blas -latlas])], 119 | [], [-latlas])]) 120 | fi 121 | 122 | # BLAS in PhiPACK libraries? (requires generic BLAS lib, too) 123 | if test $acx_blas_ok = no; then 124 | AC_CHECK_LIB(blas, $sgemm, 125 | [AC_CHECK_LIB(dgemm, $dgemm, 126 | [AC_CHECK_LIB(sgemm, $sgemm, 127 | [acx_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"], 128 | [], [-lblas])], 129 | [], [-lblas])]) 130 | fi 131 | 132 | # BLAS in Alpha CXML library? 133 | if test $acx_blas_ok = no; then 134 | AC_CHECK_LIB(cxml, $sgemm, [acx_blas_ok=yes;BLAS_LIBS="-lcxml"]) 135 | fi 136 | 137 | # BLAS in Alpha DXML library? (now called CXML, see above) 138 | if test $acx_blas_ok = no; then 139 | AC_CHECK_LIB(dxml, $sgemm, [acx_blas_ok=yes;BLAS_LIBS="-ldxml"]) 140 | fi 141 | 142 | # BLAS in Sun Performance library? 143 | if test $acx_blas_ok = no; then 144 | if test "x$GCC" != xyes; then # only works with Sun CC 145 | AC_CHECK_LIB(sunmath, acosp, 146 | [AC_CHECK_LIB(sunperf, $sgemm, 147 | [BLAS_LIBS="-xlic_lib=sunperf -lsunmath" 148 | acx_blas_ok=yes],[],[-lsunmath])]) 149 | fi 150 | fi 151 | 152 | # BLAS in SCSL library? (SGI/Cray Scientific Library) 153 | if test $acx_blas_ok = no; then 154 | AC_CHECK_LIB(scs, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lscs"]) 155 | fi 156 | 157 | # BLAS in SGIMATH library? 158 | if test $acx_blas_ok = no; then 159 | AC_CHECK_LIB(complib.sgimath, $sgemm, 160 | [acx_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"]) 161 | fi 162 | 163 | # BLAS in IBM ESSL library? (requires generic BLAS lib, too) 164 | if test $acx_blas_ok = no; then 165 | AC_CHECK_LIB(blas, $sgemm, 166 | [AC_CHECK_LIB(essl, $sgemm, 167 | [acx_blas_ok=yes; BLAS_LIBS="-lessl -lblas"], 168 | [], [-lblas $FLIBS])]) 169 | fi 170 | 171 | # Generic BLAS library? 172 | if test $acx_blas_ok = no; then 173 | AC_CHECK_LIB(blas, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lblas"]) 174 | fi 175 | 176 | AC_SUBST(BLAS_LIBS) 177 | 178 | LIBS="$acx_blas_save_LIBS" 179 | 180 | # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: 181 | if test x"$acx_blas_ok" = xyes; then 182 | ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1]) 183 | : 184 | else 185 | acx_blas_ok=no 186 | $2 187 | fi 188 | ])dnl ACX_BLAS 189 | 190 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT([cronos],[1.40],[Anthony Brockwell ]) 2 | AM_INIT_AUTOMAKE 3 | 4 | 5 | ######################################################################### 6 | # Dependency checks 7 | ######################################################################### 8 | gtkmm_min_glibmm_version=2.4.0 9 | gtkmm_min_gtk_version=2.4.0 10 | 11 | 12 | GLIBMM_PREFIX=`pkg-config --variable=prefix glibmm-2.4` 13 | GMMPROC_DIR=$GLIBMM_PREFIX/lib/glibmm-2.4/proc 14 | AC_SUBST(GMMPROC_DIR) 15 | GMMPROC=$GMMPROC_DIR/gmmproc 16 | AC_SUBST(GMMPROC) 17 | 18 | 19 | PKG_CHECK_MODULES(ATKMM, glibmm-2.4 >= ${gtkmm_min_glibmm_version} atk >= 1.6.0) 20 | AC_SUBST(ATKMM_CFLAGS) 21 | AC_SUBST(ATKMM_LIBS) 22 | 23 | PKG_CHECK_MODULES(PANGOMM, glibmm-2.4 >= ${gtkmm_min_glibmm_version} pango >= 1.4.0) 24 | AC_SUBST(PANGOMM_CFLAGS) 25 | AC_SUBST(PANGOMM_LIBS) 26 | 27 | PKG_CHECK_MODULES(GDKMM, glibmm-2.4 >= ${gtkmm_min_glibmm_version} gtk+-2.0 >= ${gtkmm_min_gtk_version}) 28 | AC_SUBST(GDKMM_CFLAGS) 29 | AC_SUBST(GDKMM_LIBS) 30 | 31 | PKG_CHECK_MODULES(GTKMM, glibmm-2.4 >= ${gtkmm_min_glibmm_version} gtk+-2.0 >= ${gtkmm_min_gtk_version} gtkmm-2.4 >= 2.4.0 ) 32 | AC_SUBST(GTKMM_CFLAGS) 33 | AC_SUBST(GTKMM_LIBS) 34 | 35 | AM_PATH_GSL(1.6,,[AC_MSG_ERROR([could not find required version of GSL])]) 36 | 37 | PKG_CHECK_MODULES(MUPARSER, muparser >= 1.25) 38 | 39 | #AC_CHECK_LIB(lapack, dsyev_,,[AC_MSG_ERROR([Unable to locate LAPACK.])]) 40 | 41 | AC_CONFIG_FILES([Makefile src/Makefile src/main/Makefile src/mslib/Makefile]) 42 | AC_PROG_RANLIB 43 | AC_PROG_CXX 44 | AC_OUTPUT 45 | -------------------------------------------------------------------------------- /cronos-scrawls1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemedic/cronos/e55ab6b3b7a64a5edb2f7c371fe9461c1bd62d78/cronos-scrawls1.pdf -------------------------------------------------------------------------------- /data/airpass.dat: -------------------------------------------------------------------------------- 1 | % 2 | % Title: Airline Passengers 3 | % Description: This time series contains monthly totals of international airline passengers%from Jan. 1949 to Dec. 1960 (from Box & Jenkins, 1976). 4 | % Starttime: 19490100.0 5 | % Timeunits: 100.0 6 | % Timedisplay: 10000.0 2 7 | % 8 | 112 9 | 118 10 | 132 11 | 129 12 | 121 13 | 135 14 | 148 15 | 148 16 | 136 17 | 119 18 | 104 19 | 118 20 | 115 21 | 126 22 | 141 23 | 135 24 | 125 25 | 149 26 | 170 27 | 170 28 | 158 29 | 133 30 | 114 31 | 140 32 | 145 33 | 150 34 | 178 35 | 163 36 | 172 37 | 178 38 | 199 39 | 199 40 | 184 41 | 162 42 | 146 43 | 166 44 | 171 45 | 180 46 | 193 47 | 181 48 | 183 49 | 218 50 | 230 51 | 242 52 | 209 53 | 191 54 | 172 55 | 194 56 | 196 57 | 196 58 | 236 59 | 235 60 | 229 61 | 243 62 | 264 63 | 272 64 | 237 65 | 211 66 | 180 67 | 201 68 | 204 69 | 188 70 | 235 71 | 227 72 | 234 73 | 264 74 | 302 75 | 293 76 | 259 77 | 229 78 | 203 79 | 229 80 | 242 81 | 233 82 | 267 83 | 269 84 | 270 85 | 315 86 | 364 87 | 347 88 | 312 89 | 274 90 | 237 91 | 278 92 | 284 93 | 277 94 | 317 95 | 313 96 | 318 97 | 374 98 | 413 99 | 405 100 | 355 101 | 306 102 | 271 103 | 306 104 | 315 105 | 301 106 | 356 107 | 348 108 | 355 109 | 422 110 | 465 111 | 467 112 | 404 113 | 347 114 | 305 115 | 336 116 | 340 117 | 318 118 | 362 119 | 348 120 | 363 121 | 435 122 | 491 123 | 505 124 | 404 125 | 359 126 | 310 127 | 337 128 | 360 129 | 342 130 | 406 131 | 396 132 | 420 133 | 472 134 | 548 135 | 559 136 | 463 137 | 407 138 | 362 139 | 405 140 | 417 141 | 391 142 | 419 143 | 461 144 | 472 145 | 535 146 | 622 147 | 606 148 | 508 149 | 461 150 | 390 151 | 432 152 | -------------------------------------------------------------------------------- /data/airpass.dat~: -------------------------------------------------------------------------------- 1 | % 2 | % Title: Airline Passengers 3 | % Description: This time series contains monthly totals of international airline passengers%from Jan. 1949 to Dec. 1960 (from Box & Jenkins, 1976). 4 | % Starttime: 19490100.0 5 | % Timeunits: 100.0 6 | % Timedisplay: 10000.0 2 7 | % 8 | 112 9 | 118 10 | 132 11 | 129 12 | 121 13 | 135 14 | 148 15 | 148 16 | 136 17 | 119 18 | 104 19 | 118 20 | 115 21 | 126 22 | 141 23 | 135 24 | 125 25 | 149 26 | 170 27 | 170 28 | 158 29 | 133 30 | 114 31 | 140 32 | 145 33 | 150 34 | 178 35 | 163 36 | 172 37 | 178 38 | 199 39 | 199 40 | 184 41 | 162 42 | 146 43 | 166 44 | 171 45 | 180 46 | 193 47 | 181 48 | 183 49 | 218 50 | 230 51 | 242 52 | 209 53 | 191 54 | 172 55 | 194 56 | 196 57 | 196 58 | 236 59 | 235 60 | 229 61 | 243 62 | 264 63 | 272 64 | 237 65 | 211 66 | 180 67 | 201 68 | 204 69 | 188 70 | 235 71 | 227 72 | 234 73 | 264 74 | 302 75 | 293 76 | 259 77 | 229 78 | 203 79 | 229 80 | 242 81 | 233 82 | 267 83 | 269 84 | 270 85 | 315 86 | 364 87 | 347 88 | 312 89 | 274 90 | 237 91 | 278 92 | 284 93 | 277 94 | 317 95 | 313 96 | 318 97 | 374 98 | 413 99 | 405 100 | 355 101 | 306 102 | 271 103 | 306 104 | 315 105 | 301 106 | 356 107 | 348 108 | 355 109 | 422 110 | 465 111 | 467 112 | 404 113 | 347 114 | 305 115 | 336 116 | 340 117 | 318 118 | 362 119 | 348 120 | 363 121 | 435 122 | 491 123 | 505 124 | 404 125 | 359 126 | 310 127 | 337 128 | 360 129 | 342 130 | 406 131 | 396 132 | 420 133 | 472 134 | 548 135 | 559 136 | 463 137 | 407 138 | 362 139 | 405 140 | 417 141 | 391 142 | 419 143 | 461 144 | 472 145 | 535 146 | 622 147 | 606 148 | 508 149 | 461 150 | 390 151 | 432 152 | -------------------------------------------------------------------------------- /data/cat1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemedic/cronos/e55ab6b3b7a64a5edb2f7c371fe9461c1bd62d78/data/cat1.wav -------------------------------------------------------------------------------- /data/dowjones2000.dat: -------------------------------------------------------------------------------- 1 | % 2 | % Title: Dow Jones Industrial Average 3 | % Description: Closing values on trading days during the year 2000. 4 | % 5 | 11357.51 6 | 10997.93 7 | 11122.65 8 | 11253.26 9 | 11522.56 10 | 11572.2 11 | 11511.08 12 | 11551.1 13 | 11582.43 14 | 11722.98 15 | 11722.98 16 | 11560.72 17 | 11489.36 18 | 11351.3 19 | 11251.71 20 | 11008.17 21 | 11029.89 22 | 11032.99 23 | 11028.02 24 | 10738.87 25 | 10940.53 26 | 11041.05 27 | 11003.2 28 | 11013.44 29 | 10963.8 30 | 10905.79 31 | 10957.6 32 | 10699.16 33 | 10643.63 34 | 10425.21 35 | 10519.84 36 | 10718.09 37 | 10561.41 38 | 10514.57 39 | 10219.52 40 | 10219.52 41 | 10304.84 42 | 10225.73 43 | 10092.63 44 | 9862.12 45 | 10038.65 46 | 10128.31 47 | 10137.93 48 | 10164.92 49 | 10367.2 50 | 10170.5 51 | 9796.03 52 | 9856.53 53 | 10010.73 54 | 9928.82 55 | 9947.13 56 | 9811.24 57 | 10131.41 58 | 10630.6 59 | 10595.23 60 | 10680.24 61 | 10907.34 62 | 10866.7 63 | 11119.86 64 | 11112.72 65 | 11025.85 66 | 10936.11 67 | 11020.27 68 | 10980.25 69 | 10921.92 70 | 11221.93 71 | 11164.84 72 | 11033.92 73 | 11114.27 74 | 11111.48 75 | 11186.56 76 | 11287.08 77 | 11125.13 78 | 10923.55 79 | 10305.77 80 | 10582.51 81 | 10767.42 82 | 10674.96 83 | 10844.05 84 | 10844.05 85 | 10906.1 86 | 11124.82 87 | 10945.5 88 | 10888.1 89 | 10733.91 90 | 10811.78 91 | 10731.12 92 | 10480.13 93 | 10412.49 94 | 10577.86 95 | 10603.63 96 | 10536.75 97 | 10367.78 98 | 10545.97 99 | 10609.37 100 | 10807.78 101 | 10934.57 102 | 10769.74 103 | 10777.28 104 | 10626.85 105 | 10542.55 106 | 10422.27 107 | 10535.35 108 | 10323.92 109 | 10299.24 110 | 10299.24 111 | 10527.13 112 | 10522.33 113 | 10652.2 114 | 10794.76 115 | 10815.3 116 | 10735.57 117 | 10812.86 118 | 10668.72 119 | 10614.06 120 | 10564.21 121 | 10621.84 122 | 10687.95 123 | 10714.82 124 | 10449.3 125 | 10557.84 126 | 10435.16 127 | 10497.74 128 | 10376.12 129 | 10404.75 130 | 10542.99 131 | 10504.46 132 | 10527.79 133 | 10398.04 134 | 10447.89 135 | 10560.67 136 | 10560.67 137 | 10483.6 138 | 10481.47 139 | 10635.98 140 | 10646.58 141 | 10727.19 142 | 10783.76 143 | 10788.71 144 | 10812.75 145 | 10804.27 146 | 10739.92 147 | 10696.08 148 | 10843.87 149 | 10733.56 150 | 10685.12 151 | 10699.97 152 | 10516.48 153 | 10586.13 154 | 10511.17 155 | 10521.98 156 | 10606.95 157 | 10687.53 158 | 10706.58 159 | 10767.75 160 | 10867.01 161 | 10976.89 162 | 10905.83 163 | 10908.76 164 | 11027.8 165 | 11176.14 166 | 11067 167 | 11008.39 168 | 11055.64 169 | 11046.48 170 | 11079.81 171 | 11139.15 172 | 11144.65 173 | 11182.74 174 | 11192.63 175 | 11252.84 176 | 11215.1 177 | 11103.01 178 | 11215.1 179 | 11238.78 180 | 11238.78 181 | 11260.61 182 | 11310.64 183 | 11259.87 184 | 11220.65 185 | 11195.49 186 | 11233.23 187 | 11182.18 188 | 11087.47 189 | 10927 190 | 10808.52 191 | 10789.29 192 | 10687.92 193 | 10765.52 194 | 10847.37 195 | 10808.15 196 | 10631.32 197 | 10628.36 198 | 10824.06 199 | 10650.92 200 | 10700.13 201 | 10719.74 202 | 10784.48 203 | 10724.92 204 | 10596.54 205 | 10568.43 206 | 10524.4 207 | 10413.79 208 | 10034.58 209 | 10192.18 210 | 10238.8 211 | 10089.71 212 | 9975.02 213 | 10142.98 214 | 10226.59 215 | 10271.72 216 | 10393.07 217 | 10326.48 218 | 10380.12 219 | 10590.62 220 | 10835.77 221 | 10971.14 222 | 10899.47 223 | 10880.51 224 | 10817.95 225 | 10977.21 226 | 10952.18 227 | 10907.06 228 | 10834.25 229 | 10603 230 | 10517.3 231 | 10681.1 232 | 10707.6 233 | 10656 234 | 10629.9 235 | 10462.7 236 | 10494.5 237 | 10399.3 238 | 10470.2 239 | 10546.1 240 | 10507.6 241 | 10629.1 242 | 10414.5 243 | 10373.5 244 | 10561 245 | 10898.7 246 | 10664.4 247 | 10617.4 248 | 10712.9 249 | 10725.8 250 | 10768.3 251 | 10794.4 252 | 10675 253 | 10435 254 | 10645.4 255 | 10584.4 256 | 10318.9 257 | 10487.3 258 | 10635.6 259 | 10692.4 260 | 10803.2 261 | 10868.8 262 | 10788 263 | 10646.2 264 | 10945.8 265 | -------------------------------------------------------------------------------- /data/fexxr.txt: -------------------------------------------------------------------------------- 1 | Anthony, 2 | 3 | Attached please find the data I used for my thesis. There are 6 4 | columns in the data set, and they correspond to the log-daily-returns of 5 | the Deutsche mark/USD, Swiss Franc/USD, British Pound/USD, Sweden 6 | Krona/USD, Japanese Yen/USD, and Australia dollar/USD. The data starts 7 | from Jan 03, 1994 and ends at Sep 12, 2001, a total of 1927 trading days. 8 | Please let know if there is any information I could provide further. 9 | 10 | Cheers, 11 | Philip 12 | -------------------------------------------------------------------------------- /data/lynx.dat: -------------------------------------------------------------------------------- 1 | % 2 | % Title: Lynx Trappings 3 | % Description: Annual Canadian lynx trappings (number of animals trapped each year) as recorded by the Hudson Bay Company from 1821 to 1934. 4 | % 5 | 269 6 | 321 7 | 585 8 | 871 9 | 1475 10 | 2821 11 | 3928 12 | 5943 13 | 4950 14 | 2577 15 | 523 16 | 98 17 | 184 18 | 279 19 | 409 20 | 2285 21 | 2685 22 | 3409 23 | 1824 24 | 409 25 | 151 26 | 45 27 | 68 28 | 213 29 | 546 30 | 1033 31 | 2129 32 | 2536 33 | 957 34 | 361 35 | 377 36 | 225 37 | 360 38 | 731 39 | 1638 40 | 2725 41 | 2871 42 | 2119 43 | 684 44 | 299 45 | 236 46 | 245 47 | 552 48 | 1623 49 | 3311 50 | 6721 51 | 4254 52 | 687 53 | 255 54 | 473 55 | 358 56 | 784 57 | 1594 58 | 1676 59 | 2251 60 | 1426 61 | 756 62 | 299 63 | 201 64 | 229 65 | 469 66 | 736 67 | 2042 68 | 2811 69 | 4431 70 | 2511 71 | 389 72 | 73 73 | 39 74 | 49 75 | 59 76 | 188 77 | 377 78 | 1292 79 | 4031 80 | 3495 81 | 587 82 | 105 83 | 153 84 | 387 85 | 758 86 | 1307 87 | 3465 88 | 6991 89 | 6313 90 | 3794 91 | 1836 92 | 345 93 | 382 94 | 808 95 | 1388 96 | 2713 97 | 3800 98 | 3091 99 | 2985 100 | 3790 101 | 674 102 | 81 103 | 80 104 | 108 105 | 229 106 | 399 107 | 1132 108 | 2432 109 | 3574 110 | 2935 111 | 1537 112 | 529 113 | 485 114 | 662 115 | 1000 116 | 1590 117 | 2657 118 | 3396 119 | -------------------------------------------------------------------------------- /data/nab02-04.dat: -------------------------------------------------------------------------------- 1 | % 2 | % Title: National Australia Bank share prices 3 | % Description: NAB share prices, from Feb. 9th, 2002 to Aug. 10th, 2004. 4 | % 5 | 34.85 6 | 35.1 7 | 34.75 8 | 35.17 9 | 35.25 10 | 35.5 11 | 35.42 12 | 35.69 13 | 35.78 14 | 35.93 15 | 35.88 16 | 35.92 17 | 35.4 18 | 35.52 19 | 35.3 20 | 35.35 21 | 35.17 22 | 34.47 23 | 34.04 24 | 33.9 25 | 33.48 26 | 33.87 27 | 34 28 | 34.09 29 | 33.83 30 | 33.21 31 | 32.91 32 | 32.35 33 | 31.4 34 | 31.6 35 | 32.25 36 | 33.18 37 | 32.68 38 | 32.17 39 | 32.4 40 | 32.4 41 | 32.99 42 | 33.6 43 | 33.49 44 | 33.1 45 | 33.56 46 | 33.37 47 | 33.65 48 | 34.37 49 | 33.79 50 | 34.3 51 | 33.95 52 | 33.86 53 | 32.02 54 | 32.19 55 | 32.05 56 | 32.4 57 | 32.57 58 | 32.7 59 | 33.17 60 | 32.5 61 | 32.22 62 | 32.2 63 | 32.63 64 | 32.85 65 | 33.45 66 | 33.26 67 | 32.94 68 | 33.27 69 | 32.75 70 | 33.18 71 | 33.3 72 | 32.95 73 | 33.46 74 | 33.03 75 | 33 76 | 32.29 77 | 31.62 78 | 32.01 79 | 31.55 80 | 31.55 81 | 31.03 82 | 31.5 83 | 31.65 84 | 32.14 85 | 32.41 86 | 32.45 87 | 32.45 88 | 32.45 89 | 32.16 90 | 31.66 91 | 31.75 92 | 31.75 93 | 31.91 94 | 31.91 95 | 32.62 96 | 32.51 97 | 32.65 98 | 32.38 99 | 32.28 100 | 32.12 101 | 32.35 102 | 32.39 103 | 32.08 104 | 32.13 105 | 32.35 106 | 32.4 107 | 32.21 108 | 32.38 109 | 32.48 110 | 32.48 111 | 31.95 112 | 31.48 113 | 31.78 114 | 31.7 115 | 31.55 116 | 31.53 117 | 31.35 118 | 30.55 119 | 30.36 120 | 30.29 121 | 30.32 122 | 30.2 123 | 29.53 124 | 28.85 125 | 29.32 126 | 29.26 127 | 29.44 128 | 28.8 129 | 29.26 130 | 29.7 131 | 29.02 132 | 29.57 133 | 29.03 134 | 28.9 135 | 29.42 136 | 29.15 137 | 28.7 138 | 29.2 139 | 29.06 140 | 28.85 141 | 28.7 142 | 28.6 143 | 28.55 144 | 29.4 145 | 29.06 146 | 30.68 147 | 30.68 148 | 30.93 149 | 30.85 150 | 30.9 151 | 31.14 152 | 32.06 153 | 32.24 154 | 32.05 155 | 31.95 156 | 32.45 157 | 32.35 158 | 32.4 159 | 32.61 160 | 33.2 161 | 33.2 162 | 32.75 163 | 33 164 | 32.2 165 | 31.92 166 | 32.21 167 | 32.25 168 | 32.09 169 | 32.09 170 | 32.09 171 | 32.5 172 | 32.91 173 | 32.85 174 | 32.85 175 | 32.78 176 | 32.88 177 | 32.5 178 | 32.46 179 | 31.84 180 | 32.05 181 | 31.85 182 | 32.07 183 | 31.62 184 | 31.19 185 | 31.65 186 | 31.32 187 | 31.6 188 | 31.97 189 | 32.08 190 | 32.05 191 | 31.9 192 | 31.9 193 | 32.04 194 | 32.42 195 | 32.45 196 | 32.46 197 | 32.75 198 | 32.98 199 | 33.1 200 | 33.47 201 | 33.45 202 | 33.7 203 | 33.85 204 | 33.03 205 | 33.03 206 | 33.38 207 | 33.75 208 | 33.7 209 | 33.7 210 | 33.82 211 | 34.2 212 | 34.11 213 | 34.1 214 | 34.03 215 | 34.1 216 | 34.21 217 | 34.31 218 | 33.7 219 | 33.7 220 | 33.5 221 | 33.8 222 | 33.78 223 | 34.11 224 | 33.6 225 | 33.48 226 | 32.91 227 | 32.46 228 | 32.27 229 | 32.3 230 | 32.63 231 | 32.7 232 | 32.74 233 | 32.55 234 | 32.31 235 | 32.41 236 | 32.31 237 | 32.48 238 | 32.18 239 | 32 240 | 32.15 241 | 32.55 242 | 32.4 243 | 32.65 244 | 32.51 245 | 32.4 246 | 32.65 247 | 32.56 248 | 32.76 249 | 32.93 250 | 32.88 251 | 32.85 252 | 32.84 253 | 32.88 254 | 32.95 255 | 33.04 256 | 32.59 257 | 32.52 258 | 32.65 259 | 32.58 260 | 32.4 261 | 31.93 262 | 32.22 263 | 31.35 264 | 31.09 265 | 30.8 266 | 31 267 | 30.72 268 | 30.79 269 | 30.74 270 | 31.11 271 | 31 272 | 30.82 273 | 30.79 274 | 30.71 275 | 30.65 276 | 30.45 277 | 30.6 278 | 31.04 279 | 30.72 280 | 30.6 281 | 30.36 282 | 30.49 283 | 30.35 284 | 30.54 285 | 30.6 286 | 30.8 287 | 30.96 288 | 31.43 289 | 31.3 290 | 31.26 291 | 31.1 292 | 31.48 293 | 31.38 294 | 31 295 | 30.99 296 | 30.85 297 | 31.12 298 | 30.98 299 | 31.14 300 | 31.27 301 | 31.41 302 | 31.44 303 | 31.18 304 | 31.06 305 | 30.92 306 | 30.92 307 | 30.94 308 | 30.85 309 | 30.59 310 | 30.25 311 | 30.39 312 | 30.26 313 | 29.84 314 | 30.03 315 | 29.72 316 | 29.1 317 | 29.5 318 | 29.88 319 | 29.63 320 | 28.64 321 | 28.73 322 | 29.31 323 | 29.33 324 | 29.26 325 | 29.31 326 | 29.38 327 | 29.49 328 | 29.26 329 | 28.92 330 | 28.77 331 | 28.92 332 | 29.35 333 | 30.13 334 | 29.99 335 | 29.95 336 | 30.05 337 | 30.01 338 | 29.9 339 | 29.98 340 | 30.05 341 | 29.82 342 | 29.93 343 | 29.51 344 | 29.35 345 | 29.41 346 | 29.56 347 | 29.77 348 | 29.77 349 | 29.77 350 | 29.8 351 | 29.88 352 | 29.95 353 | 29.95 354 | 29.92 355 | 29.42 356 | 29.54 357 | 29.84 358 | 30.03 359 | 30.17 360 | 30.52 361 | 30.05 362 | 30.46 363 | 30.3 364 | 29.92 365 | 29.84 366 | 29.54 367 | 29.2 368 | 29.54 369 | 29.59 370 | 29.59 371 | 29.45 372 | 30.4 373 | 30.3 374 | 30.56 375 | 31.02 376 | 30.94 377 | 31.01 378 | 30.6 379 | 30.43 380 | 30.57 381 | 30.31 382 | 30.41 383 | 30.61 384 | 30.73 385 | 30.52 386 | 30.7 387 | 30.94 388 | 30.91 389 | 30.88 390 | 30.69 391 | 30.8 392 | 30.87 393 | 30.83 394 | 30.9 395 | 31 396 | 31.03 397 | 31.06 398 | 31.37 399 | 31.44 400 | 31.78 401 | 31.94 402 | 31.92 403 | 31.84 404 | 31.6 405 | 31.65 406 | 31.71 407 | 31.76 408 | 31.72 409 | 31.8 410 | 31.47 411 | 31.45 412 | 31.36 413 | 31.14 414 | 31.45 415 | 31.16 416 | 31.11 417 | 31 418 | 31.21 419 | 31 420 | 31.17 421 | 31.47 422 | 31.45 423 | 31.4 424 | 31.4 425 | 31.4 426 | 31.25 427 | 31.16 428 | 31.02 429 | 29.71 430 | 29.64 431 | 29.57 432 | 29.6 433 | 29.67 434 | 29.7 435 | 29.57 436 | 29.47 437 | 29.44 438 | 29.4 439 | 29.47 440 | 29.45 441 | 29.4 442 | 29.25 443 | 29.1 444 | 29.37 445 | 29.07 446 | 29.3 447 | 29.07 448 | 28.76 449 | 28.55 450 | 28.61 451 | 28.55 452 | 29.21 453 | 29.22 454 | 29.3 455 | 29.34 456 | 29.17 457 | 29.38 458 | 29.58 459 | 30.1 460 | 30.2 461 | 30.19 462 | 30.28 463 | 30.3 464 | 30.31 465 | 29.72 466 | 29.67 467 | 29.47 468 | 29.36 469 | 29.31 470 | 29.31 471 | 29.08 472 | 29.13 473 | 29.11 474 | 29.29 475 | 29.74 476 | 29.95 477 | 29.99 478 | 30.04 479 | 29.86 480 | 29.88 481 | 29.87 482 | 29.84 483 | 30.14 484 | 30.16 485 | 30.3 486 | 30.63 487 | 30.6 488 | 30.75 489 | 30.85 490 | 30.87 491 | 30.98 492 | 28.85 493 | 28.45 494 | 28.34 495 | 28 496 | 27.48 497 | 27.8 498 | 27.16 499 | 26.87 500 | 27.1 501 | 26.75 502 | 26.59 503 | 26.48 504 | 26.67 505 | 26.8 506 | 26.98 507 | 26.62 508 | 26.33 509 | 26.47 510 | 26.24 511 | 26.12 512 | -------------------------------------------------------------------------------- /data/nabprice.dat: -------------------------------------------------------------------------------- 1 | % 2 | % Title: National Australia Bank Share Prices 3 | % Description: These are daily closing values of the National Australia Bank%on the Australian Stock Exchange (in Australian dollars)%from Jan. 2, 1999 to Dec. 29, 2000. 4 | % 5 | 26.874 6 | 26.68 7 | 26.6 8 | 26.7 9 | 26.4 10 | 25.909 11 | 25.85 12 | 25.465 13 | 25.694 14 | 26.353 15 | 26.35 16 | 26.35 17 | 26.367 18 | 26.32 19 | 26.62 20 | 26.44 21 | 26.89 22 | 27.29 23 | 27.17 24 | 26.85 25 | 27.3 26 | 27.092 27 | 26.95 28 | 26.915 29 | 27.35 30 | 27.785 31 | 27.889 32 | 28.1 33 | 28.35 34 | 28.056 35 | 28.395 36 | 28.49 37 | 28.09 38 | 27.98 39 | 28.35 40 | 28.42 41 | 28.53 42 | 28.26 43 | 28.392 44 | 28.409 45 | 27.96 46 | 28.497 47 | 28.65 48 | 28.7 49 | 28.7 50 | 28.7 51 | 28.8 52 | 28.75 53 | 28.8 54 | 28.9 55 | 28.8 56 | 29.29 57 | 29.49 58 | 29.65 59 | 29.606 60 | 29.336 61 | 29.2 62 | 29.43 63 | 30.14 64 | 30.043 65 | 29.88 66 | 29.9 67 | 29.706 68 | 29.61 69 | 29.42 70 | 29 71 | 28.74 72 | 28.06 73 | 27.5 74 | 25.79 75 | 25.95 76 | 25.75 77 | 25.7 78 | 26.189 79 | 26.7 80 | 25.5 81 | 25.57 82 | 25.208 83 | 25.04 84 | 25.252 85 | 25.252 86 | 24.611 87 | 24.848 88 | 24.93 89 | 24.812 90 | 25.459 91 | 25.87 92 | 25.75 93 | 26 94 | 25.953 95 | 26.6 96 | 26.244 97 | 26.41 98 | 26.12 99 | 25.4 100 | 25.4 101 | 25.105 102 | 24.94 103 | 25.771 104 | 26.04 105 | 26 106 | 25.86 107 | 25.84 108 | 25.45 109 | 25.236 110 | 24.94 111 | 25.44 112 | 25 113 | 25.05 114 | 25.08 115 | 25.278 116 | 25.05 117 | 24.91 118 | 24.59 119 | 24.15 120 | 24.2 121 | 24.378 122 | 24.041 123 | 24.15 124 | 23.993 125 | 24.1 126 | 24.5 127 | 25 128 | 24.783 129 | 24.37 130 | 24.158 131 | 24.19 132 | 24.083 133 | 23.99 134 | 23.4 135 | 23.09 136 | 23.45 137 | 23.293 138 | 23.33 139 | 23.2 140 | 22.8 141 | 22.43 142 | 22.529 143 | 22.79 144 | 23.088 145 | 23.794 146 | 23.4 147 | 23.57 148 | 23.7 149 | 23.56 150 | 24 151 | 24.285 152 | 24.342 153 | 24.7 154 | 24.72 155 | 24.487 156 | 23.69 157 | 24.19 158 | 24.2 159 | 23.62 160 | 24.339 161 | 24.03 162 | 24.209 163 | 23.89 164 | 23.5 165 | 23.05 166 | 23.256 167 | 22.75 168 | 22.19 169 | 22.09 170 | 21.908 171 | 21.79 172 | 22.35 173 | 22.97 174 | 22.7 175 | 23 176 | 23.162 177 | 22.883 178 | 22.431 179 | 23.1 180 | 22.95 181 | 22.95 182 | 22.6 183 | 22.92 184 | 23.1 185 | 23.6 186 | 23.65 187 | 23.54 188 | 23.505 189 | 23.087 190 | 22.227 191 | 22.23 192 | 22.641 193 | 22.53 194 | 22.408 195 | 22.73 196 | 22.565 197 | 22.58 198 | 23.02 199 | 24.2 200 | 24.89 201 | 24.86 202 | 25.44 203 | 24.45 204 | 23.55 205 | 23.715 206 | 23.8 207 | 24.13 208 | 24.27 209 | 24.071 210 | 24.009 211 | 23.915 212 | 24.05 213 | 24.24 214 | 24.4 215 | 23.767 216 | 23.64 217 | 23.25 218 | 23.22 219 | 23.28 220 | 23.055 221 | 22.7 222 | 22.777 223 | 23 224 | 22.98 225 | 22.94 226 | 22.7 227 | 22.76 228 | 22.74 229 | 22.72 230 | 22.9 231 | 22.92 232 | 22.97 233 | 23.05 234 | 23.02 235 | 23.16 236 | 23.1 237 | 23.17 238 | 23.04 239 | 23.12 240 | 23.12 241 | 23.12 242 | 23.2 243 | 23.3 244 | 23.3 245 | 23.3 246 | 22.5 247 | 22.05 248 | 21.7 249 | 21.89 250 | 22.2 251 | 21.8 252 | 21.63 253 | 21.43 254 | 21.906 255 | 23.01 256 | 23.35 257 | 22.95 258 | 22.526 259 | 22.06 260 | 22.7 261 | 22.28 262 | 22.28 263 | 21.791 264 | 22.16 265 | 21.831 266 | 21.78 267 | 21.97 268 | 21.598 269 | 21.73 270 | 21.9 271 | 21.8 272 | 21.92 273 | 21.84 274 | 21.67 275 | 21.3 276 | 21.281 277 | 20.79 278 | 20.539 279 | 20.4 280 | 20.25 281 | 20.03 282 | 19.9 283 | 19.99 284 | 20.791 285 | 20.8 286 | 21.4 287 | 22.106 288 | 22.273 289 | 21.442 290 | 20.95 291 | 21.34 292 | 20.83 293 | 20.08 294 | 20.38 295 | 20.16 296 | 20.56 297 | 20.8 298 | 21.1 299 | 20.83 300 | 20.857 301 | 21.24 302 | 21.77 303 | 21.8 304 | 21.905 305 | 21.35 306 | 21.351 307 | 21.539 308 | 21.33 309 | 21.18 310 | 21.85 311 | 22.47 312 | 23.25 313 | 23.25 314 | 22.65 315 | 23.171 316 | 23.985 317 | 24.376 318 | 23.8 319 | 23.583 320 | 22.88 321 | 23.4 322 | 23.718 323 | 23.95 324 | 23.95 325 | 23.95 326 | 23.95 327 | 24.05 328 | 23.65 329 | 23.46 330 | 23.491 331 | 24.05 332 | 23.918 333 | 23.634 334 | 24.47 335 | 24.608 336 | 24.445 337 | 24.3 338 | 24.159 339 | 24.26 340 | 24.341 341 | 24.809 342 | 24.75 343 | 24.4 344 | 24.25 345 | 24.1 346 | 24.25 347 | 24.8 348 | 25 349 | 24.92 350 | 25.515 351 | 25.505 352 | 26.099 353 | 26.35 354 | 26.32 355 | 26.65 356 | 27.15 357 | 26.75 358 | 26.374 359 | 25.4 360 | 25.4 361 | 25.49 362 | 25.642 363 | 25.578 364 | 25.85 365 | 25.743 366 | 25.85 367 | 26.074 368 | 25.759 369 | 26.275 370 | 26.518 371 | 27.15 372 | 27.126 373 | 27.431 374 | 27.898 375 | 27.25 376 | 26.118 377 | 27.898 378 | 25.69 379 | 26.15 380 | 25.65 381 | 25.35 382 | 25.46 383 | 25.35 384 | 25.35 385 | 24.905 386 | 24.9 387 | 25.08 388 | 25.405 389 | 25.564 390 | 25.36 391 | 24.674 392 | 24.77 393 | 24.322 394 | 24.568 395 | 24.76 396 | 24.75 397 | 25.15 398 | 25.03 399 | 25.15 400 | 25.341 401 | 25.305 402 | 25.25 403 | 25.55 404 | 25.8 405 | 25.67 406 | 25.54 407 | 25.529 408 | 25.85 409 | 25.707 410 | 25.52 411 | 25.75 412 | 25.685 413 | 25.98 414 | 26.43 415 | 26.1 416 | 26.24 417 | 26.173 418 | 25.4 419 | 25.799 420 | 25.848 421 | 25.786 422 | 25.28 423 | 25.329 424 | 25.36 425 | 25.3 426 | 25.5 427 | 25.06 428 | 24.841 429 | 24.31 430 | 24.2 431 | 24.081 432 | 24.516 433 | 24.7 434 | 24.373 435 | 24.75 436 | 25 437 | 25 438 | 25.3 439 | 25.507 440 | 25.7 441 | 26.4 442 | 26.941 443 | 26.794 444 | 26.491 445 | 26.49 446 | 26.747 447 | 26.71 448 | 26.919 449 | 26.58 450 | 26.65 451 | 26.65 452 | 27.12 453 | 27.2 454 | 26.76 455 | 26.95 456 | 27.004 457 | 27.3 458 | 27.2 459 | 27.11 460 | 26.94 461 | 26.8 462 | 27.19 463 | 27.64 464 | 27.83 465 | 27.826 466 | 28.02 467 | 28.5 468 | 28.89 469 | 28.94 470 | 28.55 471 | 28.482 472 | 28.68 473 | 28.695 474 | 29.3 475 | 28.8 476 | 28.6 477 | 29.217 478 | 29.845 479 | 29.35 480 | 29.32 481 | 29.074 482 | 29.069 483 | 29.824 484 | 30 485 | 30.15 486 | 29.7 487 | 29.606 488 | 29.651 489 | 29.583 490 | 29.109 491 | 29.2 492 | 28.73 493 | 28.57 494 | 28.27 495 | 28.717 496 | 28.947 497 | 29.37 498 | 29.4 499 | 29.36 500 | 29.36 501 | 29.36 502 | 29.81 503 | 29.61 504 | 28.81 505 | -------------------------------------------------------------------------------- /data/pigs.dat: -------------------------------------------------------------------------------- 1 | % 2 | % Title: Monthly Number of Pigs Slaughtered 3 | % 4 | 66698 5 | 72258 6 | 73445 7 | 76131 8 | 86082 9 | 75443 10 | 73969 11 | 78139 12 | 78646 13 | 66269 14 | 73776 15 | 80034 16 | 70694 17 | 81823 18 | 75640 19 | 75540 20 | 82229 21 | 75345 22 | 77034 23 | 78589 24 | 79769 25 | 75982 26 | 78074 27 | 77588 28 | 84100 29 | 97966 30 | 89051 31 | 93503 32 | 84747 33 | 74531 34 | 91900 35 | 81635 36 | 89797 37 | 81022 38 | 78265 39 | 77271 40 | 85043 41 | 95418 42 | 79568 43 | 103283 44 | 95770 45 | 91297 46 | 101244 47 | 114525 48 | 101139 49 | 93866 50 | 95171 51 | 100183 52 | 103926 53 | 102643 54 | 108387 55 | 97077 56 | 90901 57 | 90336 58 | 88732 59 | 83759 60 | 99267 61 | 73292 62 | 78943 63 | 94399 64 | 92937 65 | 90130 66 | 91055 67 | 106062 68 | 103560 69 | 104075 70 | 101783 71 | 93791 72 | 102313 73 | 82413 74 | 83534 75 | 109011 76 | 96499 77 | 102430 78 | 103002 79 | 91815 80 | 99067 81 | 110067 82 | 101599 83 | 97646 84 | 104930 85 | 88905 86 | 89936 87 | 106723 88 | 84307 89 | 114896 90 | 106749 91 | 87892 92 | 100506 93 | -------------------------------------------------------------------------------- /data/wine.dat: -------------------------------------------------------------------------------- 1 | % 2 | % Title: Red Wine Sales 3 | % Description: Monthly sales of red wine in Australia in kilolitres, Jan. 1980-Oct. 1991 4 | % 5 | 464 6 | 675 7 | 703 8 | 887 9 | 1139 10 | 1077 11 | 1318 12 | 1260 13 | 1120 14 | 963 15 | 996 16 | 960 17 | 530 18 | 883 19 | 894 20 | 1045 21 | 1199 22 | 1287 23 | 1565 24 | 1577 25 | 1076 26 | 918 27 | 1008 28 | 1063 29 | 544 30 | 635 31 | 804 32 | 980 33 | 1018 34 | 1064 35 | 1404 36 | 1286 37 | 1104 38 | 999 39 | 996 40 | 1015 41 | 615 42 | 722 43 | 832 44 | 977 45 | 1270 46 | 1437 47 | 1520 48 | 1708 49 | 1151 50 | 934 51 | 1159 52 | 1209 53 | 699 54 | 830 55 | 996 56 | 1124 57 | 1458 58 | 1270 59 | 1753 60 | 2258 61 | 1208 62 | 1241 63 | 1265 64 | 1828 65 | 809 66 | 997 67 | 1164 68 | 1205 69 | 1538 70 | 1513 71 | 1378 72 | 2083 73 | 1357 74 | 1536 75 | 1526 76 | 1376 77 | 779 78 | 1005 79 | 1193 80 | 1522 81 | 1539 82 | 1546 83 | 2116 84 | 2326 85 | 1596 86 | 1356 87 | 1553 88 | 1613 89 | 814 90 | 1150 91 | 1225 92 | 1691 93 | 1759 94 | 1754 95 | 2100 96 | 2062 97 | 2012 98 | 1897 99 | 1964 100 | 2186 101 | 966 102 | 1549 103 | 1538 104 | 1612 105 | 2078 106 | 2137 107 | 2907 108 | 2249 109 | 1883 110 | 1739 111 | 1828 112 | 1868 113 | 1138 114 | 1430 115 | 1809 116 | 1763 117 | 2200 118 | 2067 119 | 2503 120 | 2141 121 | 2103 122 | 1972 123 | 2181 124 | 2344 125 | 970 126 | 1199 127 | 1718 128 | 1683 129 | 2025 130 | 2051 131 | 2439 132 | 2353 133 | 2230 134 | 1852 135 | 2147 136 | 2286 137 | 1007 138 | 1665 139 | 1642 140 | 1525 141 | 1838 142 | 1892 143 | 2920 144 | 2572 145 | 2617 146 | 2047 147 | -------------------------------------------------------------------------------- /data/xrx.dat: -------------------------------------------------------------------------------- 1 | % 2 | % Title: Xerox share prices 3 | % 4 | 13.5900 5 | 13.8200 6 | 14.0700 7 | 14.1200 8 | 14.1600 9 | 13.9600 10 | 14.0300 11 | 13.7500 12 | 13.7500 13 | 13.6800 14 | 13.5200 15 | 13.4300 16 | 13.6800 17 | 13.3900 18 | 13.6300 19 | 13.9500 20 | 15.1500 21 | 14.7800 22 | 14.7900 23 | 14.6400 24 | 14.7300 25 | 14.3400 26 | 14.2700 27 | 14.5000 28 | 15.1300 29 | 15.0600 30 | 15.0000 31 | 15.0300 32 | 15.2600 33 | 15.0500 34 | 15.3000 35 | 15.2600 36 | 14.6900 37 | 14.4100 38 | 14.2300 39 | 13.9300 40 | 14.1000 41 | 14.1500 42 | 14.1400 43 | 14.2800 44 | 14.2100 45 | 14.2400 46 | 14.2500 47 | 14.1800 48 | 13.9500 49 | 13.8000 50 | 13.9000 51 | 13.7600 52 | 14.0700 53 | 13.8000 54 | 13.8900 55 | 14.1400 56 | 14.2800 57 | 14.0800 58 | 13.7400 59 | 13.9000 60 | 13.8500 61 | 14.2100 62 | 14.2500 63 | 14.4500 64 | 14.6300 65 | 14.5700 66 | 14.8500 67 | 14.9200 68 | 14.9600 69 | 14.8400 70 | 14.9200 71 | 14.7700 72 | 14.8500 73 | 14.3100 74 | 14.4300 75 | 14.0000 76 | 13.9800 77 | 14.1200 78 | 13.9400 79 | 13.9800 80 | 14.4100 81 | 13.1800 82 | 13.5600 83 | 13.4400 84 | 13.4700 85 | 13.4300 86 | 13.4300 87 | 13.5900 88 | 13.3400 89 | 13.4300 90 | 13.0500 91 | 12.9600 92 | 12.8000 93 | 13.1000 94 | 12.8400 95 | 12.8300 96 | 12.8500 97 | 12.6600 98 | 12.9400 99 | 13.0500 100 | 13.1400 101 | 13.3500 102 | 13.2800 103 | 13.4300 104 | 13.6300 105 | 13.7200 106 | 13.5400 107 | 13.4000 108 | 13.3800 109 | 13.2000 110 | 13.4000 111 | 13.7700 112 | 13.7400 113 | 13.9000 114 | 14.1200 115 | 14.2000 116 | 14.4300 117 | 14.1600 118 | 14.1300 119 | 14.2200 120 | 14.3000 121 | 14.6800 122 | 14.8500 123 | 14.5400 124 | 14.4700 125 | 14.3000 126 | 14.3900 127 | 14.5000 128 | 14.2100 129 | 14.1500 130 | 13.7600 131 | 13.8400 132 | 13.6000 133 | 13.6500 134 | 13.6200 135 | 13.8100 136 | 13.6900 137 | 13.5900 138 | 13.2900 139 | 13.2600 140 | 13.2900 141 | 13.1000 142 | 13.3100 143 | 13.8000 144 | 13.6800 145 | 13.6100 146 | 13.4900 147 | 13.7200 148 | 13.8600 149 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install - install a program, script, or datafile 3 | 4 | scriptversion=2005-02-02.21 5 | 6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 7 | # later released in X11R6 (xc/config/util/install.sh) with the 8 | # following copyright and license. 9 | # 10 | # Copyright (C) 1994 X Consortium 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documentation files (the "Software"), to 14 | # deal in the Software without restriction, including without limitation the 15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16 | # sell copies of the Software, and to permit persons to whom the Software is 17 | # furnished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # Except as contained in this notice, the name of the X Consortium shall not 30 | # be used in advertising or otherwise to promote the sale, use or other deal- 31 | # ings in this Software without prior written authorization from the X Consor- 32 | # tium. 33 | # 34 | # 35 | # FSF changes to this file are in the public domain. 36 | # 37 | # Calling this script install-sh is preferred over install.sh, to prevent 38 | # `make' implicit rules from creating a file called install from it 39 | # when there is no Makefile. 40 | # 41 | # This script is compatible with the BSD install script, but was written 42 | # from scratch. It can only install one file at a time, a restriction 43 | # shared with many OS's install programs. 44 | 45 | # set DOITPROG to echo to test this script 46 | 47 | # Don't use :- since 4.3BSD and earlier shells don't like it. 48 | doit="${DOITPROG-}" 49 | 50 | # put in absolute paths if you don't have them in your path; or use env. vars. 51 | 52 | mvprog="${MVPROG-mv}" 53 | cpprog="${CPPROG-cp}" 54 | chmodprog="${CHMODPROG-chmod}" 55 | chownprog="${CHOWNPROG-chown}" 56 | chgrpprog="${CHGRPPROG-chgrp}" 57 | stripprog="${STRIPPROG-strip}" 58 | rmprog="${RMPROG-rm}" 59 | mkdirprog="${MKDIRPROG-mkdir}" 60 | 61 | chmodcmd="$chmodprog 0755" 62 | chowncmd= 63 | chgrpcmd= 64 | stripcmd= 65 | rmcmd="$rmprog -f" 66 | mvcmd="$mvprog" 67 | src= 68 | dst= 69 | dir_arg= 70 | dstarg= 71 | no_target_directory= 72 | 73 | usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE 74 | or: $0 [OPTION]... SRCFILES... DIRECTORY 75 | or: $0 [OPTION]... -t DIRECTORY SRCFILES... 76 | or: $0 [OPTION]... -d DIRECTORIES... 77 | 78 | In the 1st form, copy SRCFILE to DSTFILE. 79 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 80 | In the 4th, create DIRECTORIES. 81 | 82 | Options: 83 | -c (ignored) 84 | -d create directories instead of installing files. 85 | -g GROUP $chgrpprog installed files to GROUP. 86 | -m MODE $chmodprog installed files to MODE. 87 | -o USER $chownprog installed files to USER. 88 | -s $stripprog installed files. 89 | -t DIRECTORY install into DIRECTORY. 90 | -T report an error if DSTFILE is a directory. 91 | --help display this help and exit. 92 | --version display version info and exit. 93 | 94 | Environment variables override the default commands: 95 | CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG 96 | " 97 | 98 | while test -n "$1"; do 99 | case $1 in 100 | -c) shift 101 | continue;; 102 | 103 | -d) dir_arg=true 104 | shift 105 | continue;; 106 | 107 | -g) chgrpcmd="$chgrpprog $2" 108 | shift 109 | shift 110 | continue;; 111 | 112 | --help) echo "$usage"; exit $?;; 113 | 114 | -m) chmodcmd="$chmodprog $2" 115 | shift 116 | shift 117 | continue;; 118 | 119 | -o) chowncmd="$chownprog $2" 120 | shift 121 | shift 122 | continue;; 123 | 124 | -s) stripcmd=$stripprog 125 | shift 126 | continue;; 127 | 128 | -t) dstarg=$2 129 | shift 130 | shift 131 | continue;; 132 | 133 | -T) no_target_directory=true 134 | shift 135 | continue;; 136 | 137 | --version) echo "$0 $scriptversion"; exit $?;; 138 | 139 | *) # When -d is used, all remaining arguments are directories to create. 140 | # When -t is used, the destination is already specified. 141 | test -n "$dir_arg$dstarg" && break 142 | # Otherwise, the last argument is the destination. Remove it from $@. 143 | for arg 144 | do 145 | if test -n "$dstarg"; then 146 | # $@ is not empty: it contains at least $arg. 147 | set fnord "$@" "$dstarg" 148 | shift # fnord 149 | fi 150 | shift # arg 151 | dstarg=$arg 152 | done 153 | break;; 154 | esac 155 | done 156 | 157 | if test -z "$1"; then 158 | if test -z "$dir_arg"; then 159 | echo "$0: no input file specified." >&2 160 | exit 1 161 | fi 162 | # It's OK to call `install-sh -d' without argument. 163 | # This can happen when creating conditional directories. 164 | exit 0 165 | fi 166 | 167 | for src 168 | do 169 | # Protect names starting with `-'. 170 | case $src in 171 | -*) src=./$src ;; 172 | esac 173 | 174 | if test -n "$dir_arg"; then 175 | dst=$src 176 | src= 177 | 178 | if test -d "$dst"; then 179 | mkdircmd=: 180 | chmodcmd= 181 | else 182 | mkdircmd=$mkdirprog 183 | fi 184 | else 185 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 186 | # might cause directories to be created, which would be especially bad 187 | # if $src (and thus $dsttmp) contains '*'. 188 | if test ! -f "$src" && test ! -d "$src"; then 189 | echo "$0: $src does not exist." >&2 190 | exit 1 191 | fi 192 | 193 | if test -z "$dstarg"; then 194 | echo "$0: no destination specified." >&2 195 | exit 1 196 | fi 197 | 198 | dst=$dstarg 199 | # Protect names starting with `-'. 200 | case $dst in 201 | -*) dst=./$dst ;; 202 | esac 203 | 204 | # If destination is a directory, append the input filename; won't work 205 | # if double slashes aren't ignored. 206 | if test -d "$dst"; then 207 | if test -n "$no_target_directory"; then 208 | echo "$0: $dstarg: Is a directory" >&2 209 | exit 1 210 | fi 211 | dst=$dst/`basename "$src"` 212 | fi 213 | fi 214 | 215 | # This sed command emulates the dirname command. 216 | dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` 217 | 218 | # Make sure that the destination directory exists. 219 | 220 | # Skip lots of stat calls in the usual case. 221 | if test ! -d "$dstdir"; then 222 | defaultIFS=' 223 | ' 224 | IFS="${IFS-$defaultIFS}" 225 | 226 | oIFS=$IFS 227 | # Some sh's can't handle IFS=/ for some reason. 228 | IFS='%' 229 | set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` 230 | shift 231 | IFS=$oIFS 232 | 233 | pathcomp= 234 | 235 | while test $# -ne 0 ; do 236 | pathcomp=$pathcomp$1 237 | shift 238 | if test ! -d "$pathcomp"; then 239 | $mkdirprog "$pathcomp" 240 | # mkdir can fail with a `File exist' error in case several 241 | # install-sh are creating the directory concurrently. This 242 | # is OK. 243 | test -d "$pathcomp" || exit 244 | fi 245 | pathcomp=$pathcomp/ 246 | done 247 | fi 248 | 249 | if test -n "$dir_arg"; then 250 | $doit $mkdircmd "$dst" \ 251 | && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ 252 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ 253 | && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ 254 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } 255 | 256 | else 257 | dstfile=`basename "$dst"` 258 | 259 | # Make a couple of temp file names in the proper directory. 260 | dsttmp=$dstdir/_inst.$$_ 261 | rmtmp=$dstdir/_rm.$$_ 262 | 263 | # Trap to clean up those temp files at exit. 264 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 265 | trap '(exit $?); exit' 1 2 13 15 266 | 267 | # Copy the file name to the temp name. 268 | $doit $cpprog "$src" "$dsttmp" && 269 | 270 | # and set any options; do chmod last to preserve setuid bits. 271 | # 272 | # If any of these fail, we abort the whole thing. If we want to 273 | # ignore errors from any of these, just make sure not to ignore 274 | # errors from the above "$doit $cpprog $src $dsttmp" command. 275 | # 276 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ 277 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ 278 | && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ 279 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && 280 | 281 | # Now rename the file to the real destination. 282 | { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ 283 | || { 284 | # The rename failed, perhaps because mv can't rename something else 285 | # to itself, or perhaps because mv is so ancient that it does not 286 | # support -f. 287 | 288 | # Now remove or move aside any old file at destination location. 289 | # We try this two ways since rm can't unlink itself on some 290 | # systems and the destination file might be busy for other 291 | # reasons. In this case, the final cleanup might fail but the new 292 | # file should still install successfully. 293 | { 294 | if test -f "$dstdir/$dstfile"; then 295 | $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ 296 | || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ 297 | || { 298 | echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 299 | (exit 1); exit 1 300 | } 301 | else 302 | : 303 | fi 304 | } && 305 | 306 | # Now rename the file to the real destination. 307 | $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" 308 | } 309 | } 310 | fi || { (exit 1); exit 1; } 311 | done 312 | 313 | # The final little trick to "correctly" pass the exit status to the exit trap. 314 | { 315 | (exit 0); exit 0 316 | } 317 | 318 | # Local variables: 319 | # eval: (add-hook 'write-file-hooks 'time-stamp) 320 | # time-stamp-start: "scriptversion=" 321 | # time-stamp-format: "%:y-%02m-%02d.%02H" 322 | # time-stamp-end: "$" 323 | # End: 324 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2005-02-08.22 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7 | # Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 23 | # 02111-1307, USA. 24 | 25 | # As a special exception to the GNU General Public License, if you 26 | # distribute this file as part of a program that contains a 27 | # configuration script generated by Autoconf, you may include it under 28 | # the same distribution terms that you use for the rest of that program. 29 | 30 | if test $# -eq 0; then 31 | echo 1>&2 "Try \`$0 --help' for more information" 32 | exit 1 33 | fi 34 | 35 | run=: 36 | 37 | # In the cases where this matters, `missing' is being run in the 38 | # srcdir already. 39 | if test -f configure.ac; then 40 | configure_ac=configure.ac 41 | else 42 | configure_ac=configure.in 43 | fi 44 | 45 | msg="missing on your system" 46 | 47 | case "$1" in 48 | --run) 49 | # Try to run requested program, and just exit if it succeeds. 50 | run= 51 | shift 52 | "$@" && exit 0 53 | # Exit code 63 means version mismatch. This often happens 54 | # when the user try to use an ancient version of a tool on 55 | # a file that requires a minimum version. In this case we 56 | # we should proceed has if the program had been absent, or 57 | # if --run hadn't been passed. 58 | if test $? = 63; then 59 | run=: 60 | msg="probably too old" 61 | fi 62 | ;; 63 | 64 | -h|--h|--he|--hel|--help) 65 | echo "\ 66 | $0 [OPTION]... PROGRAM [ARGUMENT]... 67 | 68 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69 | error status if there is no known handling for PROGRAM. 70 | 71 | Options: 72 | -h, --help display this help and exit 73 | -v, --version output version information and exit 74 | --run try to run the given command, and emulate it if it fails 75 | 76 | Supported PROGRAM values: 77 | aclocal touch file \`aclocal.m4' 78 | autoconf touch file \`configure' 79 | autoheader touch file \`config.h.in' 80 | automake touch all \`Makefile.in' files 81 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 82 | flex create \`lex.yy.c', if possible, from existing .c 83 | help2man touch the output file 84 | lex create \`lex.yy.c', if possible, from existing .c 85 | makeinfo touch the output file 86 | tar try tar, gnutar, gtar, then tar without non-portable flags 87 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88 | 89 | Send bug reports to ." 90 | exit $? 91 | ;; 92 | 93 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94 | echo "missing $scriptversion (GNU Automake)" 95 | exit $? 96 | ;; 97 | 98 | -*) 99 | echo 1>&2 "$0: Unknown \`$1' option" 100 | echo 1>&2 "Try \`$0 --help' for more information" 101 | exit 1 102 | ;; 103 | 104 | esac 105 | 106 | # Now exit if we have it, but it failed. Also exit now if we 107 | # don't have it and --version was passed (most likely to detect 108 | # the program). 109 | case "$1" in 110 | lex|yacc) 111 | # Not GNU programs, they don't have --version. 112 | ;; 113 | 114 | tar) 115 | if test -n "$run"; then 116 | echo 1>&2 "ERROR: \`tar' requires --run" 117 | exit 1 118 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119 | exit 1 120 | fi 121 | ;; 122 | 123 | *) 124 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125 | # We have it, but it failed. 126 | exit 1 127 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128 | # Could not run --version or --help. This is probably someone 129 | # running `$TOOL --version' or `$TOOL --help' to check whether 130 | # $TOOL exists and not knowing $TOOL uses missing. 131 | exit 1 132 | fi 133 | ;; 134 | esac 135 | 136 | # If it does not exist, or fails to run (possibly an outdated version), 137 | # try to emulate it. 138 | case "$1" in 139 | aclocal*) 140 | echo 1>&2 "\ 141 | WARNING: \`$1' is $msg. You should only need it if 142 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143 | to install the \`Automake' and \`Perl' packages. Grab them from 144 | any GNU archive site." 145 | touch aclocal.m4 146 | ;; 147 | 148 | autoconf) 149 | echo 1>&2 "\ 150 | WARNING: \`$1' is $msg. You should only need it if 151 | you modified \`${configure_ac}'. You might want to install the 152 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153 | archive site." 154 | touch configure 155 | ;; 156 | 157 | autoheader) 158 | echo 1>&2 "\ 159 | WARNING: \`$1' is $msg. You should only need it if 160 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 161 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 162 | from any GNU archive site." 163 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164 | test -z "$files" && files="config.h" 165 | touch_files= 166 | for f in $files; do 167 | case "$f" in 168 | *:*) touch_files="$touch_files "`echo "$f" | 169 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170 | *) touch_files="$touch_files $f.in";; 171 | esac 172 | done 173 | touch $touch_files 174 | ;; 175 | 176 | automake*) 177 | echo 1>&2 "\ 178 | WARNING: \`$1' is $msg. You should only need it if 179 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180 | You might want to install the \`Automake' and \`Perl' packages. 181 | Grab them from any GNU archive site." 182 | find . -type f -name Makefile.am -print | 183 | sed 's/\.am$/.in/' | 184 | while read f; do touch "$f"; done 185 | ;; 186 | 187 | autom4te) 188 | echo 1>&2 "\ 189 | WARNING: \`$1' is needed, but is $msg. 190 | You might have modified some files without having the 191 | proper tools for further handling them. 192 | You can get \`$1' as part of \`Autoconf' from any GNU 193 | archive site." 194 | 195 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197 | if test -f "$file"; then 198 | touch $file 199 | else 200 | test -z "$file" || exec >$file 201 | echo "#! /bin/sh" 202 | echo "# Created by GNU Automake missing as a replacement of" 203 | echo "# $ $@" 204 | echo "exit 0" 205 | chmod +x $file 206 | exit 1 207 | fi 208 | ;; 209 | 210 | bison|yacc) 211 | echo 1>&2 "\ 212 | WARNING: \`$1' $msg. You should only need it if 213 | you modified a \`.y' file. You may need the \`Bison' package 214 | in order for those modifications to take effect. You can get 215 | \`Bison' from any GNU archive site." 216 | rm -f y.tab.c y.tab.h 217 | if [ $# -ne 1 ]; then 218 | eval LASTARG="\${$#}" 219 | case "$LASTARG" in 220 | *.y) 221 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222 | if [ -f "$SRCFILE" ]; then 223 | cp "$SRCFILE" y.tab.c 224 | fi 225 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226 | if [ -f "$SRCFILE" ]; then 227 | cp "$SRCFILE" y.tab.h 228 | fi 229 | ;; 230 | esac 231 | fi 232 | if [ ! -f y.tab.h ]; then 233 | echo >y.tab.h 234 | fi 235 | if [ ! -f y.tab.c ]; then 236 | echo 'main() { return 0; }' >y.tab.c 237 | fi 238 | ;; 239 | 240 | lex|flex) 241 | echo 1>&2 "\ 242 | WARNING: \`$1' is $msg. You should only need it if 243 | you modified a \`.l' file. You may need the \`Flex' package 244 | in order for those modifications to take effect. You can get 245 | \`Flex' from any GNU archive site." 246 | rm -f lex.yy.c 247 | if [ $# -ne 1 ]; then 248 | eval LASTARG="\${$#}" 249 | case "$LASTARG" in 250 | *.l) 251 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252 | if [ -f "$SRCFILE" ]; then 253 | cp "$SRCFILE" lex.yy.c 254 | fi 255 | ;; 256 | esac 257 | fi 258 | if [ ! -f lex.yy.c ]; then 259 | echo 'main() { return 0; }' >lex.yy.c 260 | fi 261 | ;; 262 | 263 | help2man) 264 | echo 1>&2 "\ 265 | WARNING: \`$1' is $msg. You should only need it if 266 | you modified a dependency of a manual page. You may need the 267 | \`Help2man' package in order for those modifications to take 268 | effect. You can get \`Help2man' from any GNU archive site." 269 | 270 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271 | if test -z "$file"; then 272 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273 | fi 274 | if [ -f "$file" ]; then 275 | touch $file 276 | else 277 | test -z "$file" || exec >$file 278 | echo ".ab help2man is required to generate this page" 279 | exit 1 280 | fi 281 | ;; 282 | 283 | makeinfo) 284 | echo 1>&2 "\ 285 | WARNING: \`$1' is $msg. You should only need it if 286 | you modified a \`.texi' or \`.texinfo' file, or any other file 287 | indirectly affecting the aspect of the manual. The spurious 288 | call might also be the consequence of using a buggy \`make' (AIX, 289 | DU, IRIX). You might want to install the \`Texinfo' package or 290 | the \`GNU make' package. Grab either from any GNU archive site." 291 | # The file to touch is that specified with -o ... 292 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293 | if test -z "$file"; then 294 | # ... or it is the one specified with @setfilename ... 295 | infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297 | # ... or it is derived from the source name (dir/f.texi becomes f.info) 298 | test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299 | fi 300 | touch $file 301 | ;; 302 | 303 | tar) 304 | shift 305 | 306 | # We have already tried tar in the generic part. 307 | # Look for gnutar/gtar before invocation to avoid ugly error 308 | # messages. 309 | if (gnutar --version > /dev/null 2>&1); then 310 | gnutar "$@" && exit 0 311 | fi 312 | if (gtar --version > /dev/null 2>&1); then 313 | gtar "$@" && exit 0 314 | fi 315 | firstarg="$1" 316 | if shift; then 317 | case "$firstarg" in 318 | *o*) 319 | firstarg=`echo "$firstarg" | sed s/o//` 320 | tar "$firstarg" "$@" && exit 0 321 | ;; 322 | esac 323 | case "$firstarg" in 324 | *h*) 325 | firstarg=`echo "$firstarg" | sed s/h//` 326 | tar "$firstarg" "$@" && exit 0 327 | ;; 328 | esac 329 | fi 330 | 331 | echo 1>&2 "\ 332 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 333 | You may want to install GNU tar or Free paxutils, or check the 334 | command line arguments." 335 | exit 1 336 | ;; 337 | 338 | *) 339 | echo 1>&2 "\ 340 | WARNING: \`$1' is needed, and is $msg. 341 | You might have modified some files without having the 342 | proper tools for further handling them. Check the \`README' file, 343 | it often tells you about the needed prerequisites for installing 344 | this package. You may also peek at any GNU archive site, in case 345 | some other package would contain this missing \`$1' program." 346 | exit 1 347 | ;; 348 | esac 349 | 350 | exit 0 351 | 352 | # Local variables: 353 | # eval: (add-hook 'write-file-hooks 'time-stamp) 354 | # time-stamp-start: "scriptversion=" 355 | # time-stamp-format: "%:y-%02m-%02d.%02H" 356 | # time-stamp-end: "$" 357 | # End: 358 | -------------------------------------------------------------------------------- /reconf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm -f config.cache 3 | aclocal 4 | autoconf 5 | autoheader 6 | automake -a 7 | exit 8 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = mslib main 2 | -------------------------------------------------------------------------------- /src/main/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = -I$(top_srcdir)/src/mslib 2 | AM_CPPFLAGS = $(GTKMM_CFLAGS) $(GSL_CFLAGS) $(MUPARSER_CFLAGS) -Wno-deprecated 3 | EXTRA_DIST = *.h *.xpm 4 | 5 | bin_PROGRAMS = cronos 6 | cronos_SOURCES = cronos.cc mainwin.cc xyplot.cc transform.cc otherplots.cc tsmrender.cc dialogs.cc epsdc.cc cubespline.cc otherpopups.cc textrender.cc tsinterface.cc 7 | cronos_LDADD = ../mslib/libms.a 8 | cronos_LDFLAGS = $(MUPARSER_LIBS) $(GTKMM_LIBS) $(GSL_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(LIBS) -llapack 9 | # cronos_CXXFLAGS = -ggdb -O0 10 | -------------------------------------------------------------------------------- /src/main/cronos.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | * 22 | * This is the main module of the open-source time series analysis 23 | * package (tsap). 24 | * 25 | */ 26 | 27 | #include "includes.h" 28 | #include 29 | #include 30 | #include 31 | #include "tsmrender.h" 32 | #include "dialogs.h" 33 | #include "tsinterface.h" 34 | #include "mainwin.h" 35 | #include 36 | #include 37 | #include "otherpopups.h" 38 | #include 39 | #include 40 | #include 41 | 42 | 43 | using namespace SigC; 44 | using namespace Gtk; 45 | using namespace std; 46 | 47 | 48 | Window *mainwin; 49 | Window *get_main_win() // used by other modules 50 | { return mainwin; } 51 | 52 | 53 | int main(int argc, char** argv) 54 | { 55 | Gtk::Main kit(argc,argv); 56 | 57 | init_generator(0); // seed the random number generator 58 | 59 | mainwin = new CoreWin(); // a corewin keeps track of a time series and a time series model 60 | //mainwin = new Window(); 61 | mainwin->show_all(); 62 | 63 | kit.run(*mainwin); // the argument ensures that closing the window terminates the program 64 | 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /src/main/cronos_win.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | * 22 | * This is the main module of the open-source time series analysis 23 | * package (tsap). 24 | * 25 | */ 26 | 27 | #include "includes.h" 28 | #include 29 | #include 30 | #include 31 | #include "tsmrender.h" 32 | #include "dialogs.h" 33 | #include "tsinterface.h" 34 | #include "mainwin.h" 35 | #include 36 | #include 37 | #include "otherpopups.h" 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | 44 | using namespace SigC; 45 | using namespace Gtk; 46 | using namespace std; 47 | 48 | 49 | Window *mainwin; 50 | Window *get_main_win() // used by other modules 51 | { return mainwin; } 52 | 53 | 54 | int main(int argc, char** argv) 55 | { 56 | Gtk::Main kit(argc,argv); 57 | 58 | init_generator(0); // seed the random number generator 59 | 60 | mainwin = new CoreWin(); // a corewin keeps track of a time series and a time series model 61 | //mainwin = new Window(); 62 | mainwin->show_all(); 63 | 64 | kit.run(*mainwin); // the argument ensures that closing the window terminates the program 65 | 66 | return 0; 67 | } 68 | 69 | int APIENTRY WinMain( HINSTANCE hInstance, 70 | HINSTANCE hPrevInstance, 71 | LPSTR lpCmdLine, int nCmdShow) 72 | { 73 | return main( __argc, __argv ); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/main/cubespline.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | * 22 | * This class handles truncated power series splines. 23 | * Anthony Brockwell, June 11th, 2002. 24 | */ 25 | 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "matrix.h" 32 | #include "cubespline.h" 33 | #include "glm.h" 34 | 35 | using namespace std; 36 | 37 | cubespline::cubespline(int nknots) 38 | : numknots(nknots) 39 | { 40 | if (numknots>0) { 41 | knotpos.resize(numknots); 42 | } 43 | } 44 | 45 | cubespline::~cubespline() 46 | { 47 | } 48 | 49 | double cubespline::clip(double x) 50 | { 51 | return x > 0 ? x : 0; 52 | } 53 | 54 | double cubespline::cube(double x) 55 | { 56 | return x*x*x; 57 | } 58 | 59 | void cubespline::setknots(Vector& knots) 60 | { 61 | int i, n = knots.nrows(); 62 | if (n!=numknots) 63 | { 64 | cout << "Wrong number of knots in cubespline::setknots!" << endl; 65 | return; 66 | } 67 | knotpos = knots; 68 | } 69 | 70 | Vector cubespline::knotsforgaps(double min, double max, Vector dirch) 71 | { 72 | int i,n=dirch.nrows()-1; 73 | double tx; 74 | Vector retval(n); 75 | 76 | // 1. make sure that dirch sums to 1.0 77 | for (i=0 ; i0 ? knots[i-1] : min; 100 | retval[i] = (upper-lower)/tx; 101 | } 102 | return retval; 103 | } 104 | 105 | double cubespline::cost(Vector& knotgaps, void *vp) 106 | // This function returns sum squared residuals when 107 | // regression fit for given knot positions is carried out. 108 | // Hence it can be used to get MLEs for Gaussian free-knot splines. 109 | { 110 | cubespline *cp = (cubespline *) vp; 111 | Vector knots; 112 | knots = cp->knotsforgaps(cp->minx,cp->maxx,knotgaps); 113 | cp->setknots(knots); 114 | cp->lsfit(*(cp->tempdata)); // fit it 115 | return cp->sig2; 116 | } 117 | 118 | double cubespline::cost2(Vector& gapsandparms, void *vp) 119 | // This function returns the negative Poisson log-likelihood. 120 | // It requires both gaps (numknots+1) and params (3+numknots), 121 | // and can be used to find MLEs for Poisson free-knot splines. 122 | { 123 | cubespline *cp = (cubespline *) vp; 124 | Vector gaps(cp->numknots+1), knots; 125 | gaps = gapsandparms.submatrix(0,0,cp->numknots+1,1); 126 | knots = cp->knotsforgaps(cp->minx,cp->maxx,gaps); 127 | cp->setknots(knots); 128 | 129 | // extract coefficients as well 130 | cp->beta = gapsandparms.submatrix(cp->numknots+1,0,2*cp->numknots+4,1); 131 | 132 | // now we can compute and return negative Poisson log-likelihood 133 | return -cp->loglikelihood(*(cp->tempdata),1); 134 | } 135 | 136 | double cubespline::cost3(double *xpos, void *vp) 137 | // This function returns -fittedvalue(x) and is used 138 | // to find argmax. 139 | { 140 | cubespline *cp = (cubespline *) vp; 141 | double tx = 1.0/(1.0+exp(-xpos[0])); // restrict range to [0,1] 142 | return -cp->getfitfor(tx); 143 | } 144 | 145 | double cubespline::cost4(Vector& betas, void *vp) 146 | // This function returns -fittedvalue(x) and is used 147 | // to find argmax. 148 | { 149 | cubespline *cp = (cubespline *) vp; 150 | cp->beta = betas; 151 | return -cp->loglikelihood(*(cp->tempdata),1); 152 | } 153 | 154 | void cubespline::fitPn(Matrix& data, int fileit) 155 | { 156 | int i,j,n = data.nrows(); 157 | Matrix XtX; 158 | Vector Y(n), betahat(3+numknots); 159 | double tx; 160 | PoissonGLM pglm; 161 | 162 | X = getdesignmatrix(data); 163 | Y = data.submatrix(0,1,n,2); 164 | 165 | /* 166 | if (fileit) 167 | { 168 | X.writefile("xout"); 169 | Y.writefile("yout"); 170 | } 171 | */ 172 | 173 | betahat = pglm.Estimate(Y,X); 174 | 175 | // copy from vector into class members 176 | beta = betahat; 177 | betacov = *(pglm.GetBetahatCovInv()); 178 | 179 | // finally, sort out variance 180 | fitted = X*betahat; 181 | for (i=0 ; i0?x:0" << endl; 320 | os << "c3(x,k) = g((x-k)**3)" << endl; 321 | os << ends; 322 | fputs(cmd, gnupipe); 323 | fflush(gnupipe); 324 | 325 | // now the actual spline 326 | os.seekp(0); 327 | os << setprecision(14); 328 | os << "f(x)=" << beta[0] << "+" << beta[1] << "*x+" 329 | << beta[2] << "*x*x + " 330 | << beta[3] << "*c3(x," << knotpos[0] << ")"; 331 | for (i=1 ; inrows(); 341 | for (i=0 ; inpars; 51 | 52 | add_button("Cancel", RESPONSE_CANCEL); 53 | add_button("O.K.", RESPONSE_OK); 54 | signal_response().connect(mem_fun(*this, &TransformDialog::terminate)); 55 | 56 | // Then vbox area 57 | table = manage(new Table(np,2,true)); 58 | es = new Gtk::Entry*[np]; 59 | ls = new Gtk::Label*[np]; 60 | for (i=0 ; iparnames[i])); 63 | es[i] = manage(new Entry()); 64 | es[i]->set_text(t->pardefaults[i]); 65 | es[i]->signal_activate().connect(mem_fun(*this, &TransformDialog::enter_pressed)); 66 | table->attach(*ls[i],0,1,i,i+1,Gtk::EXPAND,Gtk::EXPAND,0,5); 67 | table->attach(*es[i],1,2,i,i+1,Gtk::EXPAND,Gtk::EXPAND,0,5); 68 | } 69 | 70 | get_vbox()->pack_start(*table); 71 | 72 | show_all(); 73 | } 74 | 75 | void TransformDialog::enter_pressed() 76 | { 77 | // we really should validate text entered here ... 78 | response(RESPONSE_OK); 79 | } 80 | 81 | void TransformDialog::terminate(int code) 82 | { 83 | // extract parameters 84 | int i, np = trans->npars; 85 | string s1; 86 | for (i=0 ; iget_text(); 90 | istrstream inst(s1.c_str()); 91 | switch (trans->partypes[i]) 92 | { 93 | case 0: // integer 94 | inst >> trans->ipars[i]; 95 | break; 96 | case 1: // real 97 | inst >> trans->dpars[i]; 98 | break; 99 | case 2: // string 100 | inst >> trans->spars[i]; 101 | break; 102 | } 103 | 104 | delete es[i]; 105 | delete ls[i]; 106 | } 107 | delete[] es; 108 | delete[] ls; 109 | } 110 | 111 | IterationCounter::IterationCounter(Window& wp) 112 | : CenteringDialog("Progress", wp) 113 | { 114 | localcount = 0; 115 | Table *table = manage(new Table(3,2,true)); 116 | pbar = manage(new ProgressBar()); 117 | label1 = manage(new Label("# Iterations: ")); 118 | label2 = manage(new Label("0")); 119 | stage_label = manage(new Label()); 120 | table->attach(*stage_label, 0, 2, 0, 1, EXPAND, EXPAND, 10, 2); 121 | table->attach(*pbar, 0, 2, 2, 3, EXPAND, EXPAND, 10, 2); 122 | table->attach(*label1, 0, 1, 1, 2, EXPAND, EXPAND, 10, 2); 123 | table->attach(*label2, 1, 2, 1, 2, EXPAND, EXPAND, 10, 2); 124 | curstage = -1; // no stage to begin with 125 | get_vbox()->pack_start(*table); 126 | } 127 | 128 | int IterationCounter::increment(int stage) 129 | { 130 | char temps[80]; 131 | ostrstream os(temps, 80); 132 | 133 | ++localcount; 134 | os << localcount << ends; 135 | label2->set_label(temps); 136 | 137 | if (stage!=curstage) 138 | { 139 | curstage = stage; 140 | os.seekp(0); 141 | switch (curstage) { 142 | case 0: os << "Likelihood Maximization" << ends; break; 143 | case 1: os << "Hessian Matrix Calculation" << ends; break; 144 | case 2: os << "Markov Chain Monte Carlo" << ends; break; 145 | default: os << "Bad Stage" << ends; break; 146 | }; 147 | stage_label->set_markup(temps); 148 | } 149 | 150 | pbar->pulse(); 151 | return localcount; 152 | } 153 | 154 | //------------------------------------------------------------- 155 | 156 | CoefficientDialog::CoefficientDialog(Window& wi, int n, 157 | string *labs, double *vals, double *mask) 158 | : CenteringDialog("Coefficient Entry", wi), nentries(n) 159 | { 160 | int i; 161 | char temps[30]; 162 | 163 | ScrolledWindow *sw = manage(new ScrolledWindow()); 164 | sw->set_size_request(300,min(30*n+10,160)); 165 | sw->set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC); 166 | 167 | Table *table = manage(new Table(nentries,1,false)); 168 | 169 | Label *lp; 170 | HBox *vb; 171 | eps = new Entry*[nentries]; 172 | checks = new CheckButton*[nentries]; 173 | for (i=0 ; ipack_start(*lp); 179 | 180 | eps[i] = manage(new Entry()); 181 | ostrstream os(temps, 30); 182 | os << vals[i] << ends; 183 | eps[i]->set_text(temps); 184 | vb->pack_start(*eps[i]); 185 | 186 | lp = manage(new Label(" Hold:")); 187 | vb->pack_start(*lp); 188 | 189 | checks[i] = manage(new CheckButton()); 190 | checks[i]->set_active(mask != NULL ? !mask[i] : 0); 191 | vb->pack_start(*checks[i]); 192 | 193 | table->attach(*vb, 0, 1, i, i+1, EXPAND, EXPAND); 194 | } 195 | 196 | sw->add(*table); 197 | get_vbox()->pack_start(*sw); 198 | add_button("OK",RESPONSE_OK); 199 | add_button("Cancel",RESPONSE_CANCEL); 200 | 201 | show_all_children(); 202 | } 203 | 204 | CoefficientDialog::~CoefficientDialog() 205 | { 206 | delete[] eps; 207 | delete[] checks; 208 | } 209 | 210 | void CoefficientDialog::on_response(int rid) 211 | { 212 | string s1; 213 | if (rid==RESPONSE_OK) 214 | { 215 | retvals.resize(nentries); 216 | maskvals.resize(nentries); 217 | for (int i=0 ; iget_text(); 220 | istrstream inst(s1.c_str()); 221 | inst >> retvals[i]; 222 | maskvals[i] = !checks[i]->get_active(); 223 | } 224 | } 225 | } 226 | 227 | //------------------------------------------------------------------- 228 | 229 | SimulateDialog::SimulateDialog(Window& wi, int defaultn) 230 | : CenteringDialog("Simulation", wi) 231 | { 232 | int i,nn = defaultn==0 ? 250 : defaultn; 233 | char temps[30]; 234 | 235 | // action area 236 | add_button("Cancel", RESPONSE_CANCEL); 237 | add_button("O.K.", RESPONSE_OK); 238 | 239 | // Then vbox area 240 | table = manage(new Table(1,2,false)); 241 | table->attach(*(manage(new Label("# Obs"))), 0, 1, 0, 1, EXPAND, EXPAND, 10, 2); 242 | nadjust = manage(new Adjustment(nn,0,100000,10,10,10)); 243 | nspin = manage(new SpinButton(*nadjust,0,0)); 244 | table->attach(*nspin, 0,1,1,2, EXPAND, EXPAND, 10, 2); 245 | get_vbox()->pack_start(*table); 246 | 247 | show_all_children(); 248 | } 249 | 250 | int SimulateDialog::get_n() 251 | { 252 | return nspin->get_value_as_int(); 253 | } 254 | 255 | //------------------------------------------------------------------- 256 | 257 | ForecastDialog::ForecastDialog(Window& wi, int defaultn) 258 | : CenteringDialog("Forecast", wi) 259 | { 260 | int i,nn = defaultn==0 ? 10 : defaultn; 261 | char temps[30]; 262 | 263 | // action area 264 | add_button("Cancel", RESPONSE_CANCEL); 265 | add_button("O.K.", RESPONSE_OK); 266 | 267 | // Then vbox area 268 | table = manage(new Table(2,3,false)); 269 | table->attach(*(manage(new Label("Forecast Horizon"))), 0,1,1,2, EXPAND, EXPAND, 10, 2); 270 | table->attach(*(manage(new Label("Number of Trajectories"))), 1,2,1,2, EXPAND, EXPAND, 10, 2); 271 | 272 | nadjust = manage(new Adjustment(nn,0,100000,1,10,10)); 273 | nspin = manage(new SpinButton(*nadjust,0,0)); 274 | 275 | simsadjust = manage(new Adjustment(2500, 100, 100000, 100, 10, 10)); 276 | simsspin = manage(new SpinButton(*simsadjust,0,0)); 277 | 278 | table->attach(*nspin, 0,1,2,3, EXPAND, EXPAND, 10, 2); 279 | table->attach(*simsspin, 1,2,2,3, EXPAND, EXPAND, 10, 2); 280 | get_vbox()->pack_start(*table); 281 | 282 | Label *label = manage(new Label("Forecasts are based on simulation of (future) trajectories.\nSome Monte-Carlo simulation error can be expected in predictive distributions.")); 283 | table->attach(*label, 0,2,0,1, EXPAND, EXPAND); 284 | 285 | show_all_children(); 286 | } 287 | 288 | int ForecastDialog::get_n() 289 | { 290 | return nspin->get_value_as_int(); 291 | } 292 | 293 | int ForecastDialog::get_sims() 294 | { 295 | return simsspin->get_value_as_int(); 296 | } 297 | 298 | //------------------------------------------------------------------- 299 | 300 | GeneralTextDialog::GeneralTextDialog(Window& wi, string label, string thetext) 301 | : CenteringDialog("", wi) 302 | { 303 | int i; 304 | 305 | // action area 306 | add_button("Cancel", RESPONSE_CANCEL); 307 | add_button("O.K.", RESPONSE_OK); 308 | 309 | // Then vbox area 310 | table = manage(new Table(1,2,false)); 311 | table->attach(*(manage(new Label(label.c_str()))), 312 | 0, 1, 0, 1, EXPAND, EXPAND, 10, 2); 313 | entry = manage(new Gtk::Entry()); 314 | entry->set_text(thetext.c_str()); 315 | table->attach(*entry, 0,1,1,2, EXPAND, EXPAND, 10, 2); 316 | get_vbox()->pack_start(*table); 317 | 318 | show_all_children(); 319 | } 320 | 321 | string GeneralTextDialog::get_text() 322 | { 323 | string ts = entry->get_text(); 324 | return ts; 325 | } 326 | -------------------------------------------------------------------------------- /src/main/dialogs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef DIALOGS_HPP 24 | #define DIALOGS_HPP 25 | 26 | #include "timeseries.h" 27 | 28 | class Transformation; 29 | class TransformDialog; 30 | 31 | class CenteringDialog : public Gtk::Dialog { 32 | public: 33 | Window *cd_parent_win; 34 | CenteringDialog(Glib::ustring title, Window& w); 35 | }; 36 | 37 | 38 | class TransformDialog : public CenteringDialog { 39 | protected: 40 | Transformation *trans; 41 | Gtk::Table *table; 42 | Gtk::Entry **es; 43 | Gtk::Label **ls; 44 | 45 | public: 46 | TransformDialog(Transformation *t, Window& wi); 47 | 48 | void terminate(int); 49 | void enter_pressed(); 50 | }; 51 | 52 | class IterationCounter : public CenteringDialog { 53 | protected: 54 | int localcount; 55 | Gtk::ProgressBar *pbar; 56 | Gtk::Label *label1, *label2, *stage_label; 57 | int curstage; 58 | 59 | public: 60 | IterationCounter(Window& wp); 61 | 62 | int increment(int stage); 63 | }; 64 | 65 | class CoefficientDialog : public CenteringDialog { 66 | protected: 67 | int nentries; 68 | Gtk::Entry **eps; 69 | Gtk::CheckButton **checks; 70 | 71 | public: 72 | CoefficientDialog(Window& wi, int n, string *, double *val, double *mask); 73 | ~CoefficientDialog(); 74 | void on_response(int response_id); 75 | 76 | Vector retvals, maskvals; 77 | }; 78 | 79 | class SimulateDialog : public CenteringDialog { 80 | protected: 81 | Gtk::Table *table; 82 | Gtk::SpinButton *nspin; 83 | Gtk::Adjustment *nadjust; 84 | 85 | public: 86 | SimulateDialog(Window& wi, int defaultn); 87 | int get_n(); 88 | }; 89 | 90 | class ForecastDialog : public CenteringDialog { 91 | protected: 92 | Gtk::Table *table; 93 | Gtk::SpinButton *nspin, *simsspin; 94 | Gtk::Adjustment *nadjust, *simsadjust; 95 | 96 | public: 97 | ForecastDialog(Window& wi, int defaultn); 98 | int get_n(); 99 | int get_sims(); 100 | }; 101 | 102 | class GeneralTextDialog : public CenteringDialog { 103 | protected: 104 | Gtk::Table *table; 105 | Gtk::Entry *entry; 106 | 107 | public: 108 | GeneralTextDialog(Window& wi, string label, string thetext); 109 | string get_text(); 110 | }; 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/main/epsdc.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | * 22 | * This module contains a class which writes to encapsulated 23 | * postscript files, treating them like standard graphics 24 | * devices, with calls to generate lines, rectangles, etc. 25 | * March, 2001, Anthony Brockwell. 26 | * 27 | */ 28 | 29 | 30 | #include "epsdc.h" 31 | #include "rect.h" 32 | #include 33 | #include 34 | 35 | TEpsPlot::TEpsPlot(TRect boundingbox, const char *filename) 36 | { 37 | outfile = new ofstream(filename); 38 | topy = boundingbox.Height(); 39 | bottomy = 0; 40 | scale = 576.0/boundingbox.Width(); // 8 inches wide 41 | 42 | // write header 43 | *outfile << "%!PS-Adobe-3.0 EPSF-3.0" << endl; 44 | *outfile << "%%Creator: Brockwell Software" << endl; 45 | *outfile << "%%Title: test1.eps" << endl; 46 | *outfile << "%%DocumentNeededFonts: Times-Roman" << endl; 47 | *outfile << "%%LanguageLevel: 2" << endl; 48 | *outfile << "%%Pages: 0" << endl; 49 | *outfile << "%%Orientation: Portrait" << endl; 50 | *outfile << "%%BoundingBox: 0 0 " << boundingbox.Width()*scale << " " 51 | << boundingbox.Height()*scale << endl; 52 | *outfile << "%%EndComments" << endl; 53 | *outfile << endl << endl; 54 | 55 | *outfile << "/Times-Roman findfont" << endl; 56 | *outfile << "30 scalefont" << endl; 57 | *outfile << "setfont" << endl; 58 | 59 | *outfile << endl; 60 | 61 | *outfile << "/L {lineto} bind def" << endl; 62 | *outfile << "/M {moveto} bind def" << endl; 63 | *outfile << "/S {stroke} bind def" << endl; 64 | *outfile << "/N {newpath} bind def" << endl; 65 | *outfile << "/D {setdash} bind def" << endl; 66 | 67 | *outfile << scale << " " << scale << " scale" << endl; 68 | *outfile << "2 setlinewidth" << endl; 69 | 70 | inpath = false; 71 | } 72 | 73 | TEpsPlot::~TEpsPlot() 74 | { 75 | FinishPath(); 76 | *outfile << endl << "showpage" << endl << "%%Trailer" << endl 77 | << "%%EOF" << endl; 78 | outfile->close(); 79 | } 80 | 81 | int TEpsPlot::tof(int y) 82 | { 83 | return topy - y; 84 | } 85 | 86 | void TEpsPlot::TextOut(int x, int y, const char *cp, bool center) 87 | { 88 | FinishPath(); 89 | *outfile << x << " (" << cp << ") stringwidth pop "; 90 | if (center) 91 | *outfile << "2 div "; 92 | *outfile << "sub "; 93 | *outfile << tof(y); 94 | *outfile << " M" << endl; 95 | *outfile << "(" << cp << ") show" << endl; 96 | } 97 | 98 | void TEpsPlot::FinishPath() 99 | { 100 | if (inpath) { 101 | *outfile << "S" << endl; // finish previous path 102 | inpath = false; 103 | } 104 | } 105 | 106 | void TEpsPlot::SetLineMode(int mode, int width) 107 | { 108 | FinishPath(); 109 | switch (mode) 110 | { 111 | case 1: 112 | *outfile << "[4 10] 0 D" << endl; 113 | break; 114 | default: 115 | *outfile << "[] 0 D" << endl; 116 | break; 117 | } 118 | *outfile << width << " setlinewidth" << endl; 119 | } 120 | 121 | void TEpsPlot::FillRect(int x1, int y1, int x2, int y2, 122 | int r1, int g1, int b1) 123 | { 124 | float r=r1/256.0,g=g1/256.0,b=b1/256.0; 125 | DrawRect(x1,y1,x2,y2); 126 | *outfile << r << " " << g << " " << b << " setrgbcolor" << endl; 127 | *outfile << " fill" << endl; 128 | *outfile << "0 0 0 setrgbcolor" << endl; 129 | } 130 | 131 | void TEpsPlot::DrawRect(int x1, int y1, int x2, int y2) 132 | { 133 | MoveTo(x1,y1); 134 | LineTo(x2,y1); 135 | LineTo(x2,y2); 136 | LineTo(x1,y2); 137 | LineTo(x1,y1); 138 | } 139 | 140 | void TEpsPlot::SetFontSize(int w, int h) 141 | { 142 | FinishPath(); 143 | *outfile << "/Times-Roman findfont" << endl 144 | << "[" << h << " 0 0 " << h << " 0 0] makefont" << endl 145 | << "setfont" << endl; 146 | } 147 | 148 | bool TEpsPlot::MoveTo(int x, int y) 149 | { 150 | FinishPath(); 151 | *outfile << "N" << endl << x << " " << tof(y) << " M" << endl; 152 | return true; 153 | } 154 | 155 | bool TEpsPlot::LineTo(int x, int y) 156 | { 157 | *outfile << x << " " << tof(y) << " L" << endl; 158 | inpath = true; 159 | return true; 160 | } 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /src/main/epsdc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef EPSDC_HPP 24 | #define EPSDC_HPP 25 | 26 | #include "rect.h" 27 | #include 28 | 29 | class TEpsPlot 30 | { 31 | protected: 32 | ofstream *outfile; 33 | bool inpath; 34 | int topy,bottomy; 35 | double scale; 36 | int tof(int); 37 | 38 | public: 39 | TEpsPlot(TRect bbox, const char *filename); 40 | ~TEpsPlot(); 41 | 42 | // things I have taken over 43 | void FinishPath(); 44 | bool MoveTo(int,int); 45 | bool LineTo(int,int); 46 | void FillRect(int x1, int y1, int x2, int y2, int r,int g,int b); 47 | void FillRect(TRect r1, int r, int g, int b) 48 | { FillRect(r1.left, r1.top, r1.right, r1.bottom, r, g, b); }; 49 | void DrawRect(int x1, int y1, int x2, int y2); 50 | void DrawRect(TRect r1) 51 | { DrawRect(r1.left, r1.top, r1.right, r1.bottom);}; 52 | void TextOut(int,int,const char *,bool center); 53 | 54 | void SetLineMode(int md, int w=2); 55 | void SetFontSize(int w, int h); 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/main/farma.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * farma_xpm[] = { 3 | "32 32 3 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #010101", 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 | -------------------------------------------------------------------------------- /src/main/fdiff.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fdiff_xpm[] = { 3 | "32 32 3 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #FFFFFF", 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 | -------------------------------------------------------------------------------- /src/main/fegarch.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fegarch_xpm[] = { 3 | "50 32 2 1", 4 | " c None", 5 | ". c #000000", 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 | -------------------------------------------------------------------------------- /src/main/ffore.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * ffore_xpm[] = { 3 | "32 32 6 1", 4 | " c None", 5 | ". c black", 6 | "X c white", 7 | "o c cyan", 8 | "O c blue", 9 | "+ c red", 10 | " ", 11 | " ", 12 | " ", 13 | " ", 14 | " ", 15 | " ............................ ", 16 | " .XXXXXXXXXXXXXXXoXXXXXXXXXX. ", 17 | " .XXXXXXXXXXXXXXXoXXXXXXXXXX. ", 18 | " .XXXXXXXXXXXXXXXoXXXXXXXXXX. ", 19 | " .XXXXXXXXXXXXXXXoXXXXXXXXXX. ", 20 | " .XXXXXXXXXXXXXXXoXXXXXXXXXX. ", 21 | " .XXXXXXXXXXXXXOXoXXX+XXXXXX. ", 22 | " .XXXXXXXXXXXXOOXoXXX++XXXXX. ", 23 | " .XXXXXXXXXXXXOXOo++++++XXXX. ", 24 | " .XXXXXXOXXXXXOXXo+++++++XXX. ", 25 | " .XXOXXXOOOXXXOXXo++++++++XX. ", 26 | " .XOXOXOXXXOXOXXXo++++++++XX. ", 27 | " .OXXOXOXXXOXOXXXo+++++++XXX. ", 28 | " .XXXOXOXXXOXOXXXo++++++XXXX. ", 29 | " .XXXXOXXXXOXOXXXoXXX++XXXXX. ", 30 | " .XXXXOXXXXXOXXXXoXXX+XXXXXX. ", 31 | " .XXXXXXXXXXOXXXXoXXXXXXXXXX. ", 32 | " .XXXXXXXXXXOXXXXoXXXXXXXXXX. ", 33 | " .XXXXXXXXXXOXXXXoXXXXXXXXXX. ", 34 | " .XXXXXXXXXXXXXXXoXXXXXXXXXX. ", 35 | " .XXXXXXXXXXXXXXXoXXXXXXXXXX. ", 36 | " ............................ ", 37 | " ", 38 | " ", 39 | " ", 40 | " ", 41 | " "}; 42 | -------------------------------------------------------------------------------- /src/main/fgarch.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fgarch_xpm[] = { 3 | "44 32 2 1", 4 | " c None", 5 | ". c #000000", 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 | -------------------------------------------------------------------------------- /src/main/fintegrate.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fintegrate_xpm[] = { 3 | "32 32 3 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #A09393", 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 | -------------------------------------------------------------------------------- /src/main/flogs.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * flogs_xpm[] = { 3 | "32 32 5 1", 4 | " c None", 5 | ". c black", 6 | "X c white", 7 | "o c grey", 8 | "O c blue", 9 | " ", 10 | " ", 11 | " ", 12 | " ", 13 | " ", 14 | " ............................ ", 15 | " .XXXoXXXXXXXXXXXXXXXXXXXXXX. ", 16 | " .XXXoXXXXXXXXXXXXXXXXXXXXXX. ", 17 | " .XXXoXXXXXXXXXXXXXXXXXXXXXX. ", 18 | " .XXXoXXXXXXXXXXXXXXXXXXXXXX. ", 19 | " .XXXoXXXXXXXXXXXXXXXXXXXXXX. ", 20 | " .XXXoXXXXXXXXXXXXXXXXXXXXXX. ", 21 | " .XXXoXXXXXXXXXXXXXXXXXXXOOO. ", 22 | " .XXXoXXXXXXXXXXXOOOOOOOOXXX. ", 23 | " .XXXoXXXXXXXOOOOXXXXXXXXXXX. ", 24 | " .XXXoXXXXXOOXXXXXXXXXXXXXXX. ", 25 | " .XXXoXXXXOXXXXXXXXXXXXXXXXX. ", 26 | " .oooooooOoooooooooooooooooo. ", 27 | " .XXXoXXXOXXX.XXXXXXXXXXXXXX. ", 28 | " .XXXoXXOXXXX.XXXXXXXXXXXXXX. ", 29 | " .XXXoXXOXXXX.XXX...X...XXXX. ", 30 | " .XXXoXXOXXXX.XXX.X.X.X.XXXX. ", 31 | " .XXXoXOXXXXX...X...X...XXXX. ", 32 | " .XXXoXOXXXXXXXXXXXXXXX.XXXX. ", 33 | " .XXXoXOXXXXXXXXXXXXX...XXXX. ", 34 | " .XXXoXOXXXXXXXXXXXXXXXXXXXX. ", 35 | " ............................ ", 36 | " ", 37 | " ", 38 | " ", 39 | " ", 40 | " "}; 41 | -------------------------------------------------------------------------------- /src/main/fmle.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fmle_xpm[] = { 3 | "32 32 68 1", 4 | " c None", 5 | ". c #F8F3AB", 6 | "+ c #F7F2AA", 7 | "@ c #000000", 8 | "# c #010101", 9 | "$ c #D5D092", 10 | "% c #11110C", 11 | "& c #ABA775", 12 | "* c #54533A", 13 | "= c #706E4D", 14 | "- c #B0AC79", 15 | "; c #C6C288", 16 | "> c #F3EEA7", 17 | ", c #F3EEA8", 18 | "' c #F3EFA8", 19 | ") c #F4EFA8", 20 | "! c #28271C", 21 | "~ c #27261B", 22 | "{ c #4E4C35", 23 | "] c #191911", 24 | "^ c #B4B17C", 25 | "/ c #CBC78C", 26 | "( c #7A7754", 27 | "_ c #C8C48A", 28 | ": c #F6F1A9", 29 | "< c #15140E", 30 | "[ c #646245", 31 | "} c #BAB680", 32 | "| c #CCC78C", 33 | "1 c #C1BE85", 34 | "2 c #100F0B", 35 | "3 c #686648", 36 | "4 c #ADA977", 37 | "5 c #10100B", 38 | "6 c #B7B37E", 39 | "7 c #BEBA83", 40 | "8 c #CCC88D", 41 | "9 c #59573D", 42 | "0 c #1F1F15", 43 | "a c #F6F1AA", 44 | "b c #525038", 45 | "c c #58563C", 46 | "d c #C1BD85", 47 | "e c #C9C58B", 48 | "f c #B7B47E", 49 | "g c #B8B57F", 50 | "h c #0F0F0A", 51 | "i c #C2BE86", 52 | "j c #C5C187", 53 | "k c #CEC98E", 54 | "l c #1B1A12", 55 | "m c #252419", 56 | "n c #C5C188", 57 | "o c #C7C389", 58 | "p c #CECA8E", 59 | "q c #6C6A4A", 60 | "r c #7C7955", 61 | "s c #CDC98D", 62 | "t c #DCD898", 63 | "u c #99966A", 64 | "v c #E3DF9D", 65 | "w c #CAC68B", 66 | "x c #353424", 67 | "y c #0E0D09", 68 | "z c #F3EDA8", 69 | "A c #C1B592", 70 | "B c #F0EAA7", 71 | "C c #A49485", 72 | " ", 73 | " ", 74 | " ", 75 | " ...... ", 76 | " ......... ", 77 | " ......... ", 78 | " ......... ", 79 | " .. ......... ", 80 | " . .......... ", 81 | " .. .....+.... ", 82 | " .... ....++..... ", 83 | " .@#$. %@ @& ....@@@@@@* ", 84 | " .@@=. @@ @-.....@;>,,') ", 85 | " .@!~.. {]@ @^.....@/..... ", 86 | " .@(@_.:<[@ @}.....@|..... ", 87 | " .@123.456@..@7.....@8..... ", 88 | " .@_90abc7@..@d.....@@@@@@. ", 89 | " .@ef@gh7i@..@j.....@k..... ", 90 | " .@/al~m.n@..@o.....@p...... ", 91 | " .@8.q@r._@..@n>>>,+@/'))), ", 92 | " @s.tuv.w@..@@@@@xa@@@@@@y ", 93 | " ........................ ", 94 | " ......................z ", 95 | " +....................+A ", 96 | " ....................BC ", 97 | " ......+........... ", 98 | " ............... ", 99 | " ........... ", 100 | " ", 101 | " ", 102 | " ", 103 | " "}; 104 | -------------------------------------------------------------------------------- /src/main/fopen.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fopen_xpm[] = { 3 | "32 32 65 1", 4 | " c #FFFF00000000", 5 | ". c #FFFF08200820", 6 | "X c #FFFF0C300820", 7 | "o c #FFFF14511040", 8 | "O c #FFFF1C711861", 9 | "+ c #FFFF20812081", 10 | "@ c #FFFF28A228A2", 11 | "# c #FFFF2CB228A2", 12 | "$ c #FFFF34D330C2", 13 | "% c #FFFF38E338E3", 14 | "& c #FFFF41034103", 15 | "* c #FFFF49244924", 16 | "= c #FFFF4D344924", 17 | "- c #FFFF55555144", 18 | "; c #FFFF59655965", 19 | ": c #FFFF61856185", 20 | "> c #FFFF65956185", 21 | ", c #FFFF6DB669A6", 22 | "< c #FFFF75D671C6", 23 | "1 c #FFFF79E779E7", 24 | "2 c #FFFF82078617", 25 | "3 c #FFFF86178617", 26 | "4 c #FFFF8E388E38", 27 | "5 c #FFFF92489658", 28 | "6 c #FFFF9A699E79", 29 | "7 c #FFFFA289A699", 30 | "8 c #FFFFA699A699", 31 | "9 c #FFFFAEBAAEBA", 32 | "0 c #FFFF10401040", 33 | "q c #FFFF3CF338E3", 34 | "w c #FFFFB2CAB6DA", 35 | "e c #FFFF69A669A6", 36 | "r c #FFFF96589658", 37 | "t c #FFFFBAEABEFB", 38 | "y c #FFFF04100000", 39 | "u c #FFFF30C230C2", 40 | "i c #FFFF5D755965", 41 | "p c #FFFFC30BC71B", 42 | "a c #FFFF8A288E38", 43 | "s c #FFFFB6DAB6DA", 44 | "d c #FFFFC71BC71B", 45 | "f c #FFFF24922081", 46 | "g c #FFFF51445144", 47 | "h c #FFFF7DF779E7", 48 | "j c #FFFFCF3CCF3C", 49 | "k c #FFFF18611861", 50 | "l c #FFFFAAAAAEBA", 51 | "z c #FFFFD75CD75C", 52 | "x c #FFFF45144103", 53 | "c c #FFFF71C671C6", 54 | "v c #FFFF9E799E79", 55 | "b c #FFFFDB6CDF7D", 56 | "n c #000000000000", 57 | "m c #FFFFCB2BCF3C", 58 | "M c #FFFFE38DE79D", 59 | "N c #FFFFFFFF0000", 60 | "B c #FFFFBEFBBEFB", 61 | "V c #FFFFE79DE79D", 62 | "C c #FFFFEBADEFBE", 63 | "Z c #FFFFEFBEEFBE", 64 | "A c #FFFFDF7DDF7D", 65 | "S c #FFFFF7DEF7DE", 66 | "D c #FFFFFBEEFFFF", 67 | "F c #FFFFFFFFFFFF", 68 | "G c #FFFFF3CEF7DE", 69 | " .XoO+@#$%&*=-;:>,<123456789", 70 | " .0oO+@#$q&*=-;:>,<123456789w", 71 | " .0oO+@#$q&*=-;:e,<1234r6789wt", 72 | " y.0oO+@u$q&*=-i:e,<1234r6789wtp", 73 | "y.0oO+@u$q&*=-i:e,<12a4r6789stpd", 74 | ".0oOf@u$q&*g-i:e,nNNNNnnnnnnnnnnnnnnnnnSFFF", 84 | "=g;:>,nNNNnNNNNNNNNNNNNNNNNnFFFF", 85 | "g;:>,cnNNNnNNNNNNNNNNNNNNNNnFFFF", 86 | ";:>,c1nNNnNNNNNNNNNNNNNNNNnFFFFF", 87 | ":>,c12nNNnNNNNNNNNNNNNNNNnFFFFFF", 88 | ">,<123nNnNNNNNNNNNNNNNNNNnFFFFFF", 89 | ",<1234nNnNNNNNNNNNNNNNNNNnFFFFFF", 90 | "<1234rnnNNNNNNNNNNNNNNNnnFFFFFFF", 91 | "1234r6nnNNNNNNNNNNNNNNNnnFFFFFFF", 92 | "2a4r67nNNNNNNNNNNNNNNNNnFFFFFFFF", 93 | "a4r678nnnnnnnnnnnnnnnnnnFFFFFFFF", 94 | "4r67l9stpdjzbMVZGDFFFFFFFFFFFFFF", 95 | "rv7l9stpdjzbMVZGDFFFFFFFFFFFFFFF", 96 | "v7l9stpmjzbMVZSDFFFFFFFFFFFFFFFF", 97 | "7l9sBpmjzbMVZSDFFFFFFFFFFFFFFFFF", 98 | "l9sBpmjzbMCZSDFFFFFFFFFFFFFFFFFF", 99 | "wsBpmjzAMCZSDFFFFFFFFFFFFFFFFFFF", 100 | "sBpmjzAMCZSDFFFFFFFFFFFFFFFFFFFF"}; 101 | -------------------------------------------------------------------------------- /src/main/fresids.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fresids_xpm[] = { 3 | "32 32 4 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #3D07EA", 7 | "@ c #FFFFFF", 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 | -------------------------------------------------------------------------------- /src/main/fsvm.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fsvm_xpm[] = { 3 | "32 32 2 1", 4 | " c None", 5 | ". c #000000", 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 | -------------------------------------------------------------------------------- /src/main/ftreverse.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * ftreverse_xpm[] = { 3 | "32 32 3 1", 4 | " c None", 5 | ". c #000000", 6 | "+ c #A09393", 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 | -------------------------------------------------------------------------------- /src/main/fundo.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fundo_xpm[] = { 3 | "32 32 3 1", 4 | " c None", 5 | ". c #000000000000", 6 | "X c #A6999E79C71B", 7 | " ", 8 | " ", 9 | " ", 10 | " ", 11 | " ", 12 | " ", 13 | " ", 14 | " ", 15 | " ... ", 16 | " ...X. ", 17 | " ...XXX. ", 18 | " ...XXXXX. ", 19 | " ...XXXXXXX. ", 20 | " ...XXXXXXXXX. ", 21 | " ...XXXXXXXXXXX. ", 22 | " ...XXXXXXXXXXXXX. ", 23 | " ...XXXXXXXXXXXXX. ", 24 | " ...XXXXXXXXXXX. ", 25 | " ...XXXXXXXXX. ", 26 | " ...XXXXXXX. ", 27 | " ...XXXXX. ", 28 | " ...XXX. ", 29 | " ...X. ", 30 | " ... ", 31 | " ", 32 | " ", 33 | " ", 34 | " ", 35 | " ", 36 | " ", 37 | " ", 38 | " "}; 39 | -------------------------------------------------------------------------------- /src/main/gc1.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static char * fc1_xpm[] = { 3 | "32 20 126 2", 4 | " c None", 5 | ". c #020204", 6 | "+ c #A68284", 7 | "@ c #524A4C", 8 | "# c #E2CECC", 9 | "$ c #EA4244", 10 | "% c #AAA2A4", 11 | "& c #E61A1C", 12 | "* c #A66E6C", 13 | "= c #E2E2E4", 14 | "- c #362624", 15 | "; c #DA8284", 16 | "> c #726664", 17 | ", c #EE6264", 18 | "' c #DEAEAC", 19 | ") c #DA9694", 20 | "! c #E2D2D4", 21 | "~ c #EA2E2C", 22 | "{ c #3A3634", 23 | "] c #DEBEBC", 24 | "^ c #BE5E5C", 25 | "/ c #FEF2F4", 26 | "( c #361214", 27 | "_ c #9E4244", 28 | ": c #F27274", 29 | "< c #A69694", 30 | "[ c #F29294", 31 | "} c #A25254", 32 | "| c #EA2624", 33 | "1 c #A67274", 34 | "2 c #FAE2E4", 35 | "3 c #522624", 36 | "4 c #A26264", 37 | "5 c #FAD2D4", 38 | "6 c #F6B2B4", 39 | "7 c #FAC2C4", 40 | "8 c #EE4A4C", 41 | "9 c #F28284", 42 | "0 c #EE6A6C", 43 | "a c #F6A2A4", 44 | "b c #EA3A3C", 45 | "c c #523234", 46 | "d c #EE5254", 47 | "e c #4E1A1C", 48 | "f c #C29294", 49 | "g c #F69A9C", 50 | "h c #FEEAEC", 51 | "i c #F6BABC", 52 | "j c #1A1214", 53 | "k c #EA2224", 54 | "l c #FEFAFC", 55 | "m c #A24A4C", 56 | "n c #F27A7C", 57 | "o c #6A2E2C", 58 | "p c #FADADC", 59 | "q c #FACACC", 60 | "r c #F28A8C", 61 | "s c #F6AAAC", 62 | "t c #523A3C", 63 | "u c #EE5A5C", 64 | "v c #C28E8C", 65 | "w c #EE4644", 66 | "x c #EA1E1C", 67 | "y c #BE6264", 68 | "z c #727274", 69 | "A c #EA3634", 70 | "B c #361E1C", 71 | "C c #AA9E9C", 72 | "D c #F69694", 73 | "E c #A25A5C", 74 | "F c #BE7E7C", 75 | "G c #FEE6E4", 76 | "H c #522E2C", 77 | "I c #A26A6C", 78 | "J c #F26E6C", 79 | "K c #FABEBC", 80 | "L c #1A0A0C", 81 | "M c #A68E8C", 82 | "N c #6E5A5C", 83 | "O c #EE4244", 84 | "P c #C6BEBC", 85 | "Q c #EA1A1C", 86 | "R c #4E2224", 87 | "S c #EE6664", 88 | "T c #DA9A9C", 89 | "U c #E2DADC", 90 | "V c #EA3234", 91 | "W c #FEF6F4", 92 | "X c #361614", 93 | "Y c #9E4644", 94 | "Z c #F27674", 95 | "` c #AA9A9C", 96 | " . c #F69294", 97 | ".. c #A25654", 98 | "+. c #EA2A2C", 99 | "@. c #A67674", 100 | "#. c #FEE2E4", 101 | "$. c #522A2C", 102 | "%. c #A26664", 103 | "&. c #FAD6D4", 104 | "*. c #F6B6B4", 105 | "=. c #FAC6C4", 106 | "-. c #EE4E4C", 107 | ";. c #F28684", 108 | ">. c #F26A6C", 109 | ",. c #F6A6A4", 110 | "'. c #EA3E3C", 111 | "). c #523634", 112 | "!. c #EE5654", 113 | "~. c #4E1E1C", 114 | "{. c #C29E9C", 115 | "]. c #F69E9C", 116 | "^. c #FEEEEC", 117 | "/. c #FABABC", 118 | "(. c #1E1A1C", 119 | "_. c #FEFEFC", 120 | ":. c #A24E4C", 121 | "<. c #F27E7C", 122 | "[. c #FADEDC", 123 | "}. c #FACECC", 124 | "|. c #F28E8C", 125 | "1. c #F6AEAC", 126 | "2. c #523E3C", 127 | "3. c #EE5E5C", 128 | "4. c #BE6E6C", 129 | "5. c #8A7674", 130 | "& & & & k +.V b $ 8 d u , 0 : n 9 r .g a s 6 /.7 q 5 p #.h / l ", 131 | "Q Q Q x | ~ A '.w -.!.3.S J Z <.;.|.D ].,.1.*.K =.}.&.[.G ^.W _.", 132 | "& & & k +.V b $ 8 d u , 0 : n 9 r [ g a s 6 i 7 q 5 p 2 h / l _.", 133 | "& & x | ~ A '.w -.!.3.S J Z <.;.|.D ].,.1.*.K =.}.&.[.G ^.W _._.", 134 | "& x | ~ A '.w -.!.3.S J Z <.;.|.D ].,.1.*.K =.q 5 p 2 h / l _._.", 135 | "& x | ~ A '.w -.!.3.S J Z <.;.|.D ].,.1.*.K =.5 p 2 h / l _._._.", 136 | "x | ~ A '.w e . . . . . } ... . . . - v i ' N . . . ! / _._._._.", 137 | "x | ~ A '.w e . ( R R 3 y E . j c . . t 7 . . @ @ (.C l _._._._.", 138 | "| ~ A '.w -.( . _ J Z <.;.H . ).a . . 2.+ . . p 2 ^./ _._._._._.", 139 | "+.V b $ 8 -.. . o m ^ 9 r H . I ) . . K {.. . > # ^.l _._._._._.", 140 | "+.V b $ -.d . . . . 3 ;.4.L . . . . f 7 q ] . . . P _._._._._._.", 141 | "V b $ 8 d ~.. . : n 9 r 4 . - * @.i 7 q 5 &.[.{ . . _._._._._._.", 142 | "A '.w -.!.~.. m Z <.;.|.4 . t 1.*.K =.}.5.[.G (.. z _._._._._._.", 143 | "b $ 8 d u L . . . . B ; ).. ).6 i 7 q M . . . . . = _._._._._._.", 144 | "$ 8 -.u 3._ m :.} E 4.D F * T *.7 =.}.] < < C U _._._._._._._._.", 145 | "$ 8 !.u S 0 : n ;.r D g a s 6 i 7 q 5 p 2 ^./ l _._._._._._._._.", 146 | "w -.!.3.0 J Z <.;.|.D ].s 1.*.K q }.p [.G ^.W _._._._._._._._._.", 147 | "-.!.3., 0 Z <.9 |.[ ].,.s *.K =.q &.p G h W _._._._._._._._._._.", 148 | "-.!., 0 J Z 9 ;.[ D ].s 1.*.K q }.p [.h ^.W _._._._._._._._._._.", 149 | "!.3.S 0 Z <.;.|.[ ].,.s *.K =.q &.p G h W _._._._._._._._._._._."}; 150 | -------------------------------------------------------------------------------- /src/main/includes.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "matrix.h" 6 | #include "abrand.h" 7 | #include "xyplot.h" 8 | #include "transform.h" 9 | #include "timeseries.h" 10 | #include "otherplots.h" 11 | -------------------------------------------------------------------------------- /src/main/link_win: -------------------------------------------------------------------------------- 1 | /bin/sh ../../libtool --mode=link --tag=CXX g++ -g -O2 -mwindows -o cronos.exe -Lc:/GTK/lib -lgtkmm-2.4 -lgdkmm-2.4 -latkmm-1.6 -lgtk-win32-2.0 -lpangomm-1.4 -lglibmm-2.4 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv -L/usr/local/lib -Lc:/MinGW/bin -L/mingw/lib/gcc/mingw32/3.4.2 -L/mingw/lib/gcc/mingw32/3.4.2/../../../../mingw32/lib -L/mingw/lib -Lc:/MinGW/bin/.. -L/mingw/lib/gcc/mingw32/3.4.2/../../.. -lfrtbegin -lmingw32 -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 cronos.o mainicon.obj mainwin.o xyplot.o transform.o otherplots.o tsmrender.o dialogs.o epsdc.o cubespline.o otherpopups.o textrender.o tsinterface.o ../mslib/libms.a /usr/local/lib/liblapack.a /usr/local/lib/libblas.a /usr/local/lib/libmuparser.a -lgsl -lgslcblas -lm -lg2c 2 | -------------------------------------------------------------------------------- /src/main/mainicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemedic/cronos/e55ab6b3b7a64a5edb2f7c371fe9461c1bd62d78/src/main/mainicon.ico -------------------------------------------------------------------------------- /src/main/mainicon.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemedic/cronos/e55ab6b3b7a64a5edb2f7c371fe9461c1bd62d78/src/main/mainicon.obj -------------------------------------------------------------------------------- /src/main/mainicon.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codemedic/cronos/e55ab6b3b7a64a5edb2f7c371fe9461c1bd62d78/src/main/mainicon.xcf -------------------------------------------------------------------------------- /src/main/mainwin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef MAINWIN_H 24 | #define MAINWIN_H 25 | 26 | class CoreWin : public Window { 27 | protected: 28 | FileSelection *fs; 29 | TimeSeriesModel *model; 30 | TSMInterface *interface; 31 | int modeltype; 32 | TimeSeries *timeseries; 33 | vector transformlist; 34 | TSPlot *plotwin; 35 | ACFPlot *acfplot; 36 | PACFPlot *pacfplot; 37 | TSMRenderer *modelrenderer; 38 | Transformation *trans_loc; 39 | IterationCounter *itcount; 40 | Glib::TimeVal ittime; 41 | Glib::ustring local_data; 42 | 43 | //void on_clipboard_get(Gtk::SelectionData& selection_data, guint); 44 | public: 45 | CoreWin(); // constructor (empty TS, etc.) 46 | 47 | void clear_transforms(); 48 | void update_all(bool doacf=false); 49 | 50 | void file_new_cb(); 51 | void file_open_cb(); 52 | void file_save_cb(); 53 | void file_exit_cb(); 54 | void undo_transform_cb(); 55 | void data_periodogram(); 56 | void data_import_clipboard(); 57 | void transform_specified(bool getparms); 58 | void transform_cb(int tt, bool getparms); 59 | void help_about_cb(); 60 | void model_specify_cb(int mtype); 61 | void model_specified(); 62 | void model_fit_iteration(int stage); 63 | void model_fit_cb(int methodtype); 64 | void model_residuals_cb(); 65 | void model_acf_pacf_cb(); 66 | void model_spectral_density(); 67 | void model_simulate(); 68 | void model_forecast_cb(); 69 | void model_view_cts_version_cb(); 70 | 71 | void on_clipboard_received(const Gtk::SelectionData& selection_data); 72 | 73 | 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/main/otherplots.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef OTHERPLOTS_HPP 24 | #define OTHERPLOTS_HPP 25 | 26 | #include "xyplot.h" 27 | #include "gtkmm.h" 28 | 29 | using namespace Gtk; 30 | 31 | class TSPlot : public XYPlot 32 | { 33 | protected: 34 | 35 | public: 36 | TSPlot(TimeSeries& ts); 37 | void Update(TimeSeries&); 38 | void Update(TimeSeries& ts1, TimeSeries& ts2); 39 | 40 | protected: 41 | }; 42 | 43 | class QQPlot : public XYPlot 44 | { 45 | protected: 46 | public: 47 | QQPlot(TimeSeries& ts); 48 | void Update(TimeSeries&); 49 | }; 50 | 51 | class ACFPlot : public XYPlot 52 | { 53 | protected: 54 | Vector localacf, locallag; 55 | double gamma0; 56 | Adjustment *lagadjust; 57 | SpinButton *lagspin; 58 | CheckButton *cb1,*cb2; 59 | int nlags; 60 | bool normalizing, includinglag0; 61 | 62 | public: 63 | ACFPlot(TimeSeries& ts); 64 | ACFPlot(TimeSeriesModel& tm); 65 | ~ACFPlot(); 66 | void Update(TimeSeries&); 67 | void Update(TimeSeriesModel&); 68 | void RenderStuff(); 69 | 70 | virtual void InitPropDialog(CenteringDialog& cd); 71 | virtual void ClosePropDialog(CenteringDialog& cd); 72 | }; 73 | 74 | class PACFPlot : public XYPlot 75 | { 76 | protected: 77 | Vector localacf, localpacf, locallag; 78 | public: 79 | PACFPlot(TimeSeries& ts); 80 | PACFPlot(TimeSeriesModel& tm); 81 | ~PACFPlot(); 82 | void Update(TimeSeries&); 83 | void Update(TimeSeriesModel&); 84 | }; 85 | 86 | class PatchPlot : public Gtk::DrawingArea 87 | { 88 | protected: 89 | string title; 90 | Glib::RefPtr gc; 91 | Gdk::Color blue, lightblue, red, green, black, white, grey, darkgrey; 92 | Gdk::Color *shades; 93 | 94 | int n, nshades; 95 | Vector *u; 96 | Matrix pseudomap, baselinemap; 97 | 98 | public: 99 | PatchPlot(TimeSeries& resids); 100 | ~PatchPlot(); 101 | void Update(); 102 | void SetTitle(string&); 103 | 104 | virtual void on_realize(); 105 | virtual bool on_expose_event(GdkEventExpose* e); 106 | void ComputePseudomap(int nr, int nc); 107 | double Intensity(double x, double y, double centerx, double centery, double sig); 108 | }; 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /src/main/otherpopups.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef RESIDWIN_H 24 | #define RESIDWIN_H 25 | 26 | class TextRenderer; 27 | 28 | class ModelACFWin : public Gtk::Table { 29 | protected: 30 | ACFPlot *acfpp; 31 | PACFPlot *pacfpp; 32 | 33 | public: 34 | ModelACFWin(TimeSeriesModel *m); 35 | }; 36 | 37 | class ResidualWin : public Gtk::Table { 38 | protected: 39 | TSPlot *tsp; 40 | ACFPlot *acfpp; 41 | PACFPlot *pacfpp; 42 | TextRenderer *tr; 43 | TimeSeries residuals; 44 | Vector acf, pacf; 45 | QQPlot *qqpp; 46 | 47 | void RunTests(); 48 | Vector Ts, pvals; 49 | 50 | public: 51 | ResidualWin(TimeSeries *resids, TimeSeriesModel *model, TimeSeries *ts); 52 | ~ResidualWin(); 53 | }; 54 | 55 | class SpectrumWin : public Gtk::Table { 56 | protected: 57 | Matrix freqs; // Nx1 vector or Nx2 vector 58 | Matrix pdgm; // often just a vector, but if smoothed as well, is Nx2 59 | XYPlot *xyplot; 60 | bool logged; 61 | 62 | public: 63 | SpectrumWin(Matrix& f, Matrix& p, string& title); 64 | ~SpectrumWin(); 65 | void LogTransform(); 66 | void ExpTransform(); 67 | }; 68 | 69 | class ForecastWin : public Gtk::Table { 70 | protected: 71 | vector *trans; 72 | int ntrans,transpos; 73 | Matrix x,y,missing; // data fed to xyplot class 74 | int nf; 75 | XYPlot *xyplot; 76 | Matrix all_sims; 77 | void RebuildData(); 78 | TimeSeries local_ts_copy; 79 | 80 | public: 81 | ForecastWin(TimeSeries&, TimeSeriesModel&, int horizon, 82 | vector *tlistcopy, int num_sims); 83 | ~ForecastWin(); 84 | void UndoTransform(); 85 | void RedoTransform(); 86 | }; 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /src/main/ots.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMESERIES_H 2 | #define TIMESERIES_H 3 | 4 | #include 5 | #include "matrix.h" 6 | using namespace std; 7 | using namespace mslib; 8 | 9 | const int maxorder = 100; 10 | const int maxtransforms = 50; 11 | 12 | class TimeSeriesModel; 13 | class ARMAModel; 14 | class Transformation; 15 | class matrix; 16 | 17 | int min(int,int); 18 | int max(int,int); 19 | int abs(int); 20 | 21 | class JulianTime { 22 | protected: 23 | int julianday; 24 | double dayfraction; 25 | 26 | public: 27 | JulianTime() {julianday=0;} 28 | ~JulianTime() {}; 29 | void GetYearMonthDay(int *y, int *m, int *d); 30 | void SetYearMonthDay(int y, int m, int d); 31 | void IncreaseBy(double amount); 32 | }; 33 | 34 | class TimeSeries { 35 | protected: 36 | void ParseDescriptor(char *); 37 | string title, description; 38 | 39 | public: 40 | double *data; 41 | bool *missing, anymissing; 42 | int n, nallocated; 43 | int desiredforecasts; // This supersedes the realitypoint variable above. 44 | int ntransforms; 45 | Transformation *transforms[maxtransforms]; 46 | 47 | public: 48 | TimeSeries(); 49 | ~TimeSeries(); 50 | 51 | void ClearOut(); 52 | void Append(double x, bool msng=false); 53 | int GetN() {return n;} 54 | bool IsMissing(int t) {return missing[t];} 55 | bool HasAnyMissing(); 56 | double *GetData() {return data;} 57 | Vector GetDataVector(); 58 | Vector GetMissingVector(); 59 | void Clip(int n0, int n1); 60 | void RenderInto(ostrstream &); 61 | string& GetDescription() {return description;} 62 | string& GetTitle() {return title;} 63 | 64 | // useful stuff 65 | double SampleMean(); 66 | double SampleMin(); 67 | void ComputeSampleACF(Vector *acf, Vector *pacf, 68 | int normalizeacf=1); 69 | Matrix *GetInnovations(double *vhat, int m); 70 | void ComputePeriodogram(); 71 | double *periodogram; 72 | TimeSeries& operator=(const TimeSeries &other); 73 | bool ApplyTransformation(Transformation *, ostrstream&); 74 | bool ReverseATransformation(ostrstream&); 75 | 76 | friend ostream& operator<<(ostream&, TimeSeries&); 77 | friend istream& operator>>(istream&, TimeSeries&); 78 | }; 79 | 80 | class TimeSeriesModel { 81 | protected: 82 | double loglikelihood, AICC; 83 | 84 | public: 85 | TimeSeriesModel(); 86 | virtual ~TimeSeriesModel(); 87 | 88 | virtual void Specify()=0; 89 | virtual int FitModel(TimeSeries *ts, void (*itercallback)(), 90 | ostrstream& msg)=0; 91 | virtual void SimulateInto(TimeSeries *, int n, bool ovw)=0; 92 | virtual void RenderInto(ostrstream&)=0; 93 | virtual void ComputeACFPACF(Vector &acf, Vector *pacf, 94 | int normalizeacf=1)=0; 95 | virtual void Forecast(TimeSeries *, int nsteps, 96 | double *fret, TimeSeries *resids, double *rstore=NULL)=0; 97 | virtual void ForecastWithMissing(TimeSeries *, int nsteps, 98 | double *fret, TimeSeries *resids, double *rstore=NULL)=0; 99 | virtual double ComputeLogLikelihood(TimeSeries *)=0; 100 | virtual void AutoFitModel(TimeSeries *ts)=0; 101 | double GetLogLikelihood() {return loglikelihood;} 102 | double GetAICC() {return AICC;} 103 | 104 | static const int SUCCESS=1, NONCONVERGENT=0, UNABLE=-1; 105 | }; 106 | 107 | class ARMAModel : public TimeSeriesModel { 108 | protected: 109 | int p,q; 110 | double sigma; 111 | double mean; 112 | double kappa(int i, int j, int m, Vector &acfs); // used for prediction 113 | double fracdiff; 114 | 115 | public: 116 | ARMAModel(); 117 | ~ARMAModel(); 118 | ARMAModel& operator=(const ARMAModel &other); 119 | 120 | double phi[maxorder], theta[maxorder]; 121 | 122 | void InteriorFit(int p, int q, TimeSeries *ts, bool usemle=false, 123 | void (*callback)() = NULL); 124 | void SetOrder(int arorder, int maorder) 125 | { p=arorder; q=maorder; } 126 | void SetSigma2(double sigma2) 127 | { sigma = sqrt(sigma2); } 128 | void SetCoefficients(double *phis, double *thetas); 129 | void SetMean(double m) 130 | { mean=m; } 131 | void SetFracDiff(double d) 132 | { fracdiff=d; } 133 | 134 | int GetP() {return p;} 135 | int GetQ() {return q;} 136 | double GetFracDiff() {return fracdiff;} 137 | double GetMean() {return mean;} 138 | double GetSigma() {return sigma;} 139 | int CreateStateSpaceRepresentation(Matrix& F, Matrix& G, Matrix& Q); 140 | 141 | bool IsCausal(bool causalify=false); 142 | bool IsInvertible(bool invertibilify=false); 143 | bool CheckModel(bool flipit=false); 144 | 145 | void Specify(); 146 | int FitModel(TimeSeries *, void (*itercallback)(), ostrstream& msg); 147 | void AutoFitModel(TimeSeries *ts); 148 | void SimulateInto(TimeSeries *, int, bool); 149 | void Forecast(TimeSeries *, int nsteps, 150 | double *fret, TimeSeries *resids, double *rstore=NULL); 151 | void ForecastWithMissing(TimeSeries *, int nsteps, 152 | double *fret, TimeSeries *resids, double *rstore=NULL); 153 | void RenderInto(ostrstream&); 154 | void ComputeACFPACF(Vector& acf, Vector* pacf, int normalizeacf); 155 | double ComputeReducedLogLikelihood(TimeSeries *tp, double *bestsig=NULL); 156 | double ComputeLogLikelihood(TimeSeries *tp); 157 | 158 | bool hasmissingflag; 159 | }; 160 | 161 | Matrix cfuncsfor(double d, double rho_real, double rho_complex, 162 | int p, int h, int extent); 163 | 164 | #endif 165 | -------------------------------------------------------------------------------- /src/main/rect.h: -------------------------------------------------------------------------------- 1 | #ifndef RECT_HPP 2 | #define RECT_HPP 3 | 4 | class TRect { 5 | public: 6 | int left,top,right,bottom; 7 | TRect(int ix,int iy,int iw,int ih) : left(ix),top(iy),right(ix+iw-1),bottom(iy+ih-1) {}; 8 | TRect() {}; 9 | 10 | int Height() {return (bottom-top+1);} 11 | int Width() {return (right-left+1);} 12 | TRect& operator=(const TRect& other) 13 | { 14 | left = other.left; right = other.right; 15 | top = other.top; bottom = other.bottom; 16 | return *this; 17 | } 18 | }; 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /src/main/textrender.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | * 22 | * This module defines a class which displays 23 | * information and can print bold, greek, superscript, etc. 24 | * 25 | */ 26 | 27 | #include "includes.h" 28 | #include "textrender.h" 29 | 30 | TextRenderer::TextRenderer() 31 | : Gtk::TextView() 32 | { 33 | set_editable(false); 34 | set_wrap_mode(Gtk::WRAP_WORD); 35 | set_name("MITSMTextWidget"); 36 | 37 | tbuf = Gtk::TextBuffer::create(); 38 | tagtable = tbuf->get_tag_table(); 39 | boldtag = Gtk::TextBuffer::Tag::create("bolding"); 40 | boldtag->property_weight() = Pango::WEIGHT_BOLD; 41 | boldtag->property_scale() = 1.2; 42 | tagtable->add(boldtag); 43 | 44 | supertag = Gtk::TextBuffer::Tag::create("supertag"); 45 | supertag->property_rise() = 2500; 46 | supertag->property_scale() = 0.7; 47 | tagtable->add(supertag); 48 | 49 | subtag = Gtk::TextBuffer::Tag::create("subtag"); 50 | subtag->property_rise() = -2500; 51 | subtag->property_scale() = 0.7; 52 | tagtable->add(subtag); 53 | 54 | tagmono = Gtk::TextBuffer::Tag::create("tagmono"); 55 | tagmono->property_family()="monospace"; 56 | tagtable->add(tagmono); 57 | 58 | tag0 = Gtk::TextBuffer::Tag::create("tag0"); 59 | tag0->property_foreground() = "#e00000"; 60 | tag0->property_family()="monospace"; 61 | tagtable->add(tag0); 62 | 63 | tag1 = Gtk::TextBuffer::Tag::create("tag1"); 64 | tag1->property_background() = "#e06060"; 65 | tag1->property_family()="monospace"; 66 | tagtable->add(tag1); 67 | 68 | tag2 = Gtk::TextBuffer::Tag::create("tag2"); 69 | tag2->property_background() = "#e0c0c0"; 70 | tag2->property_family()="monospace"; 71 | tagtable->add(tag2); 72 | 73 | tag3 = Gtk::TextBuffer::Tag::create("tag3"); 74 | tag3->property_background() = "#c0c0c0"; 75 | tag3->property_family()="monospace"; 76 | tagtable->add(tag3); 77 | 78 | tag4 = Gtk::TextBuffer::Tag::create("tag4"); 79 | tag4->property_background() = "#60c060"; 80 | tag4->property_family()="monospace"; 81 | tagtable->add(tag4); 82 | 83 | tag5 = Gtk::TextBuffer::Tag::create("tag5"); 84 | tag5->property_family()="monospace"; 85 | tag5->property_background() = "#00e000"; 86 | tagtable->add(tag5); 87 | 88 | tagunderline = Gtk::TextBuffer::Tag::create("tagunderline"); 89 | tagunderline->property_underline() = Pango::UNDERLINE_SINGLE; 90 | tagtable->add(tagunderline); 91 | } 92 | 93 | void TextRenderer::on_realize() 94 | { 95 | TextView::on_realize(); 96 | } 97 | 98 | void TextRenderer::Update(const char *temps) 99 | { 100 | // now go through and insert the string 101 | string bigstring(temps); 102 | int pos; 103 | Glib::RefPtr *currenttag = NULL; 104 | tbuf->erase(tbuf->begin(), tbuf->end()); 105 | 106 | while (bigstring.size()>0) 107 | { 108 | // pick out first bit 109 | if (bigstring[0]=='\\') 110 | { 111 | switch (bigstring[1]) 112 | { 113 | case 'n': 114 | currenttag = NULL; 115 | break; 116 | case 'b': // bold for line 117 | currenttag = &boldtag; 118 | break; 119 | case 's': 120 | currenttag = &supertag; // superscript 121 | break; 122 | case 'd': 123 | currenttag = &subtag; // subscript 124 | break; 125 | case '0': 126 | currenttag = &tag0; 127 | break; 128 | case '1': 129 | currenttag = &tag1; 130 | break; 131 | case '2': 132 | currenttag = &tag2; 133 | break; 134 | case '3': 135 | currenttag = &tag3; 136 | break; 137 | case '4': 138 | currenttag = &tag4; 139 | break; 140 | case '5': 141 | currenttag = &tag5; 142 | break; 143 | case 'm': 144 | currenttag = &tagmono; 145 | break; 146 | case 'u': 147 | currenttag = &tagunderline; 148 | break; 149 | } 150 | // delete first two chars 151 | bigstring.erase(0,2); 152 | } 153 | // find next occurrence of backslash 154 | pos = bigstring.find('\\'); 155 | if (pos==-1) 156 | pos = bigstring.size(); 157 | 158 | 159 | try 160 | { 161 | if (currenttag!=NULL) 162 | tbuf->insert_with_tag(tbuf->end(), bigstring.substr(0,pos), *currenttag); 163 | else 164 | tbuf->insert(tbuf->end(), bigstring.substr(0,pos)); 165 | } 166 | catch(char *str) 167 | { 168 | cout << "Exception:" << str << endl; 169 | } 170 | bigstring.erase(0,pos); 171 | } 172 | 173 | set_buffer(tbuf); 174 | } 175 | -------------------------------------------------------------------------------- /src/main/textrender.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef TEXTRENDER_HPP 24 | #define TEXTRENDER_HPP 25 | 26 | class TextRenderer : public Gtk::TextView { 27 | protected: 28 | Glib::RefPtr tagtable; 29 | Glib::RefPtr boldtag, supertag, subtag, 30 | tagmono, tag0, tag1, tag2, tag3, tag4, tag5, tagunderline; 31 | Glib::RefPtr tbuf; 32 | 33 | void on_realize(); 34 | 35 | public: 36 | TextRenderer(); 37 | void Update(const char *buf); 38 | 39 | }; 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /src/main/transform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef TRANSFORM_HPP 24 | #define TRANSFORM_HPP 25 | 26 | #include "timeseries.h" 27 | #include "cubespline.h" 28 | #include "otherplots.h" 29 | 30 | class Transformation { 31 | protected: 32 | public: 33 | Transformation(); 34 | virtual ~Transformation() {}; 35 | virtual bool Apply(TimeSeries *, ostream&, bool getparms=true)=0; 36 | virtual bool Reverse(TimeSeries *, ostream&, bool discard=true)=0; 37 | virtual void DescribeIn(ostream& os); 38 | virtual void GetParList() {}; 39 | virtual bool GetParameters() {return true;}; 40 | virtual Transformation *CreateCopy()=0; 41 | 42 | double dpars[10]; 43 | int ipars[10]; 44 | string spars[10]; 45 | string parnames[10], pardefaults[10], transname; 46 | int partypes[10]; // 0=int, 1=real, 2=string 47 | int npars; 48 | }; 49 | 50 | class RemoveSplineTransform : public Transformation 51 | { 52 | protected: 53 | int numknots, nforfit; 54 | cubespline *cs; 55 | TSPlot *pp; 56 | 57 | public: 58 | RemoveSplineTransform(); 59 | virtual ~RemoveSplineTransform(); 60 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 61 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 62 | bool GetParameters(); 63 | void DescribeIn(ostream&); 64 | void GetParList() 65 | { 66 | npars = 1; 67 | partypes[0] = 0; // non-negative integer 68 | parnames[0] = "Number of Knots"; 69 | pardefaults[0] = "3"; 70 | transname = "Cubic Spline Trend Removal"; 71 | }; 72 | void SetPlotWin(TSPlot *tpp) { pp=tpp; }; 73 | Transformation *CreateCopy(); 74 | }; 75 | 76 | class RemoveSeasonal : public Transformation 77 | { 78 | protected: 79 | int period; 80 | TSPlot *pp; 81 | Vector scomp; 82 | 83 | public: 84 | RemoveSeasonal(); 85 | virtual ~RemoveSeasonal(); 86 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 87 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 88 | bool GetParameters(); 89 | void DescribeIn(ostream&); 90 | void GetParList() 91 | { 92 | npars = 1; 93 | partypes[0] = 0; // non-negative integer 94 | parnames[0] = "Period"; 95 | pardefaults[0] = "12"; 96 | transname = "Seasonal Component Removal"; 97 | }; 98 | void SetPlotWin(TSPlot *tpp) { pp=tpp; }; 99 | Transformation *CreateCopy(); 100 | }; 101 | 102 | class DiffTransform : public Transformation 103 | { 104 | protected: 105 | int lag; 106 | double *beginning; 107 | bool isreversible; 108 | 109 | public: 110 | DiffTransform(); 111 | DiffTransform(DiffTransform& other); 112 | virtual ~DiffTransform(); 113 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 114 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 115 | bool GetParameters(); 116 | void DescribeIn(ostream&); 117 | void GetParList() 118 | { 119 | npars = 1; 120 | partypes[0] = 0; // non-negative integer 121 | parnames[0] = "Lag"; 122 | pardefaults[0] = "1"; 123 | transname = "Difference"; 124 | }; 125 | Transformation *CreateCopy(); 126 | }; 127 | 128 | class IntegrateTransform : public Transformation 129 | { 130 | protected: 131 | int lag; 132 | double *beginning; 133 | bool isreversible; 134 | 135 | public: 136 | IntegrateTransform(); 137 | IntegrateTransform(IntegrateTransform& other); 138 | virtual ~IntegrateTransform(); 139 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 140 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 141 | bool GetParameters(); 142 | void DescribeIn(ostream&); 143 | void GetParList() 144 | { 145 | npars = 0; 146 | transname = "Integrate"; 147 | }; 148 | Transformation *CreateCopy(); 149 | }; 150 | 151 | class AbsTransform : public Transformation 152 | { 153 | public: 154 | AbsTransform(); 155 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 156 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 157 | bool GetParameters(); 158 | void DescribeIn(ostream&); 159 | void GetParList() { npars = 0; }; 160 | Transformation *CreateCopy(); 161 | }; 162 | 163 | class TimeReverseTransform : public Transformation 164 | { 165 | public: 166 | TimeReverseTransform(); 167 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 168 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 169 | bool GetParameters(); 170 | void DescribeIn(ostream&); 171 | void GetParList() { npars = 0; }; 172 | Transformation *CreateCopy(); 173 | }; 174 | 175 | class SMeanTransform : public Transformation 176 | { 177 | protected: 178 | double subtracted; 179 | 180 | public: 181 | SMeanTransform(); 182 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 183 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 184 | bool GetParameters(); 185 | void GetParList() 186 | { 187 | npars = 1; 188 | partypes[0] = 1; // double 189 | parnames[0] = "Constant"; 190 | pardefaults[0] = "0"; 191 | transname = "Subtract"; 192 | }; 193 | }; 194 | 195 | class LogTransform : public Transformation 196 | { 197 | protected: 198 | bool isreversible; 199 | double lambda; 200 | 201 | public: 202 | LogTransform(); 203 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 204 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 205 | bool GetParameters(); 206 | void DescribeIn(ostream&); 207 | void GetParList() 208 | { 209 | npars = 1; 210 | partypes[0] = 1; // Box-Cox param is double-valued 211 | pardefaults[0] = "0.0"; // default=0 for log 212 | parnames[0] = "Lambda"; 213 | transname = "Box-Cox Parameter"; 214 | }; 215 | Transformation *CreateCopy(); 216 | }; 217 | 218 | class AggTransform : public Transformation 219 | { 220 | protected: 221 | int length; 222 | public: 223 | AggTransform(); 224 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 225 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 226 | bool GetParameters(); 227 | void DescribeIn(ostream&); 228 | void GetParList() 229 | { 230 | npars = 1; 231 | partypes[0] = 0; // non-negative integer 232 | parnames[0] = "Interval Length"; 233 | pardefaults[0] = "1"; 234 | transname = "Aggregate"; 235 | }; 236 | Transformation *CreateCopy(); 237 | }; 238 | 239 | class PolyTransform : public Transformation 240 | { 241 | protected: 242 | int power; 243 | public: 244 | PolyTransform(); 245 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 246 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 247 | bool GetParameters(); 248 | void DescribeIn(ostream&); 249 | }; 250 | 251 | class ClipTransform : public Transformation 252 | { 253 | protected: 254 | int n1, n2; 255 | TSPlot *pp; 256 | 257 | public: 258 | ClipTransform(); 259 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 260 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 261 | bool GetParameters(TimeSeries *); 262 | void GetParList() 263 | { 264 | npars = 2; 265 | partypes[0] = 0; // non-negative integer 266 | parnames[0] = "First obs."; 267 | pardefaults[0] = "1"; 268 | partypes[1] = 0; 269 | parnames[1] = "Last obs." ; 270 | pardefaults[1] = "100"; 271 | transname = "Clip"; 272 | }; 273 | void DescribeIn(ostream&); 274 | void SetPlotWin(TSPlot *tpp) { pp=tpp; }; 275 | Transformation *CreateCopy(); 276 | }; 277 | 278 | class CustomTransform : public Transformation 279 | { 280 | protected: 281 | int lag; 282 | double *beginning; 283 | bool isreversible; 284 | 285 | public: 286 | CustomTransform(); 287 | CustomTransform(CustomTransform& other); 288 | virtual ~CustomTransform(); 289 | bool Apply(TimeSeries *, ostream&, bool getparms=true); 290 | bool Reverse(TimeSeries *, ostream&, bool discard=true); 291 | bool GetParameters(); 292 | void DescribeIn(ostream&); 293 | void GetParList() 294 | { 295 | npars = 2; 296 | partypes[0] = 2; // string 297 | parnames[0] = "Function of x (and t=0,1,...)"; 298 | pardefaults[0] = "x"; 299 | partypes[1] = 2; 300 | parnames[1] = "Inverse function (may be blank)"; 301 | pardefaults[1] = ""; 302 | transname = "Custom"; 303 | }; 304 | Transformation *CreateCopy(); 305 | }; 306 | 307 | 308 | #endif 309 | -------------------------------------------------------------------------------- /src/main/tsinterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef tsinterface_h 24 | #define tsinterface_h 25 | 26 | #include "timeseries.h" 27 | #include "garch.h" 28 | #include "svm.h" 29 | 30 | class TSMInterface 31 | { 32 | protected: 33 | TimeSeriesModel *tsmp; 34 | 35 | public: 36 | TSMInterface() {} 37 | virtual bool Specify(Gtk::Window *mainwin) = 0; 38 | }; 39 | 40 | class ARMAModelDialog : public CenteringDialog { 41 | protected: 42 | ARMAModel *amp; 43 | 44 | Gtk::Button *ok_button, *cancel_button; 45 | Gtk::Table *table; 46 | Gtk::SpinButton *arspin, *maspin, *fracspin, *sigmaspin, *muspin; 47 | Gtk::Adjustment *aradjust, *maadjust, *fracadjust, *sigmaadjust, 48 | *muadjust; 49 | Gtk::CheckButton *mucheck, *fraccheck, *sigmacheck, *whittlecheck; 50 | 51 | void terminate(int); 52 | void BaseConstruction(); 53 | void EnterCoefficients(int id); 54 | 55 | Vector localphi, localtheta, localmask1,localmask2,localmask3; 56 | 57 | public: 58 | ARMAModelDialog(ARMAModel *am, Window& w); // centered over w 59 | int run(); // local version 60 | }; 61 | 62 | class ARMAInterface : public TSMInterface 63 | { 64 | protected: 65 | ARMAModel *mp; 66 | public: 67 | ARMAInterface(ARMAModel *amp) : 68 | TSMInterface(), mp(amp) {} 69 | 70 | bool Specify(Gtk::Window *mainwin); 71 | }; 72 | 73 | 74 | 75 | class GARCHModelDialog : public CenteringDialog { 76 | protected: 77 | GARCHModel *gmp; 78 | 79 | Gtk::Button *ok_button, *cancel_button; 80 | Gtk::Table *table; 81 | Gtk::SpinButton *aspin, *bspin, *muspin; 82 | Gtk::Adjustment *aadjust, *badjust, *muadjust; 83 | 84 | void terminate(int); 85 | void BaseConstruction(); 86 | void EnterCoefficients(int id); 87 | 88 | Vector localas, localbs, localmask1,localmask2,localmask3; 89 | 90 | public: 91 | GARCHModelDialog(GARCHModel *gm, Window& w); // centered over w 92 | int run(); // local version 93 | }; 94 | 95 | class GARCHInterface : public TSMInterface 96 | { 97 | protected: 98 | GARCHModel *mp; 99 | public: 100 | GARCHInterface(GARCHModel *gmp) : 101 | TSMInterface(), mp(gmp) {} 102 | 103 | bool Specify(Gtk::Window *mainwin); 104 | }; 105 | 106 | 107 | 108 | class EGARCHModelDialog : public CenteringDialog { 109 | protected: 110 | EGARCHModel *egmp; 111 | 112 | Gtk::Button *ok_button, *cancel_button; 113 | Gtk::Table *table; 114 | Gtk::SpinButton *aspin, *bspin, *muspin; 115 | Gtk::Adjustment *aadjust, *badjust, *muadjust; 116 | 117 | void terminate(int); 118 | void BaseConstruction(); 119 | void EnterCoefficients(int id); 120 | 121 | Vector localas, localbs, localgs, 122 | localmask1, localmask2, localmask3, localmask4; 123 | 124 | public: 125 | EGARCHModelDialog(EGARCHModel *egm, Window& w); // centered over w 126 | int run(); // local version checks validity of params 127 | }; 128 | 129 | 130 | class EGARCHInterface : public TSMInterface 131 | { 132 | protected: 133 | EGARCHModel *mp; 134 | public: 135 | EGARCHInterface(EGARCHModel *gmp) : 136 | TSMInterface(), mp(gmp) {} 137 | 138 | bool Specify(Gtk::Window *mainwin); 139 | }; 140 | 141 | 142 | 143 | class SSVMDialog : public CenteringDialog { 144 | protected: 145 | SSVModel *svmp; 146 | Vector localmask; 147 | 148 | Gtk::Adjustment *meanadjust, *muxadjust, *phiadjust, *nuadjust; 149 | Gtk::SpinButton *meanspin, *muxspin, *phispin, *nuspin; 150 | Gtk::CheckButton *meancheck, *muxcheck, *phicheck, *nucheck; 151 | 152 | void BaseConstruction(); 153 | void terminate(int); 154 | 155 | public: 156 | SSVMDialog(SSVModel *mp, Window& w); 157 | int run(); // local version checks for validity of params 158 | }; 159 | 160 | class SSVMInterface : public TSMInterface 161 | { 162 | protected: 163 | SSVModel *svmmp; 164 | public: 165 | SSVMInterface(SSVModel *mp) 166 | : TSMInterface(), svmmp(mp) {} 167 | 168 | bool Specify(Gtk::Window *mainwin); // called in response to model->specify menu option 169 | }; 170 | 171 | #endif 172 | -------------------------------------------------------------------------------- /src/main/tsmrender.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | * 22 | * This module defines a class which displays 23 | * information about a time series model. 24 | * 25 | */ 26 | 27 | #include "includes.h" 28 | #include "tsmrender.h" 29 | 30 | TSMRenderer::TSMRenderer(TimeSeriesModel *tsm, TimeSeries *ts, 31 | vector *tl) 32 | : Gtk::TextView() 33 | { 34 | set_editable(false); 35 | set_wrap_mode(Gtk::WRAP_WORD); 36 | set_name("MITSMTextWidget"); 37 | 38 | tbuf = Gtk::TextBuffer::create(); 39 | tagtable = tbuf->get_tag_table(); 40 | boldtag = Gtk::TextBuffer::Tag::create("bolding"); 41 | boldtag->property_weight() = Pango::WEIGHT_BOLD; 42 | boldtag->property_scale() = 1.2; 43 | tagtable->add(boldtag); 44 | 45 | supertag = Gtk::TextBuffer::Tag::create("supertag"); 46 | supertag->property_rise() = 2500; 47 | supertag->property_scale() = 0.7; 48 | tagtable->add(supertag); 49 | 50 | greektag = Gtk::TextBuffer::Tag::create("greektag"); 51 | //greektag->property_family() = "symbol"; 52 | tagtable->add(greektag); 53 | 54 | Update(tsm,ts,tl); 55 | } 56 | 57 | void TSMRenderer::on_realize() 58 | { 59 | TextView::on_realize(); 60 | } 61 | 62 | void TSMRenderer::Update(TimeSeriesModel* tsm, TimeSeries* ts, 63 | vector *transformlist) 64 | { 65 | Transformation *trans; 66 | ostringstream os; 67 | 68 | if (tsm!=NULL) 69 | { 70 | tsm->RenderInto(os); 71 | os << endl << endl; 72 | } 73 | 74 | if (ts!=NULL) 75 | { 76 | ts->RenderInto(os); 77 | os << endl; 78 | } 79 | 80 | // now render the transformations 81 | if (transformlist!=NULL) 82 | if (!transformlist->empty()) { 83 | os << "Transforms:" << endl; 84 | int i,n=transformlist->size(); 85 | for (i=0 ; iDescribeIn(os); 89 | os << endl; 90 | } 91 | os << endl; 92 | } 93 | 94 | os << "\\n"; 95 | os << ends; 96 | 97 | 98 | // now go through and insert the string 99 | string bigstring = os.str(); 100 | int pos; 101 | Glib::RefPtr *currenttag = NULL; 102 | tbuf->erase(tbuf->begin(), tbuf->end()); 103 | 104 | while (bigstring.size()>0) 105 | { 106 | // pick out first bit 107 | if (bigstring[0]=='\\') 108 | { 109 | switch (bigstring[1]) 110 | { 111 | case 'n': 112 | currenttag = NULL; 113 | break; 114 | case 'b': // bold for line 115 | currenttag = &boldtag; 116 | break; 117 | case 's': 118 | currenttag = &supertag; // super/sub? script? 119 | break; 120 | case 'g': 121 | currenttag = &greektag; 122 | break; 123 | } 124 | // delete first two chars 125 | bigstring.erase(0,2); 126 | } 127 | // find next occurrence of backslash 128 | pos = bigstring.find('\\'); 129 | if (pos==-1) 130 | pos = bigstring.size(); 131 | 132 | 133 | if (currenttag!=NULL) 134 | tbuf->insert_with_tag(tbuf->end(), bigstring.substr(0,pos), *currenttag); 135 | else 136 | tbuf->insert(tbuf->end(), bigstring.substr(0,pos)); 137 | bigstring.erase(0,pos); 138 | } 139 | 140 | set_buffer(tbuf); 141 | } 142 | -------------------------------------------------------------------------------- /src/main/tsmrender.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef TSMRENDER_HPP 24 | #define TSMRENDER_HPP 25 | 26 | class TSMRenderer : public Gtk::TextView { 27 | protected: 28 | TimeSeriesModel *tsmp; 29 | 30 | Glib::RefPtr tagtable; 31 | Glib::RefPtr boldtag, supertag, greektag; 32 | Glib::RefPtr tbuf; 33 | 34 | /* 35 | Gdk::Color white,black,grey,red; 36 | Gdk::GC gc; 37 | Gdk::Window window; 38 | Gdk::Font *f1, *fb, *fs; 39 | */ 40 | 41 | void on_realize(); 42 | 43 | public: 44 | TSMRenderer(TimeSeriesModel *, TimeSeries *, vector *tl); 45 | void Update(TimeSeriesModel *, TimeSeries *, vector *tl); 46 | }; 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /src/main/xyplot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004,2005 Anthony Brockwell 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | 24 | #ifndef XYPLOT_HPP 25 | #define XYPLOT_HPP 26 | 27 | #include 28 | #include 29 | #include 30 | #include "dialogs.h" 31 | 32 | using namespace std; 33 | using namespace mslib; 34 | 35 | const int GMODE_XY = 1, GMODE_ACF = 2; 36 | 37 | class XYPlot : public Gtk::DrawingArea 38 | { 39 | protected: 40 | // local copies of data 41 | Matrix x,y,missing; 42 | Vector minx, maxx, miny, maxy, color_map; 43 | int nobs, actualnobs; // actualnobs used for ACF/PACF bounds 44 | 45 | string title; 46 | Glib::RefPtr gc; 47 | Gdk::Color blue, lightblue, red, green, black, white, grey, darkgrey; 48 | Gdk::Color *ColorNumber(int i); 49 | 50 | // some properties 51 | int integerxaxis, drawinglines; 52 | double basic_xunit, basic_yunit; 53 | double margin_fraction_x, margin_fraction_y; 54 | bool common_x_axis, common_y_axis; 55 | 56 | public: 57 | XYPlot(Matrix *x, Matrix *y, Matrix *missing = NULL); 58 | ~XYPlot(); 59 | void Update(Matrix *x, Matrix *y, Matrix *missing = NULL, bool redraw=true); 60 | void SetTitle(string&); 61 | void SetBasicUnits(double x, double y) 62 | { basic_xunit = x; basic_yunit = y; } 63 | void SetMargins(double mfx, double mfy) 64 | { margin_fraction_x = mfx; margin_fraction_y = mfy; } 65 | void SetMultiMode(bool common_x, bool common_y, bool redraw=true); 66 | void SetIntegerxaxis(bool val) {integerxaxis=val;} 67 | void SetColorMap(Vector& c) {color_map=c;} 68 | 69 | int mode; 70 | 71 | virtual void Oop1_Pressed(), Oop2_Pressed(), Oop3_Pressed(), 72 | Oop4_Pressed(), Oop5_Pressed(); 73 | 74 | virtual void InitPropDialog(CenteringDialog& cd); 75 | virtual void ClosePropDialog(CenteringDialog& cd); 76 | 77 | protected: 78 | double GetNiceUnitFor(double x1, double x2, double basic_unit=1.0); 79 | void LittleBox(Glib::RefPtr win, Glib::RefPtr gc, 80 | int x1, int y1, int r, Gdk::Color &fillcolor); 81 | 82 | virtual void on_realize(); 83 | virtual bool on_expose_event(GdkEventExpose* e); 84 | virtual bool on_button_press_event(GdkEventButton* event); 85 | virtual void on_button_copy(); 86 | 87 | void RedrawIt(); 88 | 89 | void eps_draw(string &fnm); 90 | }; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /src/mslib/Makefile.am: -------------------------------------------------------------------------------- 1 | INCLUDES = $(GSL_CFLAGS) 2 | AM_LDFLAGS = 3 | AM_CFLAGS = -DUSE_LAPACK 4 | AM_CPPFLAGS = -DUSE_LAPACK -Wno-deprecated 5 | 6 | lib_LIBRARIES = libms.a 7 | libms_a_SOURCES = abrand.cc glm.cc matrix.cc poly.cc timeseries.cc svm.cc garch.cc 8 | # libms_a_CXXFLAGS = -ggdb -O0 9 | 10 | EXTRA_DIST = *.h 11 | 12 | -------------------------------------------------------------------------------- /src/mslib/abrand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | 24 | #ifndef ABRAND_HPP 25 | #define ABRAND_HPP 26 | 27 | #include "matrix.h" 28 | 29 | namespace mslib { 30 | 31 | void init_generator(long int sd); 32 | 33 | // sampling routines 34 | double unif_random(); // Uniform on [0,1) 35 | double norm_random(); // N(0,1) 36 | double norm_random(double mu, double sig2); // N(mu,sig2) 37 | int bino_random(int, double); // Binonial (n,p) 38 | double exp_random(double lambda=1.0); // Exponential mean 1/lambda 39 | double t_random(int degreesoffreedom); // t-distribution 40 | double gam_random(double alpha, double beta); // Gamma, mean=alpha/beta, var=alpha/beta^2 41 | double chi2_random(double degreesoffreedom); // Chi-squared r.v. 42 | int pois_random(double lambda); // Poisson r.v. with mean lambda 43 | double beta_random(double a, double b); // Beta, mean=a/(a+b) 44 | double cauchy_random(double location=0); // Cauchy + location 45 | int geo_random(double p); // Geometric, mean = 1/p 46 | Vector diri_random(Vector& nums); // Dirichlet 47 | Vector mvbern_random(Vector& betas, Matrix& zetas, Vector& groups); // Multivariate Bernoulli 48 | 49 | // along with some mvn sampling routines 50 | Vector mvn_random(Vector& mean, Matrix& sig2, int *error=NULL); 51 | Vector mvn_with_sqrtvar(Vector& mean, Matrix& sqrtsig2); 52 | Vector cond_mvn_random(Vector& mean, Matrix& var, 53 | Matrix& H, Vector& rel, Vector& k, 54 | Matrix *suppliedP = NULL, Matrix *suppliedPinv = NULL, 55 | int fillinP = 0); 56 | 57 | // miscellaneous routines 58 | Matrix cov_msqrt(Matrix& covm, int reduce, int& error); 59 | 60 | 61 | // density, cdf routines 62 | double norm_density(double x, double mu=0, double sig2=1); 63 | double lognorm_density(double x, double mu=0, double sig2=1); 64 | double norm_cdf(double); // (mu=0, sig2=1) 65 | double norm_cdf(double x, double mu, double sig2); 66 | double norm_invcdf(double); // (mu=0, sig2=1) 67 | double logpois_density(double x, double lambda); 68 | double logpois_density_logl(double x, double loglambda); 69 | double logmvn_density(Vector& x, Vector *mn, Matrix *Sig, 70 | Matrix *SigInv = NULL, double Sigdet=0); 71 | double exp_density(double x, double lambda=1.0); 72 | double logexp_density(double x, double lambda=1.0); 73 | double logdiri_density(Vector& x, Vector& parms); 74 | double exp_cdf(double x, double lambda=1.0); 75 | double exp_invcdf(double x, double lambda=1.0); 76 | double logbeta_density(double x, double a, double b); 77 | double logmvbern_pmf(Vector& x, Vector& betas, Matrix& zetas, Vector& groups); 78 | Vector logmvbern_pmf(Matrix& x, Vector& betas, Matrix& zetas, Vector& groups); 79 | Vector mvbern_marginal(Vector& betas, Matrix& zetas, Vector& groups); 80 | Matrix mvbern_cov(Vector& betas, Matrix& zetas, Vector& groups); 81 | 82 | } // end of namespace 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /src/mslib/garch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004, 2005, 2006 Anthony Brockwell 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef GARCH_H 24 | #define GARCH_H 25 | 26 | #include "timeseries.h" 27 | 28 | using namespace std; 29 | using namespace mslib; 30 | 31 | 32 | const double root_margin = 0.001; 33 | 34 | 35 | class GARCHModel : public TimeSeriesModel { 36 | protected: 37 | int p,q; 38 | double mean; 39 | Vector as, bs; 40 | 41 | virtual double OneStepVariance(double *xt, double *st, int t, double gamma0); 42 | // returns one-step predictive volatility, t starts at 0, goes up to T-1. 43 | 44 | public: 45 | GARCHModel(); 46 | ~GARCHModel(); 47 | 48 | int FitModel(TimeSeries *ts, const int method, int numits, 49 | void (*itercallback)(int,void *), void *cb_parms, 50 | ostringstream& msg, ostringstream& supplementalinfo, 51 | bool get_parameter_cov); 52 | void BayesianFit(int p, int q, TimeSeries *ts, 53 | void (*callback)(int,void *) = NULL, void *cb_parms = NULL); 54 | void SimulateInto(TimeSeries *, int n, bool ovw); 55 | Matrix SimulatePredictive(TimeSeries &ts, int nsteps, int nsims); 56 | void RenderInto(ostringstream&); 57 | bool RenderCtsVersionInto(ostringstream &output, ostringstream &error, double delta); 58 | double GetVar(); 59 | void ComputeACFPACF(Vector &acf, Vector *pacf, bool normalizeacf=true); 60 | void Forecast(TimeSeries *, int nsteps, double *fret, double *fmse); 61 | void ComputeStdResiduals(TimeSeries *data, TimeSeries *resids); 62 | double LogPrior(bool& isok); 63 | double ComputeLogLikelihood(TimeSeries *); 64 | 65 | Vector ParameterBundle(); 66 | void UnbundleParameters(Vector& v); 67 | 68 | void SetParameters(int p, int q, Vector& as, Vector& bs, double mu); 69 | void GetParameters(int& p, int& q, Vector& as, Vector& bs, double& mu); 70 | Vector GetMask(); // returns estimation_mask, padded with defaults 71 | Vector GetDefaultParameters(Vector& mask, TimeSeries *tsp); // returns initial guesses 72 | void StreamParameterName(ostringstream& os, int pnum); 73 | Vector ComputeSpectralDensity(Vector& omegas); 74 | 75 | 76 | bool IsCausal(bool causalify=false); 77 | bool CheckModel(bool flipit); 78 | Vector ValidityConstraint(); 79 | }; 80 | 81 | 82 | class EGARCHModel : public GARCHModel 83 | { 84 | protected: 85 | Vector gs; // has as and bs inherited from GARCH, gs are new 86 | 87 | double OneStepVariance(double *xt, double *st, int t, double gamma0); 88 | // returns one-step predictive volatility, t starts at 0, goes up to T-1. 89 | 90 | void StabilizeBs(); // makes sure b polynomial is well-behaved 91 | 92 | 93 | public: 94 | EGARCHModel(); 95 | ~EGARCHModel(); 96 | 97 | int FitModel(TimeSeries *ts, const int method, int numits, 98 | void (*itercallback)(int,void *), void *cb_parms, 99 | ostringstream& msg, ostringstream& supplementalinfo, 100 | bool get_parameter_cov); 101 | 102 | void ComputeACFPACF(Vector &acf, Vector *pacf, bool normalizeacf=true); 103 | void RenderInto(ostringstream&); 104 | bool CheckModel(bool flipit); 105 | Vector ValidityConstraint(); 106 | 107 | 108 | Vector ParameterBundle(); 109 | void UnbundleParameters(Vector& v); 110 | 111 | void SetParameters(int p, int q, Vector& as, Vector& gs, Vector& bs, 112 | double mu); 113 | void GetParameters(int& p, int& q, Vector& as, Vector& gs, Vector& bs, 114 | double& mu); 115 | Vector GetMask(); // returns estimation_mask, padded with defaults 116 | Vector GetDefaultParameters(Vector& mask, TimeSeries *tsp); // returns initial guesses 117 | void StreamParameterName(ostringstream& os, int pnum); 118 | }; 119 | 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /src/mslib/glm.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | * 22 | * 23 | * This module contains code for GLM fitting. 24 | * It uses iteratively reweighted least squares (see McCullagh & Nelder). 25 | * Nov. 2002, Anthony Brockwell. 26 | * 27 | * Base class need functions linkfn, linkderiv, 28 | * variancefn and dispersion filled in. 29 | * 30 | */ 31 | 32 | #include 33 | #include "matrix.h" 34 | #include "abrand.h" 35 | #include "glm.h" 36 | 37 | namespace mslib { 38 | 39 | GenLinearModel::GenLinearModel() 40 | { 41 | } 42 | 43 | Vector GenLinearModel::Estimate(Vector& y, Matrix& X, Vector *initial, 44 | int maxits) 45 | { 46 | int i, j, iter, done=0; 47 | double epsilon[2]={-1,-1},newepsilon,det; 48 | Vector z,tv; 49 | Matrix WX,tm; 50 | int p = X.ncols(), n = X.nrows(); 51 | Vector eta0(n), eta1(n); 52 | 53 | wts.resize(n); 54 | 55 | if (y.nrows()!=n) 56 | { 57 | cout << "GLM error: y does not have the right number of rows." << endl; 58 | return tv; 59 | } 60 | WX.resize(n,p); 61 | betahat.resize(p); 62 | tv.resize(p); 63 | 64 | // find some kind of initializer = LS fit for inv. transformed y[i] 65 | if (initial==NULL) 66 | { 67 | for (i=0 ; iepsilon[0]) 112 | done=1; 113 | 114 | betahat = z; 115 | } 116 | 117 | // compute approximate cov. matrix for betahat 118 | eta0 = X*betahat; 119 | for (i=0 ; i1-eps) 172 | x=1-eps; 173 | return log(x/(1.0-x)); 174 | } 175 | 176 | double BinomialGLM::linkderiv(double x) 177 | { 178 | return linkfn(x)/(1.0+exp(x)); 179 | } 180 | 181 | double BinomialGLM::variancefn(double etai) 182 | // returns variance of y_i for eta_i, divided by dispersion 183 | { 184 | double tx = linkfn(etai); 185 | return tx*(1.0-tx); 186 | } 187 | 188 | PoissonGLM::PoissonGLM() 189 | : GenLinearModel() 190 | { 191 | } 192 | 193 | double PoissonGLM::linkfn(double x) 194 | { 195 | return exp(x); 196 | } 197 | 198 | double PoissonGLM::invlinkfn(double x) 199 | { 200 | double eps=0.1; 201 | if (x void sort_objects(int n, T *object,int *indices) 7 | { 8 | int l,j,ir,i; 9 | T tempobj; 10 | int tempindex; 11 | 12 | if (n<2) return; // doesn't work if only one observation 13 | // but we don't need to sort then anyway 14 | 15 | if (indices!=NULL) 16 | for (i=0 ; i> 1)+1; 20 | ir = n; 21 | 22 | for (;;) { 23 | if (l>1) // i.e. we are still in hiring phase 24 | { 25 | --l; 26 | if (indices!=NULL) 27 | tempindex = indices[l-1]; 28 | tempobj = object[l-1]; 29 | } 30 | else { 31 | tempobj=object[ir-1]; 32 | if (indices!=NULL) 33 | tempindex=indices[ir-1]; 34 | object[ir-1]=object[0]; 35 | if (indices!=NULL) 36 | indices[ir-1]=indices[0]; 37 | if (--ir == 1) { // we are finished 38 | object[0]=tempobj; 39 | if (indices!=NULL) 40 | indices[0]=tempindex; 41 | return; 42 | } 43 | } 44 | i=l; 45 | j=l<<1; 46 | while (j <= ir) 47 | { 48 | if ((j < ir) && (object[j-1] 32 | #include 33 | 34 | #define complex std::complex 35 | 36 | namespace mslib { 37 | 38 | const int MATLAB_MODE=0, BINARY_MODE=1, DISP_MODE=2, ROW_MODE=3; // used for I/O 39 | 40 | class Double_Store { 41 | protected: 42 | double *stuff; 43 | int num_refs; 44 | public: 45 | Double_Store(int len); 46 | ~Double_Store(); 47 | double& operator[](int i) 48 | {return stuff[i];} 49 | }; 50 | 51 | class Vector; 52 | 53 | class Matrix { 54 | protected: 55 | int xsize, ysize, maxels; 56 | double *stuff; 57 | int iomode; 58 | 59 | public: 60 | Matrix(); // no param. constructor 61 | Matrix(const Matrix&); // copy constructor 62 | Matrix(int,int,double **dp=NULL); // constructors 63 | ~Matrix(); // destructor 64 | 65 | Matrix& operator=(const Matrix&); 66 | Matrix& operator=(double **dp); 67 | Matrix& operator=(const double); 68 | Matrix& operator+=(const Matrix&); 69 | Matrix& operator-=(const Matrix&); 70 | Matrix& operator+=(double other); 71 | Matrix& operator-=(double other); 72 | Matrix operator+(Matrix); 73 | //friend const Matrix operator*(Matrix& left, Matrix& right); 74 | Matrix operator-(Matrix); 75 | Matrix operator*(Matrix); 76 | Vector operator*(Vector); 77 | Matrix operator*(double); 78 | Matrix operator/(double); 79 | Matrix& operator*=(double); 80 | Matrix& operator/=(double); 81 | bool operator<=(const Matrix&); // elementwise comparison 82 | inline double *operator[](int i) const 83 | { return (&stuff[i*xsize]); } 84 | Vector extract_row(int rownum); 85 | Vector extract_column(int colnum); 86 | 87 | Matrix LU_decomp(int *retsign=NULL, Matrix *permutations=NULL, 88 | int *indices=NULL); 89 | Matrix inverse(); 90 | Matrix g4_inverse(double epsilon); 91 | 92 | double symm_cond_num(); // for symmetric A, returns condition number 93 | void solve_system(Vector *b); // solve Ax=b, (ret. soln in b) 94 | void symm_solve_system(Vector *b); // same but for symmetric A 95 | void robust_symm_solve_system(Vector *b); // handles near-singular matrices 96 | 97 | Matrix transpose(); 98 | Matrix submatrix(int r1, int c1, int r2p1, int c2p1); 99 | bool singular(double *); // returns determinant and flag 100 | int nrows() { return ysize; }; 101 | int ncols() { return xsize; }; 102 | double *get_stuff() { return stuff; }; 103 | complex *eigenvalues(); 104 | Matrix symm_eigenvectors(double *evals); // a crude routine: LAPACK dsyev should be used when possible 105 | double norm(); 106 | double max(); 107 | double min(); 108 | Vector mean(); // returns mean down the columns 109 | Matrix covariance(); // returns sample covariance (each row is a datapoint) 110 | double kernel_function(double arg, int n, double sd); // used by quantiles function below 111 | double kernel_cdf(double arg, int n, double sd); // also used by quantiles f-n 112 | Vector quantiles(double alpha, bool kernel_smooth=false); 113 | // returns vector of quantiles down columns, 114 | // alpha is between 0 and 1 115 | 116 | void identity(); 117 | void zeroes(); 118 | void resize(int,int); 119 | void set_data(double *, int, int, int); 120 | double symm_quad_form(Vector& v); 121 | 122 | int read_file(const char *); // read data set as col. vec. and return # points 123 | void write_file(const char *); // write file 124 | void set_iomode(int im) {iomode=im;} 125 | void append_bottom(Matrix& newstuff, int trans=0); 126 | 127 | friend ostream& operator<<(ostream&, Matrix&); 128 | friend istream& operator>>(istream&, Matrix&); 129 | }; 130 | 131 | // Vectors are implemented as a special case of matrices. 132 | 133 | class Vector : public Matrix { 134 | public: 135 | Vector(); 136 | Vector(int); 137 | 138 | double& operator[](int i) {return stuff[i];} 139 | Vector& operator=(const Matrix&); 140 | Vector operator-(Vector); 141 | Vector operator*(const double&); 142 | double dot(const Vector&); 143 | double norm(); 144 | double sum(); 145 | double mean(); 146 | double var(); 147 | double angle(); // returns angle for 2-d vectors 148 | Matrix outer(const Vector&); 149 | int size() {return ysize;} 150 | void resize(int nrows) {Matrix::resize(nrows, 1);} 151 | void append(double); 152 | Vector subvector(int r1, int r2); 153 | void sort(); // heapsort elements of vector 154 | 155 | friend ostream& operator<<(ostream&, Vector&); 156 | friend istream& operator>>(istream&, Vector&); 157 | }; 158 | 159 | // Here are some miscellaneous functions 160 | 161 | Matrix blockmatrix(Matrix& A, Matrix& B, Matrix& C, Matrix& D); 162 | Matrix vblockmatrix(Matrix& A, Matrix& B); 163 | Matrix hblockmatrix(Matrix& A, Matrix& B); 164 | 165 | } 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /src/mslib/poly.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2004 Anthony Brockwell 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | * 22 | * 23 | * This module finds the roots 24 | * of polynomials. It was buggy, so I replaced 25 | * the core of it with calls to gsl routines on Jun, 2004. 26 | * Anthony Brockwell. 27 | * 28 | * polynomial format: 29 | * a_0 + a_1 z + a_2 z^2 + ... 30 | * a_0 = first coefficient, a_1 = second coefficient, ... 31 | */ 32 | 33 | #include 34 | #include 35 | #include "poly.h" 36 | 37 | namespace mslib { 38 | 39 | // The following procedure creates a new 40 | // complex array containing all the roots of 41 | // the specified polynomial. 42 | 43 | complex *rootsof(int order, double *coeffs) 44 | { 45 | int i; 46 | complex *roots = new complex[order]; 47 | double z[order*2]; 48 | gsl_poly_complex_workspace *gwp = 49 | gsl_poly_complex_workspace_alloc(order+1); 50 | gsl_poly_complex_solve(coeffs, order+1, gwp, z); 51 | gsl_poly_complex_workspace_free(gwp); 52 | for (i=0 ; i 33 | #include "matrix.h" 34 | 35 | #define complex std::complex 36 | 37 | namespace mslib { 38 | 39 | complex *rootsof(int order, double *coeffs); 40 | complex *coeffsof(int order, complex *root, complex normalize=1.0); 41 | 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/mslib/svm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------------- 3 | * 4 | * Copyright 2005 Anthony Brockwell 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Library General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Library General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Library General Public 17 | * License along with this library; if not, write to the Free 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | * 20 | * ------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef SVM_H 24 | #define SVM_H 25 | 26 | // simple stochastic volatility model first 27 | // Y_t \sim N(\mu_Y,\sigma_t^2) 28 | // \sigma_t = \exp(X_t + \mu_X) 29 | // X_t = \phi X_{t-1} + \epsilon_t, {\epsilon_t} \sim IIDN(0,\nu^2) 30 | 31 | class SSVModel : public TimeSeriesModel { 32 | protected: 33 | double mean, mux, phi, nu; 34 | 35 | 36 | public: 37 | SSVModel(); // constructor 38 | 39 | int FitModel(TimeSeries *ts, const int method, const int ilimit, 40 | void (*itercallback)(int,void *), void *cb_parms, 41 | ostringstream& msg, ostringstream& supplementalinfo, 42 | bool get_parameter_cov=true); 43 | void SimulateInto(TimeSeries *, int n, bool ovw); 44 | Matrix SimulatePredictive(TimeSeries&, int nsteps, int nsims); 45 | void RenderInto(ostringstream&); 46 | bool RenderCtsVersionInto(ostringstream &output, ostringstream &error, double delta); 47 | void ComputeACFPACF(Vector &acf, Vector *pacf, bool normalizeacf=true); 48 | void Forecast(TimeSeries *, int nsteps, double *fret, double *fmse); 49 | void ComputeStdResiduals(TimeSeries *data, TimeSeries *resids); 50 | double ComputeLogLikelihood(TimeSeries *); 51 | bool CheckModel(bool flipit); 52 | Vector ParameterBundle(); 53 | void UnbundleParameters(Vector& v); 54 | Vector ValidityConstraint(); 55 | Vector GetMask(); // returns estimation_mask, padded with defaults 56 | Vector GetDefaultParameters(Vector& mask, TimeSeries *tsp); // returns initial guesses for non-held model parameters; other parameters are fixed at current values 57 | void StreamParameterName(ostringstream& strm, int parmnum); // nms[0],... must already be valid allocated strings with length >= 20 58 | Vector ComputeSpectralDensity(Vector& omegas); 59 | 60 | double Cdf(double y, double mu, double sig2); 61 | double InvCdf(double u, double mu, double sig2); 62 | }; 63 | 64 | #endif 65 | --------------------------------------------------------------------------------