Mercurial > octave
annotate liboctave/array/chMatrix.h @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
1573 | 1 /* |
2 | |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 Copyright (C) 1995-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27023
diff
changeset
|
4 |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27023
diff
changeset
|
5 See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27023
diff
changeset
|
6 or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27023
diff
changeset
|
7 |
1573 | 8 |
9 This file is part of Octave. | |
10 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23443
diff
changeset
|
11 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
12 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23443
diff
changeset
|
13 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
14 (at your option) any later version. |
1573 | 15 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
16 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
17 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
19 GNU General Public License for more details. |
1573 | 20 |
21 You should have received a copy of the GNU General Public License | |
7016 | 22 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23443
diff
changeset
|
23 <https://www.gnu.org/licenses/>. |
1573 | 24 |
25 */ | |
26 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19861
diff
changeset
|
27 #if ! defined (octave_chMatrix_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
28 #define octave_chMatrix_h 1 |
1573 | 29 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
30 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
31 |
1728 | 32 #include <string> |
33 | |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10267
diff
changeset
|
34 #include "Array.h" |
19318
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
35 #include "chNDArray.h" |
1573 | 36 #include "mx-defs.h" |
8774
b756ce0002db
split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents:
8290
diff
changeset
|
37 #include "mx-op-decl.h" |
2349 | 38 #include "str-vec.h" |
1573 | 39 |
1728 | 40 class |
6108 | 41 OCTAVE_API |
19318
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
42 charMatrix : public charNDArray |
1573 | 43 { |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
44 friend class ComplexMatrix; |
1573 | 45 |
46 public: | |
47 | |
27023
fc256e9d882e
use default ctors, dtors, and assignment ops in Matrix, intNDArray, and Cell
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
48 charMatrix (void) = default; |
fc256e9d882e
use default ctors, dtors, and assignment ops in Matrix, intNDArray, and Cell
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
49 |
fc256e9d882e
use default ctors, dtors, and assignment ops in Matrix, intNDArray, and Cell
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
50 charMatrix (const charMatrix& a) = default; |
fc256e9d882e
use default ctors, dtors, and assignment ops in Matrix, intNDArray, and Cell
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
51 |
fc256e9d882e
use default ctors, dtors, and assignment ops in Matrix, intNDArray, and Cell
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
52 charMatrix& operator = (const charMatrix& a) = default; |
fc256e9d882e
use default ctors, dtors, and assignment ops in Matrix, intNDArray, and Cell
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
53 |
fc256e9d882e
use default ctors, dtors, and assignment ops in Matrix, intNDArray, and Cell
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
54 ~charMatrix (void) = default; |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
55 |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
56 charMatrix (octave_idx_type r, octave_idx_type c) |
19318
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
57 : charNDArray (dim_vector (r, c)) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
58 |
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
59 charMatrix (octave_idx_type r, octave_idx_type c, char val) |
19318
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
60 : charNDArray (dim_vector (r, c), val) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
61 |
19322
50922b1c74df
liboctave: confirm that matrices constructors are limited to 2 dimensions.
Carnë Draug <carandraug@octave.org>
parents:
19319
diff
changeset
|
62 charMatrix (const dim_vector& dv) : charNDArray (dv.redim (2)) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
63 |
19322
50922b1c74df
liboctave: confirm that matrices constructors are limited to 2 dimensions.
Carnë Draug <carandraug@octave.org>
parents:
19319
diff
changeset
|
64 charMatrix (const dim_vector& dv, char val) |
50922b1c74df
liboctave: confirm that matrices constructors are limited to 2 dimensions.
Carnë Draug <carandraug@octave.org>
parents:
19319
diff
changeset
|
65 : charNDArray (dv.redim (2), val) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
66 |
19318
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
67 charMatrix (const Array<char>& a) : charNDArray (a.as_matrix ()) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
68 |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
69 charMatrix (char c) : charNDArray (c) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
70 |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
71 charMatrix (const char *s) : charNDArray (s) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
72 |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
73 charMatrix (const std::string& s) : charNDArray (s) { } |
11570
57632dea2446
attempt better backward compatibility for Array constructors
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
74 |
19318
6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents:
17822
diff
changeset
|
75 charMatrix (const string_vector& s, char fill_value = '\0') |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
76 : charNDArray (s, fill_value) { } |
1573 | 77 |
2384 | 78 bool operator == (const charMatrix& a) const; |
79 bool operator != (const charMatrix& a) const; | |
1573 | 80 |
10351
5150ceb4dbb4
base charMatrix and boolMatrix on Array<char>
Jaroslav Hajek <highegg@gmail.com>
parents:
10267
diff
changeset
|
81 charMatrix transpose (void) const { return Array<char>::transpose (); } |
4902 | 82 |
1573 | 83 // destructive insert/delete/reorder operations |
84 | |
5275 | 85 charMatrix& insert (const char *s, octave_idx_type r, octave_idx_type c); |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 charMatrix& insert (const charMatrix& a, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 octave_idx_type r, octave_idx_type c); |
1573 | 88 |
11265
a117dc8ea1b9
charMatrix::row_as_string: never strip trailing nul characters
John W. Eaton <jwe@octave.org>
parents:
10521
diff
changeset
|
89 std::string row_as_string (octave_idx_type, bool strip_ws = false) const; |
1573 | 90 |
3189 | 91 // resize is the destructive equivalent for this one |
92 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
93 charMatrix extract (octave_idx_type r1, octave_idx_type c1, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
94 octave_idx_type r2, octave_idx_type c2) const; |
3189 | 95 |
14616
13cc11418393
improve handling of default resize fill value for arrays
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
96 void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0) |
11574
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
97 { |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
98 Array<char>::resize (dim_vector (nr, nc), rfv); |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
99 } |
a83bad07f7e3
attempt better backward compatibility for Array resize functions
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
100 |
2255 | 101 #if 0 |
1573 | 102 // i/o |
103 | |
3504 | 104 friend std::ostream& operator << (std::ostream& os, const Matrix& a); |
105 friend std::istream& operator >> (std::istream& is, Matrix& a); | |
1573 | 106 #endif |
107 }; | |
108 | |
6708 | 109 MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API) |
110 MS_BOOL_OP_DECLS (charMatrix, char, OCTAVE_API) | |
6456 | 111 |
6708 | 112 SM_CMP_OP_DECLS (char, charMatrix, OCTAVE_API) |
113 SM_BOOL_OP_DECLS (char, charMatrix, OCTAVE_API) | |
6456 | 114 |
6708 | 115 MM_CMP_OP_DECLS (charMatrix, charMatrix, OCTAVE_API) |
116 MM_BOOL_OP_DECLS (charMatrix, charMatrix, OCTAVE_API) | |
6456 | 117 |
1573 | 118 #endif |