2 * This file is part of TISEAN
4 * Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber
6 * TISEAN is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * TISEAN 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
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with TISEAN; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 /*Author: Rainer Hegger. Last modified: Sep 4, 1999 */
25 #include "routines/tsa.h"
27 #define WID_STR "Creates a parameter file containing all terms\n\t\
32 unsigned int dim=2,order=3;
33 unsigned int verbosity=0xff;
36 void make_parameter(unsigned int*,unsigned int, unsigned int);
38 void show_options(char *progname)
40 what_i_do(progname,WID_STR);
41 fprintf(stderr," Usage: %s [Options]\n",progname);
42 fprintf(stderr," Options:\n");
43 fprintf(stderr,"\t-m embedding dimension [Default: %u]\n",dim);
44 fprintf(stderr,"\t-p order of the polynomial [Default: %u]\n",order);
45 fprintf(stderr,"\t-o parameter file [Default: parameter.pol]\n");
46 fprintf(stderr,"\t-V verbosity level [Default: 1]\n\t\t"
47 "0='only panic messages'\n\t\t"
48 "1='+ input/output messages'\n");
49 fprintf(stderr,"\t-h show these options\n");
53 void scan_options(int n,char **in)
57 if ((out=check_option(in,n,'m','u')) != NULL)
58 sscanf(out,"%u",&dim);
59 if ((out=check_option(in,n,'p','u')) != NULL)
60 sscanf(out,"%u",&order);
61 if ((out=check_option(in,n,'V','u')) != NULL)
62 sscanf(out,"%u",&verbosity);
63 if ((out=check_option(in,n,'o','o')) != NULL) {
69 void make_parameter(unsigned int *par,unsigned int d,unsigned int sum)
73 for (i=0;i<=order;i++) {
79 fprintf(file,"%u ",par[j]);
83 make_parameter(par,d-1,sum);
90 int main(int argc,char **argv)
92 unsigned int i,*params;
94 if (scan_help(argc,argv))
95 show_options(argv[0]);
97 scan_options(argc,argv);
98 #ifndef OMIT_WHAT_I_DO
99 if (verbosity&VER_INPUT)
100 what_i_do(argv[0],WID_STR);
104 if (outfile == NULL) {
105 check_alloc(outfile=(char*)calloc((size_t)14,(size_t)1));
106 sprintf(outfile,"parameter.pol");
108 test_outfile(outfile);
110 check_alloc(params=(unsigned int*)malloc(sizeof(unsigned int)*dim));
114 file=fopen(outfile,"w");
115 if (verbosity&VER_INPUT)
116 fprintf(stderr,"Opened %s for writing\n",outfile);
117 make_parameter(params,dim-1,0);