X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=website%2Farchive%2Fbinaries%2Fmac%2Fsrc%2Fdisembl%2FTisean_3.0.1%2Fsource_c%2Frbf.c;fp=website%2Farchive%2Fbinaries%2Fmac%2Fsrc%2Fdisembl%2FTisean_3.0.1%2Fsource_c%2Frbf.c;h=75c2b48c7f9f51c0a901fe9794863a4916bbab4a;hb=dbde3fb6f00b9bb770343631a517c0e599db8528;hp=0000000000000000000000000000000000000000;hpb=85f830bbd51a7277994bd4233141016304e210c9;p=jabaws.git diff --git a/website/archive/binaries/mac/src/disembl/Tisean_3.0.1/source_c/rbf.c b/website/archive/binaries/mac/src/disembl/Tisean_3.0.1/source_c/rbf.c new file mode 100644 index 0000000..75c2b48 --- /dev/null +++ b/website/archive/binaries/mac/src/disembl/Tisean_3.0.1/source_c/rbf.c @@ -0,0 +1,383 @@ +/* + * This file is part of TISEAN + * + * Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber + * + * TISEAN is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * TISEAN is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with TISEAN; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +/*Author: Rainer Hegger. Last modified: Mar 11, 2002 */ +#include +#include +#include +#include +#include "routines/tsa.h" +#include + +#define WID_STR "Fits a RBF-model to the data" + +char *outfile=NULL,stdo=1,MAKECAST=0; +char *infile=NULL; +char setdrift=1; +int DIM=2,DELAY=1,CENTER=10,STEP=1; +unsigned int COLUMN=1; +unsigned int verbosity=0xff; +long CLENGTH=1000; +unsigned long LENGTH=ULONG_MAX,INSAMPLE=ULONG_MAX,exclude=0; + +double *series,*coefs; +double varianz,interval,min; +double **center; + +void show_options(char *progname) +{ + what_i_do(progname,WID_STR); + fprintf(stderr," Usage: %s [options]\n",progname); + fprintf(stderr," Options:\n"); + fprintf(stderr,"Everything not being a valid option will be interpreted" + " as a possible" + " datafile.\nIf no datafile is given stdin is read. Just - also" + " means stdin\n"); + fprintf(stderr,"\t-l # of data to use [default: all from file]\n"); + fprintf(stderr,"\t-x # of lines to be ignored [default: 0]\n"); + fprintf(stderr,"\t-c column to read [default: %u]\n",COLUMN); + fprintf(stderr,"\t-m embedding dimension [default: %d]\n",DIM); + fprintf(stderr,"\t-d delay [default: %d]\n",DELAY); + fprintf(stderr,"\t-p number of centers [default: %d]\n",CENTER); + fprintf(stderr,"\t-X deactivate drift [default: activated]\n"); + fprintf(stderr,"\t-s steps to forecast [default: %d]\n",STEP); + fprintf(stderr,"\t-n # of points for insample [default: # of data]\n"); + fprintf(stderr,"\t-L steps to cast [default: none]\n"); + fprintf(stderr,"\t-o output file name [default: 'datafile'.rbf]\n"); + fprintf(stderr,"\t-V verbosity level [default: 1]\n\t\t" + "0='only panic messages'\n\t\t" + "1='+ input/output messages'\n"); + fprintf(stderr,"\t-h show these options\n"); + exit(0); +} + +void scan_options(int n,char **in) +{ + char *out; + + if ((out=check_option(in,n,'l','u')) != NULL) + sscanf(out,"%lu",&LENGTH); + if ((out=check_option(in,n,'x','u')) != NULL) + sscanf(out,"%lu",&exclude); + if ((out=check_option(in,n,'c','u')) != NULL) + sscanf(out,"%u",&COLUMN); + if ((out=check_option(in,n,'m','u')) != NULL) + sscanf(out,"%u",&DIM); + if ((out=check_option(in,n,'d','u')) != NULL) + sscanf(out,"%u",&DELAY); + if ((out=check_option(in,n,'p','u')) != NULL) + sscanf(out,"%u",&CENTER); + if ((out=check_option(in,n,'X','n')) != NULL) + setdrift=0; + if ((out=check_option(in,n,'s','u')) != NULL) + sscanf(out,"%u",&STEP); + if ((out=check_option(in,n,'V','u')) != NULL) + sscanf(out,"%u",&verbosity); + if ((out=check_option(in,n,'n','u')) != NULL) + sscanf(out,"%lu",&INSAMPLE); + if ((out=check_option(in,n,'L','u')) != NULL) { + MAKECAST=1; + sscanf(out,"%lu",&CLENGTH); + } + if ((out=check_option(in,n,'o','o')) != NULL) { + stdo=0; + if (strlen(out) > 0) + outfile=out; + } +} + +double avdistance(void) +{ + int i,j,k; + double dist=0.0; + + for (i=0;i -0.1) && ((center[i][j]+h1) < 1.1)) + center[i][j] += h1; + } + } + } + free(force); +} + +void make_fit(void) +{ + double **mat,*hcen; + double h; + int i,j,n,nst; + + check_alloc(mat=(double**)malloc(sizeof(double*)*(CENTER+1))); + for (i=0;i<=CENTER;i++) + check_alloc(mat[i]=(double*)malloc(sizeof(double)*(CENTER+1))); + check_alloc(hcen=(double*)malloc(sizeof(double)*CENTER)); + + for (i=0;i<=CENTER;i++) { + coefs[i]=0.0; + for (j=0;j<=CENTER;j++) + mat[i][j]=0.0; + } + + for (n=(DIM-1)*DELAY;n LENGTH) + INSAMPLE=LENGTH; + + if (CENTER > LENGTH) + CENTER = LENGTH; + + if (MAKECAST) + STEP=1; + + check_alloc(coefs=(double*)malloc(sizeof(double)*(CENTER+1))); + check_alloc(center=(double**)malloc(sizeof(double*)*CENTER)); + for (i=0;i