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