/*-------------------------------------------------------------------------- @COPYRIGHT : Copyright 1996, Alex P. Zijdenbos, McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. The author and McGill University make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ---------------------------------------------------------------------------- $RCSfile: MatrixSupport.h,v $ $Revision: 1.2 $ $Author: bert $ $Date: 2003-04-16 16:57:04 $ $State: Exp $ --------------------------------------------------------------------------*/ #ifndef _MATRIX_SUPPORT_H #define _MATRIX_SUPPORT_H #ifdef USE_COMPMAT #include "dcomplex.h" #endif #ifdef USE_FCOMPMAT #include "fcomplex.h" #endif typedef void (*FFTFUNC)(int n, double *real, double *imag); //c functions declaration: // double gauss(double mean, double std_dev); /* ** Please only distribute this with it's associated FHT routine. ** This algorithm is apparently patented(!) and the code copyrighted. ** See the comment with the fht routine for more info. ** -Thanks, ** Ron Mayer */ #ifdef GOOD_TRIG #else #define FAST_TRIG #endif #if defined(GOOD_TRIG) #define FHT_SWAP(a,b,t) {(t)=(a);(a)=(b);(b)=(t);} #define TRIG_VARS \ int t_lam=0; #define TRIG_INIT(k,c,s) \ { \ int i; \ for (i=2 ; i<=k ; i++) \ {coswrk[i]=costab[i];sinwrk[i]=sintab[i];} \ t_lam = 0; \ c = 1; \ s = 0; \ } #define TRIG_NEXT(k,c,s) \ { \ int i,j; \ (t_lam)++; \ for (i=0 ; !((1<1) \ { \ for (j=k-i+2 ; (1< void allocateArray(unsigned n, Type *&array) { if (!n) { array = 0; return; } array = new Type[n]; if (!array) return; Type *elPtr = array; for (unsigned i = n; i; i--) *elPtr++ = Type(0); } template void freeArray(Type *&array) { if (array) { delete [] array; array = 0; } } void inferDimensions(unsigned long nElements, unsigned& nrows, unsigned& ncols); void inferDimensions(unsigned long nElements, unsigned& nslis, unsigned& nrows, unsigned& ncols); #endif // _MATRIX_SUPPORT_H