annotate libinterp/octave-value/ov-intx.h @ 31136:cbfe8318566a

maint: use "s_" prefix for integer "hdf5_save_type" class variable. * ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-intx.h, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc: Use "s_" prefix for integer "hdf5_save_type" class variable.
author Rik <rik@octave.org>
date Sat, 09 Jul 2022 14:37:57 -0700
parents 796f54d4ddbf
children b3ca7f891750
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30390
diff changeset
3 // Copyright (C) 2004-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
25
21213
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21118
diff changeset
26 // FIXME: Do not uncomment these lines to have this file included only once.
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21118
diff changeset
27 // The build will break (2/6/2016).
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21118
diff changeset
28 // #if ! defined (octave_ov_intx_h)
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21118
diff changeset
29 // #define octave_ov_intx_h 1
f7d1050b9b53 maint: Clean up various usages of #ifdef.
Rik <rik@octave.org>
parents: 21118
diff changeset
30
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21213
diff changeset
31 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21213
diff changeset
32
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
33 #include <cstdlib>
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
34
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
35 #include <iosfwd>
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
36 #include <string>
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
37
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
38 #include "mx-base.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
39 #include "str-vec.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
40
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
41 #include "error.h"
15149
62a35ae7d6a2 use forward decls for mxArray in ov.h and ov-base.h
John W. Eaton <jwe@octave.org>
parents: 15057
diff changeset
42 #include "mxarray.h"
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
43 #include "oct-stream.h"
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
44 #include "ov-base.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
45 #include "ov-base-int.h"
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
46 #include "ov-typeinfo.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21055
diff changeset
47 #include "errwarn.h"
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
48
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
49 #include "ov-re-mat.h"
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
50 #include "ov-scalar.h"
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
51
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
52 class
6693
768d3ad80bbf [project @ 2007-06-06 05:18:54 by jwe]
jwe
parents: 6686
diff changeset
53 OCTINTERP_API
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
54 OCTAVE_VALUE_INT_MATRIX_T
23534
b6498c088fca maint: Don't write '> >' for declaration of templates that use templates.
Rik <rik@octave.org>
parents: 23446
diff changeset
55 : public octave_base_int_matrix<intNDArray<OCTAVE_INT_T>>
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
56 {
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
57 public:
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
58
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
59 OCTAVE_VALUE_INT_MATRIX_T (void)
23534
b6498c088fca maint: Don't write '> >' for declaration of templates that use templates.
Rik <rik@octave.org>
parents: 23446
diff changeset
60 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T>> () { }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
61
8321
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
62 OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda)
23534
b6498c088fca maint: Don't write '> >' for declaration of templates that use templates.
Rik <rik@octave.org>
parents: 23446
diff changeset
63 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T>> (nda) { }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
64
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9685
diff changeset
65 OCTAVE_VALUE_INT_MATRIX_T (const Array<OCTAVE_INT_T>& nda)
23534
b6498c088fca maint: Don't write '> >' for declaration of templates that use templates.
Rik <rik@octave.org>
parents: 23446
diff changeset
66 : octave_base_int_matrix<intNDArray<OCTAVE_INT_T>>
8321
69b6127f6962 better use of templates in ov-intx.h
John W. Eaton <jwe@octave.org>
parents: 8039
diff changeset
67 (intNDArray<OCTAVE_INT_T> (nda)) { }
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
68
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22859
diff changeset
69 ~OCTAVE_VALUE_INT_MATRIX_T (void) = default;
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
70
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
71 octave_base_value * clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
72 { return new OCTAVE_VALUE_INT_MATRIX_T (*this); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
73
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
74 octave_base_value * empty_clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
75 { return new OCTAVE_VALUE_INT_MATRIX_T (); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
76
6069
67b1a61a85ce [project @ 2006-10-21 14:33:53 by jwe]
jwe
parents: 5943
diff changeset
77 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
78
23580
2230f9e10fb3 maint: Deprecate is_integer_type and replace with isinteger.
Rik <rik@octave.org>
parents: 23577
diff changeset
79 bool isinteger (void) const { return true; }
6223
a6cc01dd09f9 [project @ 2007-01-03 20:59:28 by jwe]
jwe
parents: 6214
diff changeset
80
9685
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
81 builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
82
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
83 public:
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
84
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
85 int8NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
86 int8_array_value (void) const { return int8NDArray (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 int16NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
89 int16_array_value (void) const { return int16NDArray (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 int32NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
92 int32_array_value (void) const { return int32NDArray (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 int64NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
95 int64_array_value (void) const { return int64NDArray (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 uint8NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
98 uint8_array_value (void) const { return uint8NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
99
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
100 uint16NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
101 uint16_array_value (void) const { return uint16NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
102
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
103 uint32NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
104 uint32_array_value (void) const { return uint32NDArray (matrix); }
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
105
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
106 uint64NDArray
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
107 uint64_array_value (void) const { return uint64NDArray (matrix); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
108
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
109 double
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
110 double_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
111 {
26382
2408f3b6a6db ov-intx.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
112 double retval;
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
113
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23534
diff changeset
114 if (isempty ())
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21055
diff changeset
115 err_invalid_conversion (type_name (), "real scalar");
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
116
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
117 warn_implicit_conversion ("Octave:array-to-scalar",
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
118 type_name (), "real scalar");
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
119
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
120 retval = matrix(0).double_value ();
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
121
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
122 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
123 }
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
124
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
125 float
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
126 float_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
127 {
26382
2408f3b6a6db ov-intx.h: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents: 26376
diff changeset
128 float retval;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
129
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23534
diff changeset
130 if (isempty ())
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21055
diff changeset
131 err_invalid_conversion (type_name (), "real scalar");
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
132
21118
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
133 warn_implicit_conversion ("Octave:array-to-scalar",
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
134 type_name (), "real scalar");
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
135
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
136 retval = matrix(0).float_value ();
3ac9f47fb04b Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
Rik <rik@octave.org>
parents: 21100
diff changeset
137
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
138 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
139 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
140
4983
13aaef87cf18 [project @ 2004-09-10 13:51:29 by jwe]
jwe
parents: 4982
diff changeset
141 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
142
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
143 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
144
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
145 Matrix
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
146 matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
147 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
148 Matrix retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
149 dim_vector dv = dims ();
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21244
diff changeset
150 if (dv.ndims () > 2)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
151 error ("invalid conversion of %s to Matrix", type_name ().c_str ());
21055
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
152
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
153 retval = Matrix (dv(0), dv(1));
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
154 double *vec = retval.fortran_vec ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
155 octave_idx_type nel = matrix.numel ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
156 for (octave_idx_type i = 0; i < nel; i++)
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
157 vec[i] = matrix(i).double_value ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
158
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
159 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
160 }
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
161
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
162 FloatMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
163 float_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
164 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
165 FloatMatrix retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
166 dim_vector dv = dims ();
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21244
diff changeset
167 if (dv.ndims () > 2)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
168 error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ());
21055
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
169
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
170 retval = FloatMatrix (dv(0), dv(1));
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
171 float *vec = retval.fortran_vec ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
172 octave_idx_type nel = matrix.numel ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
173 for (octave_idx_type i = 0; i < nel; i++)
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
174 vec[i] = matrix(i).float_value ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
175
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
176 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
177 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
178
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
179 ComplexMatrix
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
180 complex_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
181 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
182 ComplexMatrix retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
183 dim_vector dv = dims ();
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21244
diff changeset
184 if (dv.ndims () > 2)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
185 error ("invalid conversion of %s to Matrix", type_name ().c_str ());
21055
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
186
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
187 retval = ComplexMatrix (dv(0), dv(1));
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
188 Complex *vec = retval.fortran_vec ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
189 octave_idx_type nel = matrix.numel ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
190 for (octave_idx_type i = 0; i < nel; i++)
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
191 vec[i] = Complex (matrix(i).double_value ());
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
192
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
193 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
194 }
6214
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
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
198 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
199 FloatComplexMatrix retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
200 dim_vector dv = dims ();
21660
53728df3e4c9 maint: for clarity, call ndims() rather than length() on dimension vectors.
Rik <rik@octave.org>
parents: 21244
diff changeset
201 if (dv.ndims () > 2)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
202 error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ());
21055
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
203
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
204 retval = FloatComplexMatrix (dv(0), dv(1));
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
205 FloatComplex *vec = retval.fortran_vec ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
206 octave_idx_type nel = matrix.numel ();
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
207 for (octave_idx_type i = 0; i < nel; i++)
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
208 vec[i] = FloatComplex (matrix(i).float_value ());
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 21013
diff changeset
209
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
210 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
211 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
212
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
213 NDArray
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
214 array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
215 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
216 NDArray retval (matrix.dims ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
217 double *vec = retval.fortran_vec ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
218 octave_idx_type nel = matrix.numel ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
219 for (octave_idx_type i = 0; i < nel; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
220 vec[i] = matrix(i).double_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
221 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
222 }
4963
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
223
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
224 FloatNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
225 float_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
226 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
227 FloatNDArray retval (matrix.dims ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
228 float *vec = retval.fortran_vec ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
229 octave_idx_type nel = matrix.numel ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
230 for (octave_idx_type i = 0; i < nel; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
231 vec[i] = matrix(i).float_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
232 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
233 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
234
4963
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
235 ComplexNDArray
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
236 complex_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
237 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
238 ComplexNDArray retval (matrix.dims ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
239 Complex *vec = retval.fortran_vec ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
240 octave_idx_type nel = matrix.numel ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
241 for (octave_idx_type i = 0; i < nel; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
242 vec[i] = Complex (matrix(i).double_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
243 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
244 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
245
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
246 FloatComplexNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
247 float_complex_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
248 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
249 FloatComplexNDArray retval (matrix.dims ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
250 FloatComplex *vec = retval.fortran_vec ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
251 octave_idx_type nel = matrix.numel ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
252 for (octave_idx_type i = 0; i < nel; i++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
253 vec[i] = FloatComplex (matrix(i).float_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
254 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
255 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
256
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
257 boolNDArray
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
258 bool_array_value (bool warn = false) const
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
259 {
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
260 boolNDArray retval (dims ());
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
261
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
262 octave_idx_type nel = numel ();
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
263
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
264 if (warn && matrix.any_element_not_one_or_zero ())
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21055
diff changeset
265 warn_logical_conversion ();
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
266
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
267 bool *vec = retval.fortran_vec ();
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
268 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
269 vec[i] = matrix(i).bool_value ();
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
270
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
271 return retval;
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
272 }
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
273
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
274 charNDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
275 char_array_value (bool = false) const
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
276 {
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
277 charNDArray retval (dims ());
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
278
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
279 octave_idx_type nel = numel ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
280
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
281 char *vec = retval.fortran_vec ();
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
282 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
283 vec[i] = matrix(i).char_value ();
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
284
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
285 return retval;
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
286 }
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
287
9606
a04352386a6b clear index cache on ++,-- operators
Jaroslav Hajek <highegg@gmail.com>
parents: 9358
diff changeset
288 // Use matrix_ref here to clear index cache.
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
289 void increment (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
290 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
291 matrix_ref () += OCTAVE_INT_T (1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
292 }
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 void decrement (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
295 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
296 matrix_ref () -= OCTAVE_INT_T (1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
297 }
5829
93785a1b0f97 [project @ 2006-05-23 18:34:10 by jwe]
jwe
parents: 5781
diff changeset
298
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9606
diff changeset
299 void changesign (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
300 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
301 matrix_ref ().changesign ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
302 }
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9606
diff changeset
303
29569
29a1f8fd8ee6 move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
304 octave::idx_vector index_vector (bool /* require_integers */ = false) const
18130
e473c4853afc enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents: 17787
diff changeset
305 {
29569
29a1f8fd8ee6 move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
306 return idx_cache ? *idx_cache : set_idx_cache (octave::idx_vector (matrix));
18130
e473c4853afc enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents: 17787
diff changeset
307 }
4938
703d97b89507 [project @ 2004-08-09 20:21:59 by jwe]
jwe
parents: 4915
diff changeset
308
23059
b98ebcd7f11c move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
309 int write (octave::stream& os, int block_size,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
310 oct_data_conv::data_type output_type, int skip,
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21660
diff changeset
311 octave::mach_info::float_format flt_fmt) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
312 { return os.write (matrix, block_size, output_type, skip, flt_fmt); }
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
313
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
314 mxArray * as_mxArray (bool interleaved) const
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
315 {
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
316 mxArray *retval = new mxArray (interleaved, OCTAVE_INT_MX_CLASS, dims (),
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
317 mxREAL);
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
318
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
319 OCTAVE_INT_T::val_type *pd
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
320 = static_cast<OCTAVE_INT_T::val_type *> (retval->get_data ());
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
321
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents: 6223
diff changeset
322 mwSize nel = numel ();
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
323
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
324 const OCTAVE_INT_T *pdata = matrix.data ();
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
325
6686
2aad75fcc93a [project @ 2007-06-03 20:58:28 by dbateman]
dbateman
parents: 6223
diff changeset
326 for (mwIndex i = 0; i < nel; i++)
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
327 pd[i] = pdata[i].value ();
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
328
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
329 return retval;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
330 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
331
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
332 octave_value map (unary_mapper_t umap) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
333 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
334 switch (umap)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
335 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
336 case umap_abs:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
337 return matrix.abs ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
338 case umap_signum:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
339 return matrix.signum ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
340 case umap_ceil:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
341 case umap_conj:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
342 case umap_fix:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
343 case umap_floor:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
344 case umap_real:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
345 case umap_round:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
346 return matrix;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
347 case umap_imag:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
348 return intNDArray<OCTAVE_INT_T> (matrix.dims (), OCTAVE_INT_T ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
349 case umap_isnan:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
350 case umap_isna:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
351 case umap_isinf:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
352 return boolNDArray (matrix.dims (), false);
21013
7f4c6d594e3d Finish renaming mapper function finite to isfinite.
Rik <rik@octave.org>
parents: 19697
diff changeset
353 case umap_isfinite:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
354 return boolNDArray (matrix.dims (), true);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
355
18196
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
356 // Special cases for Matlab compatibility.
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
357 case umap_xtolower:
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
358 case umap_xtoupper:
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
359 return matrix;
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
360
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
361 default:
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
362 {
18196
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
363 // FIXME: we should be able to do better than converting to
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
364 // double here.
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
365 octave_matrix m (array_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
366 return m.map (umap);
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
367 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
368 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
369 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
370
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
371 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool flag)
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
372 {
31136
cbfe8318566a maint: use "s_" prefix for integer "hdf5_save_type" class variable.
Rik <rik@octave.org>
parents: 30564
diff changeset
373 return save_hdf5_internal (loc_id, s_hdf5_save_type, name, flag);
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
374 }
24224
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23580
diff changeset
375
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
376 bool load_hdf5 (octave_hdf5_id loc_id, const char *name)
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
377 {
31136
cbfe8318566a maint: use "s_" prefix for integer "hdf5_save_type" class variable.
Rik <rik@octave.org>
parents: 30564
diff changeset
378 return load_hdf5_internal (loc_id, s_hdf5_save_type, name);
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
379 }
24224
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23580
diff changeset
380
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
381 private:
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
382
31136
cbfe8318566a maint: use "s_" prefix for integer "hdf5_save_type" class variable.
Rik <rik@octave.org>
parents: 30564
diff changeset
383 static octave_hdf5_id s_hdf5_save_type;
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
384
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
385 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
386 };
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
387
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
388 class
6693
768d3ad80bbf [project @ 2007-06-06 05:18:54 by jwe]
jwe
parents: 6686
diff changeset
389 OCTINTERP_API
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
390 OCTAVE_VALUE_INT_SCALAR_T
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
391 : public octave_base_int_scalar<OCTAVE_INT_T>
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
392 {
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
393 public:
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
394
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
395 OCTAVE_VALUE_INT_SCALAR_T (void)
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
396 : octave_base_int_scalar<OCTAVE_INT_T> () { }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
397
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
398 OCTAVE_VALUE_INT_SCALAR_T (const OCTAVE_INT_T& nda)
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
399 : octave_base_int_scalar<OCTAVE_INT_T> (nda) { }
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
400
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22859
diff changeset
401 ~OCTAVE_VALUE_INT_SCALAR_T (void) = default;
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
402
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
403 octave_base_value * clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
404 { return new OCTAVE_VALUE_INT_SCALAR_T (*this); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
405
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
406 octave_base_value * empty_clone (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
407 { return new OCTAVE_VALUE_INT_MATRIX_T (); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
408
5885
bd3041e30d97 [project @ 2006-07-14 20:29:35 by jwe]
jwe
parents: 5829
diff changeset
409 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
410 bool resize_ok = false)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
411 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
412 // FIXME: this doesn't solve the problem of
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
413 //
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
414 // a = 1; a([1,1], [1,1], [1,1])
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
415 //
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
416 // and similar constructions. Hmm...
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4963
diff changeset
417
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
418 // FIXME: using this constructor avoids narrowing the
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
419 // 1x1 matrix back to a scalar value. Need a better solution
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
420 // to this problem.
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4963
diff changeset
421
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
422 octave_value tmp
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
423 (new OCTAVE_VALUE_INT_MATRIX_T
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
424 (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ()));
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4963
diff changeset
425
28631
70cdf8de553d move non-member octave_value operator functions to octave namespace
John W. Eaton <jwe@octave.org>
parents: 28126
diff changeset
426 return tmp.index_op (idx, resize_ok);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
427 }
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4963
diff changeset
428
6069
67b1a61a85ce [project @ 2006-10-21 14:33:53 by jwe]
jwe
parents: 5943
diff changeset
429 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
430
23580
2230f9e10fb3 maint: Deprecate is_integer_type and replace with isinteger.
Rik <rik@octave.org>
parents: 23577
diff changeset
431 bool isinteger (void) const { return true; }
6223
a6cc01dd09f9 [project @ 2007-01-03 20:59:28 by jwe]
jwe
parents: 6214
diff changeset
432
9685
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
433 builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; }
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
434
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
435 public:
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
436
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
437 octave_int8
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
438 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
439
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
440 octave_int16
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
441 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
442
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
443 octave_int32
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
444 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
445
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
446 octave_int64
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
447 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
448
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
449 octave_uint8
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
450 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
451
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
452 octave_uint16
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
453 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
454
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
455 octave_uint32
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
456 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
457
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
458 octave_uint64
10405
cc69a17ec801 remove integer math warnings
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
459 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
460
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
461 int8NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
462 int8_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
463 { return int8NDArray (dim_vector (1, 1), int8_scalar_value ()); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
464
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
465 int16NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
466 int16_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
467 { 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
468
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
469 int32NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
470 int32_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
471 { 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
472
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
473 int64NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
474 int64_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
475 { 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
476
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
477 uint8NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
478 uint8_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
479 { 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
480
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
481 uint16NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
482 uint16_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
483 { 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
484
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
485 uint32NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
486 uint32_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
487 { 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
488
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
489 uint64NDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
490 uint64_array_value (void) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
491 { return uint64NDArray (dim_vector (1, 1), uint64_scalar_value ()); }
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
492
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5533
diff changeset
493 octave_value resize (const dim_vector& dv, bool fill = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
494 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
495 if (fill)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
496 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
497 intNDArray<OCTAVE_INT_T> retval (dv, 0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
498 if (dv.numel ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
499 retval(0) = scalar;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
500 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
501 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
502 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
503 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
504 intNDArray<OCTAVE_INT_T> retval (dv);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
505 if (dv.numel ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
506 retval(0) = scalar;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
507 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
508 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
509 }
4982
c0866f89c43d [project @ 2004-09-10 13:48:18 by jwe]
jwe
parents: 4964
diff changeset
510
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
511 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
512
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
513 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
514
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
515 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
516
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
517 float float_scalar_value (bool = false) const
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
518 { return scalar.float_value (); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
519
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
520 Matrix
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
521 matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
522 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
523 Matrix retval (1, 1);
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29869
diff changeset
524 retval(0, 0) = scalar.double_value ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
525 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
526 }
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
527
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
528 FloatMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
529 float_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
530 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
531 FloatMatrix retval (1, 1);
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29869
diff changeset
532 retval(0, 0) = scalar.float_value ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
533 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
534 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
535
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
536 ComplexMatrix
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
537 complex_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
538 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
539 ComplexMatrix retval (1, 1);
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29869
diff changeset
540 retval(0, 0) = Complex (scalar.double_value ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
541 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
542 }
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
543
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
544 FloatComplexMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
545 float_complex_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
546 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
547 FloatComplexMatrix retval (1, 1);
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29869
diff changeset
548 retval(0, 0) = FloatComplex (scalar.float_value ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
549 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
550 }
6214
4685a6a76229 [project @ 2006-12-08 22:15:03 by jwe]
jwe
parents: 6069
diff changeset
551
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
552 NDArray
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
553 array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
554 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
555 NDArray retval (dim_vector (1, 1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
556 retval(0) = scalar.double_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
557 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
558 }
4963
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
559
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
560 FloatNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
561 float_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
562 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
563 FloatNDArray retval (dim_vector (1, 1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
564 retval(0) = scalar.float_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
565 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
566 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
567
4963
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
568 ComplexNDArray
573d23f9c9cf [project @ 2004-09-03 15:43:29 by jwe]
jwe
parents: 4944
diff changeset
569 complex_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
570 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
571 ComplexNDArray retval (dim_vector (1, 1));
22859
adc66f043cfc avoid double -> float -> double type conversion
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
572 retval(0) = Complex (scalar.double_value ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
573 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
574 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
575
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
576 FloatComplexNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7636
diff changeset
577 float_complex_array_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
578 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
579 FloatComplexNDArray retval (dim_vector (1, 1));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
580 retval(0) = FloatComplex (scalar.float_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
581 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
582 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4910
diff changeset
583
12645
d3ccd2e37de6 Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
584 bool bool_value (bool warn = false) const
d3ccd2e37de6 Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
585 {
d3ccd2e37de6 Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
586 if (warn && scalar != 0.0 && scalar != 1.0)
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21055
diff changeset
587 warn_logical_conversion ();
12645
d3ccd2e37de6 Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
588
d3ccd2e37de6 Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
589 return scalar.bool_value ();
d3ccd2e37de6 Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
590 }
d3ccd2e37de6 Allow scalar integer to logical conversion (bug #33219)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
591
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
592 boolNDArray
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
593 bool_array_value (bool warn = false) const
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
594 {
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
595 boolNDArray retval (dim_vector (1, 1));
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
596
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
597 if (warn && scalar != 0.0 && scalar != 1.0)
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21055
diff changeset
598 warn_logical_conversion ();
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
599
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
600 retval(0) = scalar.bool_value ();
5943
c038c2947ee1 [project @ 2006-08-18 21:27:03 by jwe]
jwe
parents: 5900
diff changeset
601
5898
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
602 return retval;
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
603 }
da843f35775c [project @ 2006-07-19 18:18:08 by jwe]
jwe
parents: 5895
diff changeset
604
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
605 charNDArray
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
606 char_array_value (bool = false) const
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
607 {
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
608 charNDArray retval (dim_vector (1, 1));
7198
4555c116b420 [project @ 2007-11-27 03:06:10 by jwe]
jwe
parents: 7064
diff changeset
609 retval(0) = scalar.char_value ();
5533
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
610 return retval;
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
611 }
667ad2becb63 [project @ 2005-11-10 21:40:48 by jwe]
jwe
parents: 5307
diff changeset
612
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
613 void increment (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
614 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
615 scalar += OCTAVE_INT_T (1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
616 }
5829
93785a1b0f97 [project @ 2006-05-23 18:34:10 by jwe]
jwe
parents: 5781
diff changeset
617
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
618 void decrement (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
619 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
620 scalar -= OCTAVE_INT_T (1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
621 }
5829
93785a1b0f97 [project @ 2006-05-23 18:34:10 by jwe]
jwe
parents: 5781
diff changeset
622
29569
29a1f8fd8ee6 move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
623 octave::idx_vector index_vector (bool /* require_integers */ = false) const
29a1f8fd8ee6 move idx_vector classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
624 { return octave::idx_vector (scalar); }
4938
703d97b89507 [project @ 2004-08-09 20:21:59 by jwe]
jwe
parents: 4915
diff changeset
625
23059
b98ebcd7f11c move some octave stream classes into octave namespace
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
626 int write (octave::stream& os, int block_size,
23093
8aba6d170887 fix prototype of octave_base_int<T>::write (bug #50157)
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
627 oct_data_conv::data_type output_type, int skip,
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21660
diff changeset
628 octave::mach_info::float_format flt_fmt) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
629 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
630 return os.write (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
631 block_size, output_type, skip, flt_fmt);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
632 }
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4938
diff changeset
633
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
634 mxArray * as_mxArray (bool interleaved) const
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
635 {
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
636 mxArray *retval = new mxArray (interleaved, OCTAVE_INT_MX_CLASS, 1, 1,
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
637 mxREAL);
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
638
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
639 OCTAVE_INT_T::val_type *pd
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
640 = static_cast<OCTAVE_INT_T::val_type *> (retval->get_data ());
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
641
28126
4c21f99b4ad5 handle interleaved complex data and new typed data access functions for mex
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
642 pd[0] = scalar.value ();
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
643
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
644 return retval;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
645 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5898
diff changeset
646
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
647 octave_value map (unary_mapper_t umap) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
648 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
649 switch (umap)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
650 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
651 case umap_abs:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
652 return scalar.abs ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
653 case umap_signum:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
654 return scalar.signum ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
655 case umap_ceil:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
656 case umap_conj:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
657 case umap_fix:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
658 case umap_floor:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
659 case umap_real:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
660 case umap_round:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
661 return scalar;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
662 case umap_imag:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
663 return OCTAVE_INT_T ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
664 case umap_isnan:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
665 case umap_isna:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
666 case umap_isinf:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
667 return false;
21013
7f4c6d594e3d Finish renaming mapper function finite to isfinite.
Rik <rik@octave.org>
parents: 19697
diff changeset
668 case umap_isfinite:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
669 return true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
670
18196
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
671 // Special cases for Matlab compatibility.
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
672 case umap_xtolower:
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
673 case umap_xtoupper:
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
674 return scalar;
1b6db9303933 allow toupper and tolower to handle numeric values (bug #33537)
John W. Eaton <jwe@octave.org>
parents: 18130
diff changeset
675
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
676 default:
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
677 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
678 octave_scalar m (scalar_value ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
679 return m.map (umap);
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
680 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
681 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
682 }
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7201
diff changeset
683
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
684 bool save_hdf5 (octave_hdf5_id loc_id, const char *name, bool flag)
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
685 {
31136
cbfe8318566a maint: use "s_" prefix for integer "hdf5_save_type" class variable.
Rik <rik@octave.org>
parents: 30564
diff changeset
686 return save_hdf5_internal (loc_id, s_hdf5_save_type, name, flag);
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
687 }
24224
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23580
diff changeset
688
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
689 bool load_hdf5 (octave_hdf5_id loc_id, const char *name)
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
690 {
31136
cbfe8318566a maint: use "s_" prefix for integer "hdf5_save_type" class variable.
Rik <rik@octave.org>
parents: 30564
diff changeset
691 return load_hdf5_internal (loc_id, s_hdf5_save_type, name);
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
692 }
24224
ff81c6772664 avoid issue with link-time optimization
John W. Eaton <jwe@octave.org>
parents: 23580
diff changeset
693
24225
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
694 private:
b8cb5a05955e improve on lto fix made in changeset ff81c6772664
John W. Eaton <jwe@octave.org>
parents: 24224
diff changeset
695
31136
cbfe8318566a maint: use "s_" prefix for integer "hdf5_save_type" class variable.
Rik <rik@octave.org>
parents: 30564
diff changeset
696 static octave_hdf5_id s_hdf5_save_type;
4904
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
697
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
698 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
71229573b6bf [project @ 2004-06-14 19:31:52 by jwe]
jwe
parents:
diff changeset
699 };