annotate liboctave/array/chNDArray.cc @ 17744:d63878346099

maint: Update copyright notices for release.
author John W. Eaton <jwe@octave.org>
date Wed, 23 Oct 2013 22:09:27 -0400
parents 7ce21619a4b9
children 49a5a4be04a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
1 // N-D Array manipulations.
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
2 /*
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
3
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 16370
diff changeset
4 Copyright (C) 2003-2013 John W. Eaton
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
5
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
7
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
11 option) any later version.
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
12
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
16 for more details.
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
17
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6456
diff changeset
20 <http://www.gnu.org/licenses/>.
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
21
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
22 */
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
23
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
26 #endif
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
27
4588
19bfd295f400 [project @ 2003-11-10 17:18:48 by jwe]
jwe
parents: 4569
diff changeset
28 #include "Array-util.h"
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
29 #include "chNDArray.h"
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
30 #include "mx-base.h"
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
31 #include "lo-ieee.h"
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
32 #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
33 #include "mx-op-defs.h"
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
34
10107
fd262afea1d1 optimize bsxfun for chars
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
35 #include "bsxfun-defs.cc"
fd262afea1d1 optimize bsxfun for chars
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
36
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5307
diff changeset
37 // FIXME -- this is not quite the right thing.
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
38
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
39 boolNDArray
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
40 charNDArray::all (int dim) const
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
41 {
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10352
diff changeset
42 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
43 }
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
44
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
45 boolNDArray
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
46 charNDArray::any (int dim) const
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
47 {
10362
b47ab50a6aa8 simplify appliers in mx-inlines.cc
Jaroslav Hajek <highegg@gmail.com>
parents: 10352
diff changeset
48 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
49 }
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
50
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
51 charNDArray
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
52 charNDArray::concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
53 {
4940
954cc2ba6a49 [project @ 2004-08-24 19:30:31 by jwe]
jwe
parents: 4915
diff changeset
54 if (rb.numel () > 0)
5073
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
55 insert (rb, ra_idx);
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
56 return *this;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
57 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
58
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
59 charNDArray
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
60 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
61 {
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
62 charNDArray tmp (rb.dims ());
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
63 octave_idx_type nel = rb.numel ();
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
64
4940
954cc2ba6a49 [project @ 2004-08-24 19:30:31 by jwe]
jwe
parents: 4915
diff changeset
65 if (rb.numel () == 0)
5073
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
66 return *this;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
67
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
68 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
69 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
70 double d = rb.elem (i);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
71
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
72 if (xisnan (d))
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
73 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
74 (*current_liboctave_error_handler)
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
75 ("invalid conversion from NaN to character");
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
76 return *this;
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
77 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
78 else
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
79 {
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
80 octave_idx_type ival = NINTbig (d);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
81
15215
9020dddc925a use std::numeric_limits for integer max and min values
John W. Eaton <jwe@octave.org>
parents: 14557
diff changeset
82 if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ())
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
83 // FIXME -- is there something
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
84 // better we could do? Should we warn the user?
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
85 ival = 0;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
86
10314
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
87 tmp.elem (i) = static_cast<char>(ival);
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
88 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
89 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
90
5073
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
91 insert (tmp, ra_idx);
e71be9c548f2 [project @ 2004-11-09 18:31:25 by jwe]
jwe
parents: 4940
diff changeset
92 return *this;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
93 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
94
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
95 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
96 charNDArray::max (int dim) const
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
97 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
98 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
99 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
100
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
101 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
102 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
103 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
104 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
105 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
106
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
107 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
108 charNDArray::min (int dim) const
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
109 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
110 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
111 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
112
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
113 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
114 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
115 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
116 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
117 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
118
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
119 charNDArray&
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
120 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
121 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
122 Array<char>::insert (a, r, c);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
123 return *this;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
124 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
125
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
126 charNDArray&
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
127 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
128 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
129 Array<char>::insert (a, ra_idx);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4806
diff changeset
130 return *this;
4758
a308566c8b42 [project @ 2004-02-13 23:01:34 by jwe]
jwe
parents: 4588
diff changeset
131 }
a308566c8b42 [project @ 2004-02-13 23:01:34 by jwe]
jwe
parents: 4588
diff changeset
132
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
133 charMatrix
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
134 charNDArray::matrix_value (void) const
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
135 {
10352
a3635bc1ea19 remove Array2
Jaroslav Hajek <highegg@gmail.com>
parents: 10314
diff changeset
136 return *this;
4514
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
137 }
8373b9b41eee [project @ 2003-09-19 21:47:10 by jwe]
jwe
parents:
diff changeset
138
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
139 void
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
140 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
141 const dim_vector& dimensions,
07ebe522dac2 untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents: 10267
diff changeset
142 int start_dimension)
4532
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
143 {
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
144 ::increment_index (ra_idx, dimensions, start_dimension);
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
145 }
01ee68d18069 [project @ 2003-10-10 00:49:54 by jwe]
jwe
parents: 4514
diff changeset
146
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
147 octave_idx_type
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
148 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
149 const dim_vector& dimensions)
4556
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
150 {
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
151 return ::compute_index (ra_idx, dimensions);
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
152 }
773a21e4fce8 [project @ 2003-10-28 05:02:10 by jwe]
jwe
parents: 4532
diff changeset
153
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
154 charNDArray
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
155 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
156 {
10267
479c7df0cc96 don't instantiate MArray<char>
Jaroslav Hajek <highegg@gmail.com>
parents: 10158
diff changeset
157 return Array<char>::diag (k);
7620
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
158 }
36594d5bbe13 Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents: 7503
diff changeset
159
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
160 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
161 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
162 {
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
163 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
164 }
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
165
16370
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
166 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
167 min (char d, const charNDArray& m)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
168 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
169 return do_sm_binary_op<charNDArray::element_type, char, charNDArray::element_type>
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
170 (d, m, mx_inline_xmin);
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
171 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
172
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
173 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
174 min (const charNDArray& m, char d)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
175 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
176 return do_ms_binary_op<charNDArray::element_type, charNDArray::element_type, char>
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
177 (m, d, mx_inline_xmin);
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
178 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
179
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
180 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
181 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
182 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
183 return do_mm_binary_op<charNDArray::element_type, charNDArray::element_type, charNDArray::element_type>
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
184 (a, b, mx_inline_xmin, mx_inline_xmin, mx_inline_xmin, "min");
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
185 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
186
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
187 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
188 max (char d, const charNDArray& m)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
189 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
190 return do_sm_binary_op<charNDArray::element_type, char, charNDArray::element_type>
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
191 (d, m, mx_inline_xmax);
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
192 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
193
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
194 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
195 max (const charNDArray& m, char d)
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
196 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
197 return do_ms_binary_op<charNDArray::element_type, charNDArray::element_type, char>
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
198 (m, d, mx_inline_xmax);
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
199 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
200
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
201 charNDArray
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
202 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
203 {
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
204 return do_mm_binary_op<charNDArray::element_type, charNDArray::element_type, charNDArray::element_type>
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
205 (a, b, mx_inline_xmax, mx_inline_xmax, mx_inline_xmax, "max");
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
206 }
7ce21619a4b9 min Matlab compatibility issue (bug #33530)
Axel Mathéi <axel.mathei@gmail.com>
parents: 15271
diff changeset
207
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9550
diff changeset
208 NDS_CMP_OPS (charNDArray, char)
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9227
diff changeset
209 NDS_BOOL_OPS (charNDArray, char)
6456
7f5316cadaa2 [project @ 2007-03-26 16:18:26 by jwe]
jwe
parents: 5983
diff changeset
210
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9550
diff changeset
211 SND_CMP_OPS (char, charNDArray)
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9227
diff changeset
212 SND_BOOL_OPS (char, charNDArray)
6456
7f5316cadaa2 [project @ 2007-03-26 16:18:26 by jwe]
jwe
parents: 5983
diff changeset
213
9578
7dafdb8b062f refactor comparison ops implementations
Jaroslav Hajek <highegg@gmail.com>
parents: 9550
diff changeset
214 NDND_CMP_OPS (charNDArray, charNDArray)
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 9227
diff changeset
215 NDND_BOOL_OPS (charNDArray, charNDArray)
6456
7f5316cadaa2 [project @ 2007-03-26 16:18:26 by jwe]
jwe
parents: 5983
diff changeset
216
10107
fd262afea1d1 optimize bsxfun for chars
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
217 BSXFUN_STDREL_DEFS_MXLOOP (charNDArray)