00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #include <lal/LIGOMetadataTables.h>
00051 #include <lal/LALConstants.h>
00052 #include <lal/LALStdlib.h>
00053
00054
00055
00056
00057 #ifndef _HT_DCOMPLEX_H_
00058 #define _HT_DCOMPLEX_H_
00059
00060 #include <stdio.h>
00061 #include <stdlib.h>
00062 #include <string.h>
00063 #include <math.h>
00064
00065 #ifndef _DCOMPLEX_DECLARE_HT_
00066 typedef struct DCOMPLEX {double r,i;} dcomplex;
00067 #define _DCOMPLEX_DECLARE_HT_
00068 #endif
00069
00070 dcomplex DCadd(dcomplex a, dcomplex b);
00071 dcomplex DCsub(dcomplex a, dcomplex b);
00072 dcomplex DCmul(dcomplex a, dcomplex b);
00073 dcomplex DComplex(double re, double im);
00074 dcomplex DConjg(dcomplex z);
00075 dcomplex DCdiv(dcomplex a, dcomplex b);
00076 double DCabs(dcomplex z);
00077 dcomplex DCsqrt(dcomplex z);
00078 dcomplex DRCmul(double x, dcomplex a);
00079
00080 #endif
00081
00082 #ifndef _HT_BCVSPINMETRIC_H_
00083 #define _HT_BCVSPINMETRIC_H_
00084
00085 #include <gsl/gsl_vector.h>
00086 #include <gsl/gsl_math.h>
00087 #include <gsl/gsl_matrix.h>
00088 #include <gsl/gsl_eigen.h>
00089 #include <gsl/gsl_rng.h>
00090 #include <gsl/gsl_roots.h>
00091
00092 #include <lal/LALRCSID.h>
00093 NRCSID (LALINSPIRALBCVSPINBANKH,"$Id: LALInspiralBCVSpinBank.h,v 1.9 2007/06/08 14:41:42 bema Exp $");
00094
00095 int cos_sin_func(
00096 int N, double beta,double fmax,
00097
00098 double *costerm,double *sinterm);
00099
00100 int coef_A(
00101 int N,double *costerm,double *sinterm,double fmax,
00102
00103 double *A1, double *A2,double *A3);
00104
00105 int deriv_A(
00106 int N,double *costerm,double *sinterm,double fmax,
00107
00108 double *dA2,double *dA3);
00109
00110 int innerR(
00111 int N, double *A, double *B, double *Sn,double fmin,double fmax,
00112
00113 double *result);
00114
00115 int innerC(
00116 int N, dcomplex *A, dcomplex *B, double *Sn,double fmin,double fmax,
00117
00118 double *result);
00119
00120 int orthonormalized_A(
00121 int N,double *A1, double *A2,double *A3,double *Sn,
00122 double fmin,double fmax,
00123
00124 double *tA2,double *tA3,
00125 double *hA1,double *hA2, double *hA3,
00126 double *normtA2,double *normtA3);
00127
00128 int dA2dbeta(
00129 int N,double *Sn,double fmin,double fmax, double *hA1,
00130 double *tA2,double *dA2,double normtA2,
00131
00132 double *dhA2);
00133
00134 int dA3dbeta(
00135 int N,double *Sn,double fmin,double fmax,
00136 double *hA1,double *hA2,double *dhA2,
00137 double *A3,double *tA3,double *dA3,double normtA3,
00138
00139 double *dhA3);
00140
00141 int calc_function_G(
00142 int N,double *Sn,double fmin,double fmax,
00143 double *A1,double *A2,double *A3,
00144 double *dhA2db,double *dhA3db,
00145
00146 double funcG[7][7][4][4]);
00147
00148 int functionG(
00149 int N,double beta,double *Sn,double fmin,double fmax,
00150
00151 double funcG[7][7][4][4]);
00152
00153 int three_metric(
00154 double funcG[7][7][4][4],double *alpha,
00155
00156 double metric3[4][4]);
00157
00158 int generate_fit_points(double MinMatch, double funcG[7][7][4][4],
00159 int ndata,
00160 double fit_point[ndata+1][4]);
00161
00162 int generate_metric_data(double MinMatch,
00163 double funcG[7][7][4][4]);
00164
00165 void model_func(double xx,double afunc[]);
00166
00167 int metric_by_fit(
00168 double MinMatch, int ndata,
00169
00170 double metric_fit[4][4]);
00171
00172 int rescale_metric( double MinMatch, int ndata, double metric1[4][4],
00173 double metric[4][4]);
00174
00175 int BCVspin_metric(
00176 double MinMatch, int N,double *Sn,double fmin,double fmax,double beta,
00177
00178 double bcv2metric[4][4],int dbg);
00179
00180 double determinant3(gsl_matrix *matrix);
00181
00182 int matrix2_determinant_plus(gsl_matrix *matrix,gsl_vector *eig);
00183
00184 int matrix3_determinant_plus(gsl_matrix *matrix,gsl_vector *eig);
00185
00186 double innerp(int n,double *b,double *c);
00187
00188 double vector_product(double *a,double *b,double *c);
00189
00190 int product_matrix(int n,double A[][n+1],double B[][n+1],double C[][n+1]);
00191
00192 int product_mat_vec(int n,double *w,double A[][n+1],double *v);
00193
00194 int BCVspin_spacing(double MinMatch,double metric3[4][4],double a[4][4],double *deltax);
00195
00196 int BCVspin_effmetric(
00197 double MinMatch, double metric3[4][4],double a[4][4],
00198
00199 double effmetric[3][3]);
00200
00201 struct func1_params
00202 {
00203 int N;
00204 double *Sn;
00205 double fmin;
00206 double fmax;
00207 double MinMatch;
00208 };
00209
00210 double func1(double beta,void *params);
00211
00212 struct func2_params
00213 {
00214 double beta_i;
00215 int N;
00216 double *Sn;
00217 double fmin;
00218 double fmax;
00219 double MinMatch;
00220 };
00221
00222 double func2(double beta,void *params);
00223
00224 int BCVspin_beta_placement(double MinMatch,double beta_min,double beta_max, int N,
00225 double *Sn,double fmin,double fmax, double *beta_list,int *nbeta);
00226
00227 int BCVspin_beta_placement_effmetric( double MinMatch,double beta_min,double beta_max, int N,
00228 double *Sn,double fmin,double fmax,
00229 double effmetric_list[3][3][1001], double *beta_list,int *nbeta);
00230
00231
00232 void svdfit_d_test(double x[], double y[], double sig[], int ndata, gsl_vector *a, int ma,
00233 gsl_matrix *u, gsl_matrix *v, gsl_vector *w, double *chisq,
00234 void (*funcs)(double, double []));
00235
00236 #endif
00237