GNU Octave
6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-sparse.h
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright (C) 2005-2021 The Octave Project Developers
4
//
5
// See the file COPYRIGHT.md in the top-level directory of this
6
// distribution or <https://octave.org/copyright/>.
7
//
8
// This file is part of Octave.
9
//
10
// Octave is free software: you can redistribute it and/or modify it
11
// under the terms of the GNU General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// Octave is distributed in the hope that it will be useful, but
16
// WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU General Public License for more details.
19
//
20
// You should have received a copy of the GNU General Public License
21
// along with Octave; see the file COPYING. If not, see
22
// <https://www.gnu.org/licenses/>.
23
//
24
////////////////////////////////////////////////////////////////////////
25
26
#if ! defined (octave_oct_sparse_h)
27
#define octave_oct_sparse_h 1
28
29
#include "octave-config.h"
30
31
#if defined (HAVE_SUITESPARSE_AMD_H)
32
# include <suitesparse/amd.h>
33
#elif defined (HAVE_UFSPARSE_AMD_H)
34
# include <ufsparse/amd.h>
35
#elif defined (HAVE_AMD_AMD_H)
36
# include <amd/amd.h>
37
#elif defined (HAVE_AMD_H)
38
# include <amd.h>
39
#endif
40
41
#if defined (HAVE_SUITESPARSE_CCOLAMD_H)
42
# include <suitesparse/ccolamd.h>
43
#elif defined (HAVE_UFSPARSE_CCOLAMD_H)
44
# include <ufsparse/ccolamd.h>
45
#elif defined (HAVE_CCOLAMD_CCOLAMD_H)
46
# include <ccolamd/ccolamd.h>
47
#elif defined (HAVE_CCOLAMD_H)
48
# include <ccolamd.h>
49
#endif
50
51
#if defined (HAVE_SUITESPARSE_CHOLMOD_H)
52
# include <suitesparse/cholmod.h>
53
#elif defined (HAVE_UFSPARSE_CHOLMOD_H)
54
# include <ufsparse/cholmod.h>
55
#elif defined (HAVE_CHOLMOD_CHOLMOD_H)
56
# include <cholmod/cholmod.h>
57
#elif defined (HAVE_CHOLMOD_H)
58
# include <cholmod.h>
59
#endif
60
61
#if defined (HAVE_SUITESPARSE_COLAMD_H)
62
# include <suitesparse/colamd.h>
63
#elif defined (HAVE_UFSPARSE_COLAMD_H)
64
# include <ufsparse/colamd.h>
65
#elif defined (HAVE_COLAMD_COLAMD_H)
66
# include <colamd/colamd.h>
67
#elif defined (HAVE_COLAMD_H)
68
# include <colamd.h>
69
#endif
70
71
#if defined (HAVE_SUITESPARSE_CS_H)
72
# include <suitesparse/cs.h>
73
#elif defined (HAVE_UFSPARSE_CS_H)
74
# include <ufsparse/cs.h>
75
#elif defined (HAVE_CXSPARSE_CS_H)
76
# include <cxsparse/cs.h>
77
#elif defined (HAVE_CS_H)
78
# include <cs.h>
79
#endif
80
81
#if defined (HAVE_SUITESPARSE_UMFPACK_H)
82
# include <suitesparse/umfpack.h>
83
#elif defined (HAVE_UFSPARSE_UMFPACK_H)
84
# include <ufsparse/umfpack.h>
85
#elif defined (HAVE_UMFPACK_UMFPACK_H)
86
# include <umfpack/umfpack.h>
87
#elif defined (HAVE_UMFPACK_H)
88
# include <umfpack.h>
89
#endif
90
91
// Cope with new SuiteSparse versions
92
93
#if defined (SUITESPARSE_VERSION)
94
# if (SUITESPARSE_VERSION >= SUITESPARSE_VER_CODE (4, 3))
95
# define SUITESPARSE_NAME(name) SuiteSparse_ ## name
96
# define SUITESPARSE_ASSIGN_FPTR(f_name, f_var, f_assign) (SuiteSparse_config.f_name = f_assign)
97
# define SUITESPARSE_ASSIGN_FPTR2(f_name, f_var, f_assign) (SuiteSparse_config.f_name = SUITESPARSE_NAME (f_assign))
98
# else
99
# define SUITESPARSE_ASSIGN_FPTR(f_name, f_var, f_assign) (f_var = f_assign)
100
# define SUITESPARSE_ASSIGN_FPTR2(f_name, f_var, f_assign) (f_var = CHOLMOD_NAME (f_assign))
101
# endif
102
#endif
103
104
// Function names depend on integer type.
105
106
#if defined (HAVE_AMD)
107
# if defined (OCTAVE_ENABLE_64)
108
# define AMD_NAME(name) amd_l ## name
109
# else
110
# define AMD_NAME(name) amd ## name
111
# endif
112
#endif
113
114
#if defined (HAVE_CCOLAMD)
115
# if defined (OCTAVE_ENABLE_64)
116
# define CCOLAMD_NAME(name) ccolamd_l ## name
117
# define CSYMAMD_NAME(name) csymamd_l ## name
118
# else
119
# define CCOLAMD_NAME(name) ccolamd ## name
120
# define CSYMAMD_NAME(name) csymamd ## name
121
# endif
122
#endif
123
124
#if defined (HAVE_CHOLMOD)
125
# if defined (OCTAVE_ENABLE_64)
126
# define CHOLMOD_NAME(name) cholmod_l_ ## name
127
# else
128
# define CHOLMOD_NAME(name) cholmod_ ## name
129
# endif
130
#endif
131
132
#if defined (HAVE_COLAMD)
133
# if defined (OCTAVE_ENABLE_64)
134
# define COLAMD_NAME(name) colamd_l ## name
135
# define SYMAMD_NAME(name) symamd_l ## name
136
# else
137
# define COLAMD_NAME(name) colamd ## name
138
# define SYMAMD_NAME(name) symamd ## name
139
# endif
140
#endif
141
142
#if defined (HAVE_CXSPARSE)
143
# if defined (OCTAVE_ENABLE_64)
144
# define CXSPARSE_DNAME(name) cs_dl ## name
145
# define CXSPARSE_ZNAME(name) cs_cl ## name
146
# else
147
# define CXSPARSE_DNAME(name) cs_di ## name
148
# define CXSPARSE_ZNAME(name) cs_ci ## name
149
# endif
150
#endif
151
152
#if defined (HAVE_UMFPACK)
153
# if defined (OCTAVE_ENABLE_64)
154
# define UMFPACK_DNAME(name) umfpack_dl_ ## name
155
# define UMFPACK_ZNAME(name) umfpack_zl_ ## name
156
# else
157
# define UMFPACK_DNAME(name) umfpack_di_ ## name
158
# define UMFPACK_ZNAME(name) umfpack_zi_ ## name
159
# endif
160
#endif
161
162
#if (defined (HAVE_AMD) || defined (HAVE_CCOLAMD) \
163
|| defined (HAVE_CHOLMOD) || defined (HAVE_COLAMD) \
164
|| defined (HAVE_CXSPARSE) || defined (HAVE_UMFPACK))
165
166
namespace
octave
167
{
168
# if defined (OCTAVE_ENABLE_64)
169
typedef
SuiteSparse_long
suitesparse_integer
;
170
# else
171
typedef
int
suitesparse_integer
;
172
# endif
173
174
extern
suitesparse_integer
*
175
to_suitesparse_intptr
(
octave_idx_type
*i);
176
177
extern
const
suitesparse_integer
*
178
to_suitesparse_intptr
(
const
octave_idx_type
*i);
179
180
extern
octave_idx_type
*
181
to_octave_idx_type_ptr
(
suitesparse_integer
*i);
182
183
extern
const
octave_idx_type
*
184
to_octave_idx_type_ptr
(
const
suitesparse_integer
*i);
185
}
186
187
#endif
188
#endif
octave_idx_type
octave
Definition:
aepbalance.cc:41
octave::suitesparse_integer
int suitesparse_integer
Definition:
oct-sparse.h:171
octave::to_octave_idx_type_ptr
octave_idx_type * to_octave_idx_type_ptr(suitesparse_integer *i)
Definition:
oct-sparse.cc:67
octave::to_suitesparse_intptr
suitesparse_integer * to_suitesparse_intptr(octave_idx_type *i)
Definition:
oct-sparse.cc:51
liboctave
util
oct-sparse.h
Generated on Tue Apr 13 2021 15:27:51 for GNU Octave by
1.9.1