APEMoST
Functions

src/gsl_helper.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_histogram.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <assert.h>

Go to the source code of this file.

Functions

double calc_vector_sum (const gsl_vector *v)
double calc_vector_squaresum (const gsl_vector *v)
gsl_vector * dup_vector (const gsl_vector *v)
gsl_vector * calc_normalized (const gsl_vector *v)
int calc_same (const gsl_vector *a, const gsl_vector *b)
void max_vector (gsl_vector *a, const gsl_vector *b)
void min_vector (gsl_vector *a, const gsl_vector *b)
void sort (gsl_vector **vs, unsigned int nvectors, unsigned int vector_size)
double min_column (const gsl_matrix *m, const unsigned int i)
double min_row (const gsl_matrix *m, const unsigned int i)
double max_column (const gsl_matrix *m, const unsigned int i)
double max_row (const gsl_matrix *m, const unsigned int i)
double calc_deviation (const gsl_matrix *x, const gsl_vector *y, const gsl_vector *k, const double d, const gsl_vector *weights)
gsl_vector * linreg_n (const gsl_matrix *x, const gsl_vector *y, double *d, const gsl_vector *weights)

Function Documentation

double calc_deviation ( const gsl_matrix *  x,
const gsl_vector *  y,
const gsl_vector *  k,
const double  d,
const gsl_vector *  weights 
)

n-dimensional weighted square deviation

References assert.

Referenced by markov_chain_calibrate_multilinear_regression().

gsl_vector* calc_normalized ( const gsl_vector *  v)

normalizes the vector, i.e. the values are scaled so that the sum of all values is 1

The caller has to free the returned vector.

References calc_vector_sum(), dup_vector(), r, and require.

int calc_same ( const gsl_vector *  a,
const gsl_vector *  b 
)
Returns:
1 if vectors contain the same entries

References assert.

double calc_vector_squaresum ( const gsl_vector *  v)

sums the squared values

double calc_vector_sum ( const gsl_vector *  v)

sums the values

Referenced by calc_normalized().

gsl_vector* dup_vector ( const gsl_vector *  v)

returns a duplicate.

The caller has to free the returned vector.

References assert, r, and require.

Referenced by burn_in(), calc_beta_0(), calc_normalized(), calibrate_rest(), markov_chain_step(), restart_from_best(), update_min_max(), and write_calibration_summary().

gsl_vector* linreg_n ( const gsl_matrix *  x,
const gsl_vector *  y,
double *  d,
const gsl_vector *  weights 
)

n-dimensional weighted linear regression returns k and d.

References assert, IFDEBUG, p, xbar(), and xbar_j().

Referenced by markov_chain_calibrate_multilinear_regression().

double max_column ( const gsl_matrix *  m,
const unsigned int  i 
)

given the first index of the matrix, iterate through the second to find the largest entry

Referenced by markov_chain_calibrate_quadratic().

double max_row ( const gsl_matrix *  m,
const unsigned int  i 
)

given the second index of the matrix, iterate through the first to find the largest entry

void max_vector ( gsl_vector *  a,
const gsl_vector *  b 
)

a = max(a, b)

References assert.

Referenced by update_min_max().

double min_column ( const gsl_matrix *  m,
const unsigned int  i 
)

given the first index of the matrix, iterate through the second to find the smallest entry

Referenced by markov_chain_calibrate_quadratic().

double min_row ( const gsl_matrix *  m,
const unsigned int  i 
)

given the second index of the matrix, iterate through the first to find the smallest entry

void min_vector ( gsl_vector *  a,
const gsl_vector *  b 
)

a = min(a, b)

References assert.

Referenced by update_min_max().

void sort ( gsl_vector **  vs,
unsigned int  nvectors,
unsigned int  vector_size 
)

sorts all vectors by the entries in the first vector.

selection sort

References IFDEBUG.