Mercurial > octave
annotate libinterp/octave-value/ov-re-sparse.h @ 32060:1203a2d81a42
Add BIST tests for Matlab compatibility for functions which accept negative dimensions.
* data.cc (Fones, Finf, Feps, Feye): Add BIST test for negative dimensions.
* rand.cc (Frand): Add BIST test for negative dimensions.
* ov-cell.cc (Fcell): Add BIST test for negative dimensions.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 26 Apr 2023 16:26:32 -0700 |
parents | c8dd3da44e83 |
children | ae4e19c0a2b1 2e484f9f1f18 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
31706
597f3ee61a48
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30801
diff
changeset
|
3 // Copyright (C) 1998-2023 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
5164 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19863
diff
changeset
|
26 #if ! defined (octave_ov_re_sparse_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
27 #define octave_ov_re_sparse_h 1 |
5164 | 28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
30 |
5164 | 31 #include <cstdlib> |
32 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
33 #include <iosfwd> |
5164 | 34 #include <string> |
35 | |
36 #include "mx-base.h" | |
37 #include "str-vec.h" | |
38 | |
39 #include "error.h" | |
40 #include "oct-stream.h" | |
41 #include "ov-base.h" | |
42 #include "ov-typeinfo.h" | |
43 | |
44 #include "dSparse.h" | |
5785 | 45 #include "MatrixType.h" |
5164 | 46 #include "ov-base-sparse.h" |
47 #include "ov-cx-sparse.h" | |
48 | |
49 class octave_value_list; | |
50 | |
51 class | |
6109 | 52 OCTINTERP_API |
5164 | 53 octave_sparse_matrix : public octave_base_sparse<SparseMatrix> |
54 { | |
55 public: | |
56 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
57 octave_sparse_matrix () |
5164 | 58 : octave_base_sparse<SparseMatrix> () { } |
59 | |
60 octave_sparse_matrix (const Matrix& m) | |
61 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
62 | |
63 octave_sparse_matrix (const NDArray& m) | |
64 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
65 | |
66 octave_sparse_matrix (const SparseMatrix& m) | |
67 : octave_base_sparse<SparseMatrix> (m) { } | |
68 | |
5785 | 69 octave_sparse_matrix (const SparseMatrix& m, const MatrixType& t) |
5164 | 70 : octave_base_sparse<SparseMatrix> (m, t) { } |
71 | |
72 octave_sparse_matrix (const MSparse<double>& m) | |
73 : octave_base_sparse<SparseMatrix> (m) { } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
74 |
6863 | 75 octave_sparse_matrix (const MSparse<double>& m, const MatrixType& t) |
76 : octave_base_sparse<SparseMatrix> (m, t) { } | |
77 | |
78 octave_sparse_matrix (const Sparse<double>& m) | |
79 : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
80 |
6863 | 81 octave_sparse_matrix (const Sparse<double>& m, const MatrixType& t) |
82 : octave_base_sparse<SparseMatrix> (SparseMatrix (m), t) { } | |
83 | |
5164 | 84 octave_sparse_matrix (const octave_sparse_matrix& m) |
85 : octave_base_sparse<SparseMatrix> (m) { } | |
86 | |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
87 ~octave_sparse_matrix () = default; |
5164 | 88 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
89 octave_base_value * clone () const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 { return new octave_sparse_matrix (*this); } |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
91 octave_base_value * empty_clone () const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
92 { return new octave_sparse_matrix (); } |
5164 | 93 |
29569
29a1f8fd8ee6
move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
94 octave::idx_vector index_vector (bool require_integers = false) const; |
5164 | 95 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
96 builtin_type_t builtin_type () const { return btyp_double; } |
9685 | 97 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
98 bool is_real_matrix () const { return true; } |
5164 | 99 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
100 bool isreal () const { return true; } |
5164 | 101 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
102 bool is_double_type () const { return true; } |
5895 | 103 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
104 bool isfloat () const { return true; } |
7576 | 105 |
5164 | 106 double double_value (bool = false) const; |
107 | |
108 double scalar_value (bool frc_str_conv = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
109 { return double_value (frc_str_conv); } |
5164 | 110 |
111 Matrix matrix_value (bool = false) const; | |
112 | |
113 Complex complex_value (bool = false) const; | |
114 | |
5943 | 115 boolNDArray bool_array_value (bool warn = false) const; |
5898 | 116 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
117 charNDArray char_array_value (bool = false) const; |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
118 |
5164 | 119 ComplexMatrix complex_matrix_value (bool = false) const; |
120 | |
121 ComplexNDArray complex_array_value (bool = false) const; | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
122 |
5164 | 123 NDArray array_value (bool = false) const; |
124 | |
125 SparseMatrix sparse_matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
126 { return matrix; } |
5164 | 127 |
128 SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
129 { return SparseComplexMatrix (matrix); } |
5164 | 130 |
9852
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
131 SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const; |
aabf7a8c2e57
implement sparse logical conversion
Jaroslav Hajek <highegg@gmail.com>
parents:
9812
diff
changeset
|
132 |
5322 | 133 octave_value convert_to_str_internal (bool pad, bool force, char type) const; |
5282 | 134 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
135 octave_value as_double () const; |
22296
8b18f46f6427
revamp double, single, int type conversions
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
136 |
26399
586413770c7f
pass save_as_floats by value in octave_value save_binary functions
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
137 bool save_binary (std::ostream& os, bool save_as_floats); |
5164 | 138 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
139 bool load_binary (std::istream& is, bool swap, |
21739
c4ab2e54f100
use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
140 octave::mach_info::float_format fmt); |
5164 | 141 |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
142 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats); |
5164 | 143 |
19863
09ed6f7538dd
avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents:
19697
diff
changeset
|
144 bool load_hdf5 (octave_hdf5_id loc_id, const char *name); |
5164 | 145 |
28126
4c21f99b4ad5
handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
146 mxArray * as_mxArray (bool interleaved) const; |
5900 | 147 |
9812
f80c566bc751
improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents:
9685
diff
changeset
|
148 octave_value map (unary_mapper_t umap) const; |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
149 |
5164 | 150 private: |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
151 octave_value map (double (*fcn) (double)) const; |
5164 | 152 |
153 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
154 }; | |
155 | |
156 #endif |