Mercurial > octave-nkf
diff src/OPERATORS/op-bm-bm.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 | c038c2947ee1 |
line wrap: on
line diff
--- a/src/OPERATORS/op-bm-bm.cc Wed Jul 19 16:52:12 2006 +0000 +++ b/src/OPERATORS/op-bm-bm.cc Wed Jul 19 18:18:31 2006 +0000 @@ -29,7 +29,18 @@ #include "oct-obj.h" #include "ov.h" #include "ov-bool-mat.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" @@ -71,6 +82,24 @@ DEFNDASSIGNOP_FN (assign, bool_matrix, bool_matrix, 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_bm_ops (void) { @@ -91,6 +120,24 @@ INSTALL_CATOP (octave_matrix, octave_bool_matrix, m_bm); INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool_matrix, assign); + + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_matrix, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_char_matrix_str, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_char_matrix_sq_str, 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_matrix, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int16_matrix, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int32_matrix, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_int64_matrix, conv_and_assign); + + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint8_matrix, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint16_matrix, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint32_matrix, conv_and_assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_uint64_matrix, conv_and_assign); } /*