GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71917
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 {double re,im;};
39 typedef struct complex Cpx;
40 #define CPX 1
41 #endif
42 
43 /* Linear Algebra */
44 
45 
46  /* Real Linear Systems */
47 
48 
49  int minv(double *a,int n) ;
50 
51  int psinv(double *v,int n) ;
52 
53  int ruinv(double *a,int n) ;
54 
55  int solv(double *a,double *b,int n) ;
56 
57  int solvps(double *s,double *x,int n) ;
58 
59  int solvru(double *a,double *b,int n) ;
60 
61  void solvtd(double *a,double *b,double *c,double *x,int m) ;
62 
63  void eigen(double *a,double *eval,int n) ;
64 
65  void eigval(double *a,double *eval,int n) ;
66 
67  double evmax(double *a,double *u,int n) ;
68 
69  int svdval(double *d,double *a,int m,int n) ;
70 
71  int sv2val(double *d,double *a,int m,int n) ;
72 
73  int svduv(double *d,double *a,double *u,int m,double *v,int n) ;
74 
75  int sv2uv(double *d,double *a,double *u,int m,double *v,int n) ;
76 
77  int svdu1v(double *d,double *a,int m,double *v,int n) ;
78 
79  int sv2u1v(double *d,double *a,int m,double *v,int n) ;
80 
81  void mmul(double *mat,double *a,double *b,int n) ;
82 
83  void rmmult(double *mat,double *a,double *b,int m,int k,int n) ;
84 
85  void vmul(double *vp,double *mat,double *v,int n) ;
86 
87  double vnrm(double *u,double *v,int n) ;
88 
89  void matprt(double *a,int n,int m,char *fmt) ;
90 
91  void fmatprt(FILE *fp,double *a,int n,int m,char *fmt) ;
92 
93  void trnm(double *a,int n) ;
94 
95  void mattr(double *a,double *b,int m,int n) ;
96 
97  void otrma(double *at,double *u,double *a,int n) ;
98 
99  void otrsm(double *st,double *u,double *s0,int n) ;
100 
101  void mcopy(double *a,double *b,int m) ;
102 
103  void ortho(double *evc,int n) ;
104 
105  void smgen(double *a,double *eval,double *evec,int n) ;
106 
107  /* utility routines for real symmertic eigensystems */
108 
109  void house(double *a,double *d,double *ud,int n) ;
110 
111  void housev(double *a,double *d,double *ud,int n) ;
112 
113  int qreval(double *eval,double *ud,int n) ;
114 
115  int qrevec(double *eval,double *evec,double *dp,int n) ;
116 
117  /* utility routines for singular value decomposition */
118 
119  int qrbdi(double *d, double *e,int n) ;
120 
121  int qrbdv(double *d, double *e,double *u,int m,double *v,int n) ;
122 
123  int qrbdu1(double *d, double *e,double *u,int m,double *v,int n) ;
124 
125  void ldumat(double *a,double *u,int m,int n) ;
126 
127  void ldvmat(double *a,double *v,int n) ;
128 
129  void atou1(double *a,int m,int n) ;
130 
131  void atovm(double *v,int n) ;
132 
133 
134  /* Complex Matrix Algebra */
135 
136 
137  int cminv(Cpx *a,int n) ;
138 
139  int csolv(Cpx *a,Cpx *b,int n) ;
140 
141  void heigvec(Cpx *a,double *eval,int n) ;
142 
143  void heigval(Cpx *a,double *eval,int n) ;
144 
145  double hevmax(Cpx *a,Cpx *u,int n) ;
146 
147  void cmmul(Cpx *c,Cpx *a,Cpx *b,int n) ;
148 
149  void cmmult(Cpx *c,Cpx *a,Cpx *b,int m,int k,int n) ;
150 
151  void cvmul(Cpx *vp,Cpx *mat,Cpx *v,int n) ;
152 
153  Cpx cvnrm(Cpx *u,Cpx *v,int n) ;
154 
155  void cmprt(Cpx *a,int n,int m,char *fmt) ;
156 
157  void trncm(Cpx *a,int n) ;
158 
159  void hconj(Cpx *u,int n) ;
160 
161  void cmattr(Cpx *a,Cpx *b,int m,int n) ;
162 
163  void utrncm(Cpx *at,Cpx *u,Cpx *a,int n) ;
164 
165  void utrnhm(Cpx *ht,Cpx *u,Cpx *h0,int n) ;
166 
167  void cmcpy(Cpx *a,Cpx *b,int n) ;
168 
169  void unitary(Cpx *u,int n) ;
170 
171  void hmgen(Cpx *h,double *eval,Cpx *u,int n) ;
172 
173 
174  /* utility routines for hermitian eigen problems */
175 
176  void chouse(Cpx *a,double *d,double *ud,int n) ;
177 
178  void chousv(Cpx *a,double *d,double *ud,int n) ;
179 
180  void qrecvc(double *eval,Cpx *evec,double *ud,int n) ;
181 #endif
void mcopy(double *a, double *b, int m)
Definition: mcopy.c:8
void utrncm(Cpx *at, Cpx *u, Cpx *a, int n)
Definition: utrncm.c:10
int svduv(double *d, double *a, double *u, int m, double *v, int n)
Definition: svduv.c:10
void hconj(Cpx *u, int n)
Definition: hconj.c:9
int qrbdu1(double *d, double *e, double *u, int m, double *v, int n)
Definition: qrbdu1.c:9
void cmcpy(Cpx *a, Cpx *b, int n)
Definition: cmcpy.c:9
void trnm(double *a, int n)
Definition: trnm.c:8
void trncm(Cpx *a, int n)
Definition: trncm.c:9
void cmmul(Cpx *c, Cpx *a, Cpx *b, int n)
Definition: cmmul.c:9
int solvps(double *s, double *x, int n)
Definition: solvps.c:9
void cmattr(Cpx *a, Cpx *b, int m, int n)
Definition: cmattr.c:9
void atovm(double *v, int n)
Definition: atovm.c:8
int svdval(double *d, double *a, int m, int n)
Definition: svdval.c:10
void qrecvc(double *eval, Cpx *evec, double *ud, int n)
Definition: qrecvc.c:9
int qreval(double *eval, double *ud, int n)
Definition: qreval.c:9
void eigen(double *a, double *eval, int n)
Definition: eigen.c:10
int sv2u1v(double *d, double *a, int m, double *v, int n)
Definition: sv2u1v.c:10
void heigval(Cpx *a, double *eval, int n)
Definition: heigval.c:10
void chousv(Cpx *a, double *d, double *ud, int n)
Definition: chousv.c:10
void utrnhm(Cpx *ht, Cpx *u, Cpx *h0, int n)
Definition: utrnhm.c:10
int qrbdv(double *d, double *e, double *u, int m, double *v, int n)
Definition: qrbdv.c:9
void ortho(double *evc, int n)
Definition: ortho.c:11
Cpx cvnrm(Cpx *u, Cpx *v, int n)
Definition: cvmul.c:24
void atou1(double *a, int m, int n)
Definition: atou1.c:9
void chouse(Cpx *a, double *d, double *ud, int n)
Definition: chouse.c:10
void solvtd(double *a, double *b, double *c, double *x, int m)
Definition: solvtd.c:8
void mmul(double *mat, double *a, double *b, int n)
Definition: mmul.c:9
#define x
void cmmult(Cpx *c, Cpx *a, Cpx *b, int m, int k, int n)
Definition: cmmult.c:10
void ldumat(double *a, double *u, int m, int n)
Definition: ldumat.c:9
void hmgen(Cpx *h, double *eval, Cpx *u, int n)
Definition: hmgen.c:10
void cmprt(Cpx *a, int n, int m, char *fmt)
Definition: cmprt.c:9
void unitary(Cpx *u, int n)
Definition: unitary.c:16
void smgen(double *a, double *eval, double *evec, int n)
Definition: smgen.c:8
struct state * st
Definition: parser.c:103
int sv2val(double *d, double *a, int m, int n)
Definition: sv2val.c:10
int minv(double *a, int n)
Definition: minv.c:10
void mattr(double *a, double *b, int m, int n)
Definition: mattr.c:8
double b
Definition: r_raster.c:39
int psinv(double *v, int n)
Definition: psinv.c:9
void vmul(double *vp, double *mat, double *v, int n)
Definition: vmul.c:8
double hevmax(Cpx *a, Cpx *u, int n)
Definition: hevmax.c:10
int sv2uv(double *d, double *a, double *u, int m, double *v, int n)
Definition: sv2uv.c:10
void cvmul(Cpx *vp, Cpx *mat, Cpx *v, int n)
Definition: cvmul.c:9
void matprt(double *a, int n, int m, char *fmt)
Definition: matprt.c:9
int cminv(Cpx *a, int n)
Definition: cminv.c:10
void fmatprt(FILE *fp, double *a, int n, int m, char *fmt)
Definition: matprt.c:22
void house(double *a, double *d, double *ud, int n)
Definition: house.c:10
int solvru(double *a, double *b, int n)
Definition: solvru.c:8
int svdu1v(double *d, double *a, int m, double *v, int n)
Definition: svdu1v.c:10
void heigvec(Cpx *a, double *eval, int n)
Definition: heigvec.c:10
int csolv(Cpx *a, Cpx *b, int n)
Definition: csolv.c:10
void otrsm(double *st, double *u, double *s0, int n)
Definition: otrsm.c:9
double evmax(double *a, double *u, int n)
Definition: evmax.c:10
void ldvmat(double *a, double *v, int n)
Definition: ldvmat.c:8
void rmmult(double *mat, double *a, double *b, int m, int k, int n)
Definition: rmmult.c:9
void otrma(double *at, double *u, double *a, int n)
Definition: otrma.c:9
double re
Definition: ccmath.h:38
double im
Definition: ccmath.h:38
int ruinv(double *a, int n)
Definition: ruinv.c:8
int solv(double *a, double *b, int n)
Definition: solv.c:10
int qrevec(double *eval, double *evec, double *dp, int n)
Definition: qrevec.c:9
int qrbdi(double *d, double *e, int n)
Definition: qrbdi.c:9
Definition: la.h:54
void housev(double *a, double *d, double *ud, int n)
Definition: housev.c:10
void eigval(double *a, double *eval, int n)
Definition: eigval.c:10
double vnrm(double *u, double *v, int n)
Definition: vmul.c:21