Mercurial > hg > octave-lyh
diff src/pt-mat.cc @ 9145:53364bb317d4
fix concatenation with all-zero matrices
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 22 Apr 2009 10:54:53 +0200 |
parents | eb63fbe60fab |
children | 0f85d9564057 |
line wrap: on
line diff
--- 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 ());