Mercurial > hg > octave-lojdl
changeset 9145:53364bb317d4
fix concatenation with all-zero matrices
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 22 Apr 2009 10:54:53 +0200 |
parents | c6463412aebb |
children | a48c500e48e1 |
files | src/ChangeLog src/pt-mat.cc |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-04-22 Jaroslav Hajek <highegg@gmail.com> + + * pt-mat.cc (tm_row_const::tm_row_const_rep::do_init_element): + Update class name even for all-zeros elements. + (get_concat_class): Update the default value if possible. + 2009-04-21 John W. Eaton <jwe@octave.org> * parse.y (Fassignin): Add missing unwind_protect frame.
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -195,6 +195,8 @@ if (c1 == c2) retval = c1; + else if (c1 == retval) + retval = c2; else { bool c1_is_int = (c1 == "int8" || c1 == "uint8" @@ -263,6 +265,9 @@ dim_vector this_elt_dv = val.dims (); + class_nm = get_concat_class (class_nm, this_elt_class_nm); + + if (! this_elt_dv.all_zero ()) { all_mt = false; @@ -271,8 +276,6 @@ { first_elem = false; - 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); @@ -283,8 +286,6 @@ } else { - class_nm = get_concat_class (class_nm, this_elt_class_nm); - int len = (this_elt_dv.length () < dv.length () ? this_elt_dv.length () : dv.length ());