Mercurial > hg > octave-lyh
diff liboctave/Array.cc @ 4762:bec345670e56
[project @ 2004-02-16 05:07:23 by jwe]
author | jwe |
---|---|
date | Mon, 16 Feb 2004 05:07:23 +0000 |
parents | 364bbf35dbfa |
children | e941e1470d7b |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -2999,6 +2999,38 @@ } template <class T> +bool +cat_ra (Array<T>& ra_cat, const Array<T>& ra_arg, int dim, int add_dim) +{ + bool retval = false; + + dim_vector dv = ra_arg.dims (); + + Array<int> ra_idx (dv.length (), 0); + + for (int i = 0; i < ra_arg.length (); i++) + { + if (i != 0) + increment_index (ra_idx, dv); + + Array<int> ra_idx2 = ra_idx; + + if (dim >= ra_idx2.length ()) + { + ra_idx2.resize_and_fill (dim + 1, 0); + + retval = true; + } + + ra_idx2(dim) = ra_idx2(dim) + add_dim; + + ra_cat(ra_idx2) = ra_arg(ra_idx); + } + + return retval; +} + +template <class T> void Array<T>::print_info (std::ostream& os, const std::string& prefix) const {