Canoe
Comprehensive Atmosphere N' Ocean Engine
linalg.h File Reference

Go to the source code of this file.

Functions

double vvdot (double const *a, double const *b, int n)
 
void mvdot (double *r, double **m, double const *v, int n1, int n2)
 
int ludcmp (double **a, int n, int *indx)
 
void lubksb (double **a, int n, int *indx, double *b)
 
void leastsq (double **A, double *b, int n1, int n2)
 
void tridiag (int n, double *a, double *b, double *c, double *r, double *u, int pivot_type)
 
void band_decomp (int n, int m1, int m2, double *a, double *al, int *index, double *d)
 
void band_back_sub (int n, int m1, int m2, double *a, double *al, int *index, double *b)
 
void band_multiply (int n, int m1, int m2, double *a, double *x, double *b)
 
void band_improve (int n, int m1, int m2, double *aorig, double *a, double *al, int *index, double *b, double *x)
 

Function Documentation

◆ vvdot()

double vvdot ( double const *  a,
double const *  b,
int  n 
)

vector vector dot product: a.b a[0..n-1] is input b[0..n-1] is input

Definition at line 5 of file vvdot.c.

◆ mvdot()

void mvdot ( double *  r,
double **  m,
double const *  v,
int  n1,
int  n2 
)

Matrix vector dot product: m.v m[0..n1-1][0..n2-1] is input v[0..n2-1] in input r[0..n1-1] is output

Definition at line 7 of file mvdot.c.

◆ ludcmp()

int ludcmp ( double **  a,
int  n,
int *  indx 
)

Given a matrix a[0..n-1][0..n-1], this routine replaces it by the LU decomposition of a rowwise permutation of itself. a and n are input. a is output, arranged as in NRIC equation (2.3.14) ; indx[0..n-1] is an output vector that records the row permutation effected by the partial pivoting; d is output as +/- 1 depending on whether the number of row interchanges was evenor odd, respectively. This routine is used in combination with lubksbto solve linear equationsor invert a matrix. adapted from Numerical Recipes in C, 2nd Ed., p. 46.

Definition at line 14 of file ludcmp.c.

◆ lubksb()

void lubksb ( double **  a,
int  n,
int *  indx,
double *  b 
)

Solves the set of n linear equations A X = B. Here a[0..n-1][0..n-1] is input, not as the matrix A but rather as its LU decomposition, determined by the routine ludcmp. indx[0..n-1] is input as the permutation vector returned by ludcmp. b[0..n-1] is input as the right-hand side vector B, and returns with the solution vector X. a, n, and indx are not modified by this routine and can be left in place for successive calls with different right-hand sides b. This routine takes into account the possibility that b will begin with many zero elements, so it is efficient for use in matrix inversion. adapted from Numerical Recipes in C, 2nd Ed., p. 47.

Definition at line 14 of file lubksb.c.

◆ leastsq()

void leastsq ( double **  A,
double *  b,
int  n1,
int  n2 
)

solve least square problem A.x = b A[0..n1-1][0..n2-1] is input b[0..n1-1] is input/output. Input dimension is n1, output dimension is n2 n1 >= n2

Definition at line 11 of file leastsq.c.

◆ tridiag()

void tridiag ( int  n,
double *  a,
double *  b,
double *  c,
double *  r,
double *  u,
int  pivot_type 
)

Definition at line 25 of file tridiag.c.

◆ band_decomp()

void band_decomp ( int  n,
int  m1,
int  m2,
double *  a,
double *  al,
int *  index,
double *  d 
)

Definition at line 28 of file band_decomp.c.

◆ band_back_sub()

void band_back_sub ( int  n,
int  m1,
int  m2,
double *  a,
double *  al,
int *  index,
double *  b 
)

Definition at line 22 of file band_back_sub.c.

◆ band_multiply()

void band_multiply ( int  n,
int  m1,
int  m2,
double *  a,
double *  x,
double *  b 
)

Definition at line 28 of file band_multiply.c.

◆ band_improve()

void band_improve ( int  n,
int  m1,
int  m2,
double *  aorig,
double *  a,
double *  al,
int *  index,
double *  b,
double *  x 
)

Definition at line 36 of file band_improve.c.