annotate liboctave/array/chNDArray.cc @ 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 0a5b15007766
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 29358
diff changeset
3 // Copyright (C) 2003-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 ////////////////////////////////////////////////////////////////////////
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21202
diff changeset
27 # include "config.h"
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
28 #endif
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
29
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
30 #include <string>
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
31
4588
19bfd295f400 [project @ 2003-11-10 17:18:48 by jwe]
jwe
parents: 4569
diff changeset
32 #include "Array-util.h"
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
33 #include "chNDArray.h"
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
34 #include "mx-base.h"
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
35 #include "lo-ieee.h"
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
36 #include "lo-mappers.h"
8774
b756ce0002db split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 8750
diff changeset
37 #include "mx-op-defs.h"
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
38 #include "str-vec.h"
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
39
10107
fd262afea1d1 optimize bsxfun for chars
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
40 #include "bsxfun-defs.cc"
fd262afea1d1 optimize bsxfun for chars
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
41
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
42 charNDArray::charNDArray (char c)
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
43 : Array<char> ()
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
44 {
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
45 octave_idx_type n = 1;
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
46
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
47 resize1 (n);
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
48
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
49 elem (0) = c;
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
50 }
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
51
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
52 charNDArray::charNDArray (const char *s)
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
53 : Array<char> ()
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
54 {
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23220
diff changeset
55 octave_idx_type n = (s ? strlen (s) : 0);
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
56
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
57 resize1 (n);
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
58
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
59 for (octave_idx_type i = 0; i < n; i++)
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
60 elem (i) = s[i];
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
61 }
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
62
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
63 charNDArray::charNDArray (const std::string& s)
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
64 : Array<char> ()
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
65 {
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
66 octave_idx_type n = s.length ();
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
67
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
68 resize1 (n);
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
69
19330
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
70 for (octave_idx_type i = 0; i < n; i++)
1f4455ff2329 Remove deprecated methods in liboctave.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 19318
diff changeset
71 elem (i) = s[i];
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
72 }
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
73
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
74 charNDArray::charNDArray (const string_vector& s, char fill_value)
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
75 : Array<char> (dim_vector (s.numel (), s.max_length ()), fill_value)
19318
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
76 {
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
77 octave_idx_type nr = rows ();
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
78
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
79 for (octave_idx_type i = 0; i < nr; i++)
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
80 {
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
81 const std::string si = s(i);
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
82 octave_idx_type nc = si.length ();
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
83 for (octave_idx_type j = 0; j < nc; j++)
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
84 elem (i, j) = si[j];
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
85 }
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
86 }
6c9ea5be96bf Change charMatrix to subclass charNDArray rather than be another Array<char>.
Carnë Draug <carandraug@octave.org>
parents: 17769
diff changeset
87
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
88 // FIXME: this is not quite the right thing.
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
89
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
90 boolNDArray
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
91 charNDArray::all (int dim) const
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
92 {
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10352
diff changeset
93 return do_mx_red_op<bool, char> (*this, dim, mx_inline_all);
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
94 }
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
95
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
96 boolNDArray
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
97 charNDArray::any (int dim) const
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
98 {
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10352
diff changeset
99 return do_mx_red_op<bool, char> (*this, dim, mx_inline_any);
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
100 }
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
101
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
102 charNDArray
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
103 charNDArray::concat (const charNDArray& rb,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
104 const Array<octave_idx_type>& ra_idx)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
105 {
4940
954cc2ba6a49 [project @ 2004-08-24 19:30:31 by jwe]
jwe
parents: 4915
diff changeset
106 if (rb.numel () > 0)
5073
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
107 insert (rb, ra_idx);
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
108 return *this;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
109 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
110
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
111 charNDArray
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
112 charNDArray::concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx)
4758
a308566c8b42 [project @ 2004-02-13 23:01:34 by jwe]
jwe
parents: 4588
diff changeset
113 {
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
114 charNDArray tmp (rb.dims ());
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
115 octave_idx_type nel = rb.numel ();
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
116
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23461
diff changeset
117 if (rb.isempty ())
5073
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
118 return *this;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
119
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
120 for (octave_idx_type i = 0; i < nel; i++)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
121 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
122 double d = rb.elem (i);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
123
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
124 if (octave::math::isnan (d))
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20974
diff changeset
125 (*current_liboctave_error_handler)
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20974
diff changeset
126 ("invalid conversion from NaN to character");
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20974
diff changeset
127
21782
2aef506f3fec use namespace for lo-mappers.h functions
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
128 octave_idx_type ival = octave::math::nint_big (d);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
129
21136
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20974
diff changeset
130 if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ())
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20974
diff changeset
131 // FIXME: is there something better to do? Should we warn the user?
7cac4e7458f2 maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents: 20974
diff changeset
132 ival = 0;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
133
25688
b2917b7858ba maint: Use Octave convention for spacing of C++ cast statements.
Rik <rik@octave.org>
parents: 25054
diff changeset
134 tmp.elem (i) = static_cast<char> (ival);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
135 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
136
5073
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
137 insert (tmp, ra_idx);
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
138 return *this;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
139 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
140
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
141 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
142 charNDArray::max (int dim) const
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
143 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
144 return do_mx_minmax_op<char> (*this, dim, mx_inline_max);
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
145 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
146
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
147 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
148 charNDArray::max (Array<octave_idx_type>& idx_arg, int dim) const
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
149 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
150 return do_mx_minmax_op<char> (*this, idx_arg, dim, mx_inline_max);
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
151 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
152
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
153 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
154 charNDArray::min (int dim) const
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
155 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
156 return do_mx_minmax_op<char> (*this, dim, mx_inline_min);
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
157 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
158
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
159 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
160 charNDArray::min (Array<octave_idx_type>& idx_arg, int dim) const
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
161 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
162 return do_mx_minmax_op<char> (*this, idx_arg, dim, mx_inline_min);
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
163 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
164
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
165 charNDArray&
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
166 charNDArray::insert (const charNDArray& a, octave_idx_type r, octave_idx_type c)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
167 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
168 Array<char>::insert (a, r, c);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
169 return *this;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
170 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
171
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
172 charNDArray&
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
173 charNDArray::insert (const charNDArray& a, const Array<octave_idx_type>& ra_idx)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
174 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
175 Array<char>::insert (a, ra_idx);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
176 return *this;
4758
a308566c8b42 [project @ 2004-02-13 23:01:34 by jwe]
jwe
parents: 4588
diff changeset
177 }
a308566c8b42 [project @ 2004-02-13 23:01:34 by jwe]
jwe
parents: 4588
diff changeset
178
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
179 void
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
180 charNDArray::increment_index (Array<octave_idx_type>& ra_idx,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
181 const dim_vector& dimensions,
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
182 int start_dimension)
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
183 {
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
184 ::increment_index (ra_idx, dimensions, start_dimension);
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
185 }
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
186
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
187 octave_idx_type
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
188 charNDArray::compute_index (Array<octave_idx_type>& ra_idx,
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
189 const dim_vector& dimensions)
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
190 {
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
191 return ::compute_index (ra_idx, dimensions);
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
192 }
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
193
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
194 charNDArray
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
195 charNDArray::diag (octave_idx_type k) const
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
196 {
10267
479c7df0cc96 don't instantiate MArray<char>
Jaroslav Hajek <highegg@gmail.com>
parents: 10158
diff changeset
197 return Array<char>::diag (k);
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
198 }
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
199
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
200 charNDArray
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
201 charNDArray::diag (octave_idx_type m, octave_idx_type n) const
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
202 {
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
203 return Array<char>::diag (m, n);
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
204 }
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
205
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
206 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
207 min (char d, const charNDArray& m)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
208 {
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
209 return do_sm_binary_op<charNDArray::element_type, char,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
210 charNDArray::element_type> (d, m, mx_inline_xmin);
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
211 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
212
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
213 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
214 min (const charNDArray& m, char d)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
215 {
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
216 return do_ms_binary_op<charNDArray::element_type, charNDArray::element_type,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
217 char> (m, d, mx_inline_xmin);
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
218 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
219
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
220 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
221 min (const charNDArray& a, const charNDArray& b)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
222 {
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
223 return do_mm_binary_op<charNDArray::element_type, charNDArray::element_type,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
224 charNDArray::element_type> (a, b, mx_inline_xmin,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
225 mx_inline_xmin,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
226 mx_inline_xmin, "min");
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
227 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
228
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
229 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
230 max (char d, const charNDArray& m)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
231 {
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
232 return do_sm_binary_op<charNDArray::element_type, char,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
233 charNDArray::element_type> (d, m, mx_inline_xmax);
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
234 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
235
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
236 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
237 max (const charNDArray& m, char d)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
238 {
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
239 return do_ms_binary_op<charNDArray::element_type, charNDArray::element_type,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
240 char> (m, d, mx_inline_xmax);
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
241 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
242
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
243 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
244 max (const charNDArray& a, const charNDArray& b)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
245 {
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
246 return do_mm_binary_op<charNDArray::element_type, charNDArray::element_type,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
247 charNDArray::element_type> (a, b, mx_inline_xmax,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
248 mx_inline_xmax,
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
249 mx_inline_xmax, "max");
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
250 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
251
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9550
diff changeset
252 NDS_CMP_OPS (charNDArray, char)
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9227
diff changeset
253 NDS_BOOL_OPS (charNDArray, char)
6456
7f5316cadaa2 [project @ 2007-03-26 16:18:26 by jwe]
jwe
parents: 5983
diff changeset
254
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9550
diff changeset
255 SND_CMP_OPS (char, charNDArray)
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9227
diff changeset
256 SND_BOOL_OPS (char, charNDArray)
6456
7f5316cadaa2 [project @ 2007-03-26 16:18:26 by jwe]
jwe
parents: 5983
diff changeset
257
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9550
diff changeset
258 NDND_CMP_OPS (charNDArray, charNDArray)
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9227
diff changeset
259 NDND_BOOL_OPS (charNDArray, charNDArray)
6456
7f5316cadaa2 [project @ 2007-03-26 16:18:26 by jwe]
jwe
parents: 5983
diff changeset
260
10107
fd262afea1d1 optimize bsxfun for chars
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
261 BSXFUN_STDREL_DEFS_MXLOOP (charNDArray)