*** ./liboctave/boolNDArray.cc~ 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 { *** ./liboctave/boolNDArray.h~ 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 (); } *** ./scripts/general/repmat.m~ 2004-09-02 03:28:50.000000000 +0200 --- ./scripts/general/repmat.m 2004-09-03 17:54:18.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,75 ---- if (isstr (a)) x = setstr (toascii (a) * ones (idx)); else ! cls = class (a); ! # if (cls == "double" || cls == "int8" || cls == "int16" ! # || cls = "int32" || cls == "int64" || cls == "uint8" ! # || cls == "uint16" || cls == "uint32" || cls == "uint64") ! if (false) ! x = a * ones(idx, class(a)); ! disp("v1") ! else ! disp("v2") ! 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-bm-bm.cc~ 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~ 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/OPERATORS/op-b-b.cc~ 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~ 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/ov-bool.cc~ 2004-09-02 03:28:52.000000000 +0200 --- ./src/ov-bool.cc 2004-09-03 17:34:55.000000000 +0200 *************** *** 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); } --- 97,103 ---- // 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~ 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; }