*** ./liboctave/boolNDArray.h.orig 2004-09-02 03:28:50.000000000 +0200 --- ./liboctave/boolNDArray.h 2004-09-03 17:17:48.000000000 +0200 *************** *** 70,75 **** --- 70,81 ---- boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; + friend boolNDArray concat (const boolNDArray& ra, const boolNDArray& rb, + const Array& ra_idx); + + boolNDArray& insert (const boolNDArray& a, int r, int c); + boolNDArray& insert (const boolNDArray& a, const Array& ra_idx); + boolMatrix matrix_value (void) const; boolNDArray squeeze (void) const { return ArrayN::squeeze (); } *** ./liboctave/boolNDArray.cc.orig 2004-02-16 20:57:21.000000000 +0100 --- ./liboctave/boolNDArray.cc 2004-09-03 17:17:16.000000000 +0200 *************** *** 61,66 **** --- 61,91 ---- MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (MX_ND_ANY_EXPR), false); } + boolNDArray + concat (const boolNDArray& ra, const boolNDArray& rb, const Array& ra_idx) + { + boolNDArray retval (ra); + if (rb.numel () > 0) + retval.insert (rb, ra_idx); + return retval; + } + + boolNDArray& + boolNDArray::insert (const boolNDArray& a, int r, int c) + { + Array::insert (a, r, c); + return *this; + } + + boolNDArray& + boolNDArray::insert (const boolNDArray& a, const Array& ra_idx) + { + Array::insert (a, ra_idx); + return *this; + } + + + boolMatrix boolNDArray::matrix_value (void) const { *** ./scripts/general/repmat.m.orig 2004-09-02 03:28:50.000000000 +0200 --- ./scripts/general/repmat.m 2004-09-03 22:38:47.000000000 +0200 *************** *** 55,61 **** if (isstr (a)) x = setstr (toascii (a) * ones (idx)); else ! x = a * ones(idx, class(a)); endif elseif (ndims (a) == 2 && length (idx) < 3) if (isstr (a)) --- 55,70 ---- if (isstr (a)) x = setstr (toascii (a) * ones (idx)); else ! if (strcmp (class (a), "double")) ! ## This is faster with octave for double/Complex ! x = a * ones(idx, class(a)); ! else ! cidx = cell (1, length (idx)); ! for i=1:length(idx) ! cidx{i} = ones (1,idx(i)); ! endfor ! x = a (cidx{:}); ! endif endif elseif (ndims (a) == 2 && length (idx) < 3) if (isstr (a)) *** ./src/OPERATORS/op-b-b.cc.orig 2004-09-02 03:28:52.000000000 +0200 --- ./src/OPERATORS/op-b-b.cc 2004-09-03 17:02:50.000000000 +0200 *************** *** 54,60 **** DEFBINOP_OP (el_and, bool, bool, &&) DEFBINOP_OP (el_or, bool, bool, ||) ! DEFNDCATOP_FN (b_b, bool, bool, array, array, concat) DEFNDCATOP_FN (b_s, bool, scalar, array, array, concat) DEFNDCATOP_FN (s_b, scalar, bool, array, array, concat) --- 54,60 ---- DEFBINOP_OP (el_and, bool, bool, &&) DEFBINOP_OP (el_or, bool, bool, ||) ! DEFNDCATOP_FN (b_b, bool, bool, bool_array, bool_array, concat) DEFNDCATOP_FN (b_s, bool, scalar, array, array, concat) DEFNDCATOP_FN (s_b, scalar, bool, array, array, concat) *** ./src/OPERATORS/op-bm-b.cc.orig 2004-09-02 03:28:52.000000000 +0200 --- ./src/OPERATORS/op-bm-b.cc 2004-09-03 17:03:32.000000000 +0200 *************** *** 45,51 **** DEFNDBINOP_FN (el_and, bool_matrix, bool, bool_array, bool, mx_el_and) DEFNDBINOP_FN (el_or, bool_matrix, bool, bool_array, bool, mx_el_or) ! DEFNDCATOP_FN (bm_b, bool_matrix, bool, array, array, concat) DEFNDCATOP_FN (bm_s, bool_matrix, scalar, array, array, concat) DEFNDCATOP_FN (m_b, matrix, bool, array, array, concat) --- 45,51 ---- DEFNDBINOP_FN (el_and, bool_matrix, bool, bool_array, bool, mx_el_and) DEFNDBINOP_FN (el_or, bool_matrix, bool, bool_array, bool, mx_el_or) ! DEFNDCATOP_FN (bm_b, bool_matrix, bool, bool_array, bool_array, concat) DEFNDCATOP_FN (bm_s, bool_matrix, scalar, array, array, concat) DEFNDCATOP_FN (m_b, matrix, bool, array, array, concat) *** ./src/OPERATORS/op-bm-bm.cc.orig 2004-09-02 03:28:52.000000000 +0200 --- ./src/OPERATORS/op-bm-bm.cc 2004-09-03 17:04:15.000000000 +0200 *************** *** 66,72 **** DEFNDBINOP_FN (el_or, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_or) ! DEFNDCATOP_FN (bm_bm, bool_matrix, bool_matrix, array, array, concat) DEFNDCATOP_FN (bm_m, bool_matrix, matrix, array, array, concat) DEFNDCATOP_FN (m_bm, matrix, bool_matrix, array, array, concat) --- 66,72 ---- DEFNDBINOP_FN (el_or, bool_matrix, bool_matrix, bool_array, bool_array, mx_el_or) ! DEFNDCATOP_FN (bm_bm, bool_matrix, bool_matrix, bool_array, bool_array, concat) DEFNDCATOP_FN (bm_m, bool_matrix, matrix, array, array, concat) DEFNDCATOP_FN (m_bm, matrix, bool_matrix, array, array, concat) *** ./src/OPERATORS/op-b-bm.cc.orig 2004-09-02 03:28:52.000000000 +0200 --- ./src/OPERATORS/op-b-bm.cc 2004-09-03 17:03:12.000000000 +0200 *************** *** 45,51 **** DEFNDBINOP_FN (el_and, bool, bool_matrix, bool, bool_array, mx_el_and) DEFNDBINOP_FN (el_or, bool, bool_matrix, bool, bool_array, mx_el_or) ! DEFNDCATOP_FN (b_bm, bool, bool_matrix, array, array, concat) DEFNDCATOP_FN (b_m, bool, matrix, array, array, concat) DEFNDCATOP_FN (s_bm, scalar, bool_matrix, array, array, concat) --- 45,51 ---- DEFNDBINOP_FN (el_and, bool, bool_matrix, bool, bool_array, mx_el_and) DEFNDBINOP_FN (el_or, bool, bool_matrix, bool, bool_array, mx_el_or) ! DEFNDCATOP_FN (b_bm, bool, bool_matrix, bool_array, bool_array, concat) DEFNDCATOP_FN (b_m, bool, matrix, array, array, concat) DEFNDCATOP_FN (s_bm, scalar, bool_matrix, array, array, concat) *** ./src/ov-bool.cc.orig 2004-09-02 03:28:52.000000000 +0200 --- ./src/ov-bool.cc 2004-09-03 21:49:28.000000000 +0200 *************** *** 36,41 **** --- 36,42 ---- #include "oct-obj.h" #include "ops.h" #include "ov-bool.h" + #include "ov-bool-mat.h" #include "ov-base.h" #include "ov-base-scalar.h" #include "ov-base-scalar.cc" *************** *** 97,103 **** // 1x1 matrix back to a scalar value. Need a better solution // to this problem. ! octave_value tmp (new octave_matrix (matrix_value ())); retval = tmp.do_index_op (idx, resize_ok); } --- 98,104 ---- // 1x1 matrix back to a scalar value. Need a better solution // to this problem. ! octave_value tmp (new octave_bool_matrix (bool_matrix_value ())); retval = tmp.do_index_op (idx, resize_ok); } *** ./src/ov-intx.h.orig 2004-08-31 07:30:47.000000000 +0200 --- ./src/ov-intx.h 2004-09-03 18:01:41.000000000 +0200 *************** *** 108,113 **** --- 108,139 ---- empty_clone (void) const { return new OCTAVE_VALUE_INT_SCALAR_T (); } + octave_value do_index_op (const octave_value_list& idx, int resize_ok) + { + octave_value retval; + + if (idx.valid_scalar_indices ()) + retval = scalar; + else + { + // XXX FIXME XXX -- this doesn't solve the problem of + // + // a = 1; a([1,1], [1,1], [1,1]) + // + // and similar constructions. Hmm... + + // XXX FIXME XXX -- using this constructor avoids narrowing the + // 1x1 matrix back to a scalar value. Need a better solution + // to this problem. + + octave_value tmp (new OCTAVE_VALUE_INT_MATRIX_T ( + OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ())); + retval = tmp.do_index_op (idx, resize_ok); + } + + return retval; + } + OCTAVE_INT_T OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION (void) const { return scalar; }