*** ./liboctave/Array.h.orig2 2004-07-06 13:37:54.000000000 +0200 --- ./liboctave/Array.h 2004-07-08 01:22:33.000000000 +0200 *************** *** 521,530 **** // Array::dimensions should be protected, not public, but we can't // do that because of bugs in gcc prior to 3.3. - template - int - cat_ra (Array& ra, const Array& ra_arg, int dim, int idx, int move); - template /* friend */ int assign (Array& lhs, const Array& rhs, const LT& rfv); --- 521,526 ---- *************** *** 560,569 **** template class Array; \ template T resize_fill_value (const T&); \ - #define INSTANTIATE_ARRAY_CAT(T) \ - template int cat_ra (Array& ra, const Array& ra_arg, \ - int dim, int idx, int move) - #define INSTANTIATE_ARRAY_AND_ASSIGN(T) \ INSTANTIATE_ARRAY (T); \ INSTANTIATE_ARRAY_ASSIGN (T, T) --- 556,561 ---- *** ./liboctave/Array.cc.orig2 2004-07-06 13:41:36.000000000 +0200 --- ./liboctave/Array.cc 2004-07-12 10:48:28.000000000 +0200 *************** *** 570,577 **** dim_vector dv_old = dimensions; int dv_old_orig_len = dv_old.length (); dimensions = dv; ! if (ts > 0 && dv_old_orig_len > 0) { Array ra_idx (dimensions.length (), 0); --- 570,578 ---- dim_vector dv_old = dimensions; int dv_old_orig_len = dv_old.length (); dimensions = dv; + int ts_old = get_size (dv_old); ! if (ts > 0 && ts_old > 0 && dv_old_orig_len > 0) { Array ra_idx (dimensions.length (), 0); *************** *** 1040,1050 **** if (n == dimensions.length ()) { ! dim_vector a_dims = a.dims (); for (int i = 0; i < n; i++) { ! if (ra_idx(i) < 0 || ra_idx(i) + a_dims(i) > dimensions(i)) { (*current_liboctave_error_handler) ("Array::insert: range error for insert"); --- 1041,1054 ---- if (n == dimensions.length ()) { ! dim_vector dva = a.dims (); ! dim_vector dv = dims (); ! int len_a = dva.length (); for (int i = 0; i < n; i++) { ! if (ra_idx(i) < 0 || (ra_idx(i) + ! (i < len_a ? dva(i) : 1)) > dimensions(i)) { (*current_liboctave_error_handler) ("Array::insert: range error for insert"); *************** *** 1052,1066 **** } } ! #if 0 ! // XXX FIXME XXX -- need to copy elements ! ! for (int j = 0; j < a_cols; j++) ! for (int i = 0; i < a_rows; i++) ! elem (r+i, c+j) = a.elem (i, j); ! #endif } else (*current_liboctave_error_handler) --- 1056,1094 ---- } } + if (dva.numel ()) + { + const T *a_data = a.data (); + int numel_to_move = dva (0); + int skip = dv (0); + for (int i = 0; i < len_a - 1; i++) + if (ra_idx(i) == 0 && dva(i) == dv(i)) + { + numel_to_move *= dva(i+1); + skip *= dv(i+1); + } + else + { + skip -= dva(i); + break; + } ! int jidx = ra_idx (n - 1); ! for (int i = n-2; i >= 0; i--) ! { ! jidx *= dv (i); ! jidx += ra_idx (i); ! } + int iidx = 0; + int moves = dva.numel () / numel_to_move; + for (int i = 0; i < moves; i++) + { + for (int j = 0; j < numel_to_move; j++) + elem (jidx++) = a_data[iidx++]; + jidx += skip; + } + } } else (*current_liboctave_error_handler) *************** *** 3081,3109 **** } template - int - cat_ra (Array& ra, const Array& ra_arg, int dim, int idx, int move) - { - dim_vector dv_arg = ra_arg.dims (); - - const T *arg_data = ra_arg.data (); - - int numel_to_move = dv_arg(0); - - int numel_arg = dv_arg.length (); - - int ii_limit = dim+1 > numel_arg ? numel_arg : dim + 1; - - for (int ii = 1; ii < ii_limit; ii++) - numel_to_move *= dv_arg(ii); - - for (int j = 0; j < numel_to_move; j++) - ra.elem (idx++) = arg_data[numel_to_move * move + j]; - - return idx; - } - - template void Array::print_info (std::ostream& os, const std::string& prefix) const { --- 3109,3114 ---- *** ./liboctave/Array-C.cc.orig2 2004-07-06 15:06:01.000000000 +0200 --- ./liboctave/Array-C.cc 2004-07-08 01:22:08.000000000 +0200 *************** *** 33,40 **** INSTANTIATE_ARRAY_AND_ASSIGN (Complex); - INSTANTIATE_ARRAY_CAT (Complex); - INSTANTIATE_ARRAY_ASSIGN (Complex, double); INSTANTIATE_ARRAY_ASSIGN (Complex, int); INSTANTIATE_ARRAY_ASSIGN (Complex, short); --- 33,38 ---- *** ./liboctave/chNDArray.h.orig2 2004-07-06 16:34:32.000000000 +0200 --- ./liboctave/chNDArray.h 2004-07-08 01:28:06.000000000 +0200 *************** *** 71,78 **** boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; ! int cat (const charNDArray& ra_arg, int dim, int iidx, int move); ! charMatrix matrix_value (void) const; charNDArray squeeze (void) const { return ArrayN::squeeze (); } --- 71,83 ---- boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; ! friend charNDArray concat (const charNDArray& ra, const charNDArray& rb, ! const Array& ra_idx); ! friend charNDArray concat (const charNDArray& ra, const NDArray& rb, ! const Array& ra_idx); ! friend charNDArray concat (const NDArray& ra, const charNDArray& rb, ! const Array& ra_idx); ! charMatrix matrix_value (void) const; charNDArray squeeze (void) const { return ArrayN::squeeze (); } *** ./liboctave/chNDArray.cc.orig2 2004-07-06 16:34:37.000000000 +0200 --- ./liboctave/chNDArray.cc 2004-07-10 22:50:27.000000000 +0200 *************** *** 33,38 **** --- 33,39 ---- #include "chNDArray.h" #include "mx-base.h" #include "lo-ieee.h" + #include "lo-mappers.h" // XXX FIXME XXX -- this is not quite the right thing. *************** *** 48,57 **** MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (elem (iter_idx) != ' '), false); } ! int ! charNDArray::cat (const charNDArray& ra_arg, int dim, int iidx, int move) { ! return ::cat_ra(*this, ra_arg, dim, iidx, move); } charMatrix --- 49,127 ---- MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (elem (iter_idx) != ' '), false); } ! charNDArray ! concat (const charNDArray& ra, const charNDArray& rb, const Array& ra_idx) { ! charNDArray retval (ra); ! retval.insert (rb, ra_idx); ! return retval; ! } ! ! charNDArray ! concat (const charNDArray& ra, const NDArray& rb, const Array& ra_idx) ! { ! charNDArray retval (ra); ! charNDArray tmp (rb.dims ()); ! int nel = rb.numel (); ! ! for (int i = 0; i < nel; i++) ! { ! double d = rb.elem (i); ! ! if (xisnan (d)) ! { ! (*current_liboctave_error_handler) ! ("invalid conversion from NaN to character"); ! return retval; ! } ! else ! { ! int ival = NINT (d); ! ! if (ival < 0 || ival > UCHAR_MAX) ! // XXX FIXME XXX -- is there something ! // better we could do? Should we warn the user? ! ival = 0; ! ! tmp.elem (i) = static_cast(ival); ! } ! } ! ! retval.insert (tmp, ra_idx); ! return retval; ! } ! ! charNDArray ! concat (const NDArray& ra, const charNDArray& rb, const Array& ra_idx) ! { ! charNDArray retval (ra.dims ()); ! int nel = ra.numel (); ! ! for (int i = 0; i < nel; i++) ! { ! double d = ra.elem (i); ! ! if (xisnan (d)) ! { ! (*current_liboctave_error_handler) ! ("invalid conversion from NaN to character"); ! return retval; ! } ! else ! { ! int ival = NINT (d); ! ! if (ival < 0 || ival > UCHAR_MAX) ! // XXX FIXME XXX -- is there something ! // better we could do? Should we warn the user? ! ival = 0; ! ! retval.elem (i) = static_cast(ival); ! } ! } ! ! retval.insert (rb, ra_idx); ! return retval; } charMatrix *** ./liboctave/dim-vector.h.orig2 2004-07-06 14:16:43.000000000 +0200 --- ./liboctave/dim-vector.h 2004-07-08 18:02:54.000000000 +0200 *************** *** 357,362 **** --- 357,433 ---- return new_dims; } + + bool concat (const dim_vector& dvb, int dim = 0) + { + if (all_zero ()) + { + *this = dvb; + return true; + } + + if (dvb.all_zero ()) + return true; + + int na = length (); + int nb = dvb.length (); + + // Find the max and min value of na and nb + int n_max = na > nb ? na : nb; + int n_min = na < nb ? na : nb; + + // The elements of the dimension vectors can only differ + // if the dim variable differs from the actual dimension + // they differ. + + for (int i = 0; i < n_min; i++) + { + if (elem(i) != dvb(i) && dim != i) + return false; + } + + // Ditto. + for (int i = n_min; i < n_max; i++) + { + if (na > n_min) + { + if (elem(i) != 1 && dim != i) + return false; + } + else + { + if (dvb(i) != 1 && dim != i) + return false; + } + } + + // If we want to add the dimension vectors at a dimension + // larger than both, then we need to set n_max to this number + // so that we resize *this to the right dimension. + + n_max = n_max > (dim + 1) ? n_max : (dim + 1); + + // Resize *this to the appropriate dimensions. + + if (n_max > na) + { + dim_vector_rep *old_rep = rep; + + rep = new dim_vector_rep (n_max, old_rep, 1); + + if (--old_rep->count <= 0) + delete old_rep; + } + + // Larger or equal since dim has been decremented by one. + + if (dim >= nb) + elem (dim) = elem (dim)++; + else + elem (dim) += dvb(dim); + + return true; + } }; static inline bool *** ./liboctave/CNDArray.h.orig2 2004-07-06 15:13:32.000000000 +0200 --- ./liboctave/CNDArray.h 2004-07-08 04:13:36.000000000 +0200 *************** *** 87,93 **** ComplexNDArray prod (int dim = -1) const; ComplexNDArray sum (int dim = -1) const; ComplexNDArray sumsq (int dim = -1) const; ! int cat (const ComplexNDArray& ra_arg, int dim, int iidx, int move); ComplexNDArray max (int dim = 0) const; ComplexNDArray max (ArrayN& index, int dim = 0) const; --- 87,99 ---- ComplexNDArray prod (int dim = -1) const; ComplexNDArray sum (int dim = -1) const; ComplexNDArray sumsq (int dim = -1) const; ! friend ComplexNDArray concat (const ComplexNDArray& ra, ! const ComplexNDArray& rb, ! const Array& ra_idx); ! friend ComplexNDArray concat (const ComplexNDArray& ra, const NDArray& rb, ! const Array& ra_idx); ! friend ComplexNDArray concat (const NDArray& ra, const ComplexNDArray& rb, ! const Array& ra_idx); ComplexNDArray max (int dim = 0) const; ComplexNDArray max (ArrayN& index, int dim = 0) const; *************** *** 96,101 **** --- 102,108 ---- ComplexNDArray& insert (const NDArray& a, int r, int c); ComplexNDArray& insert (const ComplexNDArray& a, int r, int c); + ComplexNDArray& insert (const ComplexNDArray& a, const Array& ra_idx); NDArray abs (void) const; *** ./liboctave/Array-d.cc.orig2 2004-07-06 15:08:14.000000000 +0200 --- ./liboctave/Array-d.cc 2004-07-08 01:21:47.000000000 +0200 *************** *** 31,38 **** INSTANTIATE_ARRAY_AND_ASSIGN (double); - INSTANTIATE_ARRAY_CAT (double); - INSTANTIATE_ARRAY_ASSIGN (double, int); INSTANTIATE_ARRAY_ASSIGN (double, short); INSTANTIATE_ARRAY_ASSIGN (double, char); --- 31,36 ---- *** ./liboctave/Array-ch.cc.orig2 2004-07-06 15:08:22.000000000 +0200 --- ./liboctave/Array-ch.cc 2004-07-08 01:22:24.000000000 +0200 *************** *** 31,38 **** INSTANTIATE_ARRAY_AND_ASSIGN (char); - INSTANTIATE_ARRAY_CAT (char); - #include "Array2.h" template class Array2; --- 31,36 ---- *** ./liboctave/dNDArray.cc.orig2 2004-07-06 15:12:24.000000000 +0200 --- ./liboctave/dNDArray.cc 2004-07-08 01:27:14.000000000 +0200 *************** *** 806,815 **** return result; } ! int ! NDArray::cat (const NDArray& ra_arg, int dim, int iidx, int move) { ! return ::cat_ra (*this, ra_arg, dim, iidx, move); } NDArray --- 806,817 ---- return result; } ! NDArray ! concat (const NDArray& ra, const NDArray& rb, const Array& ra_idx) { ! NDArray retval (ra); ! retval.insert (rb, ra_idx); ! return retval; } NDArray *** ./liboctave/dNDArray.h.orig2 2004-07-06 15:12:29.000000000 +0200 --- ./liboctave/dNDArray.h 2004-07-08 01:27:07.000000000 +0200 *************** *** 86,92 **** NDArray prod (int dim = -1) const; NDArray sum (int dim = -1) const; NDArray sumsq (int dim = -1) const; ! int cat (const NDArray& ra_arg, int dim, int iidx, int move); NDArray max (int dim = 0) const; NDArray max (ArrayN& index, int dim = 0) const; --- 86,93 ---- NDArray prod (int dim = -1) const; NDArray sum (int dim = -1) const; NDArray sumsq (int dim = -1) const; ! friend NDArray concat (const NDArray& ra, const NDArray& rb, ! const Array& ra_idx); NDArray max (int dim = 0) const; NDArray max (ArrayN& index, int dim = 0) const; *** ./liboctave/CNDArray.cc.orig2 2004-07-06 15:13:37.000000000 +0200 --- ./liboctave/CNDArray.cc 2004-07-08 02:20:35.000000000 +0200 *************** *** 677,686 **** MX_ND_COMPLEX_OP_REDUCTION (+= elem (iter_idx), Complex (0, 0)); } ! int ! ComplexNDArray::cat (const ComplexNDArray& ra_arg, int dim, int iidx, int move) { ! return ::cat_ra(*this, ra_arg, dim, iidx, move); } static const Complex Complex_NaN_result (octave_NaN, octave_NaN); --- 677,706 ---- MX_ND_COMPLEX_OP_REDUCTION (+= elem (iter_idx), Complex (0, 0)); } ! ComplexNDArray ! concat (const ComplexNDArray& ra, const ComplexNDArray& rb, ! const Array& ra_idx) { ! ComplexNDArray retval (ra); ! retval.insert (rb, ra_idx); ! return retval; ! } ! ! ComplexNDArray ! concat (const ComplexNDArray& ra, const NDArray& rb, const Array& ra_idx) ! { ! ComplexNDArray retval (ra); ! ComplexNDArray tmp (rb); ! retval.insert (tmp, ra_idx); ! return retval; ! } ! ! ComplexNDArray ! concat (const NDArray& ra, const ComplexNDArray& rb, const Array& ra_idx) ! { ! ComplexNDArray retval (ra); ! retval.insert (rb, ra_idx); ! return retval; } static const Complex Complex_NaN_result (octave_NaN, octave_NaN); *************** *** 939,944 **** --- 959,971 ---- return *this; } + ComplexNDArray& + ComplexNDArray::insert (const ComplexNDArray& a, const Array& ra_idx) + { + Array::insert (a, ra_idx); + return *this; + } + ComplexMatrix ComplexNDArray::matrix_value (void) const { *** ./src/OPERATORS/op-range.cc.orig2 2004-07-07 16:54:04.000000000 +0200 --- ./src/OPERATORS/op-range.cc 2004-07-08 04:03:49.000000000 +0200 *************** *** 32,37 **** --- 32,44 ---- #include "oct-obj.h" #include "ov.h" #include "ov-range.h" + #include "ov-ch-mat.h" + #include "ov-scalar.h" + #include "ov-re-mat.h" + #include "ov-complex.h" + #include "ov-cx-mat.h" + #include "ov-bool.h" + #include "ov-bool-mat.h" #include "ov-typeinfo.h" #include "ops.h" *************** *** 53,58 **** --- 60,81 ---- return octave_value (v.matrix_value().transpose ()); } + DEFNDCATOP_FN (r_r, range, range, array, array, concat) + DEFNDCATOP_FN (r_s, range, scalar, array, array, concat) + DEFNDCATOP_FN (r_m, range, matrix, array, array, concat) + DEFNDCATOP_FN (r_cs, range, complex, array, complex_array, concat) + DEFNDCATOP_FN (r_cm, range, complex_matrix, array, complex_array, concat) + DEFNDCATOP_FN (r_b, range, bool, array, array, concat) + DEFNDCATOP_FN (r_bm, range, bool_matrix, array, array, concat) + DEFNDCATOP_FN (r_chm, range, char_matrix, array, char_array, concat) + DEFNDCATOP_FN (s_r, scalar, range, array, array, concat) + DEFNDCATOP_FN (m_r, matrix, range, array, array, concat) + DEFNDCATOP_FN (cs_r, complex, range, complex_array, array, concat) + DEFNDCATOP_FN (cm_r, complex_matrix, range, complex_array, array, concat) + DEFNDCATOP_FN (b_r, bool, range, array, array, concat) + DEFNDCATOP_FN (bm_r, bool_matrix, range, array, array, concat) + DEFNDCATOP_FN (chm_r, char_matrix, range, char_array, array, concat) + void install_range_ops (void) { *************** *** 60,65 **** --- 83,104 ---- INSTALL_UNOP (op_uminus, octave_range, uminus); INSTALL_UNOP (op_transpose, octave_range, transpose); INSTALL_UNOP (op_hermitian, octave_range, transpose); + + INSTALL_CATOP (octave_range, octave_range, r_r); + INSTALL_CATOP (octave_range, octave_scalar, r_s); + INSTALL_CATOP (octave_range, octave_matrix, r_m); + INSTALL_CATOP (octave_range, octave_complex, r_cs); + INSTALL_CATOP (octave_range, octave_complex_matrix, r_cm); + INSTALL_CATOP (octave_range, octave_bool, r_b); + INSTALL_CATOP (octave_range, octave_bool_matrix, r_bm); + INSTALL_CATOP (octave_range, octave_char_matrix, r_chm); + INSTALL_CATOP (octave_scalar, octave_range, s_r); + INSTALL_CATOP (octave_matrix, octave_range, m_r); + INSTALL_CATOP (octave_complex, octave_range, cs_r); + INSTALL_CATOP (octave_complex_matrix, octave_range, cm_r); + INSTALL_CATOP (octave_bool, octave_range, b_r); + INSTALL_CATOP (octave_bool_matrix, octave_range, bm_r); + INSTALL_CATOP (octave_char_matrix, octave_range, chm_r); } /* *** ./src/OPERATORS/op-m-m.cc.orig2 2004-07-06 17:12:05.000000000 +0200 --- ./src/OPERATORS/op-m-m.cc 2004-07-06 23:16:32.000000000 +0200 *************** *** 95,100 **** --- 95,102 ---- DEFNDBINOP_FN (el_and, matrix, matrix, array, array, mx_el_and) DEFNDBINOP_FN (el_or, matrix, matrix, array, array, mx_el_or) + DEFNDCATOP_FN (m_m, matrix, matrix, array, array, concat) + DEFNDASSIGNOP_FN (assign, matrix, matrix, array, assign) void *************** *** 127,132 **** --- 129,136 ---- INSTALL_BINOP (op_el_and, octave_matrix, octave_matrix, el_and); INSTALL_BINOP (op_el_or, octave_matrix, octave_matrix, el_or); + INSTALL_CATOP (octave_matrix, octave_matrix, m_m); + INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_matrix, assign); } *** ./src/OPERATORS/op-str-str.cc.orig2 2004-07-09 14:07:48.000000000 +0200 --- ./src/OPERATORS/op-str-str.cc 2004-07-09 15:49:53.000000000 +0200 *************** *** 117,122 **** --- 117,130 ---- return octave_value (); } + DEFCATOP (str_str, char_matrix_str, char_matrix_str) + { + CAST_BINOP_ARGS (const octave_char_matrix_str&, + const octave_char_matrix_str&); + return octave_value (concat (v1.char_array_value (), v2.char_array_value (), + ra_idx), true); + } + void install_str_str_ops (void) { *************** *** 126,131 **** --- 134,141 ---- INSTALL_BINOP (op_eq, octave_char_matrix_str, octave_char_matrix_str, eq); INSTALL_BINOP (op_ne, octave_char_matrix_str, octave_char_matrix_str, ne); + INSTALL_CATOP (octave_char_matrix_str, octave_char_matrix_str, str_str); + INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_char_matrix_str, assign); } *** ./src/OPERATORS/op-s-s.cc.orig2 2004-07-06 22:33:38.000000000 +0200 --- ./src/OPERATORS/op-s-s.cc 2004-07-06 23:15:33.000000000 +0200 *************** *** 118,123 **** --- 118,125 ---- DEFBINOP_OP (el_and, scalar, scalar, &&) DEFBINOP_OP (el_or, scalar, scalar, ||) + DEFNDCATOP_FN (s_s, scalar, scalar, array, array, concat) + void install_s_s_ops (void) { *************** *** 148,153 **** --- 150,157 ---- INSTALL_BINOP (op_el_and, octave_scalar, octave_scalar, el_and); INSTALL_BINOP (op_el_or, octave_scalar, octave_scalar, el_or); + INSTALL_CATOP (octave_scalar, octave_scalar, s_s); + INSTALL_ASSIGNCONV (octave_scalar, octave_scalar, octave_matrix); } *** ./src/OPERATORS/op-s-m.cc.orig2 2004-07-06 22:33:44.000000000 +0200 --- ./src/OPERATORS/op-s-m.cc 2004-07-06 23:15:52.000000000 +0200 *************** *** 94,99 **** --- 94,101 ---- DEFNDBINOP_FN (el_and, scalar, matrix, scalar, array, mx_el_and) DEFNDBINOP_FN (el_or, scalar, matrix, scalar, array, mx_el_or) + DEFNDCATOP_FN (s_m, scalar, matrix, array, array, concat) + DEFCONV (matrix_conv, scalar, matrix) { CAST_CONV_ARG (const octave_scalar&); *************** *** 123,128 **** --- 125,132 ---- INSTALL_BINOP (op_el_and, octave_scalar, octave_matrix, el_and); INSTALL_BINOP (op_el_or, octave_scalar, octave_matrix, el_or); + INSTALL_CATOP (octave_scalar, octave_matrix, s_m); + INSTALL_ASSIGNCONV (octave_scalar, octave_matrix, octave_matrix); INSTALL_WIDENOP (octave_scalar, octave_matrix, matrix_conv); *** ./src/OPERATORS/op-m-s.cc.orig2 2004-07-06 22:34:10.000000000 +0200 --- ./src/OPERATORS/op-m-s.cc 2004-07-06 23:16:14.000000000 +0200 *************** *** 101,106 **** --- 101,108 ---- DEFNDBINOP_FN (el_and, matrix, scalar, array, scalar, mx_el_and) DEFNDBINOP_FN (el_or, matrix, scalar, array, scalar, mx_el_or) + DEFNDCATOP_FN (m_s, matrix, scalar, array, array, concat) + DEFNDASSIGNOP_FN (assign, matrix, scalar, array, assign) void *************** *** 131,136 **** --- 133,140 ---- INSTALL_BINOP (op_el_and, octave_matrix, octave_scalar, el_and); INSTALL_BINOP (op_el_or, octave_matrix, octave_scalar, el_or); + INSTALL_CATOP (octave_matrix, octave_scalar, m_s); + INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_scalar, assign); } *** ./src/OPERATORS/op-b-b.cc.orig2 2004-07-06 22:50:27.000000000 +0200 --- ./src/OPERATORS/op-b-b.cc 2004-07-06 23:23:03.000000000 +0200 *************** *** 32,37 **** --- 32,39 ---- #include "oct-obj.h" #include "ov.h" #include "ov-bool.h" + #include "ov-scalar.h" + #include "ov-re-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" *************** *** 52,57 **** --- 54,63 ---- 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) + void install_b_b_ops (void) { *************** *** 63,68 **** --- 69,78 ---- INSTALL_BINOP (op_ne, octave_bool, octave_bool, ne); INSTALL_BINOP (op_el_and, octave_bool, octave_bool, el_and); INSTALL_BINOP (op_el_or, octave_bool, octave_bool, el_or); + + INSTALL_CATOP (octave_bool, octave_bool, b_b); + INSTALL_CATOP (octave_bool, octave_scalar, b_s); + INSTALL_CATOP (octave_scalar, octave_bool, s_b); } /* *** ./src/OPERATORS/op-b-bm.cc.orig2 2004-07-06 22:50:37.000000000 +0200 --- ./src/OPERATORS/op-b-bm.cc 2004-07-06 23:23:31.000000000 +0200 *************** *** 33,38 **** --- 33,40 ---- #include "ov.h" #include "ov-bool.h" #include "ov-bool-mat.h" + #include "ov-scalar.h" + #include "ov-re-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" *************** *** 43,53 **** --- 45,63 ---- 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) + void install_b_bm_ops (void) { INSTALL_BINOP (op_el_and, octave_bool, octave_bool_matrix, el_and); INSTALL_BINOP (op_el_or, octave_bool, octave_bool_matrix, el_or); + + INSTALL_CATOP (octave_bool, octave_bool_matrix, b_bm); + INSTALL_CATOP (octave_bool, octave_matrix, b_m); + INSTALL_CATOP (octave_scalar, octave_bool_matrix, s_bm); } /* *** ./src/OPERATORS/op-bm-b.cc.orig2 2004-07-06 22:50:49.000000000 +0200 --- ./src/OPERATORS/op-bm-b.cc 2004-07-06 23:23:41.000000000 +0200 *************** *** 33,38 **** --- 33,40 ---- #include "ov.h" #include "ov-bool.h" #include "ov-bool-mat.h" + #include "ov-scalar.h" + #include "ov-re-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" *************** *** 43,48 **** --- 45,54 ---- 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) + DEFNDASSIGNOP_FN (assign, bool_matrix, bool, bool_array, assign) void *************** *** 51,56 **** --- 57,66 ---- INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool, el_and); INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool, el_or); + INSTALL_CATOP (octave_bool_matrix, octave_bool, bm_b); + INSTALL_CATOP (octave_bool_matrix, octave_scalar, bm_s); + INSTALL_CATOP (octave_matrix, octave_bool, m_b); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool, assign); } *** ./src/OPERATORS/op-bm-bm.cc.orig2 2004-07-06 22:50:56.000000000 +0200 --- ./src/OPERATORS/op-bm-bm.cc 2004-07-06 23:23:55.000000000 +0200 *************** *** 32,37 **** --- 32,38 ---- #include "oct-obj.h" #include "ov.h" #include "ov-bool-mat.h" + #include "ov-re-mat.h" #include "ov-typeinfo.h" #include "ops.h" #include "xdiv.h" *************** *** 65,70 **** --- 66,75 ---- 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) + DEFNDASSIGNOP_FN (assign, bool_matrix, bool_matrix, bool_array, assign) void *************** *** 80,85 **** --- 85,94 ---- INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_bool_matrix, el_and); INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_bool_matrix, el_or); + INSTALL_CATOP (octave_bool_matrix, octave_bool_matrix, bm_bm); + INSTALL_CATOP (octave_bool_matrix, octave_matrix, bm_m); + INSTALL_CATOP (octave_matrix, octave_bool_matrix, m_bm); + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_bool_matrix, assign); } *** ./src/OPERATORS/op-cell.cc.orig2 2004-07-06 23:20:23.000000000 +0200 --- ./src/OPERATORS/op-cell.cc 2004-07-06 23:36:09.000000000 +0200 *************** *** 52,57 **** --- 52,59 ---- return octave_value (Cell (v.cell_value().transpose ())); } + DEFCATOP_FN (c_c, cell, cell, concat) + DEFASSIGNANYOP_FN (assign, cell, assign); void *************** *** 60,65 **** --- 62,69 ---- INSTALL_UNOP (op_transpose, octave_cell, transpose); INSTALL_UNOP (op_hermitian, octave_cell, transpose); + INSTALL_CATOP (octave_cell, octave_cell, c_c); + INSTALL_ASSIGNANYOP (op_asn_eq, octave_cell, assign); } *** ./src/OPERATORS/op-chm.cc.orig2 2004-07-07 11:51:04.000000000 +0200 --- ./src/OPERATORS/op-chm.cc 2004-07-12 11:05:41.000000000 +0200 *************** *** 32,37 **** --- 32,41 ---- #include "oct-obj.h" #include "ov.h" #include "ov-ch-mat.h" + #include "ov-scalar.h" + #include "ov-re-mat.h" + #include "ov-bool.h" + #include "ov-bool-mat.h" #include "ov-typeinfo.h" #include "ops.h" *************** *** 44,54 **** --- 48,110 ---- return octave_value (v.matrix_value().transpose ()); } + DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array, concat) + + DEFCATOP (chm_s, char_matrix, scalar) + { + CAST_BINOP_ARGS (const octave_char_matrix&, const octave_scalar&); + + if (Vwarn_num_to_str) + gripe_implicit_conversion (v2.type_name (), v1.type_name ()); + + return octave_value (concat (v1.char_array_value (), v2.array_value (), + ra_idx)); + } + + DEFCATOP (chm_m, char_matrix, matrix) + { + CAST_BINOP_ARGS (const octave_char_matrix&, const octave_matrix&); + + if (Vwarn_num_to_str) + gripe_implicit_conversion (v2.type_name (), v1.type_name ()); + + return octave_value (concat (v1.char_array_value (), v2.array_value (), + ra_idx)); + } + + DEFCATOP (s_chm, scalar, char_matrix) + { + CAST_BINOP_ARGS (const octave_scalar&, const octave_char_matrix&); + + if (Vwarn_num_to_str) + gripe_implicit_conversion (v1.type_name (), v2.type_name ()); + + return octave_value (concat (v1.array_value (), v2.char_array_value (), + ra_idx)); + } + + DEFCATOP (m_chm, matrix, char_matrix) + { + CAST_BINOP_ARGS (const octave_matrix&, const octave_char_matrix&); + + if (Vwarn_num_to_str) + gripe_implicit_conversion (v1.type_name (), v2.type_name ()); + + return octave_value (concat (v1.array_value (), v2.char_array_value (), + ra_idx)); + } + void install_chm_ops (void) { INSTALL_UNOP (op_transpose, octave_char_matrix, transpose); INSTALL_UNOP (op_hermitian, octave_char_matrix, transpose); + + INSTALL_CATOP (octave_char_matrix, octave_char_matrix, chm_chm); + INSTALL_CATOP (octave_char_matrix, octave_scalar, chm_s); + INSTALL_CATOP (octave_char_matrix, octave_matrix, chm_m); + INSTALL_CATOP (octave_scalar, octave_char_matrix, s_chm); + INSTALL_CATOP (octave_matrix, octave_char_matrix, m_chm); } /* *** ./src/OPERATORS/op-str-m.cc.orig2 2004-07-09 14:18:12.000000000 +0200 --- ./src/OPERATORS/op-str-m.cc 2004-07-12 11:26:01.000000000 +0200 *************** *** 48,57 **** --- 48,84 ---- return octave_value (); } + DEFCATOP (str_m, char_matrix_str, matrix) + { + CAST_BINOP_ARGS (const octave_char_matrix_str&, + const octave_matrix&); + + if (Vwarn_num_to_str) + gripe_implicit_conversion (v2.type_name (), v1.type_name ()); + + return octave_value (concat (v1.char_array_value (), v2.array_value (), + ra_idx), true); + } + + DEFCATOP (m_str, matrix, char_matrix_str) + { + CAST_BINOP_ARGS (const octave_matrix&, + const octave_char_matrix_str&); + + if (Vwarn_num_to_str) + gripe_implicit_conversion (v1.type_name (), v2.type_name ()); + + return octave_value (concat (v1.array_value (), v2.char_array_value (), + ra_idx), true); + } + void install_str_m_ops (void) { INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_matrix, assign); + + INSTALL_CATOP (octave_char_matrix_str, octave_matrix, str_m); + INSTALL_CATOP (octave_matrix, octave_char_matrix_str, m_str); } /* *** ./src/OPERATORS/op-cm-cm.cc.orig2 2004-07-07 11:54:17.000000000 +0200 --- ./src/OPERATORS/op-cm-cm.cc 2004-07-07 11:57:55.000000000 +0200 *************** *** 108,113 **** --- 108,115 ---- 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) + DEFNDCATOP_FN (cm_cm, complex_matrix, complex_matrix, complex_array, complex_array, concat) + DEFNDASSIGNOP_FN (assign, complex_matrix, complex_matrix, complex_array, assign) void *************** *** 140,145 **** --- 142,149 ---- INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_complex_matrix, el_and); INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_complex_matrix, el_or); + INSTALL_CATOP (octave_complex_matrix, octave_complex_matrix, cm_cm); + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_complex_matrix, assign); } *** ./src/OPERATORS/op-str-s.cc.orig2 2004-07-12 12:27:06.000000000 +0200 --- ./src/OPERATORS/op-str-s.cc 2004-07-12 11:25:44.000000000 +0200 *************** *** 48,57 **** --- 48,84 ---- return octave_value (); } + DEFCATOP (str_s, char_matrix_str, scalar) + { + CAST_BINOP_ARGS (const octave_char_matrix_str&, + const octave_scalar&); + + if (Vwarn_num_to_str) + gripe_implicit_conversion (v2.type_name (), v1.type_name ()); + + return octave_value (concat (v1.char_array_value (), v2.array_value (), + ra_idx), true); + } + + DEFCATOP (s_str, scalar, char_matrix_str) + { + CAST_BINOP_ARGS (const octave_scalar&, + const octave_char_matrix_str&); + + if (Vwarn_num_to_str) + gripe_implicit_conversion (v1.type_name (), v2.type_name ()); + + return octave_value (concat (v1.array_value (), v2.char_array_value (), + ra_idx), true); + } + void install_str_s_ops (void) { INSTALL_ASSIGNOP (op_asn_eq, octave_char_matrix_str, octave_scalar, assign); + + INSTALL_CATOP (octave_char_matrix_str, octave_scalar, str_s); + INSTALL_CATOP (octave_scalar, octave_char_matrix_str, s_str); } /* *** ./src/OPERATORS/op-cm-m.cc.orig2 2004-07-07 11:59:31.000000000 +0200 --- ./src/OPERATORS/op-cm-m.cc 2004-07-07 12:00:17.000000000 +0200 *************** *** 80,85 **** --- 80,87 ---- 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) + DEFNDCATOP_FN (cm_m, complex_matrix, matrix, complex_array, array, concat) + DEFNDASSIGNOP_FN (assign, complex_matrix, matrix, complex_array, assign) void *************** *** 104,109 **** --- 106,113 ---- INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_matrix, el_and); INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_matrix, el_or); + INSTALL_CATOP (octave_complex_matrix, octave_matrix, cm_m); + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_matrix, assign); } *** ./src/OPERATORS/op-cm-cs.cc.orig2 2004-07-07 11:58:29.000000000 +0200 --- ./src/OPERATORS/op-cm-cs.cc 2004-07-07 11:59:16.000000000 +0200 *************** *** 101,106 **** --- 101,108 ---- 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) + DEFNDCATOP_FN (cm_cs, complex_matrix, complex, complex_array, complex_array, concat) + DEFNDASSIGNOP_FN (assign, complex_matrix, complex, complex_array, assign) void *************** *** 125,130 **** --- 127,134 ---- INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_complex, el_and); INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_complex, el_or); + INSTALL_CATOP (octave_complex_matrix, octave_complex, cm_cs); + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_complex, assign); } *** ./src/OPERATORS/op-cm-s.cc.orig2 2004-07-07 12:00:29.000000000 +0200 --- ./src/OPERATORS/op-cm-s.cc 2004-07-07 12:08:29.000000000 +0200 *************** *** 105,110 **** --- 105,112 ---- 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) + DEFNDCATOP_FN (cm_s, complex_matrix, scalar, complex_array, array, concat) + DEFNDASSIGNOP_FN (assign, complex_matrix, scalar, complex_array, assign) void *************** *** 129,134 **** --- 131,138 ---- INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_scalar, el_and); INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_scalar, el_or); + INSTALL_CATOP (octave_complex_matrix, octave_scalar, cm_s); + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_scalar, assign); } *** ./src/OPERATORS/op-cs-cm.cc.orig2 2004-07-07 12:01:44.000000000 +0200 --- ./src/OPERATORS/op-cs-cm.cc 2004-07-07 12:02:37.000000000 +0200 *************** *** 94,99 **** --- 94,101 ---- 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) + DEFNDCATOP_FN (cs_cm, complex, complex_matrix, complex_array, complex_array, concat) + DEFCONV (complex_matrix_conv, complex, complex_matrix) { CAST_CONV_ARG (const octave_complex&); *************** *** 123,128 **** --- 125,132 ---- INSTALL_BINOP (op_el_and, octave_complex, octave_complex_matrix, el_and); INSTALL_BINOP (op_el_or, octave_complex, octave_complex_matrix, el_or); + INSTALL_CATOP (octave_complex, octave_complex_matrix, cs_cm); + INSTALL_ASSIGNCONV (octave_complex, octave_complex_matrix, octave_complex_matrix); INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv); *** ./src/OPERATORS/op-cs-cs.cc.orig2 2004-07-07 12:05:07.000000000 +0200 --- ./src/OPERATORS/op-cs-cs.cc 2004-07-07 12:03:33.000000000 +0200 *************** *** 176,181 **** --- 176,183 ---- return v1.complex_value () != 0.0 || v2.complex_value () != 0.0; } + DEFNDCATOP_FN (cs_cs, complex, complex, complex_array, complex_array, concat) + void install_cs_cs_ops (void) { *************** *** 206,211 **** --- 208,215 ---- INSTALL_BINOP (op_el_and, octave_complex, octave_complex, el_and); INSTALL_BINOP (op_el_or, octave_complex, octave_complex, el_or); + INSTALL_CATOP (octave_complex, octave_complex, cs_cs); + INSTALL_ASSIGNCONV (octave_complex, octave_complex, octave_complex_matrix); } *** ./src/OPERATORS/op-cs-m.cc.orig2 2004-07-07 12:05:20.000000000 +0200 --- ./src/OPERATORS/op-cs-m.cc 2004-07-07 12:04:30.000000000 +0200 *************** *** 100,105 **** --- 100,107 ---- DEFNDBINOP_FN (el_and, complex, matrix, complex, array, mx_el_and) DEFNDBINOP_FN (el_or, complex, matrix, complex, array, mx_el_or) + DEFNDCATOP_FN (cs_m, complex, matrix, complex_array, array, concat) + void install_cs_m_ops (void) { *************** *** 122,127 **** --- 124,131 ---- INSTALL_BINOP (op_el_and, octave_complex, octave_matrix, el_and); INSTALL_BINOP (op_el_or, octave_complex, octave_matrix, el_or); + INSTALL_CATOP (octave_complex, octave_matrix, cs_m); + INSTALL_ASSIGNCONV (octave_complex, octave_matrix, octave_complex_matrix); } *** ./src/OPERATORS/op-cs-s.cc.orig2 2004-07-07 12:05:28.000000000 +0200 --- ./src/OPERATORS/op-cs-s.cc 2004-07-07 12:06:46.000000000 +0200 *************** *** 155,160 **** --- 155,162 ---- return v1.complex_value () != 0.0 || v2.double_value (); } + DEFNDCATOP_FN (cs_s, complex, scalar, complex_array, array, concat) + void install_cs_s_ops (void) { *************** *** 177,182 **** --- 179,186 ---- INSTALL_BINOP (op_el_and, octave_complex, octave_scalar, el_and); INSTALL_BINOP (op_el_or, octave_complex, octave_scalar, el_or); + INSTALL_CATOP (octave_complex, octave_scalar, cs_s); + INSTALL_ASSIGNCONV (octave_complex, octave_scalar, octave_complex_matrix); } *** ./src/OPERATORS/op-m-cm.cc.orig2 2004-07-07 13:07:12.000000000 +0200 --- ./src/OPERATORS/op-m-cm.cc 2004-07-07 13:08:11.000000000 +0200 *************** *** 80,85 **** --- 80,87 ---- 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) + DEFNDCATOP_FN (m_cm, matrix, complex_matrix, array, complex_array, concat) + DEFCONV (complex_matrix_conv, matrix, complex_matrix) { CAST_CONV_ARG (const octave_matrix&); *************** *** 109,114 **** --- 111,118 ---- INSTALL_BINOP (op_el_and, octave_matrix, octave_complex_matrix, el_and); INSTALL_BINOP (op_el_or, octave_matrix, octave_complex_matrix, el_or); + INSTALL_CATOP (octave_matrix, octave_complex_matrix, m_cm); + INSTALL_ASSIGNCONV (octave_matrix, octave_complex_matrix, octave_complex_matrix); INSTALL_WIDENOP (octave_matrix, octave_complex_matrix, complex_matrix_conv); *** ./src/OPERATORS/op-m-cs.cc.orig2 2004-07-07 13:08:39.000000000 +0200 --- ./src/OPERATORS/op-m-cs.cc 2004-07-07 13:09:45.000000000 +0200 *************** *** 107,112 **** --- 107,114 ---- DEFNDBINOP_FN (el_and, matrix, complex, array, complex, mx_el_and) DEFNDBINOP_FN (el_or, matrix, complex, array, complex, mx_el_or) + DEFNDCATOP_FN (m_cs, matrix, complex, array, complex_array, concat) + void install_m_cs_ops (void) { *************** *** 129,134 **** --- 131,138 ---- INSTALL_BINOP (op_el_and, octave_matrix, octave_complex, el_and); INSTALL_BINOP (op_el_or, octave_matrix, octave_complex, el_or); + INSTALL_CATOP (octave_matrix, octave_complex, m_cs); + INSTALL_ASSIGNCONV (octave_matrix, octave_complex, octave_complex_matrix); } *** ./src/OPERATORS/op-s-cm.cc.orig2 2004-07-07 13:08:49.000000000 +0200 --- ./src/OPERATORS/op-s-cm.cc 2004-07-07 13:12:13.000000000 +0200 *************** *** 111,116 **** --- 111,118 ---- return mx_el_or (v1.double_value (), v2.complex_array_value ()); } + DEFNDCATOP_FN (s_cm, scalar, complex_matrix, array, complex_array, concat) + DEFCONV (complex_matrix_conv, scalar, complex_matrix) { CAST_CONV_ARG (const octave_scalar&); *************** *** 140,145 **** --- 142,149 ---- INSTALL_BINOP (op_el_and, octave_scalar, octave_complex_matrix, el_and); INSTALL_BINOP (op_el_or, octave_scalar, octave_complex_matrix, el_or); + INSTALL_CATOP (octave_scalar, octave_complex_matrix, s_cm); + INSTALL_ASSIGNCONV (octave_scalar, octave_complex_matrix, octave_complex_matrix); INSTALL_WIDENOP (octave_scalar, octave_complex_matrix, complex_matrix_conv); *** ./src/OPERATORS/op-s-cs.cc.orig2 2004-07-07 13:08:54.000000000 +0200 --- ./src/OPERATORS/op-s-cs.cc 2004-07-07 13:12:09.000000000 +0200 *************** *** 155,160 **** --- 155,162 ---- return octave_value (v1.double_value () || (v2.complex_value () != 0.0)); } + DEFNDCATOP_FN (s_cs, scalar, complex, array, complex_array, concat) + void install_s_cs_ops (void) { *************** *** 177,182 **** --- 179,186 ---- INSTALL_BINOP (op_el_and, octave_scalar, octave_complex, el_and); INSTALL_BINOP (op_el_or, octave_scalar, octave_complex, el_or); + INSTALL_CATOP (octave_scalar, octave_complex, s_cs); + INSTALL_ASSIGNCONV (octave_scalar, octave_complex, octave_complex_matrix); } *** ./src/TEMPLATE-INST/Array-tc.cc.orig2 2004-07-06 23:33:27.000000000 +0200 --- ./src/TEMPLATE-INST/Array-tc.cc 2004-07-08 01:23:02.000000000 +0200 *************** *** 51,58 **** INSTANTIATE_ARRAY_ASSIGN (octave_value, octave_value); - INSTANTIATE_ARRAY_CAT (octave_value); - template class Array2; template class ArrayN; --- 51,56 ---- *** ./src/pt-mat.cc.orig2 2004-07-08 19:10:18.000000000 +0200 --- ./src/pt-mat.cc 2004-07-10 22:39:03.000000000 +0200 *************** *** 491,500 **** return true; } - // Just about as ugly as it gets. - // Less ugly than before, anyway. - // Looking better all the time. - octave_value_list tree_matrix::rvalue (int nargout) { --- 491,496 ---- *************** *** 517,637 **** tm_const tmp (*this); - bool all_strings_p = false; - bool some_strings_p = false; - bool all_empty_p = false; - - bool frc_str_conv = false; - if (tmp) { dim_vector dv = tmp.dims (); ! NDArray nd; ! ComplexNDArray cnd; ! charNDArray chnd; // Now, extract the values from the individual elements and // insert them in the result matrix. ! bool found_complex = tmp.complex_p (); ! ! all_strings_p = tmp.all_strings_p (); ! some_strings_p = tmp.some_strings_p (); ! all_empty_p = tmp.all_empty_p (); ! ! frc_str_conv = some_strings_p; ! ! if (all_strings_p) ! chnd.resize_and_fill (dv, Vstring_fill_char); ! else if (found_complex) ! cnd.resize_and_fill (dv, 0.0); ! else ! nd.resize_and_fill (dv, 0.0); ! ! int put_row = 0; for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) { - int put_col = 0; - tm_row_const row = *p; for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) { octave_value elt = *q; ! if (found_complex) ! { ! if (elt.is_real_scalar ()) ! cnd (put_row, put_col) = elt.double_value (); ! else if (elt.is_real_matrix () || elt.is_range ()) ! cnd.insert (elt.array_value (), put_row, put_col); ! else if (elt.is_complex_scalar ()) ! cnd (put_row, put_col) = elt.complex_value (); ! else ! { ! ComplexNDArray cnd_elt = elt.complex_array_value (); ! ! if (error_state) ! goto done; ! ! cnd.insert (cnd_elt, put_row, put_col); ! } ! } ! else ! { ! if (elt.is_real_scalar ()) ! nd (put_row, put_col) = elt.double_value (); ! else if (elt.is_string () && all_strings_p) ! { ! charNDArray chnd_elt = elt.char_array_value (); ! ! if (error_state) ! goto done; ! ! chnd.insert (chnd_elt, put_row, put_col); ! } ! else ! { ! NDArray nd_elt = elt.array_value (frc_str_conv); ! ! if (error_state) ! goto done; ! ! nd.insert (nd_elt, put_row, put_col); ! } ! } ! ! if (all_strings_p && chnd.rows () > 0 && chnd.cols () > 0) ! retval = octave_value (chnd, true); ! else if (found_complex) ! retval = cnd; ! else ! retval = nd; ! ! put_col += elt.columns (); } ! ! put_row += row.rows (); } - } - - done: ! if (! error_state) ! { ! if (retval.is_undefined () && all_empty_p) ! { ! if (all_strings_p) ! retval = ""; ! else ! retval = NDArray (); ! } ! else if (frc_str_conv && ! retval.is_string ()) ! retval = retval.convert_to_str (); } return retval; } --- 513,570 ---- tm_const tmp (*this); if (tmp) { dim_vector dv = tmp.dims (); ! // XXX FIXME XX ! // The previous version of this code obtained the return type and ! // initialized an array of the correct type. However the return type ! // is now built-up from the return types of do_cat_op. We should ! // special the situation where there are only NDArray and ComplexNDArray ! // elements, or things like boolMatrix that widen to them, and do the ! // correct initialization. How to do this? Will it be faster? Check against ! // version 2.1.57 ! ! octave_value ctmp; ! if (tmp.all_strings_p ()) ! ctmp = octave_value (charNDArray (dv, Vstring_fill_char), true); ! else ! { ! ctmp = octave_value_typeinfo::lookup_type ! (tmp.begin() -> begin() -> type_name()); ! ctmp = ctmp.resize (dv); ! } ! ! if (error_state) ! goto done; // Now, extract the values from the individual elements and // insert them in the result matrix. ! Array ra_idx (dv.length (), 0); for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) { tm_row_const row = *p; + ra_idx (1) = 0; for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) { octave_value elt = *q; ! ctmp = do_cat_op (ctmp, elt, ra_idx); ! if (error_state) ! goto done; ! ra_idx (1) += elt.columns (); } ! ra_idx (0) += row.rows (); } ! retval = ctmp; } + done: return retval; } *** ./src/data.cc.orig2 2004-07-07 15:21:40.000000000 +0200 --- ./src/data.cc 2004-07-10 21:51:56.000000000 +0200 *************** *** 42,47 **** --- 42,48 ---- #include "utils.h" #include "Cell.h" #include "oct-map.h" + #include "pt-mat.h" #define ANY_ALL(FCN) \ \ *************** *** 667,757 **** DATA_REDUCTION (prod); } - static bool - cat_add_dims (dim_vector& dv_new, const dim_vector& dv_arg, int dim) - { - // dv_arg is [] - - if (dv_arg.all_zero ()) - return true; - - // dv_new is [] - - if (dv_new.all_zero ()) - { - dv_new = dv_arg; - return true; - } - - int n_new = dv_new.length (); - int n_args = dv_arg.length (); - - // Find the max and min value of n_new and n_args - - int n_max = n_new > n_args ? n_new : n_args; - int n_min = n_new < n_args ? n_new : n_args; - - // The elements of the dimension vectors can only differ - // if the dim variable differs from the actual dimension - // they differ. - - for (int i = 0; i < n_min; i++) - { - if (dv_new(i) != dv_arg(i) && dim != i) - { - error ("cat: dimension mismatch"); - return false; - } - } - - // Ditto. - - for (int i = n_min; i < n_max; i++) - { - if (n_new > n_min) - { - if (dv_new(i) != 1 && dim != i) - { - error ("cat: dimension mismatch"); - return false; - } - } - else - { - if (dv_arg(i) != 1 && dim != i) - { - error ("cat: dimension mismatch"); - return false; - } - } - } - - // If we want to add the dimension vectors at a dimension - // larger than both, then we need to set n_max to this number - // so that we resize dv_new to the right dimension. - - n_max = n_max > (dim + 1) ? n_max : (dim + 1); - - // Resize dv_new to new the appropriate dimensions. - - if (n_max > n_new) - { - dv_new.resize (n_max); - - for (int i = n_new; i < n_max; i++) - dv_new.elem (i) = 1; - } - - // Larger or equal since dim has been decremented by one. - - if (dim >= n_args) - dv_new.elem (dim) = dv_new.elem (dim)++; - else - dv_new.elem (dim) += dv_arg(dim); - - return true; - } - static octave_value do_cat (const octave_value_list& args, std::string fname) { --- 668,673 ---- *************** *** 771,953 **** if (dim >= 0) { ! ! dim_vector dv = args(1).dims (); ! ! for (int i = 2; i < args.length (); i++) ! { ! // add_dims constructs a dimension vector which holds the // dimensions of the final array after concatenation. ! if (! cat_add_dims (dv, args(i).dims (), dim)) { // Dimensions do not match. ! // cat_add_dims printed a error msg return retval; } } ! NDArray cat_re; ! ComplexNDArray cat_cx; ! charNDArray cat_ch; ! Cell cat_cell; ! Octave_map cat_map; ! ! // The final array can be of three types: ! // ! // re cx ch c ! // ---------------- ! // re |re cx ch X ! // cx |cx cx X X ! // ch |ch X ch X ! // cell |X X X c ! // (X means incompatible). ! ! enum types { REAL, COMPLEX, CHAR, CELL, MAP} t; ! // Initialize t to right value ! if (args(1).is_cell ()) ! { ! t = CELL; ! cat_cell = Cell (dv); ! } ! else if (args(1).is_map ()) { ! error ("concatenation of structures is not yet implemented"); ! return retval; ! // t = MAP; ! // cat_map = Octave_map (dv); } ! else { ! t = REAL; ! cat_re = NDArray (dv, 0); ! } ! ! int idx = 0; ! ! dim_vector dv_first = args(1).dims (); ! ! // n_moves tells us how many times we need to ! // visit each argument. ! // ! // If we are concatenating a 2x2x2 array with a 2x2x2 array ! // along the second dimensions, we do two iterations ! // trough the arguments and move 2x2 elements from each ! // of the arguments into the resulting array on each iteration. ! int n_moves = 1; ! ! for (int i = dim + 1; i < dv_first.length (); i++) ! n_moves *= dv_first(i); ! ! for (int move = 0; move < n_moves ; move++) ! { ! for (int i = 1; i < n_args; i++) ! { ! octave_value tmp = args (i); ! if (t == MAP) ! { ! error ("concatenation of structures is not yet implemented"); ! return retval; ! } ! else if (t == CELL) ! { ! if (! tmp.is_cell ()) ! { ! error ("cannot convert argument to cell"); ! return retval; ! } ! else ! { ! Cell ra_tmp = args(i).cell_value (); ! ! if (error_state) ! return retval; ! ! idx = cat_cell.cat (ra_tmp, dim, idx, move); ! } ! } ! else if (t == REAL) ! { ! if (tmp.is_complex_type ()) ! { ! cat_cx = ComplexNDArray (cat_re); ! ! ComplexNDArray ra_tmp = tmp.complex_array_value (); ! ! if (error_state) ! return retval; ! ! idx = cat_cx.cat (ra_tmp, dim, idx, move); ! ! t = COMPLEX; ! } ! else if (tmp.is_string ()) ! { ! // This is a hack to be able to convert a dNDArray ! // to a chNDArray. ! ! cat_ch = charNDArray (octave_value (cat_re).char_array_value ()); ! ! charNDArray ra_tmp = tmp.char_array_value (); ! ! if (error_state) ! return retval; ! ! idx = cat_ch.cat (ra_tmp, dim, idx, move); ! ! t = CHAR; ! } ! else //if (tmp.is_real_type ()) ! { ! NDArray ra_tmp = tmp.array_value (); ! ! if (error_state) ! return retval; ! ! idx = cat_re.cat (ra_tmp, dim, idx, move); ! } ! } ! else if (t == COMPLEX) ! { ! ComplexNDArray ra_tmp = tmp.complex_array_value (); ! ! if (error_state) ! return retval; ! ! idx = cat_cx.cat (ra_tmp, dim, idx, move); ! } ! else if (t == CHAR) ! { ! if (tmp.is_complex_type ()) ! { ! error ("cannot convert complex type to character type"); ! return retval; ! } ! else ! { ! charNDArray ra_tmp = tmp.char_array_value (); ! ! if (error_state) ! return retval; ! ! cat_ch.cat (ra_tmp, dim, idx, move); ! } ! } ! } } ! ! if (t == REAL) ! retval = octave_value (cat_re); ! else if (t == COMPLEX) ! retval = octave_value (cat_cx); ! else if (t == CHAR) ! retval = octave_value (cat_ch); ! else if (t == CELL) ! retval = octave_value (cat_cell); ! else if (t == MAP) ! retval = octave_value (cat_map); } else print_usage (fname); } --- 687,740 ---- if (dim >= 0) { ! ! dim_vector dv = args(1).dims (); ! ! for (int i = 2; i < args.length (); i++) ! { ! // add_dims constructs a dimension vector which holds the // dimensions of the final array after concatenation. ! if (! dv.concat (args(i).dims (), dim)) { // Dimensions do not match. ! // dv.concat printed a error msg return retval; } } ! // Take a empty copy of the same argument type as args(1) and resize ! octave_value tmp; ! bool all_strings = true; ! for (int i = 1; i < n_args; i++) ! if (! args(i).is_string ()) ! { ! all_strings = false; ! break; ! } ! if (all_strings) ! tmp = octave_value (charNDArray (dv, Vstring_fill_char), true); ! else { ! tmp = octave_value_typeinfo::lookup_type(args(1).type_name()); ! tmp = tmp.resize (dv); } ! ! if (error_state) ! return retval; ! ! Array ra_idx (dv.length (), 0); ! for (int i = 1; i < n_args; i++) { ! tmp = do_cat_op (tmp, args (i), ra_idx); ! if (error_state) ! return retval; ! dim_vector dv_tmp = args (i).dims (); ! ra_idx (dim) += (dim < dv_tmp.length () ? dv_tmp (dim) : 1); } ! retval = tmp; } else print_usage (fname); } *** ./src/ops.h.orig2 2004-01-06 21:13:21.000000000 +0100 --- ./src/ops.h 2004-07-08 01:32:47.000000000 +0200 *************** *** 40,45 **** --- 40,49 ---- (octave_value::op, t1::static_type_id (), t2::static_type_id (), \ oct_binop_ ## f); + #define INSTALL_CATOP(t1, t2, f) \ + octave_value_typeinfo::register_cat_op \ + (t1::static_type_id (), t2::static_type_id (), oct_catop_ ## f); + #define INSTALL_ASSIGNOP(op, t1, t2, f) \ octave_value_typeinfo::register_assign_op \ (octave_value::op, t1::static_type_id (), t2::static_type_id (), \ *************** *** 280,285 **** --- 284,322 ---- a2.rows (), a2.columns ()); \ return octave_value () + #define CATOPDECL(name, a1, a2) \ + static octave_value \ + oct_catop_ ## name (const octave_value& a1, const octave_value& a2, \ + const Array& ra_idx) + + #define DEFCATOPX(name, t1, t2) \ + CATOPDECL (name, , ) + + #define DEFCATOP(name, t1, t2) \ + CATOPDECL (name, a1, a2) + + // XXX FIXME XXX -- in some cases, the constructor isn't necessary. + + #define DEFCATOP_FN(name, t1, t2, f) \ + CATOPDECL (name, a1, a2) \ + { \ + CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ + return octave_value (f (v1.t1 ## _value (), v2.t2 ## _value (), ra_idx)); \ + } + + #define DEFNDCATOP_FN(name, t1, t2, e1, e2, f) \ + CATOPDECL (name, a1, a2) \ + { \ + CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ + return octave_value (f (v1.e1 ## _value (), v2.e2 ## _value (), ra_idx)); \ + } + + #define CATOP_NONCONFORMANT(msg) \ + gripe_nonconformant (msg, \ + a1.rows (), a1.columns (), \ + a2.rows (), a2.columns ()); \ + return octave_value () + #endif /* *** ./src/ov-typeinfo.cc.orig2 2004-01-21 05:47:00.000000000 +0100 --- ./src/ov-typeinfo.cc 2004-07-05 22:32:08.000000000 +0200 *************** *** 56,61 **** --- 56,64 ---- template class Array2; template class Array3; + INSTANTIATE_ARRAY (cat_op_fcn); + template class Array2; + INSTANTIATE_ARRAY (assign_op_fcn); template class Array2; template class Array3; *************** *** 116,121 **** --- 119,131 ---- } bool + octave_value_typeinfo::register_cat_op (int t1, int t2, cat_op_fcn f) + { + return (instance_ok ()) + ? instance->do_register_cat_op (t1, t2, f) : false; + } + + bool octave_value_typeinfo::register_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs, assign_op_fcn f) *************** *** 182,187 **** --- 192,199 ---- binary_ops.resize (static_cast (octave_value::num_binary_ops), len, len, static_cast (0)); + cat_ops.resize (len, len, static_cast (0)); + assign_ops.resize (static_cast (octave_value::num_assign_ops), len, len, static_cast (0)); *************** *** 259,264 **** --- 271,293 ---- } bool + octave_value_typeinfo::do_register_cat_op (int t1, int t2, cat_op_fcn f) + { + if (lookup_cat_op (t1, t2)) + { + std::string t1_name = types(t1); + std::string t2_name = types(t2); + + warning ("duplicate concatenation operator for types `%s' and `%s'", + t1_name.c_str (), t1_name.c_str ()); + } + + cat_ops.checkelem (t1, t2) = f; + + return false; + } + + bool octave_value_typeinfo::do_register_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs, assign_op_fcn f) *************** *** 370,375 **** --- 399,410 ---- return binary_ops.checkelem (static_cast (op), t1, t2); } + cat_op_fcn + octave_value_typeinfo::do_lookup_cat_op (int t1, int t2) + { + return cat_ops.checkelem (t1, t2); + } + assign_op_fcn octave_value_typeinfo::do_lookup_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs) *** ./src/ov-typeinfo.h.orig2 2003-11-25 04:59:43.000000000 +0100 --- ./src/ov-typeinfo.h 2004-07-05 22:08:18.000000000 +0200 *************** *** 55,60 **** --- 55,62 ---- static bool register_binary_op (octave_value::binary_op, int, int, binary_op_fcn); + static bool register_cat_op (int, int, cat_op_fcn); + static bool register_assign_op (octave_value::assign_op, int, int, assign_op_fcn); *************** *** 89,94 **** --- 91,102 ---- return instance->do_lookup_binary_op (op, t1, t2); } + static cat_op_fcn + lookup_cat_op (int t1, int t2) + { + return instance->do_lookup_cat_op (t1, t2); + } + static assign_op_fcn lookup_assign_op (octave_value::assign_op op, int t_lhs, int t_rhs) { *************** *** 129,134 **** --- 137,143 ---- (non_const_unary_op_fcn) 0), binary_ops (octave_value::num_binary_ops, init_tab_sz, init_tab_sz, (binary_op_fcn) 0), + cat_ops (init_tab_sz, init_tab_sz, (cat_op_fcn) 0), assign_ops (octave_value::num_assign_ops, init_tab_sz, init_tab_sz, (assign_op_fcn) 0), assignany_ops (octave_value::num_assign_ops, init_tab_sz, *************** *** 154,159 **** --- 163,170 ---- Array3 binary_ops; + Array2 cat_ops; + Array3 assign_ops; Array2 assignany_ops; *************** *** 173,178 **** --- 184,191 ---- bool do_register_binary_op (octave_value::binary_op, int, int, binary_op_fcn); + bool do_register_cat_op (int, int, cat_op_fcn); + bool do_register_assign_op (octave_value::assign_op, int, int, assign_op_fcn); *************** *** 192,197 **** --- 205,212 ---- binary_op_fcn do_lookup_binary_op (octave_value::binary_op, int, int); + cat_op_fcn do_lookup_cat_op (int, int); + assign_op_fcn do_lookup_assign_op (octave_value::assign_op, int, int); assign_op_fcn do_lookup_assignany_op (octave_value::assign_op, int); *** ./src/ov.cc.orig2 2004-04-30 12:05:42.000000000 +0200 --- ./src/ov.cc 2004-07-08 02:53:55.000000000 +0200 *************** *** 1525,1530 **** --- 1525,1616 ---- return retval; } + static void + gripe_cat_op (const std::string& tn1, const std::string& tn2) + { + error ("concatenation operator not implemented for `%s' by `%s' operations", + tn1.c_str (), tn2.c_str ()); + } + + static void + gripe_cat_op_conv (void) + { + error ("type conversion failed for concatenation operator"); + } + + octave_value + do_cat_op (const octave_value& v1, const octave_value& v2, + const Array& ra_idx) + { + octave_value retval; + + int t1 = v1.type_id (); + int t2 = v2.type_id (); + + cat_op_fcn f = octave_value_typeinfo::lookup_cat_op (t1, t2); + + if (f) + retval = f (*v1.rep, *v2.rep, ra_idx); + else + { + octave_value tv1; + type_conv_fcn cf1 = v1.numeric_conversion_function (); + + if (cf1) + { + octave_value *tmp = cf1 (*v1.rep); + + if (tmp) + { + tv1 = octave_value (tmp); + t1 = tv1.type_id (); + } + else + { + gripe_cat_op_conv (); + return retval; + } + } + else + tv1 = v1; + + octave_value tv2; + type_conv_fcn cf2 = v2.numeric_conversion_function (); + + if (cf2) + { + octave_value *tmp = cf2 (*v2.rep); + + if (tmp) + { + tv2 = octave_value (tmp); + t2 = tv2.type_id (); + } + else + { + gripe_cat_op_conv (); + return retval; + } + } + else + tv2 = v2; + + if (cf1 || cf2) + { + f = octave_value_typeinfo::lookup_cat_op (t1, t2); + + if (f) + retval = f (*tv1.rep, *tv2.rep, ra_idx); + else + gripe_cat_op (v1.type_name (), v2.type_name ()); + } + else + gripe_cat_op (v1.type_name (), v2.type_name ()); + } + + return retval; + } + void octave_value::print_info (std::ostream& os, const std::string& prefix) const { *** ./src/ov.h.orig2 2004-02-20 22:16:54.000000000 +0100 --- ./src/ov.h 2004-07-08 13:34:05.000000000 +0200 *************** *** 84,89 **** --- 84,92 ---- typedef octave_value (*binary_op_fcn) (const octave_value&, const octave_value&); + typedef octave_value (*cat_op_fcn) + (const octave_value&, const octave_value&, const Array& ra_idx); + typedef octave_value (*assign_op_fcn) (octave_value&, const octave_value_list&, const octave_value&); *************** *** 349,354 **** --- 352,360 ---- octave_value ipermute (const Array& vec) const { return rep->permute (vec, true); } + virtual octave_value resize (const dim_vector& dv) const + { return rep->resize (dv);} + // Does this constant have a type? Both of these are provided since // it is sometimes more natural to write is_undefined() instead of // ! is_defined(). *************** *** 645,650 **** --- 651,660 ---- const octave_value& a, const octave_value& b); + friend octave_value do_cat_op (const octave_value& a, + const octave_value& b, + const Array& ra_idx); + const octave_value& get_rep (void) const { return *rep; } virtual void print_info (std::ostream& os, *** ./src/version.h.orig2 2004-07-08 14:56:00.000000000 +0200 --- ./src/version.h 2004-04-30 12:05:42.000000000 +0200 *************** *** 25,31 **** #define OCTAVE_VERSION "2.1.57" ! #define OCTAVE_API_VERSION "api-v8" #define OCTAVE_COPYRIGHT \ "Copyright (C) 2004 John W. Eaton." --- 25,31 ---- #define OCTAVE_VERSION "2.1.57" ! #define OCTAVE_API_VERSION "api-v9" #define OCTAVE_COPYRIGHT \ "Copyright (C) 2004 John W. Eaton." *** ./src/Cell.cc.orig2 2004-07-06 23:33:39.000000000 +0200 --- ./src/Cell.cc 2004-07-08 01:27:27.000000000 +0200 *************** *** 100,109 **** return *this; } ! int ! Cell::cat (const Cell& ra_arg, int dim, int iidx, int move) { ! return ::cat_ra (*this, ra_arg, dim, iidx, move); } /* --- 100,111 ---- return *this; } ! Cell ! concat (const Cell& ra, const Cell& rb, const Array& ra_idx) { ! Cell retval (ra); ! retval.insert (rb, ra_idx); ! return retval; } /* *** ./src/Cell.h.orig2 2004-07-06 23:37:50.000000000 +0200 --- ./src/Cell.h 2004-07-08 01:27:21.000000000 +0200 *************** *** 96,102 **** // XXX FIXME XXX boolMatrix any (int dim = 0) const { return boolMatrix (); } ! int cat (const Cell& ra_arg, int dim, int iidx, int move); // XXX FIXME XXX bool is_true (void) const { return false; } --- 96,102 ---- // XXX FIXME XXX boolMatrix any (int dim = 0) const { return boolMatrix (); } ! friend Cell concat (const Cell& ra, const Cell& rb, const Array& ra_idx); // XXX FIXME XXX bool is_true (void) const { return false; } *** ./src/oct-map.cc.orig2 2004-07-07 15:30:07.000000000 +0200 --- ./src/oct-map.cc 2004-07-08 01:27:34.000000000 +0200 *************** *** 88,98 **** return retval; } ! int ! Octave_map::cat (const Octave_map& ra_arg, int dim, int iidx, int move) { ! //return ::cat_ra (*this, ra_arg, dim, iidx, move); ! return 0; } static string_vector --- 88,101 ---- return retval; } ! Octave_map ! concat (const Octave_map& ra, const Octave_map& rb, const Array& ra_idx) { ! // XXX FIXME XXX ! Octave_map retval; ! //Octave_map retval (ra); ! //::concat_ra (retval, rb, dim) ! return retval; } static string_vector *** ./src/oct-map.h.orig2 2004-07-07 15:32:04.000000000 +0200 --- ./src/oct-map.h 2004-07-08 01:27:42.000000000 +0200 *************** *** 118,124 **** int numel (void) const; ! int cat (const Octave_map& ra_arg, int dim, int iidx, int move); Octave_map& assign (const octave_value_list& idx, const Octave_map& rhs); --- 118,125 ---- int numel (void) const; ! friend Octave_map concat (const Octave_map& ra, const Octave_map& rb, ! const Array& ra_idx); Octave_map& assign (const octave_value_list& idx, const Octave_map& rhs); *** ./src/ov-base.cc.orig2 2004-07-08 12:13:13.000000000 +0200 --- ./src/ov-base.cc 2004-07-08 13:33:48.000000000 +0200 *************** *** 191,196 **** --- 191,203 ---- } octave_value + octave_base_value::resize (const dim_vector& dv) const + { + gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ()); + return octave_value (); + } + + octave_value octave_base_value::convert_to_str_internal (bool, bool) const { gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()", *** ./src/ov-base.h.orig2 2004-07-08 12:13:23.000000000 +0200 --- ./src/ov-base.h 2004-07-08 13:33:57.000000000 +0200 *************** *** 102,107 **** --- 102,109 ---- octave_value permute (const Array& vec, bool = false) const; + octave_value resize (const dim_vector& dv) const; + bool is_defined (void) const { return false; } bool is_cell (void) const { return false; } *** ./src/ov-scalar.h.orig2 2004-07-08 12:21:12.000000000 +0200 --- ./src/ov-scalar.h 2004-07-09 11:38:51.000000000 +0200 *************** *** 97,102 **** --- 97,105 ---- NDArray array_value (bool = false) const { return NDArray (dim_vector (1, 1), scalar); } + octave_value resize (const dim_vector& dv) const + { NDArray retval (dv); retval(0) = scalar; return retval; } + Complex complex_value (bool = false) const { return scalar; } ComplexMatrix complex_matrix_value (bool = false) const *** ./src/ov-bool.h.orig2 2004-07-08 12:21:19.000000000 +0200 --- ./src/ov-bool.h 2004-07-09 11:39:01.000000000 +0200 *************** *** 111,116 **** --- 111,119 ---- boolNDArray bool_array_value (void) const { return boolNDArray (dim_vector (1, 1), scalar); } + octave_value resize (const dim_vector& dv) const + { boolNDArray retval (dv); retval(0) = scalar; return retval; } + octave_value convert_to_str_internal (bool pad, bool force) const; bool save_ascii (std::ostream& os, bool& infnan_warned, *** ./src/ov-complex.h.orig2 2004-07-08 12:21:33.000000000 +0200 --- ./src/ov-complex.h 2004-07-09 11:38:36.000000000 +0200 *************** *** 95,100 **** --- 95,103 ---- NDArray array_value (bool = false) const; + octave_value resize (const dim_vector& dv) const + { ComplexNDArray retval (dv); retval(0) = scalar; return retval; } + Complex complex_value (bool = false) const; ComplexMatrix complex_matrix_value (bool = false) const; *** ./src/ov-base-mat.h.orig2 2004-07-08 12:22:06.000000000 +0200 --- ./src/ov-base-mat.h 2004-07-08 13:58:22.000000000 +0200 *************** *** 101,106 **** --- 101,109 ---- octave_value permute (const Array& vec, bool inv = false) const { return MT (matrix.permute (vec, inv)); } + octave_value resize (const dim_vector& dv) const + { MT retval (matrix); retval.resize (dv); return retval; } + octave_value all (int dim = 0) const { return matrix.all (dim); } octave_value any (int dim = 0) const { return matrix.any (dim); }