APEMoST

src/gsl_helper.h

Go to the documentation of this file.
00001 /*
00002     APEMoST - Automated Parameter Estimation and Model Selection Toolkit
00003     Copyright (C) 2009  Johannes Buchner
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #ifndef MCMC_GSL_HELPER
00020 #define MCMC_GSL_HELPER
00021 
00022 #include <stdio.h>
00023 #include <stdlib.h>
00024 
00025 #include <gsl/gsl_math.h>
00026 #include <gsl/gsl_histogram.h>
00027 #include <gsl/gsl_vector.h>
00028 #include <gsl/gsl_matrix.h>
00029 
00030 #ifdef NOASSERT
00031 #define assert(cond)
00032 #else
00033 #include <assert.h>
00034 #endif
00035 
00039 double calc_vector_sum(const gsl_vector * v);
00040 
00044 double calc_vector_squaresum(const gsl_vector * v);
00050 gsl_vector * dup_vector(const gsl_vector * v);
00051 
00058 gsl_vector * calc_normalized(const gsl_vector * v);
00059 
00063 int calc_same(const gsl_vector * a, const gsl_vector * b);
00064 
00068 void max_vector(gsl_vector * a, const gsl_vector * b);
00072 void min_vector(gsl_vector * a, const gsl_vector * b);
00073 
00074 
00075 
00076 
00082 void sort(gsl_vector ** vs, unsigned int nvectors, unsigned int vector_size);
00083 
00088 double min_column(const gsl_matrix * m, const unsigned int i);
00089 
00094 double min_row(const gsl_matrix * m, const unsigned int i);
00095 
00100 double max_column(const gsl_matrix * m, const unsigned int i);
00101 
00106 double max_row(const gsl_matrix * m, const unsigned int i);
00107 
00111 double calc_deviation(const gsl_matrix * x, const gsl_vector * y,
00112                 const gsl_vector * k, const double d, const gsl_vector * weights);
00113 
00118 gsl_vector * linreg_n(const gsl_matrix * x, const gsl_vector * y, double * d,
00119                 const gsl_vector * weights);
00120 
00121 #endif