GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-bb27c0570b
ccmath.h
Go to the documentation of this file.
1 /* ccmath.h CCMATH mathematics library source code.
2  *
3  * Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
4  * This code may be redistributed under the terms of the GNU library
5  * public license (LGPL). ( See the lgpl.license file for details.)
6  *
7  * Modified by Soeren gebbert 2009/01/08
8  * Removed al unused functions in GRASS. Only the linear algebra
9  * functions are used.
10  * ------------------------------------------------------------------------
11  */
12 /*
13  CCM
14 
15  Numerical Analysis Toolkit Header File
16  ELF Shared Library Version
17  */
18 /* Required for Shared Library */
19 #ifndef _CCMATH_H_
20 #define _CCMATH_H_
21 #define XMATH 1
22 
23 /* Define File Pointers and Standard Library */
24 
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <math.h>
28 
29 /* Definitions of Types */
30 
31 #ifndef NULL
32 #define NULL ((void *)0
33 #endif
34 
35 /* Complex Types */
36 
37 #ifndef CPX
38 struct complex {
39  double re, im;
40 };
41 typedef struct complex Cpx;
42 
43 #define CPX 1
44 #endif
45 
46 /* Linear Algebra */
47 
48 /* Real Linear Systems */
49 
50 int minv(double *a, int n);
51 
52 int psinv(double *v, int n);
53 
54 int ruinv(double *a, int n);
55 
56 int solv(double *a, double *b, int n);
57 
58 int solvps(double *s, double *x, int n);
59 
60 int solvru(double *a, double *b, int n);
61 
62 void solvtd(double *a, double *b, double *c, double *x, int m);
63 
64 void eigen(double *a, double *eval, int n);
65 
66 void eigval(double *a, double *eval, int n);
67 
68 double evmax(double *a, double *u, int n);
69 
70 int svdval(double *d, double *a, int m, int n);
71 
72 int sv2val(double *d, double *a, int m, int n);
73 
74 int svduv(double *d, double *a, double *u, int m, double *v, int n);
75 
76 int sv2uv(double *d, double *a, double *u, int m, double *v, int n);
77 
78 int svdu1v(double *d, double *a, int m, double *v, int n);
79 
80 int sv2u1v(double *d, double *a, int m, double *v, int n);
81 
82 void mmul(double *mat, double *a, double *b, int n);
83 
84 void rmmult(double *mat, double *a, double *b, int m, int k, int n);
85 
86 void vmul(double *vp, double *mat, double *v, int n);
87 
88 double vnrm(double *u, double *v, int n);
89 
90 void matprt(double *a, int n, int m, char *fmt);
91 
92 void fmatprt(FILE *fp, double *a, int n, int m, char *fmt);
93 
94 void trnm(double *a, int n);
95 
96 void mattr(double *a, double *b, int m, int n);
97 
98 void otrma(double *at, double *u, double *a, int n);
99 
100 void otrsm(double *st, double *u, double *s0, int n);
101 
102 void mcopy(double *a, double *b, int m);
103 
104 void ortho(double *evc, int n);
105 
106 void smgen(double *a, double *eval, double *evec, int n);
107 
108 /* utility routines for real symmertic eigensystems */
109 
110 void house(double *a, double *d, double *ud, int n);
111 
112 void housev(double *a, double *d, double *ud, int n);
113 
114 int qreval(double *eval, double *ud, int n);
115 
116 int qrevec(double *eval, double *evec, double *dp, int n);
117 
118 /* utility routines for singular value decomposition */
119 
120 int qrbdi(double *d, double *e, int n);
121 
122 int qrbdv(double *d, double *e, double *u, int m, double *v, int n);
123 
124 int qrbdu1(double *d, double *e, double *u, int m, double *v, int n);
125 
126 void ldumat(double *a, double *u, int m, int n);
127 
128 void ldvmat(double *a, double *v, int n);
129 
130 void atou1(double *a, int m, int n);
131 
132 void atovm(double *v, int n);
133 
134 /* Complex Matrix Algebra */
135 
136 int cminv(Cpx *a, int n);
137 
138 int csolv(Cpx *a, Cpx *b, int n);
139 
140 void heigvec(Cpx *a, double *eval, int n);
141 
142 void heigval(Cpx *a, double *eval, int n);
143 
144 double hevmax(Cpx *a, Cpx *u, int n);
145 
146 void cmmul(Cpx *c, Cpx *a, Cpx *b, int n);
147 
148 void cmmult(Cpx *c, Cpx *a, Cpx *b, int m, int k, int n);
149 
150 void cvmul(Cpx *vp, Cpx *mat, Cpx *v, int n);
151 
152 Cpx cvnrm(Cpx *u, Cpx *v, int n);
153 
154 void cmprt(Cpx *a, int n, int m, char *fmt);
155 
156 void trncm(Cpx *a, int n);
157 
158 void hconj(Cpx *u, int n);
159 
160 void cmattr(Cpx *a, Cpx *b, int m, int n);
161 
162 void utrncm(Cpx *at, Cpx *u, Cpx *a, int n);
163 
164 void utrnhm(Cpx *ht, Cpx *u, Cpx *h0, int n);
165 
166 void cmcpy(Cpx *a, Cpx *b, int n);
167 
168 void unitary(Cpx *u, int n);
169 
170 void hmgen(Cpx *h, double *eval, Cpx *u, int n);
171 
172 /* utility routines for hermitian eigen problems */
173 
174 void chouse(Cpx *a, double *d, double *ud, int n);
175 
176 void chousv(Cpx *a, double *d, double *ud, int n);
177 
178 void qrecvc(double *eval, Cpx *evec, double *ud, int n);
179 #endif
void cmmul(Cpx *c, Cpx *a, Cpx *b, int n)
Definition: cmmul.c:11
void otrma(double *at, double *u, double *a, int n)
Definition: otrma.c:9
int qrevec(double *eval, double *evec, double *dp, int n)
Definition: qrevec.c:9
void ldumat(double *a, double *u, int m, int n)
Definition: ldumat.c:9
void mmul(double *mat, double *a, double *b, int n)
Definition: mmul.c:9
void solvtd(double *a, double *b, double *c, double *x, int m)
Definition: solvtd.c:8
int svdu1v(double *d, double *a, int m, double *v, int n)
Definition: svdu1v.c:10
void matprt(double *a, int n, int m, char *fmt)
Definition: matprt.c:11
void cmmult(Cpx *c, Cpx *a, Cpx *b, int m, int k, int n)
Definition: cmmult.c:12
void cmprt(Cpx *a, int n, int m, char *fmt)
Definition: cmprt.c:11
void eigval(double *a, double *eval, int n)
Definition: eigval.c:10
void chouse(Cpx *a, double *d, double *ud, int n)
Definition: chouse.c:12
void cmattr(Cpx *a, Cpx *b, int m, int n)
Definition: cmattr.c:11
int qrbdu1(double *d, double *e, double *u, int m, double *v, int n)
Definition: qrbdu1.c:9
int solv(double *a, double *b, int n)
Definition: solv.c:10
double vnrm(double *u, double *v, int n)
Definition: vmul.c:21
void cvmul(Cpx *vp, Cpx *mat, Cpx *v, int n)
Definition: cvmul.c:11
void heigval(Cpx *a, double *eval, int n)
Definition: heigval.c:12
void cmcpy(Cpx *a, Cpx *b, int n)
Definition: cmcpy.c:11
void trnm(double *a, int n)
Definition: trnm.c:8
void trncm(Cpx *a, int n)
Definition: trncm.c:11
int sv2uv(double *d, double *a, double *u, int m, double *v, int n)
Definition: sv2uv.c:10
void fmatprt(FILE *fp, double *a, int n, int m, char *fmt)
Definition: matprt.c:24
int svduv(double *d, double *a, double *u, int m, double *v, int n)
Definition: svduv.c:10
int qrbdi(double *d, double *e, int n)
Definition: qrbdi.c:9
double hevmax(Cpx *a, Cpx *u, int n)
Definition: hevmax.c:12
void atou1(double *a, int m, int n)
Definition: atou1.c:9
void qrecvc(double *eval, Cpx *evec, double *ud, int n)
Definition: qrecvc.c:11
void hmgen(Cpx *h, double *eval, Cpx *u, int n)
Definition: hmgen.c:12
Cpx cvnrm(Cpx *u, Cpx *v, int n)
Definition: cvmul.c:26
int psinv(double *v, int n)
Definition: psinv.c:9
int cminv(Cpx *a, int n)
Definition: cminv.c:12
void ortho(double *evc, int n)
Definition: ortho.c:11
int qreval(double *eval, double *ud, int n)
Definition: qreval.c:9
int solvps(double *s, double *x, int n)
Definition: solvps.c:9
void housev(double *a, double *d, double *ud, int n)
Definition: housev.c:10
void rmmult(double *mat, double *a, double *b, int m, int k, int n)
Definition: rmmult.c:9
void mcopy(double *a, double *b, int m)
Definition: mcopy.c:8
void smgen(double *a, double *eval, double *evec, int n)
Definition: smgen.c:8
int ruinv(double *a, int n)
Definition: ruinv.c:8
double evmax(double *a, double *u, int n)
Definition: evmax.c:10
void eigen(double *a, double *eval, int n)
Definition: eigen.c:10
void hconj(Cpx *u, int n)
Definition: hconj.c:11
void atovm(double *v, int n)
Definition: atovm.c:8
void utrncm(Cpx *at, Cpx *u, Cpx *a, int n)
Definition: utrncm.c:12
void house(double *a, double *d, double *ud, int n)
Definition: house.c:10
void vmul(double *vp, double *mat, double *v, int n)
Definition: vmul.c:8
int sv2u1v(double *d, double *a, int m, double *v, int n)
Definition: sv2u1v.c:10
void otrsm(double *st, double *u, double *s0, int n)
Definition: otrsm.c:9
int svdval(double *d, double *a, int m, int n)
Definition: svdval.c:10
int qrbdv(double *d, double *e, double *u, int m, double *v, int n)
Definition: qrbdv.c:9
void unitary(Cpx *u, int n)
Definition: unitary.c:18
void ldvmat(double *a, double *v, int n)
Definition: ldvmat.c:8
void utrnhm(Cpx *ht, Cpx *u, Cpx *h0, int n)
Definition: utrnhm.c:12
int solvru(double *a, double *b, int n)
Definition: solvru.c:8
int minv(double *a, int n)
Definition: minv.c:10
int sv2val(double *d, double *a, int m, int n)
Definition: sv2val.c:10
void chousv(Cpx *a, double *d, double *ud, int n)
Definition: chousv.c:12
int csolv(Cpx *a, Cpx *b, int n)
Definition: csolv.c:12
void heigvec(Cpx *a, double *eval, int n)
Definition: heigvec.c:12
void mattr(double *a, double *b, int m, int n)
Definition: mattr.c:8
struct state * st
Definition: parser.c:104
double b
Definition: r_raster.c:39
Definition: la.h:54
double re
Definition: ccmath.h:39
double im
Definition: ccmath.h:39
#define x