annotate libinterp/octave-value/ov-complex.h @ 19632:76478d2da117

unconditionally disable the octave_allocator class * configure.ac: Delete the --enable-octave-allocator option. * oct-alloc.h: Delete octave_allocator class. Warn if file is included. Unconditionally define macros to be empty. * NEWS: Make note of these changes. * oct-alloc.cc: Delete. * liboctave/util/module.mk (UTIL_SRC): Remove it from the list. * make_int.cc, Cell.h, oct-obj.cc, oct-obj.h, audiodevinfo.cc, ov-base-int.h, ov-base-scalar.h, ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-complex.h, ov-cs-list.cc, ov-cs-list.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.cc, ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-intx.h, ov-java.cc, ov-java.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, pt-const.cc, pt-const.h, idx-vector.cc, idx-vector.h: Delete uses of oct-alloc.h and OCTAVE_ALLOCATOR macros.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 13:43:29 -0500
parents e473c4853afc
children 4197fc428c7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1 /*
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
3 Copyright (C) 1996-2013 John W. Eaton
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
4
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
6
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
10 option) any later version.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
11
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
15 for more details.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
16
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
19 <http://www.gnu.org/licenses/>.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
20
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
21 */
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
22
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
23 #if !defined (octave_ov_complex_h)
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
24 #define octave_ov_complex_h 1
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
25
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
26 #include <cstdlib>
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
27
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
28 #include <iosfwd>
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
29 #include <string>
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
30
5110
ea96466f98ea [project @ 2005-01-19 02:11:53 by jwe]
jwe
parents: 5105
diff changeset
31 #include "lo-ieee.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
32 #include "mx-base.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
33 #include "str-vec.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
34
9853
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
35 #include "gripes.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
36 #include "error.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
37 #include "ov-base.h"
4749
a4bc7156bd60 [project @ 2004-02-07 16:59:28 by jwe]
jwe
parents: 4687
diff changeset
38 #include "ov-cx-mat.h"
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3220
diff changeset
39 #include "ov-base-scalar.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
40 #include "ov-typeinfo.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
41
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
42 class octave_value_list;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
43
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
44 class tree_walker;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
45
2477
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2466
diff changeset
46 // Complex scalar values.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
47
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
48 class
6693
768d3ad80bbf [project @ 2007-06-06 05:18:54 by jwe]
jwe
parents: 6269
diff changeset
49 OCTINTERP_API
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3220
diff changeset
50 octave_complex : public octave_base_scalar<Complex>
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
51 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
52 public:
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
53
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
54 octave_complex (void)
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3220
diff changeset
55 : octave_base_scalar<Complex> () { }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
56
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
57 octave_complex (const Complex& c)
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3220
diff changeset
58 : octave_base_scalar<Complex> (c) { }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
59
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
60 octave_complex (const octave_complex& c)
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3220
diff changeset
61 : octave_base_scalar<Complex> (c) { }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
62
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
63 ~octave_complex (void) { }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
64
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
65 octave_base_value *clone (void) const { return new octave_complex (*this); }
4749
a4bc7156bd60 [project @ 2004-02-07 16:59:28 by jwe]
jwe
parents: 4687
diff changeset
66
a4bc7156bd60 [project @ 2004-02-07 16:59:28 by jwe]
jwe
parents: 4687
diff changeset
67 // We return an octave_complex_matrix object here instead of an
a4bc7156bd60 [project @ 2004-02-07 16:59:28 by jwe]
jwe
parents: 4687
diff changeset
68 // octave_complex object so that in expressions like A(2,2,2) = 2
a4bc7156bd60 [project @ 2004-02-07 16:59:28 by jwe]
jwe
parents: 4687
diff changeset
69 // (for A previously undefined), A will be empty instead of a 1x1
a4bc7156bd60 [project @ 2004-02-07 16:59:28 by jwe]
jwe
parents: 4687
diff changeset
70 // object.
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
71 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
72 { return new octave_complex_matrix (); }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
73
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
74 type_conv_info numeric_demotion_function (void) const;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
75
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
76 octave_base_value *try_narrowing_conversion (void);
2410
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
77
5885
bd3041e30d97 [project @ 2006-07-14 20:29:35 by jwe]
jwe
parents: 5775
diff changeset
78 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
79 bool resize_ok = false);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
80
14127
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11586
diff changeset
81 // Use this to give a more specific error message
18129
e473c4853afc enable non-integer ranges as indices by default and deprecate preference
John W. Eaton <jwe@octave.org>
parents: 17822
diff changeset
82 idx_vector index_vector (bool /* require_integers */ = false) const
14127
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11586
diff changeset
83 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
84 error ("attempted to use a complex scalar as an index\n"
14127
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11586
diff changeset
85 " (forgot to initialize i or j?)");
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11586
diff changeset
86 return idx_vector ();
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11586
diff changeset
87 }
b5e819930fd5 Give friendlier error message when indexing with default i or j (bug #35157)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 11586
diff changeset
88
5110
ea96466f98ea [project @ 2005-01-19 02:11:53 by jwe]
jwe
parents: 5105
diff changeset
89 octave_value any (int = 0) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
90 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
91 return (scalar != Complex (0, 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
92 && ! (lo_ieee_isnan (std::real (scalar))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
93 || lo_ieee_isnan (std::imag (scalar))));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
94 }
5110
ea96466f98ea [project @ 2005-01-19 02:11:53 by jwe]
jwe
parents: 5105
diff changeset
95
9685
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
96 builtin_type_t builtin_type (void) const { return btyp_complex; }
e793865ede63 implement builtin_type
Jaroslav Hajek <highegg@gmail.com>
parents: 8950
diff changeset
97
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
98 bool is_complex_scalar (void) const { return true; }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
99
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
100 bool is_complex_type (void) const { return true; }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
101
5895
b9c45e0cf685 [project @ 2006-07-19 01:57:44 by jwe]
jwe
parents: 5885
diff changeset
102 bool is_double_type (void) const { return true; }
b9c45e0cf685 [project @ 2006-07-19 01:57:44 by jwe]
jwe
parents: 5885
diff changeset
103
7576
7ebdc99a0bab new isfloat function
John W. Eaton <jwe@octave.org>
parents: 7503
diff changeset
104 bool is_float_type (void) const { return true; }
7ebdc99a0bab new isfloat function
John W. Eaton <jwe@octave.org>
parents: 7503
diff changeset
105
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
106 double double_value (bool = false) const;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
107
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
108 float float_value (bool = false) const;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
109
3145
0d640dc625c7 [project @ 1998-02-05 08:44:59 by jwe]
jwe
parents: 2974
diff changeset
110 double scalar_value (bool frc_str_conv = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
111 { return double_value (frc_str_conv); }
2916
4e7bea116f24 [project @ 1997-04-30 20:56:31 by jwe]
jwe
parents: 2901
diff changeset
112
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
113 float float_scalar_value (bool frc_str_conv = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
114 { return float_value (frc_str_conv); }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
115
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
116 Matrix matrix_value (bool = false) const;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
117
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
118 FloatMatrix float_matrix_value (bool = false) const;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
119
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4192
diff changeset
120 NDArray array_value (bool = false) const;
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4192
diff changeset
121
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
122 FloatNDArray float_array_value (bool = false) const;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
123
5989
e049385342f6 [project @ 2006-09-14 02:10:46 by jwe]
jwe
parents: 5958
diff changeset
124 SparseMatrix sparse_matrix_value (bool = false) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
125 { return SparseMatrix (matrix_value ()); }
5989
e049385342f6 [project @ 2006-09-14 02:10:46 by jwe]
jwe
parents: 5958
diff changeset
126
e049385342f6 [project @ 2006-09-14 02:10:46 by jwe]
jwe
parents: 5958
diff changeset
127 SparseComplexMatrix sparse_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
128 { return SparseComplexMatrix (complex_matrix_value ()); }
5989
e049385342f6 [project @ 2006-09-14 02:10:46 by jwe]
jwe
parents: 5958
diff changeset
129
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5307
diff changeset
130 octave_value resize (const dim_vector& dv, bool fill = false) const;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4749
diff changeset
131
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
132 Complex complex_value (bool = false) const;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
133
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
134 FloatComplex float_complex_value (bool = false) const;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
135
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
136 ComplexMatrix complex_matrix_value (bool = false) const;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
137
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
138 FloatComplexMatrix float_complex_matrix_value (bool = false) const;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
139
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4192
diff changeset
140 ComplexNDArray complex_array_value (bool = false) const;
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4192
diff changeset
141
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
142 FloatComplexNDArray float_complex_array_value (bool = false) const;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
143
9853
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
144 bool bool_value (bool warn = false) const
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
145 {
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
146 if (xisnan (scalar))
11129
0de5cc44e690 use gripe functions for NaN to logical and NaN to character conversions more consistently
John W. Eaton <jwe@octave.org>
parents: 10759
diff changeset
147 gripe_nan_to_logical_conversion ();
9853
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
148 else if (warn && scalar != 0.0 && scalar != 1.0)
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
149 gripe_logical_conversion ();
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
150
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
151 return scalar != 0.0;
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
152 }
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
153
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
154 boolNDArray bool_array_value (bool warn = false) const
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
155 {
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
156 if (xisnan (scalar))
11129
0de5cc44e690 use gripe functions for NaN to logical and NaN to character conversions more consistently
John W. Eaton <jwe@octave.org>
parents: 10759
diff changeset
157 gripe_nan_to_logical_conversion ();
9853
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
158 else if (warn && scalar != 0.0 && scalar != 1.0)
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
159 gripe_logical_conversion ();
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
160
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
161 return boolNDArray (dim_vector (1, 1), scalar != 0.0);
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
162 }
8d9e4752441a implement complex built-in logical conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 9812
diff changeset
163
14557
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
164 octave_value diag (octave_idx_type m, octave_idx_type n) const;
e8e86ae3abbc make diag (x, m, n) return a proper diagonal matrix object (bug #36099)
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
165
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
166 void increment (void) { scalar += 1.0; }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
167
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
168 void decrement (void) { scalar -= 1.0; }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
169
6974
9e32bb109980 [project @ 2007-10-08 11:06:47 by jwe]
jwe
parents: 6693
diff changeset
170 bool save_ascii (std::ostream& os);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
171
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
172 bool load_ascii (std::istream& is);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
173
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
174 bool save_binary (std::ostream& os, bool& save_as_floats);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
175
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
176 bool load_binary (std::istream& is, bool swap,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
177 oct_mach_info::float_format fmt);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
178
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
179 #if defined (HAVE_HDF5)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
180 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
181
9881
b3089dba88bf Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents: 9853
diff changeset
182 bool load_hdf5 (hid_t loc_id, const char *name);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
183 #endif
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4612
diff changeset
184
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4915
diff changeset
185 int write (octave_stream& os, int block_size,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
186 oct_data_conv::data_type output_type, int skip,
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
187 oct_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
188 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
189 // Yes, for compatibility, we drop the imaginary part here.
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
190 return os.write (array_value (true), block_size, output_type,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
191 skip, flt_fmt);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
192 }
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4915
diff changeset
193
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5895
diff changeset
194 mxArray *as_mxArray (void) const;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5895
diff changeset
195
9812
f80c566bc751 improve unary mapper system
Jaroslav Hajek <highegg@gmail.com>
parents: 9685
diff changeset
196 octave_value map (unary_mapper_t umap) const;
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
197
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
198 private:
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
199
2477
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2466
diff changeset
200
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4569
diff changeset
201 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
202 };
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
203
4953
7a3a480e8645 [project @ 2004-09-01 21:10:28 by jwe]
jwe
parents: 4944
diff changeset
204 typedef octave_complex octave_complex_scalar;
7a3a480e8645 [project @ 2004-09-01 21:10:28 by jwe]
jwe
parents: 4944
diff changeset
205
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
206 #endif