Mercurial > octave
annotate libinterp/octave-value/ov-base-mat.h @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | a61e1a0f6024 |
children | b3ca7f891750 |
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 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3 // Copyright (C) 1998-2022 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 //////////////////////////////////////////////////////////////////////// |
3219 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
26 #if ! defined (octave_ov_base_mat_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_base_mat_h 1 |
3219 | 28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
30 |
3219 | 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> |
3219 | 34 #include <string> |
35 | |
36 #include "mx-base.h" | |
37 #include "str-vec.h" | |
6376 | 38 #include "MatrixType.h" |
3219 | 39 |
40 #include "error.h" | |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
41 #include "ovl.h" |
3219 | 42 #include "ov-base.h" |
43 #include "ov-typeinfo.h" | |
44 | |
45 // Real matrix values. | |
46 | |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
47 template <typename MT> |
3223 | 48 class |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
49 OCTINTERP_API |
3219 | 50 octave_base_matrix : public octave_base_value |
51 { | |
52 public: | |
53 | |
28641
2c15231c3154
new typedefs for octave_value matrix and scalar types
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
54 typedef MT object_type; |
2c15231c3154
new typedefs for octave_value matrix and scalar types
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
55 |
3219 | 56 octave_base_matrix (void) |
11584
cda4aa780d58
Another round of initialising members in the constructor initialisation list
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
57 : octave_base_value (), matrix (), typ (), idx_cache () { } |
3219 | 58 |
6376 | 59 octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ()) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
60 : octave_base_value (), matrix (m), |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23588
diff
changeset
|
61 typ (t.is_known () ? new MatrixType (t) : nullptr), idx_cache () |
4676 | 62 { |
63 if (matrix.ndims () == 0) | |
64 matrix.resize (dim_vector (0, 0)); | |
65 } | |
3219 | 66 |
67 octave_base_matrix (const octave_base_matrix& m) | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11584
diff
changeset
|
68 : octave_base_value (), matrix (m.matrix), |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23588
diff
changeset
|
69 typ (m.typ ? new MatrixType (*m.typ) : nullptr), |
29569
29a1f8fd8ee6
move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
70 idx_cache (m.idx_cache ? new octave::idx_vector (*m.idx_cache) : nullptr) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
71 { } |
3219 | 72 |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8994
diff
changeset
|
73 ~octave_base_matrix (void) { clear_cached_info (); } |
3219 | 74 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
75 std::size_t byte_size (void) const { return matrix.byte_size (); } |
4901 | 76 |
5147 | 77 octave_value squeeze (void) const { return MT (matrix.squeeze ()); } |
4532 | 78 |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
79 octave_value full_value (void) const { return matrix; } |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
80 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
81 void maybe_economize (void) { matrix.maybe_economize (); } |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
82 |
26916
9cd4b045fe3d
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
83 // We don't need to override all three forms of subsref. The using |
9cd4b045fe3d
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
84 // declaration will avoid warnings about partially-overloaded virtual |
9cd4b045fe3d
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
85 // functions. |
9cd4b045fe3d
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
86 using octave_base_value::subsref; |
9cd4b045fe3d
avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
87 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
88 OCTINTERP_API octave_value |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
89 subsref (const std::string& type, const std::list<octave_value_list>& idx); |
3219 | 90 |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7620
diff
changeset
|
91 octave_value_list subsref (const std::string& type, |
10313 | 92 const std::list<octave_value_list>& idx, int) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
93 { return subsref (type, idx); } |
4271 | 94 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
95 OCTINTERP_API octave_value |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
96 subsasgn (const std::string& type, const std::list<octave_value_list>& idx, |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
97 const octave_value& rhs); |
3933 | 98 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
99 OCTINTERP_API octave_value |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
100 do_index_op (const octave_value_list& idx, bool resize_ok = false); |
3220 | 101 |
21333
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
102 // FIXME: should we import the functions from the base class and |
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
103 // overload them here, or should we use a different name so we don't |
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
104 // have to do this? Without the using declaration or a name change, |
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
105 // the base class functions will be hidden. That may be OK, but it |
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
106 // can also cause some confusion. |
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
107 using octave_base_value::assign; |
c4690d9ff566
avoid warnings about overloading virtual functions from a base class
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
108 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
109 OCTINTERP_API void assign (const octave_value_list& idx, const MT& rhs); |
3928 | 110 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
111 OCTINTERP_API void |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
112 assign (const octave_value_list& idx, typename MT::element_type rhs); |
8679
280fae940bb0
optimize scalar indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
113 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
114 OCTINTERP_API void delete_elements (const octave_value_list& idx); |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
7651
diff
changeset
|
115 |
4513 | 116 dim_vector dims (void) const { return matrix.dims (); } |
117 | |
8994 | 118 octave_idx_type numel (void) const { return matrix.numel (); } |
119 | |
10653
ec5fa46e0e45
override ndims and numel for scalars and matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
10544
diff
changeset
|
120 int ndims (void) const { return matrix.ndims (); } |
ec5fa46e0e45
override ndims and numel for scalars and matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
10544
diff
changeset
|
121 |
5602 | 122 octave_idx_type nnz (void) const { return matrix.nnz (); } |
123 | |
4567 | 124 octave_value reshape (const dim_vector& new_dims) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
125 { return MT (matrix.reshape (new_dims)); } |
4567 | 126 |
4593 | 127 octave_value permute (const Array<int>& vec, bool inv = false) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
128 { return MT (matrix.permute (vec, inv)); } |
4593 | 129 |
5731 | 130 octave_value resize (const dim_vector& dv, bool fill = false) const; |
4915 | 131 |
4017 | 132 octave_value all (int dim = 0) const { return matrix.all (dim); } |
133 octave_value any (int dim = 0) const { return matrix.any (dim); } | |
3221 | 134 |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8994
diff
changeset
|
135 MatrixType matrix_type (void) const { return typ ? *typ : MatrixType (); } |
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8994
diff
changeset
|
136 MatrixType matrix_type (const MatrixType& _typ) const; |
5785 | 137 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7463
diff
changeset
|
138 octave_value diag (octave_idx_type k = 0) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
139 { return octave_value (matrix.diag (k)); } |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7463
diff
changeset
|
140 |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
141 octave_value diag (octave_idx_type m, octave_idx_type n) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
142 { return octave_value (matrix.diag (m, n)); } |
14557
e8e86ae3abbc
make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
143 |
7463
2467639bd8c0
eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
144 octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
145 { return octave_value (matrix.sort (dim, mode)); } |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30232
diff
changeset
|
146 octave_value sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, |
10313 | 147 sortmode mode = ASCENDING) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
148 { return octave_value (matrix.sort (sidx, dim, mode)); } |
7433 | 149 |
23588
0549061d35b9
maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents:
23586
diff
changeset
|
150 sortmode issorted (sortmode mode = UNSORTED) const |
0549061d35b9
maint: Deprecate is_sorted and replace with issorted.
Rik <rik@octave.org>
parents:
23586
diff
changeset
|
151 { return matrix.issorted (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8679
diff
changeset
|
152 |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8721
diff
changeset
|
153 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
154 { return matrix.sort_rows_idx (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8679
diff
changeset
|
155 |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
156 sortmode is_sorted_rows (sortmode mode = UNSORTED) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
157 { return matrix.is_sorted_rows (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8679
diff
changeset
|
158 |
3221 | 159 bool is_matrix_type (void) const { return true; } |
160 | |
23586
f6c5db0a02e7
maint: Deprecate is_numeric_type and replace with isnumeric.
Rik <rik@octave.org>
parents:
23502
diff
changeset
|
161 bool isnumeric (void) const { return true; } |
3221 | 162 |
3219 | 163 bool is_defined (void) const { return true; } |
164 | |
165 bool is_constant (void) const { return true; } | |
166 | |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
167 OCTINTERP_API bool is_true (void) const; |
3220 | 168 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
169 OCTINTERP_API bool print_as_scalar (void) const; |
3219 | 170 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
171 OCTINTERP_API void print (std::ostream& os, bool pr_as_read_syntax = false); |
3219 | 172 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
173 OCTINTERP_API void |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
174 print_info (std::ostream& os, const std::string& prefix) const; |
3933 | 175 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
176 OCTINTERP_API void short_disp (std::ostream& os) const; |
17866
ea0ecbe2eaf5
display matrix values in GUI workspace viewer (bug #40499)
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
177 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
178 OCTINTERP_API float_display_format get_edit_display_format (void) const; |
24668
d4dd741b2794
new octave_value functions for formatting output
John W. Eaton <jwe@octave.org>
parents:
24643
diff
changeset
|
179 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
180 OCTINTERP_API std::string |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
181 edit_display (const float_display_format& fmt, |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
182 octave_idx_type i, octave_idx_type j) const; |
24643
78aff6f14227
more variable editor improvements; allow more variable types to be edited
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
183 |
9546
1beb23d2b892
optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents:
9358
diff
changeset
|
184 MT& matrix_ref (void) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
185 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
186 clear_cached_info (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
187 return matrix; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
188 } |
9546
1beb23d2b892
optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents:
9358
diff
changeset
|
189 |
10665
0f310fce905d
implement octave_base_matrix::matrix_ref const
Jaroslav Hajek <highegg@gmail.com>
parents:
10653
diff
changeset
|
190 const MT& matrix_ref (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
191 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
192 return matrix; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
193 } |
10665
0f310fce905d
implement octave_base_matrix::matrix_ref const
Jaroslav Hajek <highegg@gmail.com>
parents:
10653
diff
changeset
|
194 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
195 OCTINTERP_API octave_value |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10665
diff
changeset
|
196 fast_elem_extract (octave_idx_type n) const; |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10665
diff
changeset
|
197 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
198 OCTINTERP_API bool |
10670
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10665
diff
changeset
|
199 fast_elem_insert (octave_idx_type n, const octave_value& x); |
654fbde5dceb
make cellfun's fast scalar collection mechanism public
Jaroslav Hajek <highegg@gmail.com>
parents:
10665
diff
changeset
|
200 |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
201 // This function exists to support the MEX interface. |
29869
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
202 // You should not use it anywhere else. |
30232
a2936935c7c8
attempt to limit possible const_cast damage
John W. Eaton <jwe@octave.org>
parents:
29869
diff
changeset
|
203 const void * mex_get_data (void) const { return matrix.data (); } |
29869
5411391a4cc0
allow typed mx get data functions to work without mutation in more cases
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
204 |
3219 | 205 protected: |
206 | |
207 MT matrix; | |
5785 | 208 |
29569
29a1f8fd8ee6
move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
209 octave::idx_vector set_idx_cache (const octave::idx_vector& idx) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
210 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
211 delete idx_cache; |
29569
29a1f8fd8ee6
move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
212 idx_cache = (idx ? new octave::idx_vector (idx) : nullptr); |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
213 return idx; |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
214 } |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8994
diff
changeset
|
215 |
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8994
diff
changeset
|
216 void clear_cached_info (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
217 { |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23588
diff
changeset
|
218 delete typ; typ = nullptr; |
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23588
diff
changeset
|
219 delete idx_cache; idx_cache = nullptr; |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
220 } |
9350
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8994
diff
changeset
|
221 |
16a5f9e1fdb3
cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8994
diff
changeset
|
222 mutable MatrixType *typ; |
29569
29a1f8fd8ee6
move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
223 mutable octave::idx_vector *idx_cache; |
12153
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
224 |
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
225 private: |
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
226 |
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
227 // No assignment. |
e0e50f48df37
Explicitly disallow copying in some classes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11586
diff
changeset
|
228 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28641
diff
changeset
|
229 OCTINTERP_API octave_base_matrix& operator = (const octave_base_matrix&); |
3219 | 230 }; |
231 | |
232 #endif |