Mercurial > hg > octave-nkf
diff src/OPERATORS/op-bm-b.cc @ 5898:da843f35775c
[project @ 2006-07-19 18:18:08 by jwe]
author | jwe |
---|---|
date | Wed, 19 Jul 2006 18:18:31 +0000 |
parents | 4c8a2e4e0717 |
children | 82c38ce145a7 |
line wrap: on
line diff
--- a/src/OPERATORS/op-bm-b.cc +++ b/src/OPERATORS/op-bm-b.cc @@ -31,7 +31,18 @@ #include "ov-bool.h" #include "ov-bool-mat.h" #include "ov-scalar.h" +#include "ov-range.h" #include "ov-re-mat.h" +#include "ov-re-sparse.h" +#include "ov-str-mat.h" +#include "ov-int8.h" +#include "ov-int16.h" +#include "ov-int32.h" +#include "ov-int64.h" +#include "ov-uint8.h" +#include "ov-uint16.h" +#include "ov-uint32.h" +#include "ov-uint64.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" @@ -48,6 +59,24 @@ DEFNDASSIGNOP_FN (assign, bool_matrix, bool, bool_array, assign) +static octave_value +oct_assignop_conv_and_assign (octave_base_value& a1, + const octave_value_list& idx, + const octave_base_value& a2) +{ + octave_bool_matrix& v1 = dynamic_cast<octave_bool_matrix&> (a1); + + // FIXME -- perhaps add a warning for this conversion if the values + // are not all 0 or 1? + + boolNDArray v2 = a2.bool_array_value (); + + if (! error_state) + v1.assign (idx, v2); + + return octave_value (); +} + void install_bm_b_ops (void) { @@ -59,6 +88,22 @@ INSTALL_CATOP (octave_matrix, octave_bool, m_b); INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool, assign); + + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_scalar, conv_and_assign); + + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_range, conv_and_assign); + + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_sparse_matrix, conv_and_assign); + + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int8_scalar, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int16_scalar, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int32_scalar, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int64_scalar, conv_and_assign); + + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint8_scalar, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint16_scalar, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint32_scalar, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint64_scalar, conv_and_assign); } /*