GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
la.h
Go to the documentation of this file.
1
2
/**
3
* \file la.h
4
*
5
* \brief Wrapper headers for BLAS/LAPACK.
6
*
7
* This program is free software under the GNU General Public License
8
* (>=v2). Read the file COPYING that comes with GRASS for details.
9
*
10
* \author David D. Gray, ddgray@armacde.demon co uk
11
* \author GRASS GIS Development Team
12
*
13
* \date 2000-2007
14
*/
15
16
#ifndef HAVE_LIBBLAS
17
#error GRASS GIS is not configured with BLAS (la.h cannot be included)
18
#endif
19
20
#ifndef HAVE_LIBLAPACK
21
#error GRASS GIS is not configured with LAPACK (la.h cannot be included)
22
#endif
23
24
#ifndef GRASS_LA_H
25
#define GRASS_LA_H
26
27
/* QUESTION: On some systems there appears to be no default link
28
to this. Do we create a symlink to
29
/usr/lib/gcc-lib/<platform>/<vers_num>/include/g2c.h
30
31
or link to any old f2c.h that happens to hanging around?
32
33
A job for autoconf
34
35
[Also a consideration for -lg2c]
36
*/
37
38
#include <
grass/config.h
>
39
#include <stdio.h>
40
41
#ifdef HAVE_G2C_H
42
typedef
int
__g77_integer;
43
typedef
unsigned
int
__g77_uinteger;
44
typedef
long
int
__g77_longint;
45
typedef
unsigned
long
int
__g77_ulongint;
46
#include <g2c.h>
47
#else
/* for gcc4+ */
48
typedef
int
integer
;
49
typedef
unsigned
int
uinteger
;
50
typedef
char
*
address
;
51
typedef
short
shortint
;
52
typedef
float
real
;
53
typedef
double
doublereal
;
54
typedef
struct
55
{
56
real
r
, i;
57
}
complex
;
58
typedef
struct
59
{
60
doublereal
r
, i;
61
}
doublecomplex
;
62
typedef
int
logical
;
63
typedef
short
shortlogical
;
64
typedef
char
logical1
;
65
typedef
char
integer1
;
66
typedef
long
longint
;
67
typedef
unsigned
long
ulongint
;
68
69
/* IO stuff */
70
typedef
int
ftnlen
;
71
72
/* procedure parameter types for -A */
73
typedef
int (*
U_fp
) ();
74
typedef
shortint
(*
J_fp
) ();
75
typedef
integer
(*
I_fp
) ();
76
typedef
real
(*
R_fp
) ();
77
typedef
doublereal
(*
D_fp
) (), (*
E_fp
) ();
78
typedef
void (*
C_fp
) ();
79
typedef
void (*
Z_fp
) ();
80
typedef
logical
(*
L_fp
) ();
81
typedef
shortlogical
(*
K_fp
) ();
82
typedef
void (*
H_fp
) ();
83
typedef
int (*
S_fp
) ();
84
85
/* E_fp is for real functions when -R is not specified */
86
typedef
void
C_f
;
/* complex function */
87
typedef
void
H_f
;
/* character function */
88
typedef
void
Z_f
;
/* double complex function */
89
typedef
doublereal
E_f
;
/* real function with -R not specified */
90
#endif
/* HAVE_G2C_H */
91
92
/* The following may have to be selectively installed according
93
to platform, at least partly
94
*/
95
96
#if defined(HAVE_LIBBLAS) && defined(HAVE_LIBLAPACK)
97
#include <
grass/blas.h
>
98
#include <
grass/lapack.h
>
99
#endif
100
101
102
/* Useful defines */
103
104
#define MAX_POS 1
/* Indicates maximum value */
105
#define MAX_NEG -1
/* Indicates minimum value */
106
#define MAX_ABS 0
/* Indicates absolute value */
107
108
#define DO_COMPACT 0
/* Eliminate unnecessary rows (cols) in matrix */
109
#define NO_COMPACT 1
/* ... or not */
110
111
112
/* define macros for fortran symbols (called directly). Needed because
113
of platform invariance on fortran->C symbol translations
114
*/
115
116
#if defined(HAVE_LIBBLAS) && defined(HAVE_LIBLAPACK)
117
#define f77_dgesv dgesv_
118
#define f77_dgemm dgemm_
119
#define f77_dnrm2 dnrm2_
120
#endif
121
122
/* Operations should know type of coefficient matrix, so that
123
they can call the right driver
124
*/
125
126
typedef
enum
127
{
NONSYM
,
SYM
,
HERMITIAN
}
mat_type
;
128
typedef
enum
129
{
MATRIX_
,
ROWVEC_
,
COLVEC_
}
mat_spec
;
130
typedef
enum
131
{
RVEC
,
CVEC
}
vtype
;
132
133
134
/************************************************************
135
* *
136
* A general matrix wrapper for use with BLAS / LAPACK *
137
* routines, and perhaps elsewhere *
138
* *
139
************************************************************/
140
141
typedef
struct
matrix_
142
{
143
144
mat_spec
type
;
/* matrix, row vector or column vector? */
145
int
v_indx
;
/* If a vector, which row(column) is active?
146
* If a matrix this is ignored. If value is < 0,
147
* the first row(column) is assumed, ie. index 0. */
148
int
rows
,
cols
;
/* Rows and columns of matrix */
149
int
ldim
;
/* Lead dimension of matrix. How many `rows' are
150
* alloc'ed? May exceed real number of rows `rows' */
151
doublereal
*
vals
;
/* The values (should be dimensioned to lda * cols */
152
int
is_init
;
/* Is matrix initialised: values array
153
* is allocated and parameters set ? */
154
}
mat_struct
;
155
156
typedef
mat_struct
vec_struct
;
157
158
#include <
grass/defs/la.h
>
159
160
#endif
/* GRASS_LA_H */
vec_struct
mat_struct vec_struct
Definition:
la.h:156
integer
int integer
Definition:
la.h:48
vtype
vtype
Definition:
la.h:130
real
float real
Definition:
la.h:52
logical1
char logical1
Definition:
la.h:64
I_fp
integer(* I_fp)()
Definition:
la.h:75
doublereal
double doublereal
Definition:
la.h:53
SYM
Definition:
la.h:127
blas.h
U_fp
int(* U_fp)()
Definition:
la.h:73
Z_f
void Z_f
Definition:
la.h:88
matrix_::vals
doublereal * vals
Definition:
la.h:151
RVEC
Definition:
la.h:131
L_fp
logical(* L_fp)()
Definition:
la.h:80
config.h
matrix_::rows
int rows
Definition:
la.h:148
address
char * address
Definition:
la.h:50
E_f
doublereal E_f
Definition:
la.h:89
matrix_
Definition:
la.h:141
doublecomplex::r
doublereal r
Definition:
la.h:60
mat_type
mat_type
Definition:
la.h:126
D_fp
doublereal(* D_fp)()
Definition:
la.h:77
E_fp
doublereal(*)(* E_fp)()
Definition:
la.h:77
matrix_::ldim
int ldim
Definition:
la.h:149
mat_struct
struct matrix_ mat_struct
H_f
void H_f
Definition:
la.h:87
mat_spec
mat_spec
Definition:
la.h:128
matrix_::v_indx
int v_indx
Definition:
la.h:145
MATRIX_
Definition:
la.h:129
logical
int logical
Definition:
la.h:62
NONSYM
Definition:
la.h:127
longint
long longint
Definition:
la.h:66
R_fp
real(* R_fp)()
Definition:
la.h:76
COLVEC_
Definition:
la.h:129
ulongint
unsigned long ulongint
Definition:
la.h:67
CVEC
Definition:
la.h:131
ROWVEC_
Definition:
la.h:129
matrix_::type
mat_spec type
Definition:
la.h:144
matrix_::cols
int cols
Definition:
la.h:148
shortlogical
short shortlogical
Definition:
la.h:63
C_f
void C_f
Definition:
la.h:86
C_fp
void(* C_fp)()
Definition:
la.h:78
complex
Definition:
la.h:54
H_fp
void(* H_fp)()
Definition:
la.h:82
uinteger
unsigned int uinteger
Definition:
la.h:49
integer1
char integer1
Definition:
la.h:65
S_fp
int(* S_fp)()
Definition:
la.h:83
HERMITIAN
Definition:
la.h:127
Z_fp
void(* Z_fp)()
Definition:
la.h:79
J_fp
shortint(* J_fp)()
Definition:
la.h:74
la.h
K_fp
shortlogical(* K_fp)()
Definition:
la.h:81
shortint
short shortint
Definition:
la.h:51
lapack.h
matrix_::is_init
int is_init
Definition:
la.h:152
doublecomplex
Definition:
la.h:58
complex::r
real r
Definition:
la.h:56
ftnlen
int ftnlen
Definition:
la.h:70
include
grass
la.h
Generated on Tue Feb 14 2023 05:56:00 for GRASS GIS 8 Programmer's Manual by
1.8.13