Loading...
Searching...
No Matches
ccmath.h
Go to the documentation of this file.
/* ccmath.h CCMATH mathematics library source code.
*
* Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
* This code may be redistributed under the terms of the GNU library
* public license (LGPL). ( See the lgpl.license file for details.)
*
* Modified by Soeren gebbert 2009/01/08
* Removed al unused functions in GRASS. Only the linear algebra
* functions are used.
* ------------------------------------------------------------------------
*/
/*
CCM
Numerical Analysis Toolkit Header File
ELF Shared Library Version
*/
/* Required for Shared Library */
#ifndef _CCMATH_H_
#define _CCMATH_H_
#define XMATH 1
/* Define File Pointers and Standard Library */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* Definitions of Types */
#ifndef NULL
#define NULL ((void *)0
#endif
/* Complex Types */
#ifndef CPX
#ifndef _MSC_VER
struct complex {
double re, im;
};
typedef struct complex Cpx;
#else
/* _MSVC has complex struct and cannot be used */
struct gcomplex {
double re, im;
};
typedef struct gcomplex Cpx;
#endif /* _MSC_VER */
#define CPX 1
#endif
/* Linear Algebra */
/* Real Linear Systems */
int minv(double *a, int n);
int psinv(double *v, int n);
int ruinv(double *a, int n);
int solv(double *a, double *b, int n);
int solvps(double *s, double *x, int n);
int solvru(double *a, double *b, int n);
void solvtd(double *a, double *b, double *c, double *x, int m);
void eigen(double *a, double *eval, int n);
void eigval(double *a, double *eval, int n);
double evmax(double *a, double *u, int n);
int svdval(double *d, double *a, int m, int n);
int sv2val(double *d, double *a, int m, int n);
int svduv(double *d, double *a, double *u, int m, double *v, int n);
int sv2uv(double *d, double *a, double *u, int m, double *v, int n);
int svdu1v(double *d, double *a, int m, double *v, int n);
int sv2u1v(double *d, double *a, int m, double *v, int n);
void mmul(double *mat, double *a, double *b, int n);
void rmmult(double *mat, double *a, double *b, int m, int k, int n);
void vmul(double *vp, double *mat, double *v, int n);
double vnrm(double *u, double *v, int n);
void matprt(double *a, int n, int m, char *fmt);
void fmatprt(FILE *fp, double *a, int n, int m, char *fmt);
void trnm(double *a, int n);
void mattr(double *a, double *b, int m, int n);
void otrma(double *at, double *u, double *a, int n);
void otrsm(double *st, double *u, double *s0, int n);
void mcopy(double *a, double *b, int m);
void ortho(double *evc, int n);
void smgen(double *a, double *eval, double *evec, int n);
/* utility routines for real symmertic eigensystems */
void house(double *a, double *d, double *ud, int n);
void housev(double *a, double *d, double *ud, int n);
int qreval(double *eval, double *ud, int n);
int qrevec(double *eval, double *evec, double *dp, int n);
/* utility routines for singular value decomposition */
int qrbdi(double *d, double *e, int n);
int qrbdv(double *d, double *e, double *u, int m, double *v, int n);
int qrbdu1(double *d, double *e, double *u, int m, double *v, int n);
void ldumat(double *a, double *u, int m, int n);
void ldvmat(double *a, double *v, int n);
void atou1(double *a, int m, int n);
void atovm(double *v, int n);
/* Complex Matrix Algebra */
int cminv(Cpx *a, int n);
int csolv(Cpx *a, Cpx *b, int n);
void heigvec(Cpx *a, double *eval, int n);
void heigval(Cpx *a, double *eval, int n);
double hevmax(Cpx *a, Cpx *u, int n);
void cmmul(Cpx *c, Cpx *a, Cpx *b, int n);
void cmmult(Cpx *c, Cpx *a, Cpx *b, int m, int k, int n);
void cvmul(Cpx *vp, Cpx *mat, Cpx *v, int n);
Cpx cvnrm(Cpx *u, Cpx *v, int n);
void cmprt(Cpx *a, int n, int m, char *fmt);
void trncm(Cpx *a, int n);
void hconj(Cpx *u, int n);
void cmattr(Cpx *a, Cpx *b, int m, int n);
void utrncm(Cpx *at, Cpx *u, Cpx *a, int n);
void utrnhm(Cpx *ht, Cpx *u, Cpx *h0, int n);
void cmcpy(Cpx *a, Cpx *b, int n);
void unitary(Cpx *u, int n);
void hmgen(Cpx *h, double *eval, Cpx *u, int n);
int csolv(Cpx *a, Cpx *b, int n);
/* utility routines for hermitian eigen problems */
void chouse(Cpx *a, double *d, double *ud, int n);
void chousv(Cpx *a, double *d, double *ud, int n);
void qrecvc(double *eval, Cpx *evec, double *ud, int n);
#endif
cmmul
void cmmul(Cpx *c, Cpx *a, Cpx *b, int n)
Definition cmmul.c:11
otrma
void otrma(double *at, double *u, double *a, int n)
Definition otrma.c:9
qrevec
int qrevec(double *eval, double *evec, double *dp, int n)
Definition qrevec.c:9
ldumat
void ldumat(double *a, double *u, int m, int n)
Definition ldumat.c:9
mmul
void mmul(double *mat, double *a, double *b, int n)
Definition mmul.c:9
solvtd
void solvtd(double *a, double *b, double *c, double *x, int m)
Definition solvtd.c:8
svdu1v
int svdu1v(double *d, double *a, int m, double *v, int n)
Definition svdu1v.c:10
matprt
void matprt(double *a, int n, int m, char *fmt)
Definition matprt.c:11
cmmult
void cmmult(Cpx *c, Cpx *a, Cpx *b, int m, int k, int n)
Definition cmmult.c:12
cmprt
void cmprt(Cpx *a, int n, int m, char *fmt)
Definition cmprt.c:11
eigval
void eigval(double *a, double *eval, int n)
Definition eigval.c:10
chouse
void chouse(Cpx *a, double *d, double *ud, int n)
Definition chouse.c:12
cmattr
void cmattr(Cpx *a, Cpx *b, int m, int n)
Definition cmattr.c:11
qrbdu1
int qrbdu1(double *d, double *e, double *u, int m, double *v, int n)
Definition qrbdu1.c:9
solv
int solv(double *a, double *b, int n)
Definition solv.c:10
vnrm
double vnrm(double *u, double *v, int n)
Definition vmul.c:21
cvmul
void cvmul(Cpx *vp, Cpx *mat, Cpx *v, int n)
Definition cvmul.c:11
heigval
void heigval(Cpx *a, double *eval, int n)
Definition heigval.c:12
cmcpy
void cmcpy(Cpx *a, Cpx *b, int n)
Definition cmcpy.c:11
trnm
void trnm(double *a, int n)
Definition trnm.c:8
trncm
void trncm(Cpx *a, int n)
Definition trncm.c:11
sv2uv
int sv2uv(double *d, double *a, double *u, int m, double *v, int n)
Definition sv2uv.c:10
fmatprt
void fmatprt(FILE *fp, double *a, int n, int m, char *fmt)
Definition matprt.c:24
svduv
int svduv(double *d, double *a, double *u, int m, double *v, int n)
Definition svduv.c:10
qrbdi
int qrbdi(double *d, double *e, int n)
Definition qrbdi.c:9
hevmax
double hevmax(Cpx *a, Cpx *u, int n)
Definition hevmax.c:12
atou1
void atou1(double *a, int m, int n)
Definition atou1.c:9
qrecvc
void qrecvc(double *eval, Cpx *evec, double *ud, int n)
Definition qrecvc.c:11
hmgen
void hmgen(Cpx *h, double *eval, Cpx *u, int n)
Definition hmgen.c:12
cvnrm
Cpx cvnrm(Cpx *u, Cpx *v, int n)
Definition cvmul.c:26
psinv
int psinv(double *v, int n)
Definition psinv.c:9
cminv
int cminv(Cpx *a, int n)
Definition cminv.c:12
ortho
void ortho(double *evc, int n)
Definition ortho.c:11
qreval
int qreval(double *eval, double *ud, int n)
Definition qreval.c:9
solvps
int solvps(double *s, double *x, int n)
Definition solvps.c:9
housev
void housev(double *a, double *d, double *ud, int n)
Definition housev.c:10
rmmult
void rmmult(double *mat, double *a, double *b, int m, int k, int n)
Definition rmmult.c:9
Cpx
struct complex Cpx
Definition ccmath.h:41
mcopy
void mcopy(double *a, double *b, int m)
Definition mcopy.c:8
smgen
void smgen(double *a, double *eval, double *evec, int n)
Definition smgen.c:8
ruinv
int ruinv(double *a, int n)
Definition ruinv.c:8
evmax
double evmax(double *a, double *u, int n)
Definition evmax.c:10
eigen
void eigen(double *a, double *eval, int n)
Definition eigen.c:10
hconj
void hconj(Cpx *u, int n)
Definition hconj.c:11
atovm
void atovm(double *v, int n)
Definition atovm.c:8
utrncm
void utrncm(Cpx *at, Cpx *u, Cpx *a, int n)
Definition utrncm.c:12
house
void house(double *a, double *d, double *ud, int n)
Definition house.c:10
vmul
void vmul(double *vp, double *mat, double *v, int n)
Definition vmul.c:8
sv2u1v
int sv2u1v(double *d, double *a, int m, double *v, int n)
Definition sv2u1v.c:10
otrsm
void otrsm(double *st, double *u, double *s0, int n)
Definition otrsm.c:9
svdval
int svdval(double *d, double *a, int m, int n)
Definition svdval.c:10
qrbdv
int qrbdv(double *d, double *e, double *u, int m, double *v, int n)
Definition qrbdv.c:9
unitary
void unitary(Cpx *u, int n)
Definition unitary.c:18
ldvmat
void ldvmat(double *a, double *v, int n)
Definition ldvmat.c:8
utrnhm
void utrnhm(Cpx *ht, Cpx *u, Cpx *h0, int n)
Definition utrnhm.c:12
solvru
int solvru(double *a, double *b, int n)
Definition solvru.c:8
minv
int minv(double *a, int n)
Definition minv.c:10
sv2val
int sv2val(double *d, double *a, int m, int n)
Definition sv2val.c:10
chousv
void chousv(Cpx *a, double *d, double *ud, int n)
Definition chousv.c:12
csolv
int csolv(Cpx *a, Cpx *b, int n)
Definition csolv.c:12
heigvec
void heigvec(Cpx *a, double *eval, int n)
Definition heigvec.c:12
mattr
void mattr(double *a, double *b, int m, int n)
Definition mattr.c:8
b
double b
Definition driver/set_window.c:5
complex
Definition ccmath.h:38
complex::re
double re
Definition ccmath.h:39
complex::im
double im
Definition ccmath.h:39
x
#define x