Mercurial > hg > octave-lojdl
changeset 4550:69a9b22a72a2
[project @ 2003-10-27 15:41:55 by jwe]
author | jwe |
---|---|
date | Mon, 27 Oct 2003 15:41:55 +0000 |
parents | 2d393bead213 |
children | 2c619e5138fd |
files | src/ChangeLog src/OPERATORS/op-bm-bm.cc src/OPERATORS/op-cm-cm.cc src/OPERATORS/op-cm-cs.cc src/OPERATORS/op-cm-m.cc src/OPERATORS/op-cm-s.cc src/OPERATORS/op-cs-cm.cc src/OPERATORS/op-m-cm.cc src/OPERATORS/op-m-m.cc src/OPERATORS/op-s-cm.cc src/ops.h src/ov-base.cc src/ov-base.h src/ov-bool-mat.h src/ov-ch-mat.h src/ov-cx-mat.h src/ov-re-mat.h src/ov.h |
diffstat | 18 files changed, 221 insertions(+), 154 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,30 @@ +2003-10-27 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ops.h (DEFNDUNOP_OP, DEFNDUNOP_FN): New arg e, to name value + extractor function prefix. + * OPERATORS/op-bm-bm.cc, OPERATORS/op-cm-cm.cc, OPERATORS/op-m-m.cc: + Change all uses. + + * ov-cx-mat.h (octave_complex_matrix::complex_array_value, + octave_char_matrix::char_array_value, + octave_bool_matrix::bool_array_value): Rename from array_value. + * OPERATORS/op-bm-bm.cc, OPERATORS/op-cm-cm.cc, + OPERATORS/op-cm-cs.cc, OPERATORS/op-cm-m.cc, + OPERATORS/op-cm-s.cc, OPERATORS/op-cs-cm.cc, + OPERATORS/op-m-cm.cc, OPERATORS/op-m-m.cc, + OPERATORS/op-s-cm.cc: Use complex_array, char_array, and + bool_array as appropriate (instead of just array). + + * ov-base.cc (octave_base_value::array_value, + octave_base_value::bool_array_value, + octave_base_value::complex_array_value, + octave_base_value::char_array_value): Provide default implementations. + * ov-base.h: Provide decls. + + * ov.h (octave_value::array_value, octave_value::bool_array_value, + octave_value::complex_array_value, octave_value::char_array_value): + New virtual functions. + 2003-10-25 John W. Eaton <jwe@bevo.che.wisc.edu> * pt-idx.cc (make_subs_cell): Pass dim_vector object to resize.
--- a/src/OPERATORS/op-bm-bm.cc +++ b/src/OPERATORS/op-bm-bm.cc @@ -39,7 +39,7 @@ // unary bool matrix ops. -DEFNDUNOP_OP (not, bool_matrix, !) +DEFNDUNOP_OP (not, bool_matrix, bool_array, !) DEFUNOP (transpose, bool_matrix) { @@ -50,8 +50,8 @@ // bool matrix by bool matrix ops. -DEFNDBINOP_FN (eq, bool_matrix, bool_matrix, array, array, mx_el_eq) -DEFNDBINOP_FN (ne, bool_matrix, bool_matrix, array, array, mx_el_ne) +DEFNDBINOP_FN (eq, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_eq) +DEFNDBINOP_FN (ne, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_ne) void install_bm_bm_ops (void)
--- a/src/OPERATORS/op-cm-cm.cc +++ b/src/OPERATORS/op-cm-cm.cc @@ -39,8 +39,8 @@ // unary complex matrix ops. -DEFNDUNOP_OP (not, complex_matrix, !) -DEFNDUNOP_OP (uminus, complex_matrix, -) +DEFNDUNOP_OP (not, complex_matrix, complex_array, !) +DEFNDUNOP_OP (uminus, complex_matrix, complex_array, -) DEFUNOP (transpose, complex_matrix) { @@ -61,8 +61,8 @@ // complex matrix by complex matrix ops. -DEFNDBINOP_OP (add, complex_matrix, complex_matrix, array, array, +) -DEFNDBINOP_OP (sub, complex_matrix, complex_matrix, array, array, -) +DEFNDBINOP_OP (add, complex_matrix, complex_matrix, complex_array, complex_array, +) +DEFNDBINOP_OP (sub, complex_matrix, complex_matrix, complex_array, complex_array, -) DEFBINOP_OP (mul, complex_matrix, complex_matrix, *) DEFBINOP_FN (div, complex_matrix, complex_matrix, xdiv) @@ -75,26 +75,26 @@ DEFBINOP_FN (ldiv, complex_matrix, complex_matrix, xleftdiv) -DEFNDBINOP_FN (lt, complex_matrix, complex_matrix, array, array, mx_el_lt) -DEFNDBINOP_FN (le, complex_matrix, complex_matrix, array, array, mx_el_le) -DEFNDBINOP_FN (eq, complex_matrix, complex_matrix, array, array, mx_el_eq) -DEFNDBINOP_FN (ge, complex_matrix, complex_matrix, array, array, mx_el_ge) -DEFNDBINOP_FN (gt, complex_matrix, complex_matrix, array, array, mx_el_gt) -DEFNDBINOP_FN (ne, complex_matrix, complex_matrix, array, array, mx_el_ne) +DEFNDBINOP_FN (lt, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_lt) +DEFNDBINOP_FN (le, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_le) +DEFNDBINOP_FN (eq, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_eq) +DEFNDBINOP_FN (ge, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_ge) +DEFNDBINOP_FN (gt, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_gt) +DEFNDBINOP_FN (ne, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_ne) -DEFNDBINOP_FN (el_mul, complex_matrix, complex_matrix, array, array, product) -DEFNDBINOP_FN (el_div, complex_matrix, complex_matrix, array, array, quotient) -DEFNDBINOP_FN (el_pow, complex_matrix, complex_matrix, array, array, elem_xpow) +DEFNDBINOP_FN (el_mul, complex_matrix, complex_matrix, complex_array, complex_array, product) +DEFNDBINOP_FN (el_div, complex_matrix, complex_matrix, complex_array, complex_array, quotient) +DEFNDBINOP_FN (el_pow, complex_matrix, complex_matrix, complex_array, complex_array, elem_xpow) DEFBINOP (el_ldiv, complex_matrix, complex_matrix) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - return octave_value (quotient (v2.array_value (), v1.array_value ())); + return octave_value (quotient (v2.complex_array_value (), v1.complex_array_value ())); } -DEFNDBINOP_FN (el_and, complex_matrix, complex_matrix, array, array, mx_el_and) -DEFNDBINOP_FN (el_or, complex_matrix, complex_matrix, array, array, mx_el_or) +DEFNDBINOP_FN (el_and, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_and) +DEFNDBINOP_FN (el_or, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_or) DEFASSIGNOP_FN (assign, complex_matrix, complex_matrix, assign)
--- a/src/OPERATORS/op-cm-cs.cc +++ b/src/OPERATORS/op-cm-cs.cc @@ -40,9 +40,9 @@ // complex matrix by complex scalar ops. -DEFNDBINOP_OP (add, complex_matrix, complex, array, complex, +) -DEFNDBINOP_OP (sub, complex_matrix, complex, array, complex, -) -DEFNDBINOP_OP (mul, complex_matrix, complex, array, complex, *) +DEFNDBINOP_OP (add, complex_matrix, complex, complex_array, complex, +) +DEFNDBINOP_OP (sub, complex_matrix, complex, complex_array, complex, -) +DEFNDBINOP_OP (mul, complex_matrix, complex, complex_array, complex, *) DEFBINOP (div, complex_matrix, complex) { @@ -53,7 +53,7 @@ if (d == 0.0) gripe_divide_by_zero (); - return octave_value (v1.array_value () / d); + return octave_value (v1.complex_array_value () / d); } DEFBINOP_FN (pow, complex_matrix, complex, xpow) @@ -68,14 +68,14 @@ return octave_value (xleftdiv (m1, m2)); } -DEFNDBINOP_FN (lt, complex_matrix, complex, array, complex, mx_el_lt) -DEFNDBINOP_FN (le, complex_matrix, complex, array, complex, mx_el_le) -DEFNDBINOP_FN (eq, complex_matrix, complex, array, complex, mx_el_eq) -DEFNDBINOP_FN (ge, complex_matrix, complex, array, complex, mx_el_ge) -DEFNDBINOP_FN (gt, complex_matrix, complex, array, complex, mx_el_gt) -DEFNDBINOP_FN (ne, complex_matrix, complex, array, complex, mx_el_ne) +DEFNDBINOP_FN (lt, complex_matrix, complex, complex_array, complex, mx_el_lt) +DEFNDBINOP_FN (le, complex_matrix, complex, complex_array, complex, mx_el_le) +DEFNDBINOP_FN (eq, complex_matrix, complex, complex_array, complex, mx_el_eq) +DEFNDBINOP_FN (ge, complex_matrix, complex, complex_array, complex, mx_el_ge) +DEFNDBINOP_FN (gt, complex_matrix, complex, complex_array, complex, mx_el_gt) +DEFNDBINOP_FN (ne, complex_matrix, complex, complex_array, complex, mx_el_ne) -DEFNDBINOP_OP (el_mul, complex_matrix, complex, array, complex, *) +DEFNDBINOP_OP (el_mul, complex_matrix, complex, complex_array, complex, *) DEFBINOP (el_div, complex_matrix, complex) { @@ -86,20 +86,20 @@ if (d == 0.0) gripe_divide_by_zero (); - return octave_value (v1.array_value () / d); + return octave_value (v1.complex_array_value () / d); } -DEFNDBINOP_FN (el_pow, complex_matrix, complex, array, complex, elem_xpow) +DEFNDBINOP_FN (el_pow, complex_matrix, complex, complex_array, complex, elem_xpow) DEFBINOP (el_ldiv, complex_matrix, complex) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex&); - return x_el_div (v2.complex_value (), v1.array_value ()); + return x_el_div (v2.complex_value (), v1.complex_array_value ()); } -DEFNDBINOP_FN (el_and, complex_matrix, complex, array, complex, mx_el_and) -DEFNDBINOP_FN (el_or, complex_matrix, complex, array, complex, mx_el_or) +DEFNDBINOP_FN (el_and, complex_matrix, complex, complex_array, complex, mx_el_and) +DEFNDBINOP_FN (el_or, complex_matrix, complex, complex_array, complex, mx_el_or) DEFASSIGNOP_FN (assign, complex_matrix, complex, assign)
--- a/src/OPERATORS/op-cm-m.cc +++ b/src/OPERATORS/op-cm-m.cc @@ -45,8 +45,8 @@ // complex matrix by matrix ops. -DEFNDBINOP_OP (add, complex_matrix, matrix, array, array, +) -DEFNDBINOP_OP (sub, complex_matrix, matrix, array, array, -) +DEFNDBINOP_OP (add, complex_matrix, matrix, complex_array, array, +) +DEFNDBINOP_OP (sub, complex_matrix, matrix, complex_array, array, -) DEFBINOP_OP (mul, complex_matrix, matrix, *) DEFBINOP_FN (div, complex_matrix, matrix, xdiv) @@ -59,26 +59,26 @@ DEFBINOP_FN (ldiv, complex_matrix, matrix, xleftdiv) -DEFNDBINOP_FN (lt, complex_matrix, matrix, array, array, mx_el_lt) -DEFNDBINOP_FN (le, complex_matrix, matrix, array, array, mx_el_le) -DEFNDBINOP_FN (eq, complex_matrix, matrix, array, array, mx_el_eq) -DEFNDBINOP_FN (ge, complex_matrix, matrix, array, array, mx_el_ge) -DEFNDBINOP_FN (gt, complex_matrix, matrix, array, array, mx_el_gt) -DEFNDBINOP_FN (ne, complex_matrix, matrix, array, array, mx_el_ne) +DEFNDBINOP_FN (lt, complex_matrix, matrix, complex_array, array, mx_el_lt) +DEFNDBINOP_FN (le, complex_matrix, matrix, complex_array, array, mx_el_le) +DEFNDBINOP_FN (eq, complex_matrix, matrix, complex_array, array, mx_el_eq) +DEFNDBINOP_FN (ge, complex_matrix, matrix, complex_array, array, mx_el_ge) +DEFNDBINOP_FN (gt, complex_matrix, matrix, complex_array, array, mx_el_gt) +DEFNDBINOP_FN (ne, complex_matrix, matrix, complex_array, array, mx_el_ne) -DEFNDBINOP_FN (el_mul, complex_matrix, matrix, array, array, product) -DEFNDBINOP_FN (el_div, complex_matrix, matrix, array, array, quotient) -DEFNDBINOP_FN (el_pow, complex_matrix, matrix, array, array, elem_xpow) +DEFNDBINOP_FN (el_mul, complex_matrix, matrix, complex_array, array, product) +DEFNDBINOP_FN (el_div, complex_matrix, matrix, complex_array, array, quotient) +DEFNDBINOP_FN (el_pow, complex_matrix, matrix, complex_array, array, elem_xpow) DEFBINOP (el_ldiv, complex_matrix, matrix) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); - return quotient (v2.array_value (), v1.array_value ()); + return quotient (v2.array_value (), v1.complex_array_value ()); } -DEFNDBINOP_FN (el_and, complex_matrix, matrix, array, array, mx_el_and) -DEFNDBINOP_FN (el_or, complex_matrix, matrix, array, array, mx_el_or) +DEFNDBINOP_FN (el_and, complex_matrix, matrix, complex_array, array, mx_el_and) +DEFNDBINOP_FN (el_or, complex_matrix, matrix, complex_array, array, mx_el_or) DEFASSIGNOP_FN (assign, complex_matrix, matrix, assign)
--- a/src/OPERATORS/op-cm-s.cc +++ b/src/OPERATORS/op-cm-s.cc @@ -44,9 +44,9 @@ // complex matrix by scalar ops. -DEFNDBINOP_OP (add, complex_matrix, scalar, array, scalar, +) -DEFNDBINOP_OP (sub, complex_matrix, scalar, array, scalar, -) -DEFNDBINOP_OP (mul, complex_matrix, scalar, array, scalar, *) +DEFNDBINOP_OP (add, complex_matrix, scalar, complex_array, scalar, +) +DEFNDBINOP_OP (sub, complex_matrix, scalar, complex_array, scalar, -) +DEFNDBINOP_OP (mul, complex_matrix, scalar, complex_array, scalar, *) DEFBINOP (div, complex_matrix, scalar) { @@ -57,7 +57,7 @@ if (d == 0.0) gripe_divide_by_zero (); - return octave_value (v1.array_value () / d); + return octave_value (v1.complex_array_value () / d); } DEFBINOP_FN (pow, complex_matrix, scalar, xpow) @@ -72,12 +72,12 @@ return octave_value (xleftdiv (m1, m2)); } -DEFNDBINOP_FN (lt, complex_matrix, scalar, array, scalar, mx_el_lt) -DEFNDBINOP_FN (le, complex_matrix, scalar, array, scalar, mx_el_le) -DEFNDBINOP_FN (eq, complex_matrix, scalar, array, scalar, mx_el_eq) -DEFNDBINOP_FN (ge, complex_matrix, scalar, array, scalar, mx_el_ge) -DEFNDBINOP_FN (gt, complex_matrix, scalar, array, scalar, mx_el_gt) -DEFNDBINOP_FN (ne, complex_matrix, scalar, array, scalar, mx_el_ne) +DEFNDBINOP_FN (lt, complex_matrix, scalar, complex_array, scalar, mx_el_lt) +DEFNDBINOP_FN (le, complex_matrix, scalar, complex_array, scalar, mx_el_le) +DEFNDBINOP_FN (eq, complex_matrix, scalar, complex_array, scalar, mx_el_eq) +DEFNDBINOP_FN (ge, complex_matrix, scalar, complex_array, scalar, mx_el_ge) +DEFNDBINOP_FN (gt, complex_matrix, scalar, complex_array, scalar, mx_el_gt) +DEFNDBINOP_FN (ne, complex_matrix, scalar, complex_array, scalar, mx_el_ne) DEFBINOP_OP (el_mul, complex_matrix, scalar, *) @@ -90,20 +90,20 @@ if (d == 0.0) gripe_divide_by_zero (); - return octave_value (v1.array_value () / d); + return octave_value (v1.complex_array_value () / d); } -DEFNDBINOP_FN (el_pow, complex_matrix, scalar, array, scalar, elem_xpow) +DEFNDBINOP_FN (el_pow, complex_matrix, scalar, complex_array, scalar, elem_xpow) DEFBINOP (el_ldiv, complex_matrix, scalar) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_scalar&); - return x_el_div (v2.double_value (), v1.array_value ()); + return x_el_div (v2.double_value (), v1.complex_array_value ()); } -DEFNDBINOP_FN (el_and, complex_matrix, scalar, array, scalar, mx_el_and) -DEFNDBINOP_FN (el_or, complex_matrix, scalar, array, scalar, mx_el_or) +DEFNDBINOP_FN (el_and, complex_matrix, scalar, complex_array, scalar, mx_el_and) +DEFNDBINOP_FN (el_or, complex_matrix, scalar, complex_array, scalar, mx_el_or) DEFASSIGNOP_FN (assign, complex_matrix, scalar, assign)
--- a/src/OPERATORS/op-cs-cm.cc +++ b/src/OPERATORS/op-cs-cm.cc @@ -40,9 +40,9 @@ // complex scalar by complex matrix ops. -DEFNDBINOP_OP (add, complex, complex_matrix, complex, array, +) -DEFNDBINOP_OP (sub, complex, complex_matrix, complex, array, -) -DEFNDBINOP_OP (mul, complex, complex_matrix, complex, array, *) +DEFNDBINOP_OP (add, complex, complex_matrix, complex, complex_array, +) +DEFNDBINOP_OP (sub, complex, complex_matrix, complex, complex_array, -) +DEFNDBINOP_OP (mul, complex, complex_matrix, complex, complex_array, *) DEFBINOP (div, complex, complex_matrix) { @@ -65,19 +65,19 @@ if (d == 0.0) gripe_divide_by_zero (); - return octave_value (v2.array_value () / d); + return octave_value (v2.complex_array_value () / d); } -DEFNDBINOP_FN (lt, complex, complex_matrix, complex, array, mx_el_lt) -DEFNDBINOP_FN (le, complex, complex_matrix, complex, array, mx_el_le) -DEFNDBINOP_FN (eq, complex, complex_matrix, complex, array, mx_el_eq) -DEFNDBINOP_FN (ge, complex, complex_matrix, complex, array, mx_el_ge) -DEFNDBINOP_FN (gt, complex, complex_matrix, complex, array, mx_el_gt) -DEFNDBINOP_FN (ne, complex, complex_matrix, complex, array, mx_el_ne) +DEFNDBINOP_FN (lt, complex, complex_matrix, complex, complex_array, mx_el_lt) +DEFNDBINOP_FN (le, complex, complex_matrix, complex, complex_array, mx_el_le) +DEFNDBINOP_FN (eq, complex, complex_matrix, complex, complex_array, mx_el_eq) +DEFNDBINOP_FN (ge, complex, complex_matrix, complex, complex_array, mx_el_ge) +DEFNDBINOP_FN (gt, complex, complex_matrix, complex, complex_array, mx_el_gt) +DEFNDBINOP_FN (ne, complex, complex_matrix, complex, complex_array, mx_el_ne) -DEFNDBINOP_OP (el_mul, complex, complex_matrix, complex, array, *) -DEFNDBINOP_FN (el_div, complex, complex_matrix, complex, array, x_el_div) -DEFNDBINOP_FN (el_pow, complex, complex_matrix, complex, array, elem_xpow) +DEFNDBINOP_OP (el_mul, complex, complex_matrix, complex, complex_array, *) +DEFNDBINOP_FN (el_div, complex, complex_matrix, complex, complex_array, x_el_div) +DEFNDBINOP_FN (el_pow, complex, complex_matrix, complex, complex_array, elem_xpow) DEFBINOP (el_ldiv, complex, complex_matrix) { @@ -88,11 +88,11 @@ if (d == 0.0) gripe_divide_by_zero (); - return octave_value (v2.array_value () / d); + return octave_value (v2.complex_array_value () / d); } -DEFNDBINOP_FN (el_and, complex, complex_matrix, complex, array, mx_el_and) -DEFNDBINOP_FN (el_or, complex, complex_matrix, complex, array, mx_el_or) +DEFNDBINOP_FN (el_and, complex, complex_matrix, complex, complex_array, mx_el_and) +DEFNDBINOP_FN (el_or, complex, complex_matrix, complex, complex_array, mx_el_or) DEFCONV (complex_matrix_conv, complex, complex_matrix) {
--- a/src/OPERATORS/op-m-cm.cc +++ b/src/OPERATORS/op-m-cm.cc @@ -45,8 +45,8 @@ // matrix by complex matrix ops. -DEFNDBINOP_OP (add, matrix, complex_matrix, array, array, +) -DEFNDBINOP_OP (sub, matrix, complex_matrix, array, array, -) +DEFNDBINOP_OP (add, matrix, complex_matrix, array, complex_array, +) +DEFNDBINOP_OP (sub, matrix, complex_matrix, array, complex_array, -) DEFBINOP_OP (mul, matrix, complex_matrix, *) DEFBINOP_FN (div, matrix, complex_matrix, xdiv) @@ -59,26 +59,26 @@ DEFBINOP_FN (ldiv, matrix, complex_matrix, xleftdiv) -DEFNDBINOP_FN (lt, matrix, complex_matrix, array, array, mx_el_lt) -DEFNDBINOP_FN (le, matrix, complex_matrix, array, array, mx_el_le) -DEFNDBINOP_FN (eq, matrix, complex_matrix, array, array, mx_el_eq) -DEFNDBINOP_FN (ge, matrix, complex_matrix, array, array, mx_el_ge) -DEFNDBINOP_FN (gt, matrix, complex_matrix, array, array, mx_el_gt) -DEFNDBINOP_FN (ne, matrix, complex_matrix, array, array, mx_el_ne) +DEFNDBINOP_FN (lt, matrix, complex_matrix, array, complex_array, mx_el_lt) +DEFNDBINOP_FN (le, matrix, complex_matrix, array, complex_array, mx_el_le) +DEFNDBINOP_FN (eq, matrix, complex_matrix, array, complex_array, mx_el_eq) +DEFNDBINOP_FN (ge, matrix, complex_matrix, array, complex_array, mx_el_ge) +DEFNDBINOP_FN (gt, matrix, complex_matrix, array, complex_array, mx_el_gt) +DEFNDBINOP_FN (ne, matrix, complex_matrix, array, complex_array, mx_el_ne) -DEFNDBINOP_FN (el_mul, matrix, complex_matrix, array, array, product) -DEFNDBINOP_FN (el_div, matrix, complex_matrix, array, array, quotient) -DEFNDBINOP_FN (el_pow, matrix, complex_matrix, array, array, elem_xpow) +DEFNDBINOP_FN (el_mul, matrix, complex_matrix, array, complex_array, product) +DEFNDBINOP_FN (el_div, matrix, complex_matrix, array, complex_array, quotient) +DEFNDBINOP_FN (el_pow, matrix, complex_matrix, array, complex_array, elem_xpow) DEFBINOP (el_ldiv, matrix, complex_matrix) { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); - return quotient (v2.array_value (), v1.array_value ()); + return quotient (v2.complex_array_value (), v1.array_value ()); } -DEFNDBINOP_FN (el_and, matrix, complex_matrix, array, array, mx_el_and) -DEFNDBINOP_FN (el_or, matrix, complex_matrix, array, array, mx_el_or) +DEFNDBINOP_FN (el_and, matrix, complex_matrix, array, complex_array, mx_el_and) +DEFNDBINOP_FN (el_or, matrix, complex_matrix, array, complex_array, mx_el_or) DEFCONV (complex_matrix_conv, matrix, complex_matrix) {
--- a/src/OPERATORS/op-m-m.cc +++ b/src/OPERATORS/op-m-m.cc @@ -39,8 +39,8 @@ // matrix unary ops. -DEFNDUNOP_OP (not, matrix, !) -DEFNDUNOP_OP (uminus, matrix, -) +DEFNDUNOP_OP (not, matrix, array, !) +DEFNDUNOP_OP (uminus, matrix, array, -) DEFUNOP (transpose, matrix) {
--- a/src/OPERATORS/op-s-cm.cc +++ b/src/OPERATORS/op-s-cm.cc @@ -46,9 +46,9 @@ // scalar by complex matrix ops. -DEFNDBINOP_OP (add, scalar, complex_matrix, scalar, array, +) -DEFNDBINOP_OP (sub, scalar, complex_matrix, scalar, array, -) -DEFNDBINOP_OP (mul, scalar, complex_matrix, scalar, array, *) +DEFNDBINOP_OP (add, scalar, complex_matrix, scalar, complex_array, +) +DEFNDBINOP_OP (sub, scalar, complex_matrix, scalar, complex_array, -) +DEFNDBINOP_OP (mul, scalar, complex_matrix, scalar, complex_array, *) DEFBINOP (div, scalar, complex_matrix) { @@ -71,19 +71,19 @@ if (d == 0.0) gripe_divide_by_zero (); - return octave_value (v2.array_value () / d); + return octave_value (v2.complex_array_value () / d); } -DEFNDBINOP_FN (lt, scalar, complex_matrix, scalar, array, mx_el_lt) -DEFNDBINOP_FN (le, scalar, complex_matrix, scalar, array, mx_el_le) -DEFNDBINOP_FN (eq, scalar, complex_matrix, scalar, array, mx_el_eq) -DEFNDBINOP_FN (ge, scalar, complex_matrix, scalar, array, mx_el_ge) -DEFNDBINOP_FN (gt, scalar, complex_matrix, scalar, array, mx_el_gt) -DEFNDBINOP_FN (ne, scalar, complex_matrix, scalar, array, mx_el_ne) +DEFNDBINOP_FN (lt, scalar, complex_matrix, scalar, complex_array, mx_el_lt) +DEFNDBINOP_FN (le, scalar, complex_matrix, scalar, complex_array, mx_el_le) +DEFNDBINOP_FN (eq, scalar, complex_matrix, scalar, complex_array, mx_el_eq) +DEFNDBINOP_FN (ge, scalar, complex_matrix, scalar, complex_array, mx_el_ge) +DEFNDBINOP_FN (gt, scalar, complex_matrix, scalar, complex_array, mx_el_gt) +DEFNDBINOP_FN (ne, scalar, complex_matrix, scalar, complex_array, mx_el_ne) -DEFNDBINOP_OP (el_mul, scalar, complex_matrix, scalar, array, *) -DEFNDBINOP_FN (el_div, scalar, complex_matrix, scalar, array, x_el_div) -DEFNDBINOP_FN (el_pow, scalar, complex_matrix, scalar, array, elem_xpow) +DEFNDBINOP_OP (el_mul, scalar, complex_matrix, scalar, complex_array, *) +DEFNDBINOP_FN (el_div, scalar, complex_matrix, scalar, complex_array, x_el_div) +DEFNDBINOP_FN (el_pow, scalar, complex_matrix, scalar, complex_array, elem_xpow) DEFBINOP (el_ldiv, scalar, complex_matrix) { @@ -94,21 +94,21 @@ if (d == 0.0) gripe_divide_by_zero (); - return octave_value (v2.array_value () / d); + return octave_value (v2.complex_array_value () / d); } DEFBINOP (el_and, scalar, complex_matrix) { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - return mx_el_and (v1.double_value (), v2.array_value ()); + return mx_el_and (v1.double_value (), v2.complex_array_value ()); } DEFBINOP (el_or, scalar, complex_matrix) { CAST_BINOP_ARGS (const octave_scalar&, const octave_complex_matrix&); - return mx_el_or (v1.double_value (), v2.array_value ()); + return mx_el_or (v1.double_value (), v2.complex_array_value ()); } DEFCONV (complex_matrix_conv, scalar, complex_matrix)
--- a/src/ops.h +++ b/src/ops.h @@ -190,11 +190,11 @@ return octave_value (op v.t ## _value ()); \ } -#define DEFNDUNOP_OP(name, t, op) \ +#define DEFNDUNOP_OP(name, t, e, op) \ UNOPDECL (name, a) \ { \ CAST_UNOP_ARG (const octave_ ## t&); \ - return octave_value (op v.array_value ()); \ + return octave_value (op v.e ## _value ()); \ } // XXX FIXME XXX -- in some cases, the constructor isn't necessary. @@ -206,11 +206,11 @@ return octave_value (f (v.t ## _value ())); \ } -#define DEFNDUNOP_FN(name, t, f) \ +#define DEFNDUNOP_FN(name, t, e, f) \ UNOPDECL (name, a) \ { \ CAST_UNOP_ARG (const octave_ ## t&); \ - return octave_value (f (v.array_value ())); \ + return octave_value (f (v.e ## _value ())); \ } #define DEFNCUNOP_METHOD(name, t, method) \
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -300,11 +300,10 @@ } NDArray -octave_base_value::double_nd_array_value (bool) const +octave_base_value::array_value (bool) const { NDArray retval; - gripe_wrong_type_arg ("octave_base_value::double_nd_array_value()", - type_name ()); + gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ()); return retval; } @@ -326,6 +325,41 @@ return retval; } +ComplexNDArray +octave_base_value::complex_array_value (bool) const +{ + ComplexNDArray retval; + gripe_wrong_type_arg ("octave_base_value::complex_array_value()", + type_name ()); + return retval; +} + +bool +octave_base_value::bool_value (void) const +{ + bool retval = false; + gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); + return retval; +} + +boolMatrix +octave_base_value::bool_matrix_value (void) const +{ + boolMatrix retval; + gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()", + type_name ()); + return retval; +} + +boolNDArray +octave_base_value::bool_array_value (bool) const +{ + boolNDArray retval; + gripe_wrong_type_arg ("octave_base_value::bool_array_value()", + type_name ()); + return retval; +} + charMatrix octave_base_value::char_matrix_value (bool) const { @@ -339,6 +373,15 @@ return retval; } +charNDArray +octave_base_value::char_array_value (bool) const +{ + charNDArray retval; + gripe_wrong_type_arg ("octave_base_value::char_array_value()", + type_name ()); + return retval; +} + string_vector octave_base_value::all_strings (bool pad, bool force) const { @@ -435,23 +478,6 @@ return retval; } -bool -octave_base_value::bool_value (void) const -{ - bool retval = false; - gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ()); - return retval; -} - -boolMatrix -octave_base_value::bool_matrix_value (void) const -{ - boolMatrix retval; - gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()", - type_name ()); - return retval; -} - CONVDECLX (matrix_conv) { return new octave_matrix ();
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -195,14 +195,24 @@ Matrix matrix_value (bool = false) const; - NDArray double_nd_array_value (bool frc_str_conv = false) const; + NDArray array_value (bool = false) const; Complex complex_value (bool = false) const; ComplexMatrix complex_matrix_value (bool = false) const; + ComplexNDArray complex_array_value (bool = false) const; + + bool bool_value (void) const; + + boolMatrix bool_matrix_value (void) const; + + boolNDArray bool_array_value (bool = false) const; + charMatrix char_matrix_value (bool = false) const; + charNDArray char_array_value (bool = false) const; + string_vector all_strings (bool pad = false, bool force = false) const; std::string string_value (bool force = false) const; @@ -223,10 +233,6 @@ octave_value_list list_value (void) const; - bool bool_value (void) const; - - boolMatrix bool_matrix_value (void) const; - octave_value convert_to_str_internal (bool pad, bool force) const; void convert_to_row_or_column_vector (void);
--- a/src/ov-bool-mat.h +++ b/src/ov-bool-mat.h @@ -104,7 +104,7 @@ boolMatrix bool_matrix_value (void) const { return matrix.matrix_value (); } - boolNDArray array_value (bool = false) const + boolNDArray bool_array_value (bool = false) const { return matrix; } octave_value convert_to_str_internal (bool pad, bool force) const;
--- a/src/ov-ch-mat.h +++ b/src/ov-ch-mat.h @@ -106,7 +106,7 @@ charMatrix char_matrix_value (bool = false) const { return matrix.matrix_value (); } - charNDArray array_value (bool = false) const + charNDArray char_array_value (bool = false) const { return matrix; } octave_value convert_to_str_internal (bool, bool) const
--- a/src/ov-cx-mat.h +++ b/src/ov-cx-mat.h @@ -102,7 +102,7 @@ ComplexMatrix complex_matrix_value (bool = false) const; - ComplexNDArray array_value (void) const { return matrix; } + ComplexNDArray complex_array_value (bool = false) const { return matrix; } void increment (void) { matrix += Complex (1.0); }
--- a/src/ov-re-mat.h +++ b/src/ov-re-mat.h @@ -101,8 +101,7 @@ ComplexMatrix complex_matrix_value (bool = false) const; - NDArray array_value (bool = false) const - { return matrix; } + NDArray array_value (bool = false) const { return matrix; } void increment (void) { matrix += 1.0; }
--- a/src/ov.h +++ b/src/ov.h @@ -485,8 +485,8 @@ virtual Matrix matrix_value (bool frc_str_conv = false) const { return rep->matrix_value (frc_str_conv); } - virtual NDArray double_nd_array_value (bool frc_str_conv = false) const - { return rep->double_nd_array_value (frc_str_conv); } + virtual NDArray array_value (bool frc_str_conv = false) const + { return rep->array_value (frc_str_conv); } virtual Complex complex_value (bool frc_str_conv = false) const { return rep->complex_value (frc_str_conv); } @@ -494,9 +494,24 @@ virtual ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const { return rep->complex_matrix_value (frc_str_conv); } + virtual ComplexNDArray complex_array_value (bool frc_str_conv = false) const + { return rep->complex_array_value (frc_str_conv); } + + virtual bool bool_value (void) const + { return rep->bool_value (); } + + virtual boolMatrix bool_matrix_value (void) const + { return rep->bool_matrix_value (); } + + virtual boolNDArray bool_array_value (void) const + { return rep->bool_array_value (); } + virtual charMatrix char_matrix_value (bool frc_str_conv = false) const { return rep->char_matrix_value (frc_str_conv); } + virtual charNDArray char_array_value (bool frc_str_conv = false) const + { return rep->char_array_value (frc_str_conv); } + virtual string_vector all_strings (bool pad = false, bool force = false) const { return rep->all_strings (pad); } @@ -522,12 +537,6 @@ virtual octave_value_list list_value (void) const; - virtual bool bool_value (void) const - { return rep->bool_value (); } - - virtual boolMatrix bool_matrix_value (void) const - { return rep->bool_matrix_value (); } - ColumnVector column_vector_value (bool frc_str_conv = false, bool frc_vec_conv = false) const;