annotate src/ov.cc @ 12171:d08901c05c1b

fix bug in class assignment to undefined object with index
author John W. Eaton <jwe@octave.org>
date Wed, 26 Jan 2011 20:39:15 -0500
parents 12df7854fa7c
children f96b9b9f141b
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
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10871
diff changeset
3 Copyright (C) 1996-2011 John W. Eaton
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10871
diff changeset
4 Copyright (C) 2009-2010 VZLU Prague
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: 6867
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: 6867
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: 6867
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: 6867
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
4970
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
28 #include "data-conv.h"
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
29 #include "quit.h"
2942
026f342c2019 [project @ 1997-05-08 02:20:57 by jwe]
jwe
parents: 2909
diff changeset
30 #include "str-vec.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
31
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
32 #include "oct-obj.h"
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
33 #include "oct-stream.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
34 #include "ov.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
35 #include "ov-base.h"
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
36 #include "ov-bool.h"
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
37 #include "ov-bool-mat.h"
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
38 #include "ov-cell.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
39 #include "ov-scalar.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
40 #include "ov-float.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
41 #include "ov-re-mat.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
42 #include "ov-flt-re-mat.h"
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
43 #include "ov-re-diag.h"
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
44 #include "ov-flt-re-diag.h"
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
45 #include "ov-perm.h"
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
46 #include "ov-bool-sparse.h"
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
47 #include "ov-cx-sparse.h"
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
48 #include "ov-re-sparse.h"
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
49 #include "ov-int8.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
50 #include "ov-int16.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
51 #include "ov-int32.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
52 #include "ov-int64.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
53 #include "ov-uint8.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
54 #include "ov-uint16.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
55 #include "ov-uint32.h"
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
56 #include "ov-uint64.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
57 #include "ov-complex.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
58 #include "ov-flt-complex.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
59 #include "ov-cx-mat.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
60 #include "ov-flt-cx-mat.h"
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
61 #include "ov-cx-diag.h"
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
62 #include "ov-flt-cx-diag.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
63 #include "ov-ch-mat.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
64 #include "ov-str-mat.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
65 #include "ov-range.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
66 #include "ov-struct.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
67 #include "ov-class.h"
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3961
diff changeset
68 #include "ov-cs-list.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
69 #include "ov-colon.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
70 #include "ov-builtin.h"
4649
f7ce581b27fb [project @ 2003-11-23 21:46:44 by jwe]
jwe
parents: 4645
diff changeset
71 #include "ov-dld-fcn.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
72 #include "ov-usr-fcn.h"
4342
813effe14ee1 [project @ 2003-02-20 08:35:55 by jwe]
jwe
parents: 4276
diff changeset
73 #include "ov-fcn-handle.h"
4966
91b61d27b9b4 [project @ 2004-09-07 02:01:22 by jwe]
jwe
parents: 4965
diff changeset
74 #include "ov-fcn-inline.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
75 #include "ov-typeinfo.h"
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
76 #include "ov-null-mat.h"
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
77 #include "ov-lazy-idx.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
78
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
79 #include "defun.h"
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
80 #include "error.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
81 #include "gripes.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
82 #include "pager.h"
4005
fc000ebb19df [project @ 2002-07-25 21:01:16 by jwe]
jwe
parents: 3977
diff changeset
83 #include "parse.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
84 #include "pr-output.h"
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
85 #include "symtab.h"
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
86 #include "utils.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
87 #include "variables.h"
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
88
2477
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
89 // We are likely to have a lot of octave_value objects to allocate, so
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
90 // make the grow_size large.
3219
30770ba4457a [project @ 1998-11-13 03:44:31 by jwe]
jwe
parents: 3205
diff changeset
91 DEFINE_OCTAVE_ALLOCATOR2(octave_value, 1024);
2477
3d905d3820a4 [project @ 1996-11-07 16:46:11 by jwe]
jwe
parents: 2475
diff changeset
92
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5759
diff changeset
93 // FIXME
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
94
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
95 // Octave's value type.
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
96
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
97 std::string
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
98 octave_value::unary_op_as_string (unary_op op)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
99 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
100 std::string retval;
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
101
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
102 switch (op)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
103 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
104 case op_not:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
105 retval = "!";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
106 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
107
4965
c0d8e8afa82f [project @ 2004-09-06 20:19:57 by jwe]
jwe
parents: 4944
diff changeset
108 case op_uplus:
c0d8e8afa82f [project @ 2004-09-06 20:19:57 by jwe]
jwe
parents: 4944
diff changeset
109 retval = "+";
c0d8e8afa82f [project @ 2004-09-06 20:19:57 by jwe]
jwe
parents: 4944
diff changeset
110 break;
c0d8e8afa82f [project @ 2004-09-06 20:19:57 by jwe]
jwe
parents: 4944
diff changeset
111
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
112 case op_uminus:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
113 retval = "-";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
114 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
115
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
116 case op_transpose:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
117 retval = ".'";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
118 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
119
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
120 case op_hermitian:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
121 retval = "'";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
122 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
123
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
124 case op_incr:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
125 retval = "++";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
126 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
127
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
128 case op_decr:
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
129 retval = "--";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
130 break;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
131
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
132 default:
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
133 retval = "<unknown>";
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
134 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
135
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
136 return retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
137 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
138
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
139 std::string
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
140 octave_value::unary_op_fcn_name (unary_op op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
141 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
142 std::string retval;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
143
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
144 switch (op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
145 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
146 case op_not:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
147 retval = "not";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
148 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
149
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
150 case op_uplus:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
151 retval = "uplus";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
152 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
153
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
154 case op_uminus:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
155 retval = "uminus";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
156 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
157
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
158 case op_transpose:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
159 retval = "transpose";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
160 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
161
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
162 case op_hermitian:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
163 retval = "ctranspose";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
164 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
165
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
166 default:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
167 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
168 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
169
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
170 return retval;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
171 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
172
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
173 std::string
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
174 octave_value::binary_op_as_string (binary_op op)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
175 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
176 std::string retval;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
177
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
178 switch (op)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
179 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
180 case op_add:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
181 retval = "+";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
182 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
183
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
184 case op_sub:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
185 retval = "-";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
186 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
187
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
188 case op_mul:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
189 retval = "*";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
190 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
191
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
192 case op_div:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
193 retval = "/";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
194 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
195
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
196 case op_pow:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
197 retval = "^";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
198 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
199
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
200 case op_ldiv:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
201 retval = "\\";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
202 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
203
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
204 case op_lshift:
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
205 retval = "<<";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
206 break;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
207
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
208 case op_rshift:
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
209 retval = ">>";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
210 break;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
211
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
212 case op_lt:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
213 retval = "<";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
214 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
215
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
216 case op_le:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
217 retval = "<=";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
218 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
219
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
220 case op_eq:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
221 retval = "==";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
222 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
223
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
224 case op_ge:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
225 retval = ">=";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
226 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
227
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
228 case op_gt:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
229 retval = ">";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
230 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
231
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
232 case op_ne:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
233 retval = "!=";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
234 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
235
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
236 case op_el_mul:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
237 retval = ".*";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
238 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
239
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
240 case op_el_div:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
241 retval = "./";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
242 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
243
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
244 case op_el_pow:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
245 retval = ".^";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
246 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
247
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
248 case op_el_ldiv:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
249 retval = ".\\";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
250 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
251
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
252 case op_el_and:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
253 retval = "&";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
254 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
255
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
256 case op_el_or:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
257 retval = "|";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
258 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
259
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
260 case op_struct_ref:
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
261 retval = ".";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
262 break;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
263
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
264 default:
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
265 retval = "<unknown>";
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
266 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
267
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
268 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
269 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
270
3536
e8fbc8c3d6d9 [project @ 2000-02-02 12:01:00 by jwe]
jwe
parents: 3534
diff changeset
271 std::string
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
272 octave_value::binary_op_fcn_name (binary_op op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
273 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
274 std::string retval;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
275
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
276 switch (op)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
277 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
278 case op_add:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
279 retval = "plus";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
280 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
281
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
282 case op_sub:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
283 retval = "minus";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
284 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
285
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
286 case op_mul:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
287 retval = "mtimes";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
288 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
289
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
290 case op_div:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
291 retval = "mrdivide";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
292 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
293
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
294 case op_pow:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
295 retval = "mpower";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
296 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
297
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
298 case op_ldiv:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
299 retval = "mldivide";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
300 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
301
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
302 case op_lt:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
303 retval = "lt";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
304 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
305
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
306 case op_le:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
307 retval = "le";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
308 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
309
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
310 case op_eq:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
311 retval = "eq";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
312 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
313
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
314 case op_ge:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
315 retval = "ge";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
316 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
317
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
318 case op_gt:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
319 retval = "gt";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
320 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
321
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
322 case op_ne:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
323 retval = "ne";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
324 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
325
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
326 case op_el_mul:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
327 retval = "times";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
328 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
329
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
330 case op_el_div:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
331 retval = "rdivide";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
332 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
333
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
334 case op_el_pow:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
335 retval = "power";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
336 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
337
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
338 case op_el_ldiv:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
339 retval = "ldivide";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
340 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
341
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
342 case op_el_and:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
343 retval = "and";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
344 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
345
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
346 case op_el_or:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
347 retval = "or";
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
348 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
349
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
350 default:
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
351 break;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
352 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
353
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
354 return retval;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
355 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
356
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
357 std::string
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
358 octave_value::binary_op_fcn_name (compound_binary_op op)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
359 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
360 std::string retval;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
361
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
362 switch (op)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
363 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
364 case op_trans_mul:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
365 retval = "transtimes";
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
366 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
367
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
368 case op_mul_trans:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
369 retval = "timestrans";
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
370 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
371
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
372 case op_herm_mul:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
373 retval = "hermtimes";
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
374 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
375
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
376 case op_mul_herm:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
377 retval = "timesherm";
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
378 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
379
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
380 case op_trans_ldiv:
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
381 retval = "transldiv";
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
382 break;
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
383
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
384 case op_herm_ldiv:
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
385 retval = "hermldiv";
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
386 break;
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
387
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
388 case op_el_and_not:
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
389 retval = "andnot";
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
390 break;
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
391
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
392 case op_el_or_not:
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
393 retval = "ornot";
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
394 break;
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
395
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
396 case op_el_not_and:
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
397 retval = "notand";
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
398 break;
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
399
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
400 case op_el_not_or:
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
401 retval = "notor";
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
402 break;
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
403
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
404 default:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
405 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
406 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
407
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
408 return retval;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
409 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
410
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
411 std::string
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
412 octave_value::assign_op_as_string (assign_op op)
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
413 {
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
414 std::string retval;
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
415
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
416 switch (op)
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
417 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
418 case op_asn_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
419 retval = "=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
420 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
421
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
422 case op_add_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
423 retval = "+=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
424 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
425
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
426 case op_sub_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
427 retval = "-=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
428 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
429
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
430 case op_mul_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
431 retval = "*=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
432 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
433
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
434 case op_div_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
435 retval = "/=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
436 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
437
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
438 case op_ldiv_eq:
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
439 retval = "\\=";
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
440 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
441
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
442 case op_pow_eq:
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
443 retval = "^=";
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
444 break;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
445
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
446 case op_lshift_eq:
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
447 retval = "<<=";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
448 break;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
449
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
450 case op_rshift_eq:
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
451 retval = ">>=";
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
452 break;
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
453
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
454 case op_el_mul_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
455 retval = ".*=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
456 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
457
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
458 case op_el_div_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
459 retval = "./=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
460 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
461
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
462 case op_el_ldiv_eq:
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
463 retval = ".\\=";
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
464 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
465
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
466 case op_el_pow_eq:
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
467 retval = ".^=";
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
468 break;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
469
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
470 case op_el_and_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
471 retval = "&=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
472 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
473
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
474 case op_el_or_eq:
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
475 retval = "|=";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
476 break;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
477
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
478 default:
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
479 retval = "<unknown>";
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
480 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
481
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
482 return retval;
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
483 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
484
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
485 octave_value::assign_op
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
486 octave_value::binary_op_to_assign_op (binary_op op)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
487 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
488 assign_op retval;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
489
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
490 switch (op)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
491 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
492 case op_add:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
493 retval = op_add_eq;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
494 break;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
495 case op_sub:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
496 retval = op_sub_eq;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
497 break;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
498 case op_mul:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
499 retval = op_mul_eq;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
500 break;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
501 case op_div:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
502 retval = op_div_eq;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
503 break;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
504 case op_el_mul:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
505 retval = op_el_mul_eq;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
506 break;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
507 case op_el_div:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
508 retval = op_el_div_eq;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
509 break;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
510 case op_el_and:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
511 retval = op_el_and_eq;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
512 break;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
513 case op_el_or:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
514 retval = op_el_or_eq;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
515 break;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
516 default:
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
517 retval = unknown_assign_op;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
518 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
519
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
520 return retval;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
521 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
522
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
523 octave_value::octave_value (short int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
524 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
525 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
526 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
527
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
528 octave_value::octave_value (unsigned short int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
529 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
530 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
531 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
532
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
533 octave_value::octave_value (int i)
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
534 : rep (new octave_scalar (i))
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
535 {
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
536 }
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
537
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
538 octave_value::octave_value (unsigned int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
539 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
540 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
541 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
542
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
543 octave_value::octave_value (long int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
544 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
545 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
546 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
547
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
548 octave_value::octave_value (unsigned long int i)
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
549 : rep (new octave_scalar (i))
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
550 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
551 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
552
4353
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
553 #if defined (HAVE_LONG_LONG_INT)
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
554 octave_value::octave_value (long long int i)
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
555 : rep (new octave_scalar (i))
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
556 {
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
557 }
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
558 #endif
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
559
4355
6fa0c2306ef6 [project @ 2003-02-22 00:37:10 by jwe]
jwe
parents: 4353
diff changeset
560 #if defined (HAVE_UNSIGNED_LONG_LONG_INT)
4353
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
561 octave_value::octave_value (unsigned long long int i)
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
562 : rep (new octave_scalar (i))
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
563 {
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
564 }
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
565 #endif
ea4b8c35ac9d [project @ 2003-02-21 21:04:41 by jwe]
jwe
parents: 4346
diff changeset
566
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
567 octave_value::octave_value (octave_time t)
7065
97db94ae2cf0 [project @ 2007-10-25 05:50:55 by jwe]
jwe
parents: 7064
diff changeset
568 : rep (new octave_scalar (t.double_value ()))
4254
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
569 {
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
570 }
df5f2e433a11 [project @ 2002-12-31 19:43:07 by jwe]
jwe
parents: 4247
diff changeset
571
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
572 octave_value::octave_value (double d)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
573 : rep (new octave_scalar (d))
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
574 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
575 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
576
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
577 octave_value::octave_value (float d)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
578 : rep (new octave_float_scalar (d))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
579 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
580 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
581
4587
7b957b442818 [project @ 2003-11-10 15:50:39 by jwe]
jwe
parents: 4584
diff changeset
582 octave_value::octave_value (const Cell& c, bool is_csl)
5477
9e59c91ddc99 [project @ 2005-09-30 05:26:38 by jwe]
jwe
parents: 5354
diff changeset
583 : rep (is_csl
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
584 ? dynamic_cast<octave_base_value *> (new octave_cs_list (c))
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
585 : dynamic_cast<octave_base_value *> (new octave_cell (c)))
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
586 {
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
587 }
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
588
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
589 octave_value::octave_value (const Array<octave_value>& a, bool is_csl)
5477
9e59c91ddc99 [project @ 2005-09-30 05:26:38 by jwe]
jwe
parents: 5354
diff changeset
590 : rep (is_csl
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
591 ? dynamic_cast<octave_base_value *> (new octave_cs_list (Cell (a)))
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
592 : dynamic_cast<octave_base_value *> (new octave_cell (Cell (a))))
5147
47e4c91e5799 [project @ 2005-02-16 21:06:19 by jwe]
jwe
parents: 5146
diff changeset
593 {
47e4c91e5799 [project @ 2005-02-16 21:06:19 by jwe]
jwe
parents: 5146
diff changeset
594 }
47e4c91e5799 [project @ 2005-02-16 21:06:19 by jwe]
jwe
parents: 5146
diff changeset
595
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
596 octave_value::octave_value (const Matrix& m, const MatrixType& t)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
597 : rep (new octave_matrix (m, t))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
598 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
599 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
600 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
601
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
602 octave_value::octave_value (const FloatMatrix& m, const MatrixType& t)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
603 : rep (new octave_float_matrix (m, t))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
604 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
605 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
606 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
607
4507
65f47f8a92a2 [project @ 2003-09-10 15:48:02 by jwe]
jwe
parents: 4505
diff changeset
608 octave_value::octave_value (const NDArray& a)
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
609 : rep (new octave_matrix (a))
4478
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
610 {
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
611 maybe_mutate ();
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
612 }
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
613
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
614 octave_value::octave_value (const FloatNDArray& a)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
615 : rep (new octave_float_matrix (a))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
616 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
617 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
618 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
619
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
620 octave_value::octave_value (const Array<double>& a)
4911
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
621 : rep (new octave_matrix (a))
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
622 {
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
623 maybe_mutate ();
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
624 }
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
625
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
626 octave_value::octave_value (const Array<float>& a)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
627 : rep (new octave_float_matrix (a))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
628 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
629 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
630 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
631
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
632 octave_value::octave_value (const DiagMatrix& d)
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
633 : rep (new octave_diag_matrix (d))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
634 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
635 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
636 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
637
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
638 octave_value::octave_value (const FloatDiagMatrix& d)
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
639 : rep (new octave_float_diag_matrix (d))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
640 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
641 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
642 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
643
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
644 octave_value::octave_value (const RowVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
645 : rep (new octave_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
646 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
647 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
648 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
649
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
650 octave_value::octave_value (const FloatRowVector& v)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
651 : rep (new octave_float_matrix (v))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
652 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
653 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
654 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
655
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
656 octave_value::octave_value (const ColumnVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
657 : rep (new octave_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
658 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
659 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
660 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
661
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
662 octave_value::octave_value (const FloatColumnVector& v)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
663 : rep (new octave_float_matrix (v))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
664 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
665 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
666 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
667
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
668 octave_value::octave_value (const Complex& C)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
669 : rep (new octave_complex (C))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
670 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
671 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
672 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
673
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
674 octave_value::octave_value (const FloatComplex& C)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
675 : rep (new octave_float_complex (C))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
676 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
677 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
678 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
679
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
680 octave_value::octave_value (const ComplexMatrix& m, const MatrixType& t)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
681 : rep (new octave_complex_matrix (m, t))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
682 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
683 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
684 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
685
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
686 octave_value::octave_value (const FloatComplexMatrix& m, const MatrixType& t)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
687 : rep (new octave_float_complex_matrix (m, t))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
688 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
689 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
690 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
691
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
692 octave_value::octave_value (const ComplexNDArray& a)
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
693 : rep (new octave_complex_matrix (a))
4478
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
694 {
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
695 maybe_mutate ();
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
696 }
7afd4bf05aa8 [project @ 2003-07-30 19:15:31 by jwe]
jwe
parents: 4461
diff changeset
697
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
698 octave_value::octave_value (const FloatComplexNDArray& a)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
699 : rep (new octave_float_complex_matrix (a))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
700 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
701 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
702 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
703
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
704 octave_value::octave_value (const Array<Complex>& a)
4911
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
705 : rep (new octave_complex_matrix (a))
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
706 {
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
707 maybe_mutate ();
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
708 }
14027e0bafa4 [project @ 2004-07-22 19:58:06 by jwe]
jwe
parents: 4901
diff changeset
709
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
710 octave_value::octave_value (const Array<FloatComplex>& a)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
711 : rep (new octave_float_complex_matrix (a))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
712 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
713 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
714 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
715
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
716 octave_value::octave_value (const ComplexDiagMatrix& d)
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
717 : rep (new octave_complex_diag_matrix (d))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
718 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
719 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
720 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
721
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
722 octave_value::octave_value (const FloatComplexDiagMatrix& d)
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
723 : rep (new octave_float_complex_diag_matrix (d))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
724 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
725 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
726 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
727
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
728 octave_value::octave_value (const ComplexRowVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
729 : rep (new octave_complex_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
730 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
731 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
732 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
733
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
734 octave_value::octave_value (const FloatComplexRowVector& v)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
735 : rep (new octave_float_complex_matrix (v))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
736 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
737 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
738 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
739
3418
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
740 octave_value::octave_value (const ComplexColumnVector& v)
ca92c9d3f882 [project @ 2000-01-12 03:07:47 by jwe]
jwe
parents: 3373
diff changeset
741 : rep (new octave_complex_matrix (v))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
742 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
743 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
744 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
745
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
746 octave_value::octave_value (const FloatComplexColumnVector& v)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
747 : rep (new octave_float_complex_matrix (v))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
748 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
749 maybe_mutate ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
750 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
751
8960
93f18f166aba remove float perm matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
752 octave_value::octave_value (const PermMatrix& p)
93f18f166aba remove float perm matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
753 : rep (new octave_perm_matrix (p))
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
754 {
8960
93f18f166aba remove float perm matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
755 maybe_mutate ();
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
756 }
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
757
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
758 octave_value::octave_value (bool b)
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
759 : rep (new octave_bool (b))
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
760 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
761 }
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
762
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
763 octave_value::octave_value (const boolMatrix& bm, const MatrixType& t)
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
764 : rep (new octave_bool_matrix (bm, t))
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
765 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
766 maybe_mutate ();
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
767 }
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
768
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
769 octave_value::octave_value (const boolNDArray& bnda)
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
770 : rep (new octave_bool_matrix (bnda))
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
771 {
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
772 maybe_mutate ();
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
773 }
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
774
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
775 octave_value::octave_value (const Array<bool>& bnda)
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
776 : rep (new octave_bool_matrix (bnda))
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
777 {
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
778 maybe_mutate ();
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
779 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
780
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
781 octave_value::octave_value (char c, char type)
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
782 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
783 ? new octave_char_matrix_dq_str (c)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
784 : new octave_char_matrix_sq_str (c))
3189
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
785 {
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
786 maybe_mutate ();
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
787 }
bef7b73c0724 [project @ 1998-10-16 18:05:26 by jwe]
jwe
parents: 3018
diff changeset
788
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
789 octave_value::octave_value (const char *s, char type)
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
790 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
791 ? new octave_char_matrix_dq_str (s)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
792 : new octave_char_matrix_sq_str (s))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
793 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
794 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
795 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
796
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
797 octave_value::octave_value (const std::string& s, char type)
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
798 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
799 ? new octave_char_matrix_dq_str (s)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
800 : new octave_char_matrix_sq_str (s))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
801 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
802 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
803 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
804
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
805 octave_value::octave_value (const string_vector& s, char type)
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
806 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
807 ? new octave_char_matrix_dq_str (s)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
808 : new octave_char_matrix_sq_str (s))
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
809 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
810 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
811 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
812
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
813 octave_value::octave_value (const charMatrix& chm, char type)
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
814 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
815 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
816 : new octave_char_matrix_sq_str (chm))
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
817 {
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
818 maybe_mutate ();
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
819 }
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
820
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
821 octave_value::octave_value (const charNDArray& chm, char type)
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
822 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
823 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
824 : new octave_char_matrix_sq_str (chm))
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
825 {
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
826 maybe_mutate ();
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
827 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
828
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
829 octave_value::octave_value (const Array<char>& chm, char type)
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
830 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
831 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
832 : new octave_char_matrix_sq_str (chm))
4513
508238e65af7 [project @ 2003-09-19 21:40:57 by jwe]
jwe
parents: 4507
diff changeset
833 {
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
834 maybe_mutate ();
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
835 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
836
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
837 octave_value::octave_value (const charMatrix& chm, bool, char type)
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
838 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
839 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
840 : new octave_char_matrix_sq_str (chm))
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
841 {
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
842 maybe_mutate ();
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
843 }
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
844
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
845 octave_value::octave_value (const charNDArray& chm, bool, char type)
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
846 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
847 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
848 : new octave_char_matrix_sq_str (chm))
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
849 {
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
850 maybe_mutate ();
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
851 }
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
852
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
853 octave_value::octave_value (const Array<char>& chm, bool, char type)
9689
34d6f005db4b eliminate is_string argument from octave_value character array constructors
John W. Eaton <jwe@octave.org>
parents: 9661
diff changeset
854 : rep (type == '"'
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
855 ? new octave_char_matrix_dq_str (chm)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
856 : new octave_char_matrix_sq_str (chm))
4997
d117a9fb83be [project @ 2004-09-15 20:49:21 by jwe]
jwe
parents: 4994
diff changeset
857 {
d117a9fb83be [project @ 2004-09-15 20:49:21 by jwe]
jwe
parents: 4994
diff changeset
858 maybe_mutate ();
d117a9fb83be [project @ 2004-09-15 20:49:21 by jwe]
jwe
parents: 4994
diff changeset
859 }
d117a9fb83be [project @ 2004-09-15 20:49:21 by jwe]
jwe
parents: 4994
diff changeset
860
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
861 octave_value::octave_value (const SparseMatrix& m, const MatrixType &t)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
862 : rep (new octave_sparse_matrix (m, t))
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
863 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
864 maybe_mutate ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
865 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
866
6863
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
867 octave_value::octave_value (const Sparse<double>& m, const MatrixType &t)
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
868 : rep (new octave_sparse_matrix (m, t))
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
869 {
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
870 maybe_mutate ();
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
871 }
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
872
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
873 octave_value::octave_value (const SparseComplexMatrix& m, const MatrixType &t)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
874 : rep (new octave_sparse_complex_matrix (m, t))
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
875 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
876 maybe_mutate ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
877 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
878
6863
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
879 octave_value::octave_value (const Sparse<Complex>& m, const MatrixType &t)
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
880 : rep (new octave_sparse_complex_matrix (m, t))
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
881 {
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
882 maybe_mutate ();
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
883 }
3c64128e621c [project @ 2007-09-05 07:52:48 by dbateman]
dbateman
parents: 6639
diff changeset
884
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5781
diff changeset
885 octave_value::octave_value (const SparseBoolMatrix& bm, const MatrixType &t)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
886 : rep (new octave_sparse_bool_matrix (bm, t))
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
887 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
888 maybe_mutate ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
889 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
890
7433
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
891 octave_value::octave_value (const Sparse<bool>& bm, const MatrixType &t)
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
892 : rep (new octave_sparse_bool_matrix (bm, t))
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
893 {
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
894 maybe_mutate ();
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
895 }
402168152bb9 [project @ 2008-01-31 18:59:09 by dbateman]
dbateman
parents: 7336
diff changeset
896
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
897 octave_value::octave_value (const octave_int8& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
898 : rep (new octave_int8_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
899 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
900 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
901 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
902
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
903 octave_value::octave_value (const octave_uint8& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
904 : rep (new octave_uint8_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
905 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
906 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
907 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
908
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
909 octave_value::octave_value (const octave_int16& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
910 : rep (new octave_int16_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
911 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
912 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
913 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
914
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
915 octave_value::octave_value (const octave_uint16& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
916 : rep (new octave_uint16_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
917 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
918 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
919 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
920
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
921 octave_value::octave_value (const octave_int32& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
922 : rep (new octave_int32_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
923 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
924 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
925 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
926
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
927 octave_value::octave_value (const octave_uint32& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
928 : rep (new octave_uint32_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
929 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
930 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
931 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
932
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
933 octave_value::octave_value (const octave_int64& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
934 : rep (new octave_int64_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
935 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
936 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
937 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
938
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
939 octave_value::octave_value (const octave_uint64& i)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
940 : rep (new octave_uint64_scalar (i))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
941 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
942 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
943 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
944
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
945 octave_value::octave_value (const int8NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
946 : rep (new octave_int8_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
947 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
948 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
949 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
950
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
951 octave_value::octave_value (const Array<octave_int8>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
952 : rep (new octave_int8_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
953 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
954 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
955 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
956
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
957 octave_value::octave_value (const uint8NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
958 : rep (new octave_uint8_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
959 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
960 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
961 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
962
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
963 octave_value::octave_value (const Array<octave_uint8>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
964 : rep (new octave_uint8_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
965 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
966 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
967 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
968
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
969 octave_value::octave_value (const int16NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
970 : rep (new octave_int16_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
971 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
972 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
973 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
974
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
975 octave_value::octave_value (const Array<octave_int16>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
976 : rep (new octave_int16_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
977 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
978 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
979 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
980
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
981 octave_value::octave_value (const uint16NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
982 : rep (new octave_uint16_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
983 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
984 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
985 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
986
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
987 octave_value::octave_value (const Array<octave_uint16>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
988 : rep (new octave_uint16_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
989 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
990 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
991 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
992
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
993 octave_value::octave_value (const int32NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
994 : rep (new octave_int32_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
995 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
996 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
997 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
998
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
999 octave_value::octave_value (const Array<octave_int32>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1000 : rep (new octave_int32_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1001 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1002 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1003 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1004
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1005 octave_value::octave_value (const uint32NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1006 : rep (new octave_uint32_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1007 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1008 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1009 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1010
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
1011 octave_value::octave_value (const Array<octave_uint32>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1012 : rep (new octave_uint32_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1013 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1014 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1015 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1016
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1017 octave_value::octave_value (const int64NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1018 : rep (new octave_int64_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1019 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1020 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1021 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1022
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
1023 octave_value::octave_value (const Array<octave_int64>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1024 : rep (new octave_int64_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1025 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1026 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1027 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1028
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1029 octave_value::octave_value (const uint64NDArray& inda)
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1030 : rep (new octave_uint64_matrix (inda))
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1031 {
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1032 maybe_mutate ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1033 }
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
1034
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 9728
diff changeset
1035 octave_value::octave_value (const Array<octave_uint64>& inda)
7064
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1036 : rep (new octave_uint64_matrix (inda))
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1037 {
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1038 maybe_mutate ();
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1039 }
faff87ff9d5a [project @ 2007-10-24 21:09:43 by dbateman]
dbateman
parents: 7017
diff changeset
1040
9351
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1041 octave_value::octave_value (const Array<octave_idx_type>& inda, bool zero_based,
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1042 bool cache_index)
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1043 : rep (new octave_matrix (inda, zero_based, cache_index))
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1044 {
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1045 maybe_mutate ();
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1046 }
e2344f4af0cb autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents: 9329
diff changeset
1047
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1048 octave_value::octave_value (const idx_vector& idx, bool lazy)
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1049 : rep ()
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1050 {
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1051 double scalar;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1052 Range range;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1053 NDArray array;
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1054 boolNDArray mask;
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1055 idx_vector::idx_class_type idx_class;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1056
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1057 if (lazy)
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1058 {
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1059 // Only make lazy indices out of ranges and index vectors.
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1060 switch (idx.idx_class ())
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1061 {
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1062 case idx_vector::class_range:
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1063 case idx_vector::class_vector:
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1064 rep = new octave_lazy_index (idx);
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1065 maybe_mutate ();
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1066 return;
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1067 default:
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1068 break;
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1069 }
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1070 }
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1071
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1072 idx.unconvert (idx_class, scalar, range, array, mask);
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1073
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1074 switch (idx_class)
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1075 {
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1076 case idx_vector::class_colon:
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1077 rep = new octave_magic_colon ();
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1078 break;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1079 case idx_vector::class_range:
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1080 rep = new octave_range (range, idx);
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1081 break;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1082 case idx_vector::class_scalar:
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1083 rep = new octave_scalar (scalar);
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1084 break;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1085 case idx_vector::class_vector:
9894
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1086 rep = new octave_matrix (array, idx);
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1087 break;
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1088 case idx_vector::class_mask:
83bd7f34f9da improve idx_vector->octave_value conversion
Jaroslav Hajek <highegg@gmail.com>
parents: 9879
diff changeset
1089 rep = new octave_bool_matrix (mask, idx);
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1090 break;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1091 default:
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1092 assert (false);
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1093 break;
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1094 }
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1095
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1096 // FIXME: needed?
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1097 maybe_mutate ();
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1098 }
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1099
9725
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1100 octave_value::octave_value (const Array<std::string>& cellstr)
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1101 : rep (new octave_cell (cellstr))
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1102 {
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1103 maybe_mutate ();
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1104 }
aea3a3a950e1 implement nth_element
Jaroslav Hajek <highegg@gmail.com>
parents: 9693
diff changeset
1105
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1106 octave_value::octave_value (double base, double limit, double inc)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1107 : rep (new octave_range (base, limit, inc))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1108 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1109 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1110 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1111
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1112 octave_value::octave_value (const Range& r)
2423
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1113 : rep (new octave_range (r))
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1114 {
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1115 maybe_mutate ();
de430cdd9234 [project @ 1996-10-18 20:39:41 by jwe]
jwe
parents: 2413
diff changeset
1116 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1117
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1118 octave_value::octave_value (const octave_map& m)
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1119 : rep (new octave_struct (m))
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1120 {
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1121 maybe_mutate ();
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1122 }
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1123
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1124 octave_value::octave_value (const octave_scalar_map& m)
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1125 : rep (new octave_scalar_struct (m))
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1126 {
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1127 }
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1128
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1129 octave_value::octave_value (const Octave_map& m)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1130 : rep (new octave_struct (m))
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1131 {
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1132 maybe_mutate ();
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1133 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1134
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1135 octave_value::octave_value (const Octave_map& m, const std::string& id)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1136 : rep (new octave_class (m, id))
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1137 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1138 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1139
10232
0efd486813fe remove deprecated list datatype
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
1140 octave_value::octave_value (const octave_value_list& l, bool)
0efd486813fe remove deprecated list datatype
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
1141 : rep (new octave_cs_list (l))
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1142 {
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1143 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1144
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1145 octave_value::octave_value (octave_value::magic_colon)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1146 : rep (new octave_magic_colon ())
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1147 {
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1148 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1149
9728
70925b11ba46 again allow the obsolete syntax for cellfun
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
1150 octave_value::octave_value (octave_base_value *new_rep, bool borrow)
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1151 : rep (new_rep)
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1152 {
9728
70925b11ba46 again allow the obsolete syntax for cellfun
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
1153 if (borrow)
70925b11ba46 again allow the obsolete syntax for cellfun
Jaroslav Hajek <highegg@gmail.com>
parents: 9725
diff changeset
1154 rep->count++;
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
1155 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1156
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1157 octave_value::octave_value (octave_base_value *new_rep, int xcount)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1158 : rep (new_rep)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1159 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1160 rep->count = xcount;
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1161 }
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1162
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5758
diff changeset
1163 octave_base_value *
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1164 octave_value::clone (void) const
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1165 {
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
1166 return rep->clone ();
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1167 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1168
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1169 void
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1170 octave_value::maybe_mutate (void)
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1171 {
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5758
diff changeset
1172 octave_base_value *tmp = rep->try_narrowing_conversion ();
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1173
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1174 if (tmp && tmp != rep)
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1175 {
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1176 if (--rep->count == 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1177 delete rep;
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1178
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1179 rep = tmp;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1180 }
2409
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1181 }
47e5f57fb4bd [project @ 1996-10-15 16:44:26 by jwe]
jwe
parents: 2376
diff changeset
1182
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1183 octave_value
4271
be631c1720ea [project @ 2003-01-03 19:36:04 by jwe]
jwe
parents: 4257
diff changeset
1184 octave_value::single_subsref (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1185 const octave_value_list& idx)
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1186 {
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1187 std::list<octave_value_list> i;
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1188
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1189 i.push_back (idx);
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1190
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1191 return rep->subsref (type, i);
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1192 }
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1193
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1194 octave_value_list
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1195 octave_value::subsref (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1196 const std::list<octave_value_list>& idx, int nargout)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1197 {
7651
443a8f5a50fd require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents: 7503
diff changeset
1198 if (nargout == 1)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1199 return rep->subsref (type, idx);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1200 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1201 return rep->subsref (type, idx, nargout);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1202 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1203
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1204 octave_value_list
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1205 octave_value::subsref (const std::string& type,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1206 const std::list<octave_value_list>& idx, int nargout,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1207 const std::list<octave_lvalue> *lvalue_list)
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1208 {
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1209 if (lvalue_list)
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1210 return rep->subsref (type, idx, nargout, lvalue_list);
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1211 else
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1212 return subsref (type, idx, nargout);
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1213 }
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1214
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1215 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1216 octave_value::next_subsref (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1217 const std::list<octave_value_list>& idx,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1218 size_t skip)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1219 {
4582
db5a24d54915 [project @ 2003-10-31 15:11:45 by jwe]
jwe
parents: 4567
diff changeset
1220 if (! error_state && idx.size () > skip)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1221 {
4219
23d06c9e1edd [project @ 2002-12-06 21:29:17 by jwe]
jwe
parents: 4192
diff changeset
1222 std::list<octave_value_list> new_idx (idx);
4233
ccfdb55c8156 [project @ 2002-12-20 22:43:54 by jwe]
jwe
parents: 4219
diff changeset
1223 for (size_t i = 0; i < skip; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1224 new_idx.erase (new_idx.begin ());
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1225 return subsref (type.substr (skip), new_idx);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1226 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1227 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1228 return *this;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1229 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1230
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1231 octave_value_list
4994
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1232 octave_value::next_subsref (int nargout, const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1233 const std::list<octave_value_list>& idx,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1234 size_t skip)
4994
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1235 {
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1236 if (! error_state && idx.size () > skip)
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1237 {
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1238 std::list<octave_value_list> new_idx (idx);
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1239 for (size_t i = 0; i < skip; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1240 new_idx.erase (new_idx.begin ());
4994
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1241 return subsref (type.substr (skip), new_idx, nargout);
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1242 }
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1243 else
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1244 return *this;
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1245 }
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1246
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1247 octave_value
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1248 octave_value::next_subsref (bool auto_add, const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1249 const std::list<octave_value_list>& idx,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1250 size_t skip)
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1251 {
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1252 if (! error_state && idx.size () > skip)
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1253 {
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1254 std::list<octave_value_list> new_idx (idx);
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1255 for (size_t i = 0; i < skip; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1256 new_idx.erase (new_idx.begin ());
8551
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1257 return subsref (type.substr (skip), new_idx, auto_add);
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1258 }
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1259 else
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1260 return *this;
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1261 }
906f976d35a8 further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 8531
diff changeset
1262
4994
48d0defe9445 [project @ 2004-09-15 20:31:31 by jwe]
jwe
parents: 4970
diff changeset
1263 octave_value_list
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3536
diff changeset
1264 octave_value::do_multi_index_op (int nargout, const octave_value_list& idx)
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1265 {
3544
71bd2d124119 [project @ 2000-02-02 21:02:31 by jwe]
jwe
parents: 3536
diff changeset
1266 return rep->do_multi_index_op (nargout, idx);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1267 }
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1268
10832
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1269 octave_value_list
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1270 octave_value::do_multi_index_op (int nargout, const octave_value_list& idx,
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1271 const std::list<octave_lvalue> *lvalue_list)
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1272 {
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1273 return rep->do_multi_index_op (nargout, idx, lvalue_list);
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1274 }
1b2fcd122c6a allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10768
diff changeset
1275
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1276 #if 0
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1277 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1278 gripe_assign_failed (const std::string& on, const std::string& tn1,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1279 const std::string& tn2)
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1280 {
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1281 error ("assignment failed for `%s %s %s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1282 tn1.c_str (), on.c_str (), tn2.c_str ());
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1283 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1284 #endif
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1285
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1286 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1287 gripe_assign_failed_or_no_method (const std::string& on,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1288 const std::string& tn1,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1289 const std::string& tn2)
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1290 {
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1291 error ("assignment failed, or no method for `%s %s %s'",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1292 tn1.c_str (), on.c_str (), tn2.c_str ());
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1293 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1294
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1295 octave_value
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1296 octave_value::subsasgn (const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1297 const std::list<octave_value_list>& idx,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1298 const octave_value& rhs)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1299 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1300 return rep->subsasgn (type, idx, rhs);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1301 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1302
12171
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1303 octave_value
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1304 octave_value::undef_subsasgn (const std::string& type,
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1305 const std::list<octave_value_list>& idx,
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1306 const octave_value& rhs)
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1307 {
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1308 return rep->undef_subsasgn (type, idx, rhs);
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1309 }
d08901c05c1b fix bug in class assignment to undefined object with index
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
1310
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1311 octave_value&
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
1312 octave_value::assign (assign_op op, const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1313 const std::list<octave_value_list>& idx,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1314 const octave_value& rhs)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1315 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1316 octave_value retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1317
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1318 make_unique ();
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1319
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1320 octave_value t_rhs = rhs;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1321
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1322 if (op != op_asn_eq)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1323 {
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1324 if (is_defined ())
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1325 {
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1326 octave_value t = subsref (type, idx);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1327
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1328 if (! error_state)
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1329 {
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1330 binary_op binop = op_eq_to_binary_op (op);
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1331
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1332 if (! error_state)
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1333 t_rhs = do_binary_op (binop, t, rhs);
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1334 }
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1335 }
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1336 else
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1337 error ("in computed assignment A(index) OP= X, A must be defined first");
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1338 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1339
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1340 if (! error_state)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1341 {
10871
333bf09e3b6e only allow struct assignments to non-struct values for empty arrays
Jaroslav Hajek <highegg@gmail.com>
parents: 10832
diff changeset
1342 octave_value tmp = subsasgn (type, idx, t_rhs);
9693
1c19877799d3 improve error reports for computed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 9690
diff changeset
1343
1c19877799d3 improve error reports for computed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 9690
diff changeset
1344 if (error_state)
1c19877799d3 improve error reports for computed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 9690
diff changeset
1345 gripe_assign_failed_or_no_method (assign_op_as_string (op_asn_eq),
1c19877799d3 improve error reports for computed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 9690
diff changeset
1346 type_name (), rhs.type_name ());
10871
333bf09e3b6e only allow struct assignments to non-struct values for empty arrays
Jaroslav Hajek <highegg@gmail.com>
parents: 10832
diff changeset
1347 else
333bf09e3b6e only allow struct assignments to non-struct values for empty arrays
Jaroslav Hajek <highegg@gmail.com>
parents: 10832
diff changeset
1348 *this = tmp;
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1349 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1350
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1351 return *this;
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1352 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1353
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1354 octave_value&
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1355 octave_value::assign (assign_op op, const octave_value& rhs)
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1356 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
1357 if (op == op_asn_eq)
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1358 // Regularize a null matrix if stored into a variable.
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1359 operator = (rhs.storable_value ());
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1360 else if (is_defined ())
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1361 {
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1362 octave_value_typeinfo::assign_op_fcn f = 0;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1363
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1364 // Only attempt to operate in-place if this variable is unshared.
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1365 if (rep->count == 1)
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1366 {
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1367 int tthis = this->type_id ();
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1368 int trhs = rhs.type_id ();
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1369
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1370 f = octave_value_typeinfo::lookup_assign_op (op, tthis, trhs);
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1371 }
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1372
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1373 if (f)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1374 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1375 try
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1376 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1377 f (*rep, octave_value_list (), *rhs.rep);
9608
1c76e806c2a7 possibly mutate after in-place computed assignment
Jaroslav Hajek <highegg@gmail.com>
parents: 9607
diff changeset
1378 maybe_mutate (); // Usually unnecessary, but may be needed (complex arrays).
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1379 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1380 catch (octave_execution_exception)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1381 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1382 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1383 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1384 }
9546
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1385 else
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1386 {
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1387
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1388 binary_op binop = op_eq_to_binary_op (op);
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1389
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1390 if (! error_state)
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1391 {
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1392 octave_value t = do_binary_op (binop, *this, rhs);
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1393
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1394 if (! error_state)
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1395 operator = (t);
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1396 }
1beb23d2b892 optimize op= in common cases
Jaroslav Hajek <highegg@gmail.com>
parents: 9479
diff changeset
1397 }
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1398 }
10544
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1399 else
9961fc022d9d fix assignment to non-existing variables and octave_value::assign
Jaroslav Hajek <highegg@gmail.com>
parents: 10521
diff changeset
1400 error ("in computed assignment A OP= X, A must be defined first");
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
1401
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1402 return *this;
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1403 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1404
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5164
diff changeset
1405 octave_idx_type
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1406 octave_value::length (void) const
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1407 {
10654
984b8b6bee02 simplify octave_value::length
Jaroslav Hajek <highegg@gmail.com>
parents: 10614
diff changeset
1408 octave_idx_type retval = 0;
984b8b6bee02 simplify octave_value::length
Jaroslav Hajek <highegg@gmail.com>
parents: 10614
diff changeset
1409
984b8b6bee02 simplify octave_value::length
Jaroslav Hajek <highegg@gmail.com>
parents: 10614
diff changeset
1410 const dim_vector dv = dims ();
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
1411
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1412 for (int i = 0; i < dv.length (); i++)
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1413 {
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
1414 if (dv(i) == 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1415 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1416 retval = 0;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1417 break;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1418 }
4584
f7697d703481 [project @ 2003-10-31 19:47:35 by jwe]
jwe
parents: 4582
diff changeset
1419
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1420 if (dv(i) > retval)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1421 retval = dv(i);
4563
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1422 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1423
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1424 return retval;
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1425 }
742993a501b9 [project @ 2003-10-29 06:25:12 by jwe]
jwe
parents: 4532
diff changeset
1426
8346
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1427 bool
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1428 octave_value::is_equal (const octave_value& test) const
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1429 {
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1430 bool retval = false;
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1431
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1432 // If there is no op_eq for these types, we can't compare values.
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1433
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1434 if (rows () == test.rows () && columns () == test.columns ())
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1435 {
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1436 octave_value tmp = do_binary_op (octave_value::op_eq, *this, test);
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1437
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1438 // Empty array also means a match.
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1439 if (! error_state && tmp.is_defined ())
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1440 retval = tmp.is_true () || tmp.is_empty ();
8346
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1441 }
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1442
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1443 return retval;
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1444 }
8302788f09db fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents: 8345
diff changeset
1445
3351
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1446 Cell
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1447 octave_value::cell_value (void) const
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1448 {
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1449 return rep->cell_value ();
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1450 }
8623649c967c [project @ 1999-11-15 16:17:01 by jwe]
jwe
parents: 3340
diff changeset
1451
8017
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1452 // Define the idx_type_value function here instead of in ov.h to avoid
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1453 // needing definitions for the SIZEOF_X macros in ov.h.
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1454
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1455 octave_idx_type
8024
dc36eb214129 ov.cc (octave_value::idx_type_value): don't include default argument value in definition
John W. Eaton <jwe@octave.org>
parents: 8017
diff changeset
1456 octave_value::idx_type_value (bool req_int, bool frc_str_conv) const
8017
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1457 {
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1458 #if SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_LONG
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1459 return long_value (req_int, frc_str_conv);
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1460 #elif SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_INT
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1461 return int_value (req_int, frc_str_conv);
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1462 #else
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1463 #error "no octave_value extractor for octave_idx_type"
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1464 #endif
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1465 }
260294a5520f octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents: 8011
diff changeset
1466
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1467 octave_map
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1468 octave_value::map_value (void) const
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1469 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1470 return rep->map_value ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1471 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1472
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1473 octave_scalar_map
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1474 octave_value::scalar_map_value (void) const
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1475 {
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1476 return rep->scalar_map_value ();
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1477 }
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10687
diff changeset
1478
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
1479 octave_function *
7761
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1480 octave_value::function_value (bool silent) const
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1481 {
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1482 return rep->function_value (silent);
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1483 }
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7719
diff changeset
1484
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1485 octave_user_function *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1486 octave_value::user_function_value (bool silent) const
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1487 {
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1488 return rep->user_function_value (silent);
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1489 }
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
1490
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1491 octave_user_script *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1492 octave_value::user_script_value (bool silent) const
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1493 {
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1494 return rep->user_script_value (silent);
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1495 }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1496
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1497 octave_user_code *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1498 octave_value::user_code_value (bool silent) const
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1499 {
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1500 return rep->user_code_value (silent);
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1501 }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
1502
4346
d39de791ef9c [project @ 2003-02-20 21:38:39 by jwe]
jwe
parents: 4343
diff changeset
1503 octave_fcn_handle *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1504 octave_value::fcn_handle_value (bool silent) const
4343
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1505 {
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1506 return rep->fcn_handle_value (silent);
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1507 }
db5e0814277a [project @ 2003-02-20 16:44:16 by jwe]
jwe
parents: 4342
diff changeset
1508
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1509 octave_fcn_inline *
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
1510 octave_value::fcn_inline_value (bool silent) const
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1511 {
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1512 return rep->fcn_inline_value (silent);
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1513 }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents: 4930
diff changeset
1514
2880
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1515 octave_value_list
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1516 octave_value::list_value (void) const
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1517 {
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1518 return rep->list_value ();
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1519 }
0a076230ca87 [project @ 1997-04-24 09:47:41 by jwe]
jwe
parents: 2847
diff changeset
1520
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1521 static dim_vector
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1522 make_vector_dims (const dim_vector& dv, bool force_vector_conversion,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1523 const std::string& my_type, const std::string& wanted_type)
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1524 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1525 dim_vector retval (dv);
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1526 retval.chop_trailing_singletons ();
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1527 octave_idx_type nel = dv.numel ();
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1528
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1529 if (retval.length () > 2 || (retval(0) != 1 && retval(1) != 1))
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1530 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1531 if (!force_vector_conversion)
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1532 gripe_implicit_conversion ("Octave:array-as-vector",
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1533 my_type.c_str (), wanted_type.c_str ());
10350
12884915a8e4 merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents: 10325
diff changeset
1534 retval = dim_vector (nel, 1);
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1535 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1536
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1537 return retval;
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1538 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1539
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1540 ColumnVector
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1541 octave_value::column_vector_value (bool force_string_conv,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1542 bool frc_vec_conv) const
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1543 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1544 return ColumnVector (vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1545 frc_vec_conv));
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1546 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1547
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1548 ComplexColumnVector
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1549 octave_value::complex_column_vector_value (bool force_string_conv,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1550 bool frc_vec_conv) const
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1551 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1552 return ComplexColumnVector (complex_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1553 frc_vec_conv));
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1554 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1555
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1556 RowVector
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1557 octave_value::row_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1558 bool frc_vec_conv) const
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1559 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1560 return RowVector (vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1561 frc_vec_conv));
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1562 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1563
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1564 ComplexRowVector
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1565 octave_value::complex_row_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1566 bool frc_vec_conv) const
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1567 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1568 return ComplexRowVector (complex_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1569 frc_vec_conv));
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1570 }
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1571
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1572 Array<double>
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1573 octave_value::vector_value (bool force_string_conv,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1574 bool force_vector_conversion) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1575 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1576 Array<double> retval = array_value (force_string_conv);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1577
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1578 if (error_state)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1579 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1580 else
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1581 return retval.reshape (make_vector_dims (retval.dims (),
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1582 force_vector_conversion,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1583 type_name (), "real vector"));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1584 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1585
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1586 template <class T>
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1587 static Array<int>
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1588 convert_to_int_array (const Array<octave_int<T> >& A)
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1589 {
7999
f7f2d867c523 style fixes
John W. Eaton <jwe@octave.org>
parents: 7997
diff changeset
1590 Array<int> retval (A.dims ());
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1591 octave_idx_type n = A.numel ();
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1592
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1593 for (octave_idx_type i = 0; i < n; i++)
7999
f7f2d867c523 style fixes
John W. Eaton <jwe@octave.org>
parents: 7997
diff changeset
1594 retval.xelem (i) = octave_int<int> (A.xelem (i));
8039
cd90e2842080 Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents: 8024
diff changeset
1595
7999
f7f2d867c523 style fixes
John W. Eaton <jwe@octave.org>
parents: 7997
diff changeset
1596 return retval;
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1597 }
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1598
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1599 Array<int>
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1600 octave_value::int_vector_value (bool force_string_conv, bool require_int,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1601 bool force_vector_conversion) const
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1602 {
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1603 Array<int> retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1604
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1605 if (is_integer_type ())
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1606 {
7997
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1607 if (is_int32_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1608 retval = convert_to_int_array (int32_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1609 else if (is_int64_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1610 retval = convert_to_int_array (int64_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1611 else if (is_int16_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1612 retval = convert_to_int_array (int16_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1613 else if (is_int8_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1614 retval = convert_to_int_array (int8_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1615 else if (is_uint32_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1616 retval = convert_to_int_array (uint32_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1617 else if (is_uint64_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1618 retval = convert_to_int_array (uint64_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1619 else if (is_uint16_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1620 retval = convert_to_int_array (uint16_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1621 else if (is_uint8_type ())
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1622 retval = convert_to_int_array (uint8_array_value ());
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1623 else
2b8952e133c9 implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents: 7892
diff changeset
1624 retval = array_value (force_string_conv);
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1625 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1626 else
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1627 {
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1628 const NDArray a = array_value (force_string_conv);
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1629 if (! error_state)
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1630 {
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1631 if (require_int)
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1632 {
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1633 retval.resize (a.dims ());
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1634 for (octave_idx_type i = 0; i < a.numel (); i++)
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1635 {
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1636 double ai = a.elem (i);
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1637 int v = static_cast<int> (ai);
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1638 if (ai == v)
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1639 retval.xelem (i) = v;
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1640 else
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1641 {
9753
892e2aa7bc75 improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
1642 error_with_cfn ("conversion to integer value failed");
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1643 break;
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1644 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1645 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1646 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1647 else
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1648 retval = Array<int> (a);
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1649 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1650 }
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1651
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1652
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1653 if (error_state)
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1654 return retval;
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1655 else
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1656 return retval.reshape (make_vector_dims (retval.dims (),
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1657 force_vector_conversion,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1658 type_name (), "integer vector"));
4044
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1659 }
9678c5526190 [project @ 2002-08-15 16:54:55 by jwe]
jwe
parents: 4038
diff changeset
1660
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1661 template <class T>
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1662 static Array<octave_idx_type>
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1663 convert_to_octave_idx_type_array (const Array<octave_int<T> >& A)
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1664 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1665 Array<octave_idx_type> retval (A.dims ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1666 octave_idx_type n = A.numel ();
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1667
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1668 for (octave_idx_type i = 0; i < n; i++)
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1669 retval.xelem (i) = octave_int<octave_idx_type> (A.xelem (i));
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1670
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1671 return retval;
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1672 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1673
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1674 Array<octave_idx_type>
9479
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1675 octave_value::octave_idx_type_vector_value (bool require_int,
d9716e3ee0dd supply optimized compiled sub2ind & ind2sub
Jaroslav Hajek <highegg@gmail.com>
parents: 9368
diff changeset
1676 bool force_string_conv,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1677 bool force_vector_conversion) const
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1678 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1679 Array<octave_idx_type> retval;
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1680
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1681 if (is_integer_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1682 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1683 if (is_int32_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1684 retval = convert_to_octave_idx_type_array (int32_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1685 else if (is_int64_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1686 retval = convert_to_octave_idx_type_array (int64_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1687 else if (is_int16_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1688 retval = convert_to_octave_idx_type_array (int16_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1689 else if (is_int8_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1690 retval = convert_to_octave_idx_type_array (int8_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1691 else if (is_uint32_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1692 retval = convert_to_octave_idx_type_array (uint32_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1693 else if (is_uint64_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1694 retval = convert_to_octave_idx_type_array (uint64_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1695 else if (is_uint16_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1696 retval = convert_to_octave_idx_type_array (uint16_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1697 else if (is_uint8_type ())
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1698 retval = convert_to_octave_idx_type_array (uint8_array_value ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1699 else
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1700 retval = array_value (force_string_conv);
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1701 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1702 else
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1703 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1704 const NDArray a = array_value (force_string_conv);
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1705 if (! error_state)
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1706 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1707 if (require_int)
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1708 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1709 retval.resize (a.dims ());
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1710 for (octave_idx_type i = 0; i < a.numel (); i++)
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1711 {
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1712 double ai = a.elem (i);
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1713 octave_idx_type v = static_cast<octave_idx_type> (ai);
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1714 if (ai == v)
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1715 retval.xelem (i) = v;
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1716 else
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1717 {
9753
892e2aa7bc75 improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents: 9732
diff changeset
1718 error_with_cfn ("conversion to integer value failed");
8811
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1719 break;
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1720 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1721 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1722 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1723 else
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1724 retval = Array<octave_idx_type> (a);
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1725 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1726 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1727
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1728
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1729 if (error_state)
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1730 return retval;
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1731 else
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1732 return retval.reshape (make_vector_dims (retval.dims (),
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1733 force_vector_conversion,
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1734 type_name (), "integer vector"));
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1735 }
20dfb885f877 int -> octave_idx fixes
John W. Eaton <jwe@octave.org>
parents: 8551
diff changeset
1736
3419
e71b3d1dd327 [project @ 2000-01-12 05:23:34 by jwe]
jwe
parents: 3418
diff changeset
1737 Array<Complex>
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1738 octave_value::complex_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1739 bool force_vector_conversion) const
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1740 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1741 Array<Complex> retval = complex_array_value (force_string_conv);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1742
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1743 if (error_state)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1744 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1745 else
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1746 return retval.reshape (make_vector_dims (retval.dims (),
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1747 force_vector_conversion,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1748 type_name (), "complex vector"));
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1749 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1750
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1751 FloatColumnVector
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1752 octave_value::float_column_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1753 bool frc_vec_conv) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1754 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1755 return FloatColumnVector (float_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1756 frc_vec_conv));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1757 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1758
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1759 FloatComplexColumnVector
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1760 octave_value::float_complex_column_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1761 bool frc_vec_conv) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1762 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1763 return FloatComplexColumnVector (float_complex_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1764 frc_vec_conv));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1765 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1766
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1767 FloatRowVector
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1768 octave_value::float_row_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1769 bool frc_vec_conv) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1770 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1771 return FloatRowVector (float_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1772 frc_vec_conv));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1773 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1774
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1775 FloatComplexRowVector
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1776 octave_value::float_complex_row_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1777 bool frc_vec_conv) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1778 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1779 return FloatComplexRowVector (float_complex_vector_value (force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1780 frc_vec_conv));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1781 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1782
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1783 Array<float>
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1784 octave_value::float_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1785 bool force_vector_conversion) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1786 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1787 Array<float> retval = float_array_value (force_string_conv);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1788
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1789 if (error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1790 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1791 else
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1792 return retval.reshape (make_vector_dims (retval.dims (),
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1793 force_vector_conversion,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1794 type_name (), "real vector"));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1795 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1796
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1797 Array<FloatComplex>
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1798 octave_value::float_complex_vector_value (bool force_string_conv,
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1799 bool force_vector_conversion) const
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1800 {
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1801 Array<FloatComplex> retval = float_complex_array_value (force_string_conv);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1802
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1803 if (error_state)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1804 return retval;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1805 else
7892
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1806 return retval.reshape (make_vector_dims (retval.dims (),
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1807 force_vector_conversion,
7ca2735d74c2 simplify & cleanup octave_value::XXX_vector_value functions
Jaroslav Hajek <highegg@gmail.com>
parents: 7885
diff changeset
1808 type_name (), "complex vector"));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1809 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
1810
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1811 octave_value
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1812 octave_value::storable_value (void) const
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1813 {
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1814 octave_value retval = *this;
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1815 if (is_null_value ())
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1816 retval = octave_value (rep->empty_clone ());
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1817 else
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1818 retval.maybe_economize ();
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1819
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1820 return retval;
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1821 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1822
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1823 void
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1824 octave_value::make_storable_value (void)
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1825 {
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1826 if (is_null_value ())
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1827 {
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1828 octave_base_value *rc = rep->empty_clone ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1829 if (--rep->count == 0)
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1830 delete rep;
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1831 rep = rc;
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1832 }
8523
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1833 else
ad3afaaa19c1 implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents: 8367
diff changeset
1834 maybe_economize ();
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1835 }
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
1836
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1837 int
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1838 octave_value::write (octave_stream& os, int block_size,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1839 oct_data_conv::data_type output_type, int skip,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1840 oct_mach_info::float_format flt_fmt) const
4944
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1841 {
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1842 return rep->write (os, block_size, output_type, skip, flt_fmt);
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1843 }
44046bbaa52c [project @ 2004-08-31 05:30:46 by jwe]
jwe
parents: 4933
diff changeset
1844
2413
44753e0cadf2 [project @ 1996-10-15 17:02:26 by jwe]
jwe
parents: 2410
diff changeset
1845 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1846 gripe_binary_op (const std::string& on, const std::string& tn1,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1847 const std::string& tn2)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1848 {
2903
facd9d10e5c1 [project @ 1997-04-30 03:53:07 by jwe]
jwe
parents: 2891
diff changeset
1849 error ("binary operator `%s' not implemented for `%s' by `%s' operations",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1850 on.c_str (), tn1.c_str (), tn2.c_str ());
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1851 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1852
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1853 static void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
1854 gripe_binary_op_conv (const std::string& on)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1855 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1856 error ("type conversion failed for binary operator `%s'", on.c_str ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1857 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
1858
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1859 octave_value
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
1860 do_binary_op (octave_value::binary_op op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1861 const octave_value& v1, const octave_value& v2)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1862 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1863 octave_value retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1864
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1865 int t1 = v1.type_id ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1866 int t2 = v2.type_id ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1867
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1868 if (t1 == octave_class::static_type_id ()
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1869 || t2 == octave_class::static_type_id ())
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1870 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1871 octave_value_typeinfo::binary_class_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1872 = octave_value_typeinfo::lookup_binary_class_op (op);
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1873
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1874 if (f)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1875 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1876 try
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1877 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1878 retval = f (v1, v2);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1879 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1880 catch (octave_execution_exception)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1881 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1882 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1883 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
1884 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1885 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1886 gripe_binary_op (octave_value::binary_op_as_string (op),
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1887 v1.class_name (), v2.class_name ());
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1888 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1889 else
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1890 {
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1891 // FIXME -- we need to handle overloading operators for built-in
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1892 // classes (double, char, int8, etc.)
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
1893
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1894 octave_value_typeinfo::binary_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1895 = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1896
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1897 if (f)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1898 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1899 try
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1900 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1901 retval = f (*v1.rep, *v2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1902 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1903 catch (octave_execution_exception)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1904 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1905 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1906 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1907 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1908 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1909 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1910 octave_value tv1;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1911 octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1912
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1913 octave_value tv2;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1914 octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1915
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1916 // Try biased (one-sided) conversions first.
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1917 if (cf2.type_id () >= 0 &&
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1918 octave_value_typeinfo::lookup_binary_op (op, t1, cf2.type_id ()))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1919 cf1 = 0;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1920 else if (cf1.type_id () >= 0 &&
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1921 octave_value_typeinfo::lookup_binary_op (op, cf1.type_id (), t2))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1922 cf2 = 0;
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
1923
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1924 if (cf1)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1925 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1926 octave_base_value *tmp = cf1 (*v1.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1927
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1928 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1929 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1930 tv1 = octave_value (tmp);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1931 t1 = tv1.type_id ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1932 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1933 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1934 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1935 gripe_binary_op_conv (octave_value::binary_op_as_string (op));
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1936 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1937 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1938 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1939 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1940 tv1 = v1;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1941
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1942 if (cf2)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1943 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1944 octave_base_value *tmp = cf2 (*v2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1945
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1946 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1947 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1948 tv2 = octave_value (tmp);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1949 t2 = tv2.type_id ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1950 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1951 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1952 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1953 gripe_binary_op_conv (octave_value::binary_op_as_string (op));
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1954 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1955 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1956 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1957 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1958 tv2 = v2;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1959
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1960 if (cf1 || cf2)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1961 {
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1962 retval = do_binary_op (op, tv1, tv2);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1963 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1964 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1965 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1966 //demote double -> single and try again
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1967 cf1 = tv1.numeric_demotion_function ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1968
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1969 cf2 = tv2.numeric_demotion_function ();
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1970
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1971 // Try biased (one-sided) conversions first.
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1972 if (cf2.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1973 && octave_value_typeinfo::lookup_binary_op (op, t1, cf2.type_id ()))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1974 cf1 = 0;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1975 else if (cf1.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1976 && octave_value_typeinfo::lookup_binary_op (op, cf1.type_id (), t2))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1977 cf2 = 0;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
1978
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1979 if (cf1)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1980 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1981 octave_base_value *tmp = cf1 (*tv1.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1982
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1983 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1984 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1985 tv1 = octave_value (tmp);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1986 t1 = tv1.type_id ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1987 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1988 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1989 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1990 gripe_binary_op_conv (octave_value::binary_op_as_string (op));
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1991 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1992 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1993 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1994
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1995 if (cf2)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1996 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1997 octave_base_value *tmp = cf2 (*tv2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1998
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
1999 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2000 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2001 tv2 = octave_value (tmp);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2002 t2 = tv2.type_id ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2003 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2004 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2005 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2006 gripe_binary_op_conv (octave_value::binary_op_as_string (op));
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2007 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2008 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2009 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2010
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2011 if (cf1 || cf2)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2012 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2013 f = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2014
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2015 if (f)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2016 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2017 try
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2018 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2019 retval = f (*tv1.rep, *tv2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2020 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2021 catch (octave_execution_exception)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2022 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2023 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2024 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2025 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2026 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2027 gripe_binary_op (octave_value::binary_op_as_string (op),
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2028 v1.type_name (), v2.type_name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2029 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2030 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2031 gripe_binary_op (octave_value::binary_op_as_string (op),
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2032 v1.type_name (), v2.type_name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2033 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2034 }
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2035 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2036
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2037 return retval;
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2038 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2039
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2040 static octave_value
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2041 decompose_binary_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2042 const octave_value& v1, const octave_value& v2)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2043 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2044 octave_value retval;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2045
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2046 switch (op)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2047 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2048 case octave_value::op_trans_mul:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2049 retval = do_binary_op (octave_value::op_mul,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2050 do_unary_op (octave_value::op_transpose, v1),
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2051 v2);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2052 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2053 case octave_value::op_mul_trans:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2054 retval = do_binary_op (octave_value::op_mul,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2055 v1,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2056 do_unary_op (octave_value::op_transpose, v2));
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2057 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2058 case octave_value::op_herm_mul:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2059 retval = do_binary_op (octave_value::op_mul,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2060 do_unary_op (octave_value::op_hermitian, v1),
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2061 v2);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2062 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2063 case octave_value::op_mul_herm:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2064 retval = do_binary_op (octave_value::op_mul,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2065 v1,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2066 do_unary_op (octave_value::op_hermitian, v2));
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2067 break;
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2068 case octave_value::op_trans_ldiv:
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2069 retval = do_binary_op (octave_value::op_ldiv,
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2070 do_unary_op (octave_value::op_transpose, v1),
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2071 v2);
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2072 break;
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2073 case octave_value::op_herm_ldiv:
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2074 retval = do_binary_op (octave_value::op_ldiv,
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2075 do_unary_op (octave_value::op_hermitian, v1),
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2076 v2);
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 9608
diff changeset
2077 break;
8982
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2078 case octave_value::op_el_not_and:
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2079 retval = do_binary_op (octave_value::op_el_and,
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2080 do_unary_op (octave_value::op_not, v1),
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2081 v2);
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2082 break;
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2083 case octave_value::op_el_not_or:
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2084 retval = do_binary_op (octave_value::op_el_or,
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2085 do_unary_op (octave_value::op_not, v1),
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2086 v2);
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2087 break;
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2088 case octave_value::op_el_and_not:
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2089 retval = do_binary_op (octave_value::op_el_and,
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2090 v1,
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2091 do_unary_op (octave_value::op_not, v2));
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2092 break;
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2093 case octave_value::op_el_or_not:
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2094 retval = do_binary_op (octave_value::op_el_or,
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2095 v1,
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2096 do_unary_op (octave_value::op_not, v2));
dc6bda6f9994 implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8960
diff changeset
2097 break;
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2098 default:
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2099 error ("invalid compound operator");
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2100 break;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2101 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2102
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2103 return retval;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2104 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2105
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2106 octave_value
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2107 do_binary_op (octave_value::compound_binary_op op,
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2108 const octave_value& v1, const octave_value& v2)
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2109 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2110 octave_value retval;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2111
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2112 int t1 = v1.type_id ();
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2113 int t2 = v2.type_id ();
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2114
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2115 if (t1 == octave_class::static_type_id ()
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2116 || t2 == octave_class::static_type_id ())
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2117 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2118 octave_value_typeinfo::binary_class_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2119 = octave_value_typeinfo::lookup_binary_class_op (op);
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2120
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2121 if (f)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2122 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2123 try
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2124 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2125 retval = f (v1, v2);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2126 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2127 catch (octave_execution_exception)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2128 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2129 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2130 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2131 }
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2132 else
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2133 retval = decompose_binary_op (op, v1, v2);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2134 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2135 else
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2136 {
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2137 octave_value_typeinfo::binary_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2138 = octave_value_typeinfo::lookup_binary_op (op, t1, t2);
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2139
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2140 if (f)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2141 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2142 try
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2143 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2144 retval = f (*v1.rep, *v2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2145 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2146 catch (octave_execution_exception)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2147 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2148 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2149 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2150 }
7800
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2151 else
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2152 retval = decompose_binary_op (op, v1, v2);
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2153 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2154
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2155 return retval;
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2156 }
5861b95e9879 support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
2157
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2158 static void
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2159 gripe_cat_op (const std::string& tn1, const std::string& tn2)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2160 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2161 error ("concatenation operator not implemented for `%s' by `%s' operations",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2162 tn1.c_str (), tn2.c_str ());
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2163 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2164
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2165 static void
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2166 gripe_cat_op_conv (void)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2167 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2168 error ("type conversion failed for concatenation operator");
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2169 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2170
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2171 octave_value
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2172 do_cat_op (const octave_value& v1, const octave_value& v2,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2173 const Array<octave_idx_type>& ra_idx)
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2174 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2175 octave_value retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2176
7814
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7800
diff changeset
2177 // Can't rapid return for concatenation with an empty object here as
87865ed7405f Second set of single precision test code and fix of resulting bugs
David Bateman <dbateman@free.fr>
parents: 7800
diff changeset
2178 // something like cat(1,[],single([]) must return the correct type.
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
2179
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2180 int t1 = v1.type_id ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2181 int t2 = v2.type_id ();
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2182
5759
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5758
diff changeset
2183 octave_value_typeinfo::cat_op_fcn f
ce79d238f142 [project @ 2006-04-13 13:04:32 by jwe]
jwe
parents: 5758
diff changeset
2184 = octave_value_typeinfo::lookup_cat_op (t1, t2);
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2185
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2186 if (f)
7487
1e01db14700b catch octave_execution_exception for built-in and mex functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
2187 {
1e01db14700b catch octave_execution_exception for built-in and mex functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
2188 try
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2189 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2190 retval = f (*v1.rep, *v2.rep, ra_idx);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2191 }
7487
1e01db14700b catch octave_execution_exception for built-in and mex functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
2192 catch (octave_execution_exception)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2193 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2194 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2195 }
7487
1e01db14700b catch octave_execution_exception for built-in and mex functions
John W. Eaton <jwe@octave.org>
parents: 7433
diff changeset
2196 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2197 else
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2198 {
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2199 octave_value tv1;
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2200 octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2201
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2202 octave_value tv2;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2203 octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2204
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2205 // Try biased (one-sided) conversions first.
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2206 if (cf2.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2207 && octave_value_typeinfo::lookup_cat_op (t1, cf2.type_id ()))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2208 cf1 = 0;
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2209 else if (cf1.type_id () >= 0
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2210 && octave_value_typeinfo::lookup_cat_op (cf1.type_id (), t2))
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2211 cf2 = 0;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2212
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2213 if (cf1)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2214 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2215 octave_base_value *tmp = cf1 (*v1.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2216
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2217 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2218 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2219 tv1 = octave_value (tmp);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2220 t1 = tv1.type_id ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2221 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2222 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2223 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2224 gripe_cat_op_conv ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2225 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2226 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2227 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2228 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2229 tv1 = v1;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2230
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2231 if (cf2)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2232 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2233 octave_base_value *tmp = cf2 (*v2.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2234
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2235 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2236 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2237 tv2 = octave_value (tmp);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2238 t2 = tv2.type_id ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2239 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2240 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2241 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2242 gripe_cat_op_conv ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2243 return retval;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2244 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2245 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2246 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2247 tv2 = v2;
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2248
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2249 if (cf1 || cf2)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2250 {
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2251 retval = do_cat_op (tv1, tv2, ra_idx);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2252 }
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2253 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2254 gripe_cat_op (v1.type_name (), v2.type_name ());
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2255 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2256
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2257 return retval;
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2258 }
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4911
diff changeset
2259
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2260 void
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2261 octave_value::print_info (std::ostream& os, const std::string& prefix) const
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2262 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2263 os << prefix << "type_name: " << type_name () << "\n"
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2264 << prefix << "count: " << get_count () << "\n"
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2265 << prefix << "rep info: ";
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2266
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2267 rep->print_info (os, prefix + " ");
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2268 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2269
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2270 static void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
2271 gripe_unary_op (const std::string& on, const std::string& tn)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2272 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2273 error ("unary operator `%s' not implemented for `%s' operands",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2274 on.c_str (), tn.c_str ());
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2275 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2276
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2277 static void
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3465
diff changeset
2278 gripe_unary_op_conv (const std::string& on)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2279 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2280 error ("type conversion failed for unary operator `%s'", on.c_str ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2281 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2282
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2283 octave_value
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2284 do_unary_op (octave_value::unary_op op, const octave_value& v)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2285 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2286 octave_value retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2287
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2288 int t = v.type_id ();
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2289
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2290 if (t == octave_class::static_type_id ())
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2291 {
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2292 octave_value_typeinfo::unary_class_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2293 = octave_value_typeinfo::lookup_unary_class_op (op);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2294
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2295 if (f)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2296 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2297 try
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2298 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2299 retval = f (v);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2300 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2301 catch (octave_execution_exception)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2302 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2303 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2304 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2305 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2306 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2307 gripe_unary_op (octave_value::unary_op_as_string (op),
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2308 v.class_name ());
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2309 }
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2310 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2311 {
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2312 // FIXME -- we need to handle overloading operators for built-in
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2313 // classes (double, char, int8, etc.)
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2314
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2315 octave_value_typeinfo::unary_op_fcn f
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2316 = octave_value_typeinfo::lookup_unary_op (op, t);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2317
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2318 if (f)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2319 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2320 try
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2321 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2322 retval = f (*v.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2323 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2324 catch (octave_execution_exception)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2325 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2326 gripe_library_execution_error ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2327 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2328 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2329 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2330 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2331 octave_value tv;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2332 octave_base_value::type_conv_fcn cf
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2333 = v.numeric_conversion_function ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2334
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2335 if (cf)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2336 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2337 octave_base_value *tmp = cf (*v.rep);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2338
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2339 if (tmp)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2340 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2341 tv = octave_value (tmp);
8345
c777f3ce02d8 smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents: 8150
diff changeset
2342 retval = do_unary_op (op, tv);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2343 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2344 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2345 gripe_unary_op_conv (octave_value::unary_op_as_string (op));
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2346 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2347 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2348 gripe_unary_op (octave_value::unary_op_as_string (op),
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2349 v.type_name ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2350 }
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2351 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2352
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2353 return retval;
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2354 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2355
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2356 static void
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2357 gripe_unary_op_conversion_failed (const std::string& op,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2358 const std::string& tn)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2359 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2360 error ("operator %s: type conversion for `%s' failed",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2361 op.c_str (), tn.c_str ());
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2362 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2363
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2364 octave_value&
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2365 octave_value::do_non_const_unary_op (unary_op op)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2366 {
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2367 if (op == op_incr || op == op_decr)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2368 {
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2369 // We want the gripe just here, because in the other branch this should
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2370 // not happen, and if it did anyway (internal error), the message would
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2371 // be confusing.
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2372 if (is_undefined ())
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2373 {
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2374 std::string op_str = unary_op_as_string (op);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2375 error ("in x%s or %sx, x must be defined first",
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2376 op_str.c_str (), op_str.c_str ());
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2377 return *this;
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2378 }
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2379
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2380 // Genuine.
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2381 int t = type_id ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2382
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2383 octave_value_typeinfo::non_const_unary_op_fcn f
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2384 = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2385
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2386 if (f)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2387 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2388 make_unique ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2389
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2390 try
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2391 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2392 f (*rep);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2393 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2394 catch (octave_execution_exception)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2395 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2396 gripe_library_execution_error ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2397 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2398 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2399 else
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2400 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2401 octave_base_value::type_conv_fcn cf = numeric_conversion_function ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2402
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2403 if (cf)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2404 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2405 octave_base_value *tmp = cf (*rep);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2406
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2407 if (tmp)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2408 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2409 octave_base_value *old_rep = rep;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2410 rep = tmp;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2411
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2412 t = type_id ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2413
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2414 f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2415
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2416 if (f)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2417 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2418 try
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2419 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2420 f (*rep);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2421 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2422 catch (octave_execution_exception)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2423 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2424 gripe_library_execution_error ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2425 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2426
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2427 if (old_rep && --old_rep->count == 0)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2428 delete old_rep;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2429 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2430 else
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2431 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2432 if (old_rep)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2433 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2434 if (--rep->count == 0)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2435 delete rep;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2436
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2437 rep = old_rep;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2438 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2439
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2440 gripe_unary_op (octave_value::unary_op_as_string (op),
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2441 type_name ());
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2442 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2443 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2444 else
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2445 gripe_unary_op_conversion_failed
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2446 (octave_value::unary_op_as_string (op), type_name ());
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2447 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2448 else
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2449 gripe_unary_op (octave_value::unary_op_as_string (op), type_name ());
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2450 }
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2451 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2452 else
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2453 {
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2454 // Non-genuine.
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2455 int t = type_id ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2456
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2457 octave_value_typeinfo::non_const_unary_op_fcn f = 0;
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2458
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2459 // Only attempt to operate in-place if this variable is unshared.
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2460 if (rep->count == 1)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2461 f = octave_value_typeinfo::lookup_non_const_unary_op (op, t);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2462
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2463 if (f)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2464 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2465 try
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2466 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2467 f (*rep);
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2468 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2469 catch (octave_execution_exception)
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2470 {
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2471 gripe_library_execution_error ();
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2472 }
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2473 }
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2474 else
9607
1be3c73ed7b5 reuse temporary arrays in nested expressions
Jaroslav Hajek <highegg@gmail.com>
parents: 9546
diff changeset
2475 *this = do_unary_op (op, *this);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2476 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2477
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2478 return *this;
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2479 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 3196
diff changeset
2480
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2481 octave_value&
4247
fc9a075d10fb [project @ 2002-12-30 23:05:27 by jwe]
jwe
parents: 4233
diff changeset
2482 octave_value::do_non_const_unary_op (unary_op op, const std::string& type,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2483 const std::list<octave_value_list>& idx)
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2484 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2485 if (idx.empty ())
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2486 do_non_const_unary_op (op);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2487 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2488 {
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5759
diff changeset
2489 // FIXME -- only do the following stuff if we can't find a
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2490 // specific function to call to handle the op= operation for the
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2491 // types we have.
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2492
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2493 assign_op assop = unary_op_to_assign_op (op);
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2494
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2495 assign (assop, type, idx, 1.0);
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2496 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2497
10614
d1194069e58c optimize code handling ++,--
Jaroslav Hajek <highegg@gmail.com>
parents: 10544
diff changeset
2498 return *this;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2499 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2500
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2501 octave_value::assign_op
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2502 octave_value::unary_op_to_assign_op (unary_op op)
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2503 {
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2504 assign_op binop = unknown_assign_op;
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2505
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2506 switch (op)
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2507 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2508 case op_incr:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2509 binop = op_add_eq;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2510 break;
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2511
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2512 case op_decr:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2513 binop = op_sub_eq;
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2514 break;
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2515
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2516 default:
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2517 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2518 std::string on = unary_op_as_string (op);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2519 error ("operator %s: no assign operator found", on.c_str ());
3205
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2520 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2521 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2522
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2523 return binop;
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2524 }
549691faa638 [project @ 1998-10-31 04:20:15 by jwe]
jwe
parents: 3204
diff changeset
2525
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2526 octave_value::binary_op
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2527 octave_value::op_eq_to_binary_op (assign_op op)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2528 {
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2529 binary_op binop = unknown_binary_op;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2530
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2531 switch (op)
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2532 {
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2533 case op_add_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2534 binop = op_add;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2535 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2536
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2537 case op_sub_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2538 binop = op_sub;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2539 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2540
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2541 case op_mul_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2542 binop = op_mul;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2543 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2544
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2545 case op_div_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2546 binop = op_div;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2547 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2548
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2549 case op_ldiv_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2550 binop = op_ldiv;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2551 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2552
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2553 case op_pow_eq:
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2554 binop = op_pow;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2555 break;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2556
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2557 case op_lshift_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2558 binop = op_lshift;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2559 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2560
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2561 case op_rshift_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2562 binop = op_rshift;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2563 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2564
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2565 case op_el_mul_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2566 binop = op_el_mul;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2567 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2568
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2569 case op_el_div_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2570 binop = op_el_div;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2571 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2572
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2573 case op_el_ldiv_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2574 binop = op_el_ldiv;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2575 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2576
4018
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2577 case op_el_pow_eq:
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2578 binop = op_el_pow;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2579 break;
a8621d87fbf5 [project @ 2002-08-05 03:17:25 by jwe]
jwe
parents: 4005
diff changeset
2580
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2581 case op_el_and_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2582 binop = op_el_and;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2583 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2584
3533
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2585 case op_el_or_eq:
a99cf9fc22fe [project @ 2000-02-02 11:45:24 by jwe]
jwe
parents: 3531
diff changeset
2586 binop = op_el_or;
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2587 break;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2588
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2589 default:
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2590 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2591 std::string on = assign_op_as_string (op);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2592 error ("operator %s: no binary operator found", on.c_str ());
3204
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2593 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2594 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2595
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2596 return binop;
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2597 }
81738e630f57 [project @ 1998-10-30 23:28:29 by jwe]
jwe
parents: 3203
diff changeset
2598
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2599 octave_value
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2600 octave_value::empty_conv (const std::string& type, const octave_value& rhs)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2601 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2602 octave_value retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2603
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2604 if (type.length () > 0)
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2605 {
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2606 switch (type[0])
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2607 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2608 case '(':
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2609 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2610 if (type.length () > 1 && type[1] == '.')
10754
92eb5fb58ebc fix resize with structs
Jaroslav Hajek <highegg@gmail.com>
parents: 10753
diff changeset
2611 retval = octave_map ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2612 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2613 retval = octave_value (rhs.empty_clone ());
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2614 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2615 break;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2616
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2617 case '{':
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2618 retval = Cell ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2619 break;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2620
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2621 case '.':
10754
92eb5fb58ebc fix resize with structs
Jaroslav Hajek <highegg@gmail.com>
parents: 10753
diff changeset
2622 retval = octave_scalar_map ();
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2623 break;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2624
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2625 default:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2626 panic_impossible ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2627 }
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2628 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2629 else
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2630 retval = octave_value (rhs.empty_clone ());
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2631
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2632 return retval;
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2633 }
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3928
diff changeset
2634
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2635 void
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2636 install_types (void)
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2637 {
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2638 octave_base_value::register_type ();
3928
e8627dc4bdf2 [project @ 2002-05-03 19:56:01 by jwe]
jwe
parents: 3546
diff changeset
2639 octave_cell::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2640 octave_scalar::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2641 octave_complex::register_type ();
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2642 octave_matrix::register_type ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
2643 octave_diag_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2644 octave_complex_matrix::register_type ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
2645 octave_complex_diag_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2646 octave_range::register_type ();
2825
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
2647 octave_bool::register_type ();
60ae49e1284f [project @ 1997-03-25 23:17:36 by jwe]
jwe
parents: 2800
diff changeset
2648 octave_bool_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2649 octave_char_matrix_str::register_type ();
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5275
diff changeset
2650 octave_char_matrix_sq_str::register_type ();
4901
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2651 octave_int8_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2652 octave_int16_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2653 octave_int32_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2654 octave_int64_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2655 octave_uint8_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2656 octave_uint16_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2657 octave_uint32_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2658 octave_uint64_scalar::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2659 octave_int8_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2660 octave_int16_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2661 octave_int32_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2662 octave_int64_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2663 octave_uint8_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2664 octave_uint16_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2665 octave_uint32_matrix::register_type ();
35bfb4e0b96b [project @ 2004-06-14 18:33:02 by jwe]
jwe
parents: 4894
diff changeset
2666 octave_uint64_matrix::register_type ();
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
2667 octave_sparse_bool_matrix::register_type ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
2668 octave_sparse_matrix::register_type ();
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents: 5147
diff changeset
2669 octave_sparse_complex_matrix::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2670 octave_struct::register_type ();
10753
bee1b1a2e29a yield compatible dims from cell2struct + more fixes. build & tests OK
Jaroslav Hajek <highegg@gmail.com>
parents: 10742
diff changeset
2671 octave_scalar_struct::register_type ();
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7065
diff changeset
2672 octave_class::register_type ();
3977
95663a3a2682 [project @ 2002-07-05 17:43:37 by jwe]
jwe
parents: 3961
diff changeset
2673 octave_cs_list::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2674 octave_magic_colon::register_type ();
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
2675 octave_builtin::register_type ();
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents: 2963
diff changeset
2676 octave_user_function::register_type ();
4649
f7ce581b27fb [project @ 2003-11-23 21:46:44 by jwe]
jwe
parents: 4645
diff changeset
2677 octave_dld_function::register_type ();
4643
ef3a14fb6847 [project @ 2003-11-22 12:25:44 by jwe]
jwe
parents: 4591
diff changeset
2678 octave_fcn_handle::register_type ();
4966
91b61d27b9b4 [project @ 2004-09-07 02:01:22 by jwe]
jwe
parents: 4965
diff changeset
2679 octave_fcn_inline::register_type ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
2680 octave_float_scalar::register_type ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
2681 octave_float_complex::register_type ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
2682 octave_float_matrix::register_type ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
2683 octave_float_diag_matrix::register_type ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7761
diff changeset
2684 octave_float_complex_matrix::register_type ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8346
diff changeset
2685 octave_float_complex_diag_matrix::register_type ();
8367
445d27d79f4e support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 8366
diff changeset
2686 octave_perm_matrix::register_type ();
8150
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2687 octave_null_matrix::register_type ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2688 octave_null_str::register_type ();
283989f2da9b make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 8039
diff changeset
2689 octave_null_sq_str::register_type ();
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
2690 octave_lazy_index::register_type ();
2376
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2691 }
2142216bf85a [project @ 1996-10-12 01:39:07 by jwe]
jwe
parents:
diff changeset
2692
4970
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2693 #if 0
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2694 DEFUN (cast, args, ,
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2695 "-*- texinfo -*-\n\
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2696 @deftypefn {Built-in Function} {} cast (@var{val}, @var{type})\n\
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2697 Convert @var{val} to the new data type @var{type}.\n\
5642
2618a0750ae6 [project @ 2006-03-06 21:26:48 by jwe]
jwe
parents: 5539
diff changeset
2698 @seealso{class, typeinfo}\n\
2618a0750ae6 [project @ 2006-03-06 21:26:48 by jwe]
jwe
parents: 5539
diff changeset
2699 @end deftypefn")
4970
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2700 {
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2701 octave_value retval;
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2702
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2703 if (args.length () == 2)
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2704 error ("cast: not implemented");
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2705 else
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5785
diff changeset
2706 print_usage ();
4970
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2707
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2708 return retval;
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2709 }
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2710 #endif
25c2664861bc [project @ 2004-09-08 05:02:32 by jwe]
jwe
parents: 4966
diff changeset
2711
4791
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2712 DEFUN (sizeof, args, ,
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2713 "-*- texinfo -*-\n\
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2714 @deftypefn {Built-in Function} {} sizeof (@var{val})\n\
10687
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10654
diff changeset
2715 Return the size of @var{val} in bytes.\n\
a8ce6bdecce5 Improve documentation strings.
Rik <octave@nomad.inbox5.com>
parents: 10654
diff changeset
2716 @seealso{whos}\n\
4791
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2717 @end deftypefn")
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2718 {
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2719 octave_value retval;
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2720
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2721 if (args.length () == 1)
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2722 retval = args(0).byte_size ();
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2723 else
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5785
diff changeset
2724 print_usage ();
4791
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2725
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2726 return retval;
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2727 }
62f2fb593455 [project @ 2004-02-20 18:02:59 by jwe]
jwe
parents: 4700
diff changeset
2728
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2729 DEFUN (subsref, args, nargout,
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2730 "-*- texinfo -*-\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2731 @deftypefn {Built-in Function} {} subsref (@var{val}, @var{idx})\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2732 Perform the subscripted element selection operation according to\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2733 the subscript specified by @var{idx}.\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2734 \n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2735 The subscript @var{idx} is expected to be a structure array with\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2736 fields @samp{type} and @samp{subs}. Valid values for @samp{type}\n\
6550
1b7a6061a05d [project @ 2007-04-20 07:40:26 by jwe]
jwe
parents: 6338
diff changeset
2737 are @samp{\"()\"}, @samp{\"@{@}\"}, and @samp{\".\"}.\n\
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2738 The @samp{subs} field may be either @samp{\":\"} or a cell array\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2739 of index values.\n\
6631
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2740 \n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2741 The following example shows how to extract the two first columns of\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2742 a matrix\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2743 \n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2744 @example\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8992
diff changeset
2745 @group\n\
6631
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2746 val = magic(3)\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2747 @result{} val = [ 8 1 6\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2748 3 5 7\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2749 4 9 2 ]\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2750 idx.type = \"()\";\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2751 idx.subs = @{\":\", 1:2@};\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2752 subsref(val, idx)\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2753 @result{} [ 8 1 \n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2754 3 5 \n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2755 4 9 ]\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8992
diff changeset
2756 @end group\n\
6631
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2757 @end example\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2758 \n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2759 @noindent\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2760 Note that this is the same as writing @code{val(:,1:2)}.\n\
6157
045038e0108a [project @ 2006-11-13 22:22:53 by jwe]
jwe
parents: 6153
diff changeset
2761 @seealso{subsasgn, substruct}\n\
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2762 @end deftypefn")
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2763 {
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2764 octave_value_list retval;
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2765
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2766 if (args.length () == 2)
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2767 {
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2768 std::string type;
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2769 std::list<octave_value_list> idx;
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2770
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2771 decode_subscripts ("subsref", args(1), type, idx);
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2772
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2773 if (! error_state)
10075
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
2774 {
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
2775 octave_value tmp = args(0);
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
2776 retval = tmp.subsref (type, idx, nargout);
84b0725f4b09 return class types by reference in const Array element access functions
Jaroslav Hajek <highegg@gmail.com>
parents: 10033
diff changeset
2777 }
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2778 }
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2779 else
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2780 print_usage ();
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2781
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2782 return retval;
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2783 }
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2784
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2785 DEFUN (subsasgn, args, ,
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2786 "-*- texinfo -*-\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2787 @deftypefn {Built-in Function} {} subsasgn (@var{val}, @var{idx}, @var{rhs})\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2788 Perform the subscripted assignment operation according to\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2789 the subscript specified by @var{idx}.\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2790 \n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2791 The subscript @var{idx} is expected to be a structure array with\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2792 fields @samp{type} and @samp{subs}. Valid values for @samp{type}\n\
6248
7fad1fad19e1 [project @ 2007-01-22 17:28:17 by jwe]
jwe
parents: 6157
diff changeset
2793 are @samp{\"()\"}, @samp{\"@{@}\"}, and @samp{\".\"}.\n\
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2794 The @samp{subs} field may be either @samp{\":\"} or a cell array\n\
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2795 of index values.\n\
6631
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2796 \n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2797 The following example shows how to set the two first columns of a\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2798 3-by-3 matrix to zero.\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2799 \n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2800 @example\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8992
diff changeset
2801 @group\n\
6631
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2802 val = magic(3);\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2803 idx.type = \"()\";\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2804 idx.subs = @{\":\", 1:2@};\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2805 subsasgn (val, idx, 0)\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2806 @result{} [ 0 0 6\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2807 0 0 7\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2808 0 0 2 ]\n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 8992
diff changeset
2809 @end group\n\
6631
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2810 @end example\n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2811 \n\
1b8daf8c0397 [project @ 2007-05-16 16:11:55 by jwe]
jwe
parents: 6550
diff changeset
2812 Note that this is the same as writing @code{val(:,1:2) = 0}.\n\
6157
045038e0108a [project @ 2006-11-13 22:22:53 by jwe]
jwe
parents: 6153
diff changeset
2813 @seealso{subsref, substruct}\n\
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2814 @end deftypefn")
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2815 {
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2816 octave_value retval;
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2817
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2818 if (args.length () == 3)
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2819 {
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2820 std::string type;
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2821 std::list<octave_value_list> idx;
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2822
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2823 decode_subscripts ("subsasgn", args(1), type, idx);
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2824
9368
ff612fdaee95 properly unshare variable in subsasgn
Jaroslav Hajek <highegg@gmail.com>
parents: 9351
diff changeset
2825 octave_value arg0 = args(0);
ff612fdaee95 properly unshare variable in subsasgn
Jaroslav Hajek <highegg@gmail.com>
parents: 9351
diff changeset
2826
ff612fdaee95 properly unshare variable in subsasgn
Jaroslav Hajek <highegg@gmail.com>
parents: 9351
diff changeset
2827 arg0.make_unique ();
ff612fdaee95 properly unshare variable in subsasgn
Jaroslav Hajek <highegg@gmail.com>
parents: 9351
diff changeset
2828
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2829 if (! error_state)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10232
diff changeset
2830 retval = arg0.subsasgn (type, idx, args(2));
6153
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2831 }
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2832 else
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2833 print_usage ();
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2834
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2835 return retval;
e60688a1ea07 [project @ 2006-11-13 17:30:54 by jwe]
jwe
parents: 5851
diff changeset
2836 }