gsl_multifit.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #ifndef __GSL_MULTIFIT_H__
  20. #define __GSL_MULTIFIT_H__
  21. #include <stdlib.h>
  22. #include "gsl_math.h"
  23. #include "gsl_vector.h"
  24. #include "gsl_matrix.h"
  25. #undef __BEGIN_DECLS
  26. #undef __END_DECLS
  27. #ifdef __cplusplus
  28. # define __BEGIN_DECLS extern "C" {
  29. # define __END_DECLS }
  30. #else
  31. # define __BEGIN_DECLS /* empty */
  32. # define __END_DECLS /* empty */
  33. #endif
  34. __BEGIN_DECLS
  35. typedef struct
  36. {
  37. size_t n; /* number of observations */
  38. size_t p; /* number of parameters */
  39. gsl_matrix * A;
  40. gsl_matrix * Q;
  41. gsl_matrix * QSI;
  42. gsl_vector * S;
  43. gsl_vector * t;
  44. gsl_vector * xt;
  45. gsl_vector * D;
  46. }
  47. gsl_multifit_linear_workspace;
  48. gsl_multifit_linear_workspace *
  49. gsl_multifit_linear_alloc (size_t n, size_t p);
  50. void
  51. gsl_multifit_linear_free (gsl_multifit_linear_workspace * work);
  52. int
  53. gsl_multifit_linear (const gsl_matrix * X,
  54. const gsl_vector * y,
  55. gsl_vector * c,
  56. gsl_matrix * cov,
  57. double * chisq,
  58. gsl_multifit_linear_workspace * work);
  59. int
  60. gsl_multifit_linear_svd (const gsl_matrix * X,
  61. const gsl_vector * y,
  62. double tol,
  63. size_t * rank,
  64. gsl_vector * c,
  65. gsl_matrix * cov,
  66. double *chisq,
  67. gsl_multifit_linear_workspace * work);
  68. int
  69. gsl_multifit_wlinear (const gsl_matrix * X,
  70. const gsl_vector * w,
  71. const gsl_vector * y,
  72. gsl_vector * c,
  73. gsl_matrix * cov,
  74. double * chisq,
  75. gsl_multifit_linear_workspace * work);
  76. int
  77. gsl_multifit_wlinear_svd (const gsl_matrix * X,
  78. const gsl_vector * w,
  79. const gsl_vector * y,
  80. double tol,
  81. size_t * rank,
  82. gsl_vector * c,
  83. gsl_matrix * cov,
  84. double *chisq,
  85. gsl_multifit_linear_workspace * work);
  86. int
  87. gsl_multifit_linear_est (const gsl_vector * x,
  88. const gsl_vector * c,
  89. const gsl_matrix * cov, double *y, double *y_err);
  90. __END_DECLS
  91. #endif /* __GSL_MULTIFIT_H__ */