annotate src/ov-intx.h @ 11542:695141f1c05c ss-3-3-55

snapshot 3.3.55
author John W. Eaton <jwe@octave.org>
date Sat, 15 Jan 2011 04:53:04 -0500
parents fd0a3ac60b0e
children 12df7854fa7c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
1 /*
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
2
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10521
diff changeset
3 Copyright (C) 2004-2011 John W. Eaton
10521
4d1fc073fbb7 add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents: 10405
diff changeset
4 Copyright (C) 2010 VZLU Prague
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
5
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
7
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
71229573b6bf [project @ 2004-06-14 19:31:52 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: 6693
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: 6693
diff changeset
11 option) any later version.
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
12
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
16 for more details.
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
17
71229573b6bf [project @ 2004-06-14 19:31:52 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: 6693
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: 6693
diff changeset
20 <http://www.gnu.org/licenses/>.
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
21
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
22 */
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
23
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
24 #include <cstdlib>
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
25
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
26 #include <iosfwd>
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
27 #include <string>
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
28
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
29 #include "mx-base.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
30 #include "oct-alloc.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
31 #include "str-vec.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
32
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
33 #include "error.h"
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
34 #include "oct-stream.h"
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
35 #include "ov-base.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
36 #include "ov-base-int.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
37 #include "ov-typeinfo.h"
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
38 #include "gripes.h"
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
39
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
40 #include "ov-re-mat.h"
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
41 #include "ov-scalar.h"
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
42
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
43 class
6693
768d3ad80bbf [project @ 2007-06-06 05:18:54 by jwe]
jwe
parents: 6686
diff changeset
44 OCTINTERP_API
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
45 OCTAVE_VALUE_INT_MATRIX_T
8321
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
46 : public octave_base_int_matrix<intNDArray<OCTAVE_INT_T> >
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
47 {
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
48 public:
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
49
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
50 OCTAVE_VALUE_INT_MATRIX_T (void)
8321
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
51 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > () { }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
52
8321
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
53 OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda)
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
54 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > (nda) { }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
55
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9685
diff changeset
56 OCTAVE_VALUE_INT_MATRIX_T (const Array<OCTAVE_INT_T>& nda)
8321
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
57 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> >
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
58 (intNDArray<OCTAVE_INT_T> (nda)) { }
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
59
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
60 ~OCTAVE_VALUE_INT_MATRIX_T (void) { }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
61
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
62 octave_base_value *clone (void) const
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
63 { return new OCTAVE_VALUE_INT_MATRIX_T (*this); }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
64
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
65 octave_base_value *empty_clone (void) const
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
66 { return new OCTAVE_VALUE_INT_MATRIX_T (); }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
67
6069
67b1a61a85ce [project @ 2006-10-21 14:33:53 by jwe]
jwe
parents: 5943
diff changeset
68 bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; }
5895
b9c45e0cf685 [project @ 2006-07-19 01:57:44 by jwe]
jwe
parents: 5885
diff changeset
69
6223
a6cc01dd09f9 [project @ 2007-01-03 20:59:28 by jwe]
jwe
parents: 6214
diff changeset
70 bool is_integer_type (void) const { return true; }
a6cc01dd09f9 [project @ 2007-01-03 20:59:28 by jwe]
jwe
parents: 6214
diff changeset
71
9685
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
72 builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
73
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
74 public:
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
75
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
76 int8NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
77 int8_array_value (void) const { return int8NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
78
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
79 int16NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
80 int16_array_value (void) const { return int16NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
81
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
82 int32NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
83 int32_array_value (void) const { return int32NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
84
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
85 int64NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
86 int64_array_value (void) const { return int64NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
87
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
88 uint8NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
89 uint8_array_value (void) const { return uint8NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
90
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
91 uint16NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
92 uint16_array_value (void) const { return uint16NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
93
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
94 uint32NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
95 uint32_array_value (void) const { return uint32NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
96
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
97 uint64NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
98 uint64_array_value (void) const { return uint64NDArray (matrix); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
99
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
100 double
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
101 double_value (bool = false) const
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
102 {
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
103 double retval = lo_ieee_nan_value ();
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
104
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
105 if (numel () > 0)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
106 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
107 gripe_implicit_conversion ("Octave:array-as-scalar",
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
108 type_name (), "real scalar");
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
109
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
110 retval = matrix(0).double_value ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
111 }
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
112 else
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
113 gripe_invalid_conversion (type_name (), "real scalar");
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
114
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
115 return retval;
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
116
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
117 }
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
118
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
119 float
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
120 float_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
121 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
122 float retval = lo_ieee_float_nan_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
123
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
124 if (numel () > 0)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
125 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
126 gripe_implicit_conversion ("Octave:array-as-scalar",
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
127 type_name (), "real scalar");
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
128
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
129 retval = matrix(0).float_value ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
130 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
131 else
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
132 gripe_invalid_conversion (type_name (), "real scalar");
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
133
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
134 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
135
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
136 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
137
4983
13aaef87cf18 [project @ 2004-09-10 13:51:29 by jwe]
jwe
parents: 4982
diff changeset
138 double scalar_value (bool = false) const { return double_value (); }
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
139
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
140 float float_scalar_value (bool = false) const { return float_value (); }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
141
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
142 Matrix
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
143 matrix_value (bool = false) const
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
144 {
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
145 Matrix retval;
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
146 dim_vector dv = dims ();
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
147 if (dv.length () > 2)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
148 error ("invalid conversion of %s to Matrix", type_name().c_str ());
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
149 else
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
150 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
151 retval = Matrix (dv(0), dv(1));
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
152 double *vec = retval.fortran_vec ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
153 octave_idx_type nel = matrix.numel ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
154 for (octave_idx_type i = 0; i < nel; i++)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
155 vec[i] = matrix(i).double_value ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
156 }
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
157 return retval;
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
158 }
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
159
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
160 FloatMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
161 float_matrix_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
162 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
163 FloatMatrix retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
164 dim_vector dv = dims ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
165 if (dv.length () > 2)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
166 error ("invalid conversion of %s to FloatMatrix", type_name().c_str ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
167 else
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
168 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
169 retval = FloatMatrix (dv(0), dv(1));
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
170 float *vec = retval.fortran_vec ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
171 octave_idx_type nel = matrix.numel ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
172 for (octave_idx_type i = 0; i < nel; i++)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
173 vec[i] = matrix(i).float_value ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
174 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
175 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
176 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
177
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
178 ComplexMatrix
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
179 complex_matrix_value (bool = false) const
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
180 {
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
181 ComplexMatrix retval;
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
182 dim_vector dv = dims();
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
183 if (dv.length () > 2)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
184 error ("invalid conversion of %s to Matrix", type_name().c_str ());
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
185 else
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
186 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
187 retval = ComplexMatrix (dv(0), dv(1));
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
188 Complex *vec = retval.fortran_vec ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
189 octave_idx_type nel = matrix.numel ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
190 for (octave_idx_type i = 0; i < nel; i++)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
191 vec[i] = Complex (matrix(i).double_value ());
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
192 }
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
193 return retval;
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
194 }
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
195
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
196 FloatComplexMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
197 float_complex_matrix_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
198 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
199 FloatComplexMatrix retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
200 dim_vector dv = dims();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
201 if (dv.length () > 2)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
202 error ("invalid conversion of %s to FloatMatrix", type_name().c_str ());
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
203 else
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
204 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
205 retval = FloatComplexMatrix (dv(0), dv(1));
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
206 FloatComplex *vec = retval.fortran_vec ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
207 octave_idx_type nel = matrix.numel ();
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
208 for (octave_idx_type i = 0; i < nel; i++)
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
209 vec[i] = FloatComplex (matrix(i).float_value ());
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
210 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
211 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
212 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
213
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
214 NDArray
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
215 array_value (bool = false) const
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
216 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
217 NDArray retval (matrix.dims ());
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
218 double *vec = retval.fortran_vec ();
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
219 octave_idx_type nel = matrix.numel ();
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
220 for (octave_idx_type i = 0; i < nel; i++)
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
221 vec[i] = matrix(i).double_value ();
4963
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
222 return retval;
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
223 }
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
224
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
225 FloatNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
226 float_array_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
227 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
228 FloatNDArray retval (matrix.dims ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
229 float *vec = retval.fortran_vec ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
230 octave_idx_type nel = matrix.numel ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
231 for (octave_idx_type i = 0; i < nel; i++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
232 vec[i] = matrix(i).float_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
233 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
234 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
235
4963
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
236 ComplexNDArray
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
237 complex_array_value (bool = false) const
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
238 {
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
239 ComplexNDArray retval (matrix.dims ());
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
240 Complex *vec = retval.fortran_vec ();
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
241 octave_idx_type nel = matrix.numel ();
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
242 for (octave_idx_type i = 0; i < nel; i++)
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
243 vec[i] = Complex (matrix(i).double_value ());
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
244 return retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
245 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
246
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
247 FloatComplexNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
248 float_complex_array_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
249 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
250 FloatComplexNDArray retval (matrix.dims ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
251 FloatComplex *vec = retval.fortran_vec ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
252 octave_idx_type nel = matrix.numel ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
253 for (octave_idx_type i = 0; i < nel; i++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
254 vec[i] = FloatComplex (matrix(i).float_value ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
255 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
256 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
257
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
258 boolNDArray
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
259 bool_array_value (bool warn = false) const
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
260 {
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
261 boolNDArray retval (dims ());
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
262
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
263 octave_idx_type nel = numel ();
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
264
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
265 if (warn && matrix.any_element_not_one_or_zero ())
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
266 gripe_logical_conversion ();
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
267
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
268 bool *vec = retval.fortran_vec ();
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
269 for (octave_idx_type i = 0; i < nel; i++)
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
270 vec[i] = matrix(i).bool_value ();
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
271
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
272 return retval;
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
273 }
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
274
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
275 charNDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
276 char_array_value (bool = false) const
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
277 {
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
278 charNDArray retval (dims ());
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
279
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
280 octave_idx_type nel = numel ();
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
281
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
282 char *vec = retval.fortran_vec ();
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
283 for (octave_idx_type i = 0; i < nel; i++)
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
284 vec[i] = matrix(i).char_value ();
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
285
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
286 return retval;
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
287 }
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
288
9606
a04352386a6b clear index cache on ++,-- operators
Jaroslav Hajek <highegg@gmail.com>
parents: 9358
diff changeset
289 // Use matrix_ref here to clear index cache.
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
290 void increment (void)
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
291 {
9606
a04352386a6b clear index cache on ++,-- operators
Jaroslav Hajek <highegg@gmail.com>
parents: 9358
diff changeset
292 matrix_ref() += OCTAVE_INT_T (1);
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
293 }
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
294
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
295 void decrement (void)
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
296 {
9606
a04352386a6b clear index cache on ++,-- operators
Jaroslav Hajek <highegg@gmail.com>
parents: 9358
diff changeset
297 matrix_ref() -= OCTAVE_INT_T (1);
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
298 }
5829
93785a1b0f97 [project @ 2006-05-23 18:34:10 by jwe]
jwe
parents: 5781
diff changeset
299
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9606
diff changeset
300 void changesign (void)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9606
diff changeset
301 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9606
diff changeset
302 matrix_ref ().changesign ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9606
diff changeset
303 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9606
diff changeset
304
9350
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
305 idx_vector index_vector (void) const
16a5f9e1fdb3 cache idx_vector result in matrices once used for indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
306 { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); }
4938
703d97b89507 [project @ 2004-08-09 20:21:59 by jwe]
jwe
parents: 4915
diff changeset
307
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
308 int write (octave_stream& os, int block_size,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
309 oct_data_conv::data_type output_type, int skip,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
310 oct_mach_info::float_format flt_fmt) const
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
311 { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
312
9358
d4b1314a7c31 mex.cc (mxArray_octave_value::get_data): avoid enumerating types that can be handled as foreign
John W. Eaton <jwe@octave.org>
parents: 9350
diff changeset
313 // Unsafe. This function exists to support the MEX interface.
d4b1314a7c31 mex.cc (mxArray_octave_value::get_data): avoid enumerating types that can be handled as foreign
John W. Eaton <jwe@octave.org>
parents: 9350
diff changeset
314 // You should not use it anywhere else.
d4b1314a7c31 mex.cc (mxArray_octave_value::get_data): avoid enumerating types that can be handled as foreign
John W. Eaton <jwe@octave.org>
parents: 9350
diff changeset
315 void *mex_get_data (void) const { return matrix.mex_get_data (); }
d4b1314a7c31 mex.cc (mxArray_octave_value::get_data): avoid enumerating types that can be handled as foreign
John W. Eaton <jwe@octave.org>
parents: 9350
diff changeset
316
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
317 mxArray *as_mxArray (void) const
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
318 {
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
319 mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, dims (), mxREAL);
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
320
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
321 OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> (retval->get_data ());
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
322
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents: 6223
diff changeset
323 mwSize nel = numel ();
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
324
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
325 const OCTAVE_INT_T *p = matrix.data ();
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
326
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents: 6223
diff changeset
327 for (mwIndex i = 0; i < nel; i++)
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
328 pr[i] = p[i].value ();
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
329
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
330 return retval;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
331 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
332
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
333 octave_value map (unary_mapper_t umap) const
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
334 {
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
335 switch (umap)
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
336 {
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
337 case umap_abs:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
338 return matrix.abs ();
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
339 case umap_signum:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
340 return matrix.signum ();
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
341 case umap_ceil:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
342 case umap_conj:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
343 case umap_fix:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
344 case umap_floor:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
345 case umap_real:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
346 case umap_round:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
347 return matrix;
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
348 case umap_imag:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
349 return intNDArray<OCTAVE_INT_T> (matrix.dims (), OCTAVE_INT_T ());
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
350 case umap_isnan:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
351 case umap_isna:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
352 case umap_isinf:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
353 return boolNDArray (matrix.dims (), false);
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
354 case umap_finite:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
355 return boolNDArray (matrix.dims (), true);
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
356
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
357 default:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
358 {
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
359 octave_matrix m (array_value ());
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
360 return m.map (umap);
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
361 }
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
362 }
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
363 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
364
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
365 private:
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
366
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
367 DECLARE_OCTAVE_ALLOCATOR
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
368
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
369 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
370 };
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
371
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
372 class
6693
768d3ad80bbf [project @ 2007-06-06 05:18:54 by jwe]
jwe
parents: 6686
diff changeset
373 OCTINTERP_API
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
374 OCTAVE_VALUE_INT_SCALAR_T
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
375 : public octave_base_int_scalar<OCTAVE_INT_T>
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
376 {
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
377 public:
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
378
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
379 OCTAVE_VALUE_INT_SCALAR_T (void)
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
380 : octave_base_int_scalar<OCTAVE_INT_T> () { }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
381
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
382 OCTAVE_VALUE_INT_SCALAR_T (const OCTAVE_INT_T& nda)
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
383 : octave_base_int_scalar<OCTAVE_INT_T> (nda) { }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
384
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
385 ~OCTAVE_VALUE_INT_SCALAR_T (void) { }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
386
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
387 octave_base_value *clone (void) const
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
388 { return new OCTAVE_VALUE_INT_SCALAR_T (*this); }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
389
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
390 octave_base_value *empty_clone (void) const
8389
ff5892c8ddd0 fix integer assignment to non-existing variables
Jaroslav Hajek <highegg@gmail.com>
parents: 8321
diff changeset
391 { return new OCTAVE_VALUE_INT_MATRIX_T (); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
392
5885
bd3041e30d97 [project @ 2006-07-14 20:29:35 by jwe]
jwe
parents: 5829
diff changeset
393 octave_value do_index_op (const octave_value_list& idx,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
394 bool resize_ok = false)
4983
13aaef87cf18 [project @ 2004-09-10 13:51:29 by jwe]
jwe
parents: 4982
diff changeset
395 {
8437
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
396 // FIXME -- this doesn't solve the problem of
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
397 //
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
398 // a = 1; a([1,1], [1,1], [1,1])
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
399 //
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
400 // and similar constructions. Hmm...
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4963
diff changeset
401
8437
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
402 // FIXME -- using this constructor avoids narrowing the
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
403 // 1x1 matrix back to a scalar value. Need a better solution
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
404 // to this problem.
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4963
diff changeset
405
8437
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
406 octave_value tmp
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
407 (new OCTAVE_VALUE_INT_MATRIX_T
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
408 (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ()));
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4963
diff changeset
409
8437
f00578b495e9 remove valid_as_scalar_index
Jaroslav Hajek <highegg@gmail.com>
parents: 8389
diff changeset
410 return tmp.do_index_op (idx, resize_ok);
4983
13aaef87cf18 [project @ 2004-09-10 13:51:29 by jwe]
jwe
parents: 4982
diff changeset
411 }
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4963
diff changeset
412
6069
67b1a61a85ce [project @ 2006-10-21 14:33:53 by jwe]
jwe
parents: 5943
diff changeset
413 bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; }
5895
b9c45e0cf685 [project @ 2006-07-19 01:57:44 by jwe]
jwe
parents: 5885
diff changeset
414
6223
a6cc01dd09f9 [project @ 2007-01-03 20:59:28 by jwe]
jwe
parents: 6214
diff changeset
415 bool is_integer_type (void) const { return true; }
a6cc01dd09f9 [project @ 2007-01-03 20:59:28 by jwe]
jwe
parents: 6214
diff changeset
416
9685
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
417 builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
418
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
419 public:
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
420
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
421 octave_int8
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
422 int8_scalar_value (void) const { return octave_int8 (scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
423
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
424 octave_int16
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
425 int16_scalar_value (void) const { return octave_int16 (scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
426
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
427 octave_int32
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
428 int32_scalar_value (void) const { return octave_int32 (scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
429
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
430 octave_int64
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
431 int64_scalar_value (void) const { return octave_int64 (scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
432
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
433 octave_uint8
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
434 uint8_scalar_value (void) const { return octave_uint8 (scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
435
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
436 octave_uint16
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
437 uint16_scalar_value (void) const { return octave_uint16 (scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
438
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
439 octave_uint32
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
440 uint32_scalar_value (void) const { return octave_uint32 (scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
441
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
442 octave_uint64
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
443 uint64_scalar_value (void) const { return octave_uint64 (scalar); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
444
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
445 int8NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
446 int8_array_value (void) const
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
447 { return int8NDArray (dim_vector (1, 1), int8_scalar_value ()); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
448
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
449 int16NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
450 int16_array_value (void) const
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
451 { return int16NDArray (dim_vector (1, 1), int16_scalar_value ()); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
452
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
453 int32NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
454 int32_array_value (void) const
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
455 { return int32NDArray (dim_vector (1, 1), int32_scalar_value ()); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
456
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
457 int64NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
458 int64_array_value (void) const
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
459 { return int64NDArray (dim_vector (1, 1), int64_scalar_value ()); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
460
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
461 uint8NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
462 uint8_array_value (void) const
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
463 { return uint8NDArray (dim_vector (1, 1), uint8_scalar_value ()); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
464
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
465 uint16NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
466 uint16_array_value (void) const
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
467 { return uint16NDArray (dim_vector (1, 1), uint16_scalar_value ()); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
468
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
469 uint32NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
470 uint32_array_value (void) const
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
471 { return uint32NDArray (dim_vector (1, 1), uint32_scalar_value ()); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
472
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
473 uint64NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
474 uint64_array_value (void) const
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
475 { return uint64NDArray (dim_vector (1, 1), uint64_scalar_value ()); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
476
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5533
diff changeset
477 octave_value resize (const dim_vector& dv, bool fill = false) const
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
478 {
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5533
diff changeset
479 if (fill)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
480 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
481 intNDArray<OCTAVE_INT_T> retval (dv, 0);
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
482 if (dv.numel())
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
483 retval(0) = scalar;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
484 return retval;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
485 }
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5533
diff changeset
486 else
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
487 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
488 intNDArray<OCTAVE_INT_T> retval (dv);
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
489 if (dv.numel())
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
490 retval(0) = scalar;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
491 return retval;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
492 }
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
493 }
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
494
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
495 double double_value (bool = false) const { return scalar.double_value (); }
4983
13aaef87cf18 [project @ 2004-09-10 13:51:29 by jwe]
jwe
parents: 4982
diff changeset
496
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
497 float float_value (bool = false) const { return scalar.float_value (); }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
498
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
499 double scalar_value (bool = false) const { return scalar.double_value (); }
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
500
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
501 float float_scalar_value (bool = false) const { return scalar.float_value (); }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
502
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
503 Matrix
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
504 matrix_value (bool = false) const
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
505 {
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
506 Matrix retval (1, 1);
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
507 retval(0,0) = scalar.double_value ();
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
508 return retval;
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
509 }
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
510
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
511 FloatMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
512 float_matrix_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
513 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
514 FloatMatrix retval (1, 1);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
515 retval(0,0) = scalar.float_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
516 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
517 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
518
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
519 ComplexMatrix
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
520 complex_matrix_value (bool = false) const
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
521 {
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
522 ComplexMatrix retval (1, 1);
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
523 retval(0,0) = Complex (scalar.double_value ());
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
524 return retval;
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
525 }
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
526
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
527 FloatComplexMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
528 float_complex_matrix_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
529 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
530 FloatComplexMatrix retval (1, 1);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
531 retval(0,0) = FloatComplex (scalar.float_value ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
532 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
533 }
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
534
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
535 NDArray
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
536 array_value (bool = false) const
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
537 {
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
538 NDArray retval (dim_vector (1, 1));
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
539 retval(0) = scalar.double_value ();
4963
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
540 return retval;
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
541 }
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
542
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
543 FloatNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
544 float_array_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
545 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
546 FloatNDArray retval (dim_vector (1, 1));
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
547 retval(0) = scalar.float_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
548 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
549 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
550
4963
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
551 ComplexNDArray
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
552 complex_array_value (bool = false) const
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
553 {
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
554 ComplexNDArray retval (dim_vector (1, 1));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
555 retval(0) = FloatComplex (scalar.double_value ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
556 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
557 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
558
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
559 FloatComplexNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
560 float_complex_array_value (bool = false) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
561 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
562 FloatComplexNDArray retval (dim_vector (1, 1));
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
563 retval(0) = FloatComplex (scalar.float_value ());
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
564 return retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
565 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
566
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
567 boolNDArray
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
568 bool_array_value (bool warn = false) const
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
569 {
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
570 boolNDArray retval (dim_vector (1, 1));
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
571
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
572 if (warn && scalar != 0.0 && scalar != 1.0)
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
573 gripe_logical_conversion ();
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
574
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
575 retval(0) = scalar.bool_value ();
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
576
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
577 return retval;
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
578 }
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
579
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
580 charNDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
581 char_array_value (bool = false) const
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
582 {
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
583 charNDArray retval (dim_vector (1, 1));
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
584 retval(0) = scalar.char_value ();
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
585 return retval;
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
586 }
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
587
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
588 void increment (void)
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
589 {
8321
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
590 scalar += OCTAVE_INT_T (1);
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
591 }
5829
93785a1b0f97 [project @ 2006-05-23 18:34:10 by jwe]
jwe
parents: 5781
diff changeset
592
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
593 void decrement (void)
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
594 {
8321
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
595 scalar -= OCTAVE_INT_T (1);
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 7999
diff changeset
596 }
5829
93785a1b0f97 [project @ 2006-05-23 18:34:10 by jwe]
jwe
parents: 5781
diff changeset
597
4938
703d97b89507 [project @ 2004-08-09 20:21:59 by jwe]
jwe
parents: 4915
diff changeset
598 idx_vector index_vector (void) const { return idx_vector (scalar); }
703d97b89507 [project @ 2004-08-09 20:21:59 by jwe]
jwe
parents: 4915
diff changeset
599
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
600 int write (octave_stream& os, int block_size,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
601 oct_data_conv::data_type output_type, octave_idx_type skip,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
602 oct_mach_info::float_format flt_fmt) const
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
603 {
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
604 return os.write (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (),
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
605 block_size, output_type, skip, flt_fmt);
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
606 }
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
607
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
608 // Unsafe. This function exists to support the MEX interface.
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
609 // You should not use it anywhere else.
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
610 void *mex_get_data (void) const { return scalar.mex_get_data (); }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
611
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
612 mxArray *as_mxArray (void) const
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
613 {
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
614 mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, 1, 1, mxREAL);
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
615
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
616 OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> (retval->get_data ());
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
617
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
618 pr[0] = scalar.value ();
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
619
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
620 return retval;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
621 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
622
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
623 octave_value map (unary_mapper_t umap) const
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
624 {
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
625 switch (umap)
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
626 {
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
627 case umap_abs:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
628 return scalar.abs ();
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
629 case umap_signum:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
630 return scalar.signum ();
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
631 case umap_ceil:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
632 case umap_conj:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
633 case umap_fix:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
634 case umap_floor:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
635 case umap_real:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
636 case umap_round:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
637 return scalar;
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
638 case umap_imag:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
639 return OCTAVE_INT_T ();
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
640 case umap_isnan:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
641 case umap_isna:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
642 case umap_isinf:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
643 return false;
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
644 case umap_finite:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
645 return true;
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
646
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
647 default:
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
648 {
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
649 octave_scalar m (scalar_value ());
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
650 return m.map (umap);
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
651 }
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
652 }
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
653 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
654
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
655 private:
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
656
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
657 DECLARE_OCTAVE_ALLOCATOR
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
658
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
659 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
660 };