annotate src/ov-complex.cc @ 7829:8ca8e97e8c0a

Add rendering interface for surface object (no implementation yet). * * * Add surface properties. * * * Add cdata -> RGB color conversion function. Use it in surface objects. * * * Add normals automatic computation to surface objects. * * * Make sure the correct "get" method is called. * * * Extend scaler interface to accept NDArray. * * * Surface rendering (1st part). * * * Fix wrong indexing. * * * Fix bug in xget_ancestor argument declaration. * * * Initialize OpenGL context correctly. Fix bug in surface rendering. * * * Set material color when rendering surface facets. * * * Add rendering of surface mesh and markers.
author Michael Goffioul <michael.goffioul@gmail.com>
date Thu, 14 Feb 2008 12:17:44 +0100
parents 82be108cc558
children c777f3ce02d8
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
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005,
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4 2006, 2007 John W. Eaton
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
5
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
7
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
8 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
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
11 option) any later version.
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
12
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
13 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
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
15 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
16 for more details.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
17
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
20 <http://www.gnu.org/licenses/>.
2376
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 */
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
23
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
26 #endif
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
27
3503
d14c483b3c12 [project @ 2000-02-01 04:06:07 by jwe]
jwe
parents: 3223
diff changeset
28 #include <iostream>
2901
e6d25bc478dd [project @ 1997-04-30 03:41:26 by jwe]
jwe
parents: 2847
diff changeset
29
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
30 #include "lo-ieee.h"
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
31 #include "lo-specfun.h"
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
32 #include "lo-mappers.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
33
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
34 #include "oct-obj.h"
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4837
diff changeset
35 #include "oct-stream.h"
2410
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
36 #include "ops.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
37 #include "ov-complex.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
38 #include "ov-flt-complex.h"
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
39 #include "ov-base.h"
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
40 #include "ov-base-scalar.h"
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
41 #include "ov-base-scalar.cc"
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2410
diff changeset
42 #include "ov-cx-mat.h"
2410
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
43 #include "ov-scalar.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
44 #include "gripes.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
45 #include "pr-output.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
46 #include "ops.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
47
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
48 #include "ls-oct-ascii.h"
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
49 #include "ls-hdf5.h"
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
50
3223
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
51 template class octave_base_scalar<Complex>;
3ee04ff37b3e [project @ 1998-11-20 19:34:15 by jwe]
jwe
parents: 3219
diff changeset
52
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 2974
diff changeset
53 DEFINE_OCTAVE_ALLOCATOR (octave_complex);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
54
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4569
diff changeset
55 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex,
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4569
diff changeset
56 "complex scalar", "double");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
57
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
58 static octave_base_value *
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
59 default_numeric_demotion_function (const octave_base_value& a)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
60 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
61 CAST_CONV_ARG (const octave_complex&);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
62
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
63 return new octave_float_complex (v.float_complex_value ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
64 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
65
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
66 octave_base_value::type_conv_fcn
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
67 octave_complex::numeric_demotion_function (void) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
68 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
69 return default_numeric_demotion_function;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
70 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
71
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
72 octave_base_value *
2410
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
73 octave_complex::try_narrowing_conversion (void)
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
74 {
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5731
diff changeset
75 octave_base_value *retval = 0;
2410
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
76
5450
6b42c78c77d3 [project @ 2005-09-15 15:36:26 by jwe]
jwe
parents: 5307
diff changeset
77 double im = std::imag (scalar);
6b42c78c77d3 [project @ 2005-09-15 15:36:26 by jwe]
jwe
parents: 5307
diff changeset
78
6b42c78c77d3 [project @ 2005-09-15 15:36:26 by jwe]
jwe
parents: 5307
diff changeset
79 if (im == 0.0 && ! lo_ieee_signbit (im))
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
80 retval = new octave_scalar (std::real (scalar));
2410
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
81
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
82 return retval;
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
83 }
367485171742 [project @ 1996-10-15 16:50:27 by jwe]
jwe
parents: 2376
diff changeset
84
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
85 octave_value
5885
bd3041e30d97 [project @ 2006-07-14 20:29:35 by jwe]
jwe
parents: 5781
diff changeset
86 octave_complex::do_index_op (const octave_value_list& idx, bool resize_ok)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
87 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
88 octave_value retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
89
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3775
diff changeset
90 if (idx.valid_scalar_indices ())
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
91 retval = scalar;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
92 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
93 {
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5760
diff changeset
94 // FIXME -- this doesn't solve the problem of
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
95 //
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
96 // a = i; a([1,1], [1,1], [1,1])
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
97 //
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
98 // and similar constructions. Hmm...
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
99
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5760
diff changeset
100 // FIXME -- using this constructor avoids narrowing the
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2410
diff changeset
101 // 1x1 matrix back to a scalar value. Need a better solution
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2410
diff changeset
102 // to this problem.
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2410
diff changeset
103
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2410
diff changeset
104 octave_value tmp (new octave_complex_matrix (complex_matrix_value ()));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
105
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3775
diff changeset
106 retval = tmp.do_index_op (idx, resize_ok);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
107 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
108
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
109 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
110 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
111
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
112 double
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
113 octave_complex::double_value (bool force_conversion) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
114 {
4102
cbac6756967e [project @ 2002-10-14 20:16:44 by jwe]
jwe
parents: 4066
diff changeset
115 double retval = lo_ieee_nan_value ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
116
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
117 if (! force_conversion)
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
118 gripe_implicit_conversion ("Octave:imag-to-real",
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
119 "complex scalar", "real scalar");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
120
4451
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4192
diff changeset
121 retval = std::real (scalar);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
122
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
123 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
124 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
125
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
126 float
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
127 octave_complex::float_value (bool force_conversion) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
128 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
129 float retval = lo_ieee_float_nan_value ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
130
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
131 if (! force_conversion)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
132 gripe_implicit_conversion ("Octave:imag-to-real",
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
133 "complex scalar", "real scalar");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
134
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
135 retval = std::real (scalar);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
136
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
137 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
138 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
139
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
140 Matrix
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
141 octave_complex::matrix_value (bool force_conversion) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
142 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
143 Matrix retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
144
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
145 if (! force_conversion)
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
146 gripe_implicit_conversion ("Octave:imag-to-real",
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
147 "complex scalar", "real matrix");
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
148
4451
ea1d3e1a4b1b [project @ 2003-07-09 19:09:09 by jwe]
jwe
parents: 4192
diff changeset
149 retval = Matrix (1, 1, std::real (scalar));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
150
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
151 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
152 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
153
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
154 FloatMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
155 octave_complex::float_matrix_value (bool force_conversion) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
156 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
157 FloatMatrix retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
158
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
159 if (! force_conversion)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
160 gripe_implicit_conversion ("Octave:imag-to-real",
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
161 "complex scalar", "real matrix");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
162
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
163 retval = FloatMatrix (1, 1, std::real (scalar));
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
164
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
165 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
166 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
167
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
168 NDArray
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
169 octave_complex::array_value (bool force_conversion) const
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
170 {
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
171 NDArray retval;
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
172
5781
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
173 if (! force_conversion)
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
174 gripe_implicit_conversion ("Octave:imag-to-real",
faafc2d98b8d [project @ 2006-05-02 19:40:19 by jwe]
jwe
parents: 5775
diff changeset
175 "complex scalar", "real matrix");
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
176
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
177 retval = NDArray (dim_vector (1, 1), std::real (scalar));
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
178
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
179 return retval;
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
180 }
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
181
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
182 FloatNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
183 octave_complex::float_array_value (bool force_conversion) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
184 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
185 FloatNDArray retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
186
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
187 if (! force_conversion)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
188 gripe_implicit_conversion ("Octave:imag-to-real",
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
189 "complex scalar", "real matrix");
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
190
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
191 retval = FloatNDArray (dim_vector (1, 1), std::real (scalar));
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
192
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
193 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
194 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
195
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
196 Complex
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
197 octave_complex::complex_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
198 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
199 return scalar;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
200 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
201
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
202 FloatComplex
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
203 octave_complex::float_complex_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
204 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
205 return static_cast<FloatComplex> (scalar);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
206 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
207
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
208 ComplexMatrix
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
209 octave_complex::complex_matrix_value (bool) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
210 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
211 return ComplexMatrix (1, 1, scalar);
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
212 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
213
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
214 FloatComplexMatrix
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
215 octave_complex::float_complex_matrix_value (bool) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
216 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
217 return FloatComplexMatrix (1, 1, static_cast<FloatComplex> (scalar));
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
218 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
219
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
220 ComplexNDArray
4664
19bcdc6a9bb8 [project @ 2003-11-25 06:22:02 by jwe]
jwe
parents: 4612
diff changeset
221 octave_complex::complex_array_value (bool /* force_conversion */) const
4569
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
222 {
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
223 return ComplexNDArray (dim_vector (1, 1), scalar);
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
224 }
01e4957409a4 [project @ 2003-10-30 05:48:17 by jwe]
jwe
parents: 4451
diff changeset
225
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
226 FloatComplexNDArray
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
227 octave_complex::float_complex_array_value (bool /* force_conversion */) const
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
228 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
229 return FloatComplexNDArray (dim_vector (1, 1), static_cast<FloatComplex> (scalar));
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
230 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7740
diff changeset
231
5731
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
232 octave_value
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
233 octave_complex::resize (const dim_vector& dv, bool fill) const
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
234 {
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
235 if (fill)
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
236 {
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
237 ComplexNDArray retval (dv, ComplexNDArray::resize_fill_value ());
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
238
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
239 if (dv.numel ())
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
240 retval(0) = scalar;
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
241
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
242 return retval;
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
243 }
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
244 else
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
245 {
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
246 ComplexNDArray retval (dv);
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
247
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
248 if (dv.numel ())
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
249 retval(0) = scalar;
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
250
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
251 return retval;
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
252 }
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
253 }
c7d5a534afa5 [project @ 2006-04-03 19:33:26 by jwe]
jwe
parents: 5450
diff changeset
254
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
255 bool
6974
9e32bb109980 [project @ 2007-10-08 11:06:47 by jwe]
jwe
parents: 5958
diff changeset
256 octave_complex::save_ascii (std::ostream& os)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
257 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
258 Complex c = complex_value ();
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
259
5958
85c7dc4afe6b [project @ 2006-08-23 18:35:38 by jwe]
jwe
parents: 5956
diff changeset
260 octave_write_complex (os, c);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
261
5958
85c7dc4afe6b [project @ 2006-08-23 18:35:38 by jwe]
jwe
parents: 5956
diff changeset
262 os << "\n";
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
263
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
264 return true;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
265 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
266
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
267 bool
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
268 octave_complex::load_ascii (std::istream& is)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
269 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
270 scalar = octave_read_complex (is);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
271
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
272 if (!is)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
273 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
274 error ("load: failed to load complex scalar constant");
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
275 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
276 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
277
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
278 return true;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
279 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
280
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
281
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
282 bool
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
283 octave_complex::save_binary (std::ostream& os, bool& /* save_as_floats */)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
284 {
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5759
diff changeset
285 char tmp = static_cast<char> (LS_DOUBLE);
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5759
diff changeset
286 os.write (reinterpret_cast<char *> (&tmp), 1);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
287 Complex ctmp = complex_value ();
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5759
diff changeset
288 os.write (reinterpret_cast<char *> (&ctmp), 16);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
289
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
290 return true;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
291 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
292
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
293 bool
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
294 octave_complex::load_binary (std::istream& is, bool swap,
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
295 oct_mach_info::float_format fmt)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
296 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
297 char tmp;
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5759
diff changeset
298 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
299 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
300
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
301 Complex ctmp;
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5759
diff changeset
302 read_doubles (is, reinterpret_cast<double *> (&ctmp),
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5759
diff changeset
303 static_cast<save_type> (tmp), 2, swap, fmt);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
304 if (error_state || ! is)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
305 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
306
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
307 scalar = ctmp;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
308 return true;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
309 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
310
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
311 #if defined (HAVE_HDF5)
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4837
diff changeset
312
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
313 bool
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
314 octave_complex::save_hdf5 (hid_t loc_id, const char *name,
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
315 bool /* save_as_floats */)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
316 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
317 hsize_t dimens[3];
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
318 hid_t space_hid = -1, type_hid = -1, data_hid = -1;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
319 bool retval = true;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
320
4815
2eb844b27953 [project @ 2004-03-04 00:14:44 by jwe]
jwe
parents: 4687
diff changeset
321 space_hid = H5Screate_simple (0, dimens, 0);
4837
81f78a2ff8a6 [project @ 2004-03-12 19:13:01 by jwe]
jwe
parents: 4815
diff changeset
322 if (space_hid < 0)
81f78a2ff8a6 [project @ 2004-03-12 19:13:01 by jwe]
jwe
parents: 4815
diff changeset
323 return false;
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
324
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
325 type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
326 if (type_hid < 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
327 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
328 H5Sclose (space_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
329 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
330 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
331
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
332 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
333 if (data_hid < 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
334 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
335 H5Sclose (space_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
336 H5Tclose (type_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
337 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
338 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
339
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
340 Complex tmp = complex_value ();
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
341 retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
4815
2eb844b27953 [project @ 2004-03-04 00:14:44 by jwe]
jwe
parents: 4687
diff changeset
342 &tmp) >= 0;
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
343
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
344 H5Dclose (data_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
345 H5Tclose (type_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
346 H5Sclose (space_hid);
4837
81f78a2ff8a6 [project @ 2004-03-12 19:13:01 by jwe]
jwe
parents: 4815
diff changeset
347
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
348 return retval;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
349 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
350
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
351 bool
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
352 octave_complex::load_hdf5 (hid_t loc_id, const char *name,
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
353 bool /* have_h5giterate_bug */)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
354 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
355 bool retval = false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
356 hid_t data_hid = H5Dopen (loc_id, name);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
357 hid_t type_hid = H5Dget_type (data_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
358
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
359 hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
360
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
361 if (! hdf5_types_compatible (type_hid, complex_type))
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
362 {
4837
81f78a2ff8a6 [project @ 2004-03-12 19:13:01 by jwe]
jwe
parents: 4815
diff changeset
363 H5Tclose (complex_type);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
364 H5Dclose (data_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
365 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
366 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
367
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
368 hid_t space_id = H5Dget_space (data_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
369 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
370
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
371 if (rank != 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
372 {
4837
81f78a2ff8a6 [project @ 2004-03-12 19:13:01 by jwe]
jwe
parents: 4815
diff changeset
373 H5Tclose (complex_type);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
374 H5Sclose (space_id);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
375 H5Dclose (data_hid);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
376 return false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
377 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
378
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
379 // complex scalar:
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
380 Complex ctmp;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
381 if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
4815
2eb844b27953 [project @ 2004-03-04 00:14:44 by jwe]
jwe
parents: 4687
diff changeset
382 &ctmp) >= 0)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
383 {
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
384 retval = true;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
385 scalar = ctmp;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
386 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
387
4837
81f78a2ff8a6 [project @ 2004-03-12 19:13:01 by jwe]
jwe
parents: 4815
diff changeset
388 H5Tclose (complex_type);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
389 H5Sclose (space_id);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
390 H5Dclose (data_hid);
4837
81f78a2ff8a6 [project @ 2004-03-12 19:13:01 by jwe]
jwe
parents: 4815
diff changeset
391
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
392 return retval;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
393 }
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4837
diff changeset
394
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
395 #endif
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4664
diff changeset
396
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
397 mxArray *
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
398 octave_complex::as_mxArray (void) const
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
399 {
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
400 mxArray *retval = new mxArray (mxDOUBLE_CLASS, 1, 1, mxCOMPLEX);
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
401
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
402 double *pr = static_cast<double *> (retval->get_data ());
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
403 double *pi = static_cast<double *> (retval->get_imag_data ());
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
404
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
405 pr[0] = std::real (scalar);
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
406 pi[0] = std::imag (scalar);
5900
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
407
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
408 return retval;
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
409 }
c20eb7330d13 [project @ 2006-07-22 08:31:16 by jwe]
jwe
parents: 5885
diff changeset
410
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
411 static double
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
412 xabs (const Complex& x)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
413 {
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
414 return (xisinf (x.real ()) || xisinf (x.imag ())) ? octave_Inf : abs (x);
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
415 }
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
416
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
417 static double
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
418 ximag (const Complex& x)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
419 {
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
420 return x.imag ();
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
421 }
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
422
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
423 static double
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
424 xreal (const Complex& x)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
425 {
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
426 return x.real ();
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
427 }
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
428
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
429 #define COMPLEX_MAPPER(MAP, FCN) \
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
430 octave_value \
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
431 octave_complex::MAP (void) const \
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
432 { \
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
433 return octave_value (FCN (scalar)); \
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
434 }
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
435
7667
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
436 #define SCALAR_MAPPER(MAP, FCN) \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
437 octave_value \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
438 octave_complex::MAP (void) const \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
439 { \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
440 if (scalar.imag () == 0) \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
441 return octave_value (FCN (scalar.real ())); \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
442 else \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
443 { \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
444 error ("%s: not defined for complex arguments", #MAP); \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
445 return octave_value (); \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
446 } \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
447 }
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
448
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
449 #define CD_SCALAR_MAPPER(MAP, RFCN, CFCN, L1, L2) \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
450 octave_value \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
451 octave_complex::MAP (void) const \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
452 { \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
453 if (scalar.imag () == 0) \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
454 { \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
455 double re = scalar.real (); \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
456 return (re < L1 || re > L2 \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
457 ? octave_value (CFCN (scalar)) \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
458 : octave_value (RFCN (re))); \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
459 } \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
460 else \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
461 { \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
462 error ("%s: not defined for complex arguments", #MAP); \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
463 return octave_value (); \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
464 } \
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
465 }
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
466
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
467 SCALAR_MAPPER (erf, ::erf)
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
468 SCALAR_MAPPER (erfc, ::erfc)
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
469 SCALAR_MAPPER (gamma, xgamma)
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
470 CD_SCALAR_MAPPER (lgamma, xlgamma, xlgamma, 0.0, octave_Inf)
fb3a6c53c2b2 Allow negative zero imaginary part to be treated as zero for erf, erfc, gamma and lgamma mapper function
David Bateman <dbateman@free.fr>
parents: 7638
diff changeset
471
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
472 COMPLEX_MAPPER (abs, xabs)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
473 COMPLEX_MAPPER (acos, ::acos)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
474 COMPLEX_MAPPER (acosh, ::acosh)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
475 COMPLEX_MAPPER (angle, std::arg)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
476 COMPLEX_MAPPER (arg, std::arg)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
477 COMPLEX_MAPPER (asin, ::asin)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
478 COMPLEX_MAPPER (asinh, ::asinh)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
479 COMPLEX_MAPPER (atan, ::atan)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
480 COMPLEX_MAPPER (atanh, ::atanh)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
481 COMPLEX_MAPPER (ceil, ::ceil)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
482 COMPLEX_MAPPER (conj, std::conj)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
483 COMPLEX_MAPPER (cos, std::cos)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
484 COMPLEX_MAPPER (cosh, std::cosh)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
485 COMPLEX_MAPPER (exp, std::exp)
7638
2df457529cfa implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7636
diff changeset
486 COMPLEX_MAPPER (expm1, ::expm1)
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
487 COMPLEX_MAPPER (fix, ::fix)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
488 COMPLEX_MAPPER (floor, ::floor)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
489 COMPLEX_MAPPER (imag, ximag)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
490 COMPLEX_MAPPER (log, std::log)
7740
39930366b709 implement builtin log2
Jaroslav Hajek <highegg@gmail.com>
parents: 7667
diff changeset
491 COMPLEX_MAPPER (log2, xlog2)
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
492 COMPLEX_MAPPER (log10, std::log10)
7638
2df457529cfa implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7636
diff changeset
493 COMPLEX_MAPPER (log1p, ::log1p)
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
494 COMPLEX_MAPPER (real, xreal)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
495 COMPLEX_MAPPER (round, xround)
7636
99c410f7f0b0 implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents: 7503
diff changeset
496 COMPLEX_MAPPER (roundb, xroundb)
7503
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
497 COMPLEX_MAPPER (signum, ::signum)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
498 COMPLEX_MAPPER (sin, std::sin)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
499 COMPLEX_MAPPER (sinh, std::sinh)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
500 COMPLEX_MAPPER (sqrt, std::sqrt)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
501 COMPLEX_MAPPER (tan, std::tan)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
502 COMPLEX_MAPPER (tanh, std::tanh)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
503 COMPLEX_MAPPER (finite, xfinite)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
504 COMPLEX_MAPPER (isinf, xisinf)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
505 COMPLEX_MAPPER (isna, octave_is_NA)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
506 COMPLEX_MAPPER (isnan, xisnan)
8c32f95c2639 convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
507
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
508 /*
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
509 ;;; Local Variables: ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
510 ;;; mode: C++ ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
511 ;;; End: ***
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
512 */