| 1 |
/* multifit/gsl_multifit.h |
| 2 |
* |
| 3 |
* Copyright (C) 2000, 2007 Brian Gough |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 3 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef __GSL_MULTIFIT_H__ |
| 21 |
#define __GSL_MULTIFIT_H__ |
| 22 |
|
| 23 |
#include <stdlib.h> |
| 24 |
#include "gsl_math.h" |
| 25 |
#include "gsl_vector.h" |
| 26 |
#include "gsl_matrix.h" |
| 27 |
|
| 28 |
#undef __BEGIN_DECLS |
| 29 |
#undef __END_DECLS |
| 30 |
#ifdef __cplusplus |
| 31 |
# define __BEGIN_DECLS extern "C" { |
| 32 |
# define __END_DECLS } |
| 33 |
#else |
| 34 |
# define __BEGIN_DECLS /* empty */ |
| 35 |
# define __END_DECLS /* empty */ |
| 36 |
#endif |
| 37 |
|
| 38 |
__BEGIN_DECLS |
| 39 |
|
| 40 |
typedef struct |
| 41 |
{ |
| 42 |
size_t n; /* number of observations */ |
| 43 |
size_t p; /* number of parameters */ |
| 44 |
gsl_matrix * A; |
| 45 |
gsl_matrix * Q; |
| 46 |
gsl_matrix * QSI; |
| 47 |
gsl_vector * S; |
| 48 |
gsl_vector * t; |
| 49 |
gsl_vector * xt; |
| 50 |
gsl_vector * D; |
| 51 |
} |
| 52 |
gsl_multifit_linear_workspace; |
| 53 |
|
| 54 |
gsl_multifit_linear_workspace * |
| 55 |
gsl_multifit_linear_alloc (size_t n, size_t p); |
| 56 |
|
| 57 |
void |
| 58 |
gsl_multifit_linear_free (gsl_multifit_linear_workspace * work); |
| 59 |
|
| 60 |
int |
| 61 |
gsl_multifit_linear (const gsl_matrix * X, |
| 62 |
const gsl_vector * y, |
| 63 |
gsl_vector * c, |
| 64 |
gsl_matrix * cov, |
| 65 |
double * chisq, |
| 66 |
gsl_multifit_linear_workspace * work); |
| 67 |
|
| 68 |
int |
| 69 |
gsl_multifit_linear_svd (const gsl_matrix * X, |
| 70 |
const gsl_vector * y, |
| 71 |
double tol, |
| 72 |
size_t * rank, |
| 73 |
gsl_vector * c, |
| 74 |
gsl_matrix * cov, |
| 75 |
double *chisq, |
| 76 |
gsl_multifit_linear_workspace * work); |
| 77 |
|
| 78 |
int |
| 79 |
gsl_multifit_wlinear (const gsl_matrix * X, |
| 80 |
const gsl_vector * w, |
| 81 |
const gsl_vector * y, |
| 82 |
gsl_vector * c, |
| 83 |
gsl_matrix * cov, |
| 84 |
double * chisq, |
| 85 |
gsl_multifit_linear_workspace * work); |
| 86 |
|
| 87 |
int |
| 88 |
gsl_multifit_wlinear_svd (const gsl_matrix * X, |
| 89 |
const gsl_vector * w, |
| 90 |
const gsl_vector * y, |
| 91 |
double tol, |
| 92 |
size_t * rank, |
| 93 |
gsl_vector * c, |
| 94 |
gsl_matrix * cov, |
| 95 |
double *chisq, |
| 96 |
gsl_multifit_linear_workspace * work); |
| 97 |
|
| 98 |
int |
| 99 |
gsl_multifit_linear_est (const gsl_vector * x, |
| 100 |
const gsl_vector * c, |
| 101 |
const gsl_matrix * cov, double *y, double *y_err); |
| 102 |
|
| 103 |
|
| 104 |
__END_DECLS |
| 105 |
|
| 106 |
#endif /* __GSL_MULTIFIT_H__ */ |