Mercurial > hg > octave-lyh
diff src/pt-mat.cc @ 10315:57a59eae83cc
untabify src C++ source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:41:46 -0500 |
parents | cd96d29c5efa |
children | 12884915a8e4 |
line wrap: on
line diff
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -67,17 +67,17 @@ tm_row_const_rep (void) : count (1), dv (0, 0), all_str (false), - all_sq_str (false), all_dq_str (false), - some_str (false), all_real (false), all_cmplx (false), - all_mt (true), any_sparse (false), any_class (false), - class_nm (), ok (false) + all_sq_str (false), all_dq_str (false), + some_str (false), all_real (false), all_cmplx (false), + all_mt (true), any_sparse (false), any_class (false), + class_nm (), ok (false) { } tm_row_const_rep (const tree_argument_list& row) : count (1), dv (0, 0), all_str (false), all_sq_str (false), - some_str (false), all_real (false), all_cmplx (false), - all_mt (true), any_sparse (false), any_class (false), - class_nm (), ok (false) + some_str (false), all_real (false), all_cmplx (false), + all_mt (true), any_sparse (false), any_class (false), + class_nm (), ok (false) { init (row); } ~tm_row_const_rep (void) { } @@ -111,7 +111,7 @@ tm_row_const_rep& operator = (const tm_row_const_rep&); void eval_error (const char *msg, int l, int c, - int x = -1, int y = -1) const; + int x = -1, int y = -1) const; void eval_warning (const char *msg, int l, int c) const; }; @@ -138,13 +138,13 @@ { if (this != &x && rep != x.rep) { - if (rep && --rep->count == 0) - delete rep; + if (rep && --rep->count == 0) + delete rep; - rep = x.rep; + rep = x.rep; - if (rep) - rep->count++; + if (rep) + rep->count++; } return *this; @@ -204,13 +204,13 @@ else { bool c1_is_int = (c1 == "int8" || c1 == "uint8" - || c1 == "int16" || c1 == "uint16" - || c1 == "int32" || c1 == "uint32" - || c1 == "int64" || c1 == "uint64"); + || c1 == "int16" || c1 == "uint16" + || c1 == "int32" || c1 == "uint32" + || c1 == "int64" || c1 == "uint64"); bool c2_is_int = (c2 == "int8" || c2 == "uint8" - || c2 == "int16" || c2 == "uint16" - || c2 == "int32" || c2 == "uint32" - || c2 == "int64" || c2 == "uint64"); + || c2 == "int16" || c2 == "uint16" + || c2 == "int32" || c2 == "uint32" + || c2 == "int64" || c2 == "uint64"); bool c1_is_char = (c1 == "char"); bool c2_is_char = (c2 == "char"); @@ -225,33 +225,33 @@ bool c2_is_logical = (c2 == "logical"); bool c1_is_built_in_type - = (c1_is_int || c1_is_char || c1_is_double || c1_is_single - || c1_is_logical); + = (c1_is_int || c1_is_char || c1_is_double || c1_is_single + || c1_is_logical); bool c2_is_built_in_type - = (c2_is_int || c2_is_char || c2_is_double || c2_is_single - || c2_is_logical); + = (c2_is_int || c2_is_char || c2_is_double || c2_is_single + || c2_is_logical); // Order is important here... if (c1_is_char && c2_is_built_in_type) - retval = c1; + retval = c1; else if (c2_is_char && c1_is_built_in_type) - retval = c2; + retval = c2; else if (c1_is_int && c2_is_built_in_type) - retval = c1; + retval = c1; else if (c2_is_int && c1_is_built_in_type) - retval = c2; + retval = c2; else if (c1_is_single && c2_is_built_in_type) - retval = c1; + retval = c1; else if (c2_is_single && c1_is_built_in_type) - retval = c2; + retval = c2; else if (c1_is_double && c2_is_built_in_type) - retval = c1; + retval = c1; else if (c2_is_double && c1_is_built_in_type) - retval = c2; + retval = c2; else if (c1_is_logical && c2_is_logical) - retval = c1; + retval = c1; } return retval; @@ -259,8 +259,8 @@ bool tm_row_const::tm_row_const_rep::do_init_element (tree_expression *elt, - const octave_value& val, - bool& first_elem) + const octave_value& val, + bool& first_elem) { octave_idx_type this_elt_nr = val.rows (); octave_idx_type this_elt_nc = val.columns (); @@ -277,59 +277,59 @@ all_mt = false; if (first_elem) - { - first_elem = false; + { + first_elem = false; - dv.resize (this_elt_dv.length ()); - for (int i = 2; i < dv.length (); i++) - dv.elem (i) = this_elt_dv.elem (i); + dv.resize (this_elt_dv.length ()); + for (int i = 2; i < dv.length (); i++) + dv.elem (i) = this_elt_dv.elem (i); - dv.elem (0) = this_elt_nr; + dv.elem (0) = this_elt_nr; - dv.elem (1) = 0; - } + dv.elem (1) = 0; + } else - { - int len = (this_elt_dv.length () < dv.length () - ? this_elt_dv.length () : dv.length ()); + { + int len = (this_elt_dv.length () < dv.length () + ? this_elt_dv.length () : dv.length ()); - if (this_elt_nr != dv (0)) - { - eval_error ("number of rows must match", - elt->line (), elt->column (), this_elt_nr, dv (0)); - return false; - } - for (int i = 2; i < len; i++) - { - if (this_elt_dv (i) != dv (i)) - { - eval_error ("dimensions mismatch", elt->line (), elt->column (), this_elt_dv (i), dv (i)); - return false; - } - } + if (this_elt_nr != dv (0)) + { + eval_error ("number of rows must match", + elt->line (), elt->column (), this_elt_nr, dv (0)); + return false; + } + for (int i = 2; i < len; i++) + { + if (this_elt_dv (i) != dv (i)) + { + eval_error ("dimensions mismatch", elt->line (), elt->column (), this_elt_dv (i), dv (i)); + return false; + } + } - if (this_elt_dv.length () > len) - for (int i = len; i < this_elt_dv.length (); i++) - if (this_elt_dv (i) != 1) - { - eval_error ("dimensions mismatch", elt->line (), elt->column (), this_elt_dv (i), 1); - return false; - } + if (this_elt_dv.length () > len) + for (int i = len; i < this_elt_dv.length (); i++) + if (this_elt_dv (i) != 1) + { + eval_error ("dimensions mismatch", elt->line (), elt->column (), this_elt_dv (i), 1); + return false; + } - if (dv.length () > len) - for (int i = len; i < dv.length (); i++) - if (dv (i) != 1) - { - eval_error ("dimensions mismatch", elt->line (), elt->column (), 1, dv (i)); - return false; - } - } + if (dv.length () > len) + for (int i = len; i < dv.length (); i++) + if (dv (i) != 1) + { + eval_error ("dimensions mismatch", elt->line (), elt->column (), 1, dv (i)); + return false; + } + } dv.elem (1) = dv.elem (1) + this_elt_nc; } else eval_warning ("empty matrix found in matrix list", - elt->line (), elt->column ()); + elt->line (), elt->column ()); append (val); @@ -384,27 +384,27 @@ octave_value tmp = elt->rvalue1 (); if (error_state || tmp.is_undefined ()) - break; + break; else - { - if (tmp.is_cs_list ()) - { - octave_value_list tlst = tmp.list_value (); + { + if (tmp.is_cs_list ()) + { + octave_value_list tlst = tmp.list_value (); - for (octave_idx_type i = 0; i < tlst.length (); i++) - { - octave_quit (); + for (octave_idx_type i = 0; i < tlst.length (); i++) + { + octave_quit (); - if (! do_init_element (elt, tlst(i), first_elem)) - goto done; - } - } - else - { - if (! do_init_element (elt, tmp, first_elem)) - goto done; - } - } + if (! do_init_element (elt, tlst(i), first_elem)) + goto done; + } + } + else + { + if (! do_init_element (elt, tmp, first_elem)) + goto done; + } + } } done: @@ -414,33 +414,33 @@ void tm_row_const::tm_row_const_rep::eval_error (const char *msg, int l, - int c, int x, int y) const + int c, int x, int y) const { if (l == -1 && c == -1) { if (x == -1 || y == -1) - ::error ("%s", msg); + ::error ("%s", msg); else - ::error ("%s (%d != %d)", msg, x, y); + ::error ("%s (%d != %d)", msg, x, y); } else { if (x == -1 || y == -1) - ::error ("%s near line %d, column %d", msg, l, c); + ::error ("%s near line %d, column %d", msg, l, c); else - ::error ("%s (%d != %d) near line %d, column %d", msg, x, y, l, c); + ::error ("%s (%d != %d) near line %d, column %d", msg, x, y, l, c); } } void tm_row_const::tm_row_const_rep::eval_warning (const char *msg, int l, - int c) const + int c) const { if (l == -1 && c == -1) warning_with_id ("Octave:empty-list-elements", "%s", msg); else warning_with_id ("Octave:empty-list-elements", - "%s near line %d, column %d", msg, l, c); + "%s near line %d, column %d", msg, l, c); } class @@ -530,132 +530,132 @@ tm_row_const tmp (*elt); if (tmp && ! tmp.empty ()) - { - if (all_str && ! tmp.all_strings_p ()) - all_str = false; + { + if (all_str && ! tmp.all_strings_p ()) + all_str = false; - if (all_sq_str && ! tmp.all_sq_strings_p ()) - all_sq_str = false; + if (all_sq_str && ! tmp.all_sq_strings_p ()) + all_sq_str = false; - if (all_dq_str && ! tmp.all_dq_strings_p ()) - all_dq_str = false; + if (all_dq_str && ! tmp.all_dq_strings_p ()) + all_dq_str = false; - if (! some_str && tmp.some_strings_p ()) - some_str = true; + if (! some_str && tmp.some_strings_p ()) + some_str = true; - if (all_real && ! tmp.all_real_p ()) - all_real = false; + if (all_real && ! tmp.all_real_p ()) + all_real = false; - if (all_cmplx && ! tmp.all_complex_p ()) - all_cmplx = false; + if (all_cmplx && ! tmp.all_complex_p ()) + all_cmplx = false; - if (all_mt && ! tmp.all_empty_p ()) - all_mt = false; + if (all_mt && ! tmp.all_empty_p ()) + all_mt = false; - if (!any_sparse && tmp.any_sparse_p ()) - any_sparse = true; + if (!any_sparse && tmp.any_sparse_p ()) + any_sparse = true; - if (!any_class && tmp.any_class_p ()) - any_class = true; + if (!any_class && tmp.any_class_p ()) + any_class = true; - append (tmp); - } + append (tmp); + } else - break; + break; } if (! error_state) { for (iterator p = begin (); p != end (); p++) - { - octave_quit (); + { + octave_quit (); - tm_row_const elt = *p; + tm_row_const elt = *p; - octave_idx_type this_elt_nr = elt.rows (); - octave_idx_type this_elt_nc = elt.cols (); + octave_idx_type this_elt_nr = elt.rows (); + octave_idx_type this_elt_nc = elt.cols (); - std::string this_elt_class_nm = elt.class_name (); + std::string this_elt_class_nm = elt.class_name (); - dim_vector this_elt_dv = elt.dims (); + dim_vector this_elt_dv = elt.dims (); - if (!this_elt_dv.all_zero ()) - { - all_mt = false; + if (!this_elt_dv.all_zero ()) + { + all_mt = false; - if (first_elem) - { - first_elem = false; + if (first_elem) + { + first_elem = false; - class_nm = this_elt_class_nm; + class_nm = this_elt_class_nm; - dv.resize (this_elt_dv.length ()); - for (int i = 2; i < dv.length (); i++) - dv.elem (i) = this_elt_dv.elem (i); + dv.resize (this_elt_dv.length ()); + for (int i = 2; i < dv.length (); i++) + dv.elem (i) = this_elt_dv.elem (i); - dv.elem (0) = 0; + dv.elem (0) = 0; - dv.elem (1) = this_elt_nc; - } - else if (all_str) - { - class_nm = get_concat_class (class_nm, this_elt_class_nm); + dv.elem (1) = this_elt_nc; + } + else if (all_str) + { + class_nm = get_concat_class (class_nm, this_elt_class_nm); - if (this_elt_nc > cols ()) - dv.elem (1) = this_elt_nc; - } - else - { - class_nm = get_concat_class (class_nm, this_elt_class_nm); + if (this_elt_nc > cols ()) + dv.elem (1) = this_elt_nc; + } + else + { + class_nm = get_concat_class (class_nm, this_elt_class_nm); - bool get_out = false; - int len = (this_elt_dv.length () < dv.length () - ? this_elt_dv.length () : dv.length ()); + bool get_out = false; + int len = (this_elt_dv.length () < dv.length () + ? this_elt_dv.length () : dv.length ()); - for (int i = 1; i < len; i++) - { - if (i == 1 && this_elt_nc != dv (1)) - { - ::error ("number of columns must match (%d != %d)", - this_elt_nc, dv (1)); - get_out = true; - break; - } - else if (this_elt_dv (i) != dv (i)) - { - ::error ("dimensions mismatch (dim = %i, %d != %d)", i+1, this_elt_dv (i), dv (i)); - get_out = true; - break; - } - } + for (int i = 1; i < len; i++) + { + if (i == 1 && this_elt_nc != dv (1)) + { + ::error ("number of columns must match (%d != %d)", + this_elt_nc, dv (1)); + get_out = true; + break; + } + else if (this_elt_dv (i) != dv (i)) + { + ::error ("dimensions mismatch (dim = %i, %d != %d)", i+1, this_elt_dv (i), dv (i)); + get_out = true; + break; + } + } - if (this_elt_dv.length () > len) - for (int i = len; i < this_elt_dv.length (); i++) - if (this_elt_dv (i) != 1) - { - ::error ("dimensions mismatch (dim = %i, %d != %d)", i+1, this_elt_dv (i), 1); - get_out = true; - break; - } + if (this_elt_dv.length () > len) + for (int i = len; i < this_elt_dv.length (); i++) + if (this_elt_dv (i) != 1) + { + ::error ("dimensions mismatch (dim = %i, %d != %d)", i+1, this_elt_dv (i), 1); + get_out = true; + break; + } - if (dv.length () > len) - for (int i = len; i < dv.length (); i++) - if (dv (i) != 1) - { - ::error ("dimensions mismatch (dim = %i, %d != %d)", i+1, 1, dv(i)); - get_out = true; - break; - } + if (dv.length () > len) + for (int i = len; i < dv.length (); i++) + if (dv (i) != 1) + { + ::error ("dimensions mismatch (dim = %i, %d != %d)", i+1, 1, dv(i)); + get_out = true; + break; + } - if (get_out) - break; - } - dv.elem (0) = dv.elem (0) + this_elt_nr; - } - else - warning_with_id ("Octave:empty-list-elements", - "empty matrix found in matrix list"); - } + if (get_out) + break; + } + dv.elem (0) = dv.elem (0) + this_elt_nr; + } + else + warning_with_id ("Octave:empty-list-elements", + "empty matrix found in matrix list"); + } } ok = ! error_state; @@ -681,7 +681,7 @@ tree_argument_list *elt = *p; if (elt && elt->has_magic_end ()) - return true; + return true; } return false; @@ -697,7 +697,7 @@ tree_argument_list *elt = *p; if (! elt->all_elements_are_constant ()) - return false; + return false; } return true; @@ -721,7 +721,7 @@ { if (! (all_dq_strings_p || all_sq_strings_p)) warning_with_id ("Octave:string-concat", - "concatenation of different character string types may have unintended consequences"); + "concatenation of different character string types may have unintended consequences"); } template<class TYPE> @@ -820,228 +820,228 @@ std::string result_type = tmp.class_name (); if (any_class_p) - { - octave_value_list tmp3 (tmp.length (), octave_value ()); + { + octave_value_list tmp3 (tmp.length (), octave_value ()); - int j = 0; - for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) - { - octave_quit (); + int j = 0; + for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) + { + octave_quit (); - tm_row_const row = *p; + tm_row_const row = *p; - if (row.length () == 1) - tmp3 (j++) = *(row.begin ()); - else - { - octave_value_list tmp1 (row.length (), octave_value ()); + if (row.length () == 1) + tmp3 (j++) = *(row.begin ()); + else + { + octave_value_list tmp1 (row.length (), octave_value ()); - int i = 0; - for (tm_row_const::iterator q = row.begin (); - q != row.end (); q++) - tmp1 (i++) = *q; + int i = 0; + for (tm_row_const::iterator q = row.begin (); + q != row.end (); q++) + tmp1 (i++) = *q; - octave_value_list tmp2; - octave_value fcn = - symbol_table::find_function ("horzcat", tmp1); + octave_value_list tmp2; + octave_value fcn = + symbol_table::find_function ("horzcat", tmp1); - if (fcn.is_defined ()) - { - tmp2 = fcn.do_multi_index_op (1, tmp1); - - if (error_state) - goto done; + if (fcn.is_defined ()) + { + tmp2 = fcn.do_multi_index_op (1, tmp1); + + if (error_state) + goto done; - tmp3 (j++) = tmp2 (0); - } - else - { - ::error ("cat not find overloaded horzcat function"); - goto done; - } - } - } + tmp3 (j++) = tmp2 (0); + } + else + { + ::error ("cat not find overloaded horzcat function"); + goto done; + } + } + } - if (tmp.length () == 1) - retval = tmp3 (0); - else - { - octave_value_list tmp2; - octave_value fcn = symbol_table::find_function ("vertcat", tmp3); + if (tmp.length () == 1) + retval = tmp3 (0); + else + { + octave_value_list tmp2; + octave_value fcn = symbol_table::find_function ("vertcat", tmp3); - if (fcn.is_defined ()) - { - tmp2 = fcn.do_multi_index_op (1, tmp3); - - if (! error_state) - retval = tmp2 (0); - } - else - ::error ("cat not find overloaded vertcat function"); - } - } + if (fcn.is_defined ()) + { + tmp2 = fcn.do_multi_index_op (1, tmp3); + + if (! error_state) + retval = tmp2 (0); + } + else + ::error ("cat not find overloaded vertcat function"); + } + } else if (result_type == "double") - { - if (any_sparse_p) - { - if (all_real_p) - retval = do_single_type_concat<SparseMatrix> (dv, tmp); - else + { + if (any_sparse_p) + { + if (all_real_p) + retval = do_single_type_concat<SparseMatrix> (dv, tmp); + else retval = do_single_type_concat_no_mutate<SparseComplexMatrix, octave_sparse_complex_matrix> (dv, tmp); - } - else - { - if (all_real_p) - retval = do_single_type_concat<NDArray> (dv, tmp); - else + } + else + { + if (all_real_p) + retval = do_single_type_concat<NDArray> (dv, tmp); + else retval = do_single_type_concat_no_mutate<ComplexNDArray, octave_complex_matrix> (dv, tmp); - } - } + } + } else if (result_type == "single") - { - if (all_real_p) - retval = do_single_type_concat<FloatNDArray> (dv, tmp); - else + { + if (all_real_p) + retval = do_single_type_concat<FloatNDArray> (dv, tmp); + else retval = do_single_type_concat_no_mutate<FloatComplexNDArray, octave_float_complex_matrix> (dv, tmp); - } + } else if (result_type == "char") - { - char type = all_dq_strings_p ? '"' : '\''; + { + char type = all_dq_strings_p ? '"' : '\''; - maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p); + maybe_warn_string_concat (all_dq_strings_p, all_sq_strings_p); - charNDArray result (dv, Vstring_fill_char); + charNDArray result (dv, Vstring_fill_char); single_type_concat (result, tmp); - retval = octave_value (result, type); - } + retval = octave_value (result, type); + } else if (result_type == "logical") - { - if (any_sparse_p) - retval = do_single_type_concat<SparseBoolMatrix> (dv, tmp); - else - retval = do_single_type_concat<boolNDArray> (dv, tmp); - } + { + if (any_sparse_p) + retval = do_single_type_concat<SparseBoolMatrix> (dv, tmp); + else + retval = do_single_type_concat<boolNDArray> (dv, tmp); + } else if (result_type == "int8") - retval = do_single_type_concat<int8NDArray> (dv, tmp); + retval = do_single_type_concat<int8NDArray> (dv, tmp); else if (result_type == "int16") - retval = do_single_type_concat<int16NDArray> (dv, tmp); + retval = do_single_type_concat<int16NDArray> (dv, tmp); else if (result_type == "int32") - retval = do_single_type_concat<int32NDArray> (dv, tmp); + retval = do_single_type_concat<int32NDArray> (dv, tmp); else if (result_type == "int64") - retval = do_single_type_concat<int64NDArray> (dv, tmp); + retval = do_single_type_concat<int64NDArray> (dv, tmp); else if (result_type == "uint8") - retval = do_single_type_concat<uint8NDArray> (dv, tmp); + retval = do_single_type_concat<uint8NDArray> (dv, tmp); else if (result_type == "uint16") - retval = do_single_type_concat<uint16NDArray> (dv, tmp); + retval = do_single_type_concat<uint16NDArray> (dv, tmp); else if (result_type == "uint32") - retval = do_single_type_concat<uint32NDArray> (dv, tmp); + retval = do_single_type_concat<uint32NDArray> (dv, tmp); else if (result_type == "uint64") - retval = do_single_type_concat<uint64NDArray> (dv, tmp); + retval = do_single_type_concat<uint64NDArray> (dv, tmp); else - { - // The line below might seem crazy, since we take a copy of - // the first argument, resize it to be empty and then resize - // it to be full. This is done since it means that there is - // no recopying of data, as would happen if we used a single - // resize. It should be noted that resize operation is also - // significantly slower than the do_cat_op function, so it - // makes sense to have an empty matrix and copy all data. - // - // We might also start with a empty octave_value using - // - // ctmp = octave_value_typeinfo::lookup_type - // (tmp.begin() -> begin() -> type_name()); - // - // and then directly resize. However, for some types there - // might be some additional setup needed, and so this should - // be avoided. + { + // The line below might seem crazy, since we take a copy of + // the first argument, resize it to be empty and then resize + // it to be full. This is done since it means that there is + // no recopying of data, as would happen if we used a single + // resize. It should be noted that resize operation is also + // significantly slower than the do_cat_op function, so it + // makes sense to have an empty matrix and copy all data. + // + // We might also start with a empty octave_value using + // + // ctmp = octave_value_typeinfo::lookup_type + // (tmp.begin() -> begin() -> type_name()); + // + // and then directly resize. However, for some types there + // might be some additional setup needed, and so this should + // be avoided. - octave_value ctmp; + octave_value ctmp; - // Find the first non-empty object + // Find the first non-empty object - if (any_sparse_p) - { - // Start with sparse matrix to avoid issues memory issues - // with things like [ones(1,4),sprandn(1e8,4,1e-4)] - if (all_real_p) - ctmp = octave_sparse_matrix ().resize (dv); - else - ctmp = octave_sparse_complex_matrix ().resize (dv); - } - else - { - for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) - { - octave_quit (); + if (any_sparse_p) + { + // Start with sparse matrix to avoid issues memory issues + // with things like [ones(1,4),sprandn(1e8,4,1e-4)] + if (all_real_p) + ctmp = octave_sparse_matrix ().resize (dv); + else + ctmp = octave_sparse_complex_matrix ().resize (dv); + } + else + { + for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) + { + octave_quit (); - tm_row_const row = *p; + tm_row_const row = *p; - for (tm_row_const::iterator q = row.begin (); - q != row.end (); q++) - { - octave_quit (); + for (tm_row_const::iterator q = row.begin (); + q != row.end (); q++) + { + octave_quit (); - ctmp = *q; + ctmp = *q; - if (! ctmp.all_zero_dims ()) - goto found_non_empty; - } - } + if (! ctmp.all_zero_dims ()) + goto found_non_empty; + } + } - ctmp = (*(tmp.begin() -> begin())); + ctmp = (*(tmp.begin() -> begin())); - found_non_empty: + found_non_empty: - if (! all_empty_p) - ctmp = ctmp.resize (dim_vector (0,0)).resize (dv); - } + if (! all_empty_p) + ctmp = ctmp.resize (dim_vector (0,0)).resize (dv); + } - if (! error_state) - { - // Now, extract the values from the individual elements and - // insert them in the result matrix. + if (! error_state) + { + // Now, extract the values from the individual elements and + // insert them in the result matrix. - int dv_len = dv.length (); - Array<octave_idx_type> ra_idx (dv_len > 1 ? dv_len : 2, 0); + int dv_len = dv.length (); + Array<octave_idx_type> ra_idx (dv_len > 1 ? dv_len : 2, 0); - for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) - { - octave_quit (); + for (tm_const::iterator p = tmp.begin (); p != tmp.end (); p++) + { + octave_quit (); - tm_row_const row = *p; + tm_row_const row = *p; - for (tm_row_const::iterator q = row.begin (); - q != row.end (); - q++) - { - octave_quit (); + for (tm_row_const::iterator q = row.begin (); + q != row.end (); + q++) + { + octave_quit (); - octave_value elt = *q; + octave_value elt = *q; - ctmp = do_cat_op (ctmp, elt, ra_idx); + ctmp = do_cat_op (ctmp, elt, ra_idx); - if (error_state) - goto done; + if (error_state) + goto done; - ra_idx (1) += elt.columns (); - } + ra_idx (1) += elt.columns (); + } - ra_idx (0) += row.rows (); - ra_idx (1) = 0; - } + ra_idx (0) += row.rows (); + ra_idx (1) = 0; + } - retval = ctmp; + retval = ctmp; - if (frc_str_conv && ! retval.is_string ()) - retval = retval.convert_to_str (); - } - } + if (frc_str_conv && ! retval.is_string ()) + retval = retval.convert_to_str (); + } + } } done: @@ -1050,7 +1050,7 @@ tree_expression * tree_matrix::dup (symbol_table::scope_id scope, - symbol_table::context_id context) const + symbol_table::context_id context) const { tree_matrix *new_matrix = new tree_matrix (0, line (), column ());