GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-sparse.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2017-2024 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 (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include "lo-error.h"
31 #include "oct-sparse.h"
32 
33 #if (defined (HAVE_AMD) || defined (HAVE_CCOLAMD) \
34  || defined (HAVE_CHOLMOD) || defined (HAVE_COLAMD) \
35  || defined (HAVE_CXSPARSE) || defined (HAVE_UMFPACK))
36 
38 
39 static inline void
40 check_suitesparse_integer_size ()
41 {
42  // FIXME: maybe it would be better to make this a configure check and
43  // disable suitesparse if it fails?
44 
45  if (sizeof (suitesparse_integer) != sizeof (octave_idx_type))
46  (*current_liboctave_error_handler)
47  ("size of suitesparse integer does not match octave_idx_type!");
48 }
49 
52 {
53  check_suitesparse_integer_size ();
54 
55  return reinterpret_cast<suitesparse_integer *> (i);
56 }
57 
58 const suitesparse_integer *
60 {
61  check_suitesparse_integer_size ();
62 
63  return reinterpret_cast<const suitesparse_integer *> (i);
64 }
65 
68 {
69  check_suitesparse_integer_size ();
70 
71  return reinterpret_cast<octave_idx_type *> (i);
72 }
73 
74 const octave_idx_type *
76 {
77  check_suitesparse_integer_size ();
78 
79  return reinterpret_cast<const octave_idx_type *> (i);
80 }
81 
82 OCTAVE_END_NAMESPACE(octave)
83 
84 #endif
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
octave_idx_type * to_octave_idx_type_ptr(suitesparse_integer *i)
Definition: oct-sparse.cc:67
suitesparse_integer * to_suitesparse_intptr(octave_idx_type *i)
Definition: oct-sparse.cc:51
int suitesparse_integer
Definition: oct-sparse.h:184