Mercurial > hg > octave-nkf
changeset 5355:cf44c749ba52
[project @ 2005-05-18 11:43:37 by jwe]
author | jwe |
---|---|
date | Wed, 18 May 2005 11:43:38 +0000 |
parents | d33c3ef151cf |
children | 06585668a971 |
files | scripts/ChangeLog scripts/general/num2str.m src/ChangeLog src/DLD-FUNCTIONS/rand.cc src/ov-base-sparse.cc |
diffstat | 5 files changed, 33 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2005-05-18 John W. Eaton <jwe@octave.org> + + * general/num2str.m: Return early if X is a character string. + 2005-05-11 John W. Eaton <jwe@octave.org> * strings/findstr.m: Allow non-string arguments for compatiblity.
--- a/scripts/general/num2str.m +++ b/scripts/general/num2str.m @@ -38,6 +38,7 @@ if (isstr (x)) retval = x; + return; endif if (iscomplex (x))
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2005-05-18 John W. Eaton <jwe@octave.org> + + * ov-base-sparse.cc (octave_base_sparse<T>::print_raw): + Make spacing of output consistent with other parts of Octave. + + * DLD-FUNCTIONS/rand.cc (do_rand): Chop trailing singelton + dimensions before generating array. + 2005-05-17 John W. Eaton <jwe@octave.org> * ov.cc (install_types): Don't call octave_stream::register_type.
--- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -219,6 +219,8 @@ gen_matrix: + dims.chop_trailing_singletons (); + return octave_rand::nd_array (dims); }
--- a/src/ov-base-sparse.cc +++ b/src/ov-base-sparse.cc @@ -243,15 +243,19 @@ template <class T> void octave_base_sparse<T>::print_raw (std::ostream& os, - bool pr_as_read_syntax) const + bool pr_as_read_syntax) const { octave_idx_type nr = matrix.rows (); octave_idx_type nc = matrix.cols (); octave_idx_type nz = nonzero (); - os << "Compressed Column Sparse (rows=" << nr << - ", cols=" << nc << - ", nnz=" << nz << ")"; + // XXX FIXME XXX -- this should probably all be handled by a + // separate octave_print_internal function that can handle format + // compact, loose, etc. + + os << "Compressed Column Sparse (rows = " << nr + << ", cols = " << nc + << ", nnz = " << nz << ")\n"; // add one to the printed indices to go from // zero-based to one-based arrays @@ -261,12 +265,20 @@ for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; + + // XXX FIXME XXX -- is there an easy way to get the max row + // and column indices so we can set the width appropriately + // and line up the columns here? Similarly, we should look + // at all the nonzero values and display them with the same + // formatting rules that apply to columns of a matrix. + for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) { os << "\n"; os << " (" << matrix.ridx(i)+1 << - " , " << j+1 << ") -> "; - octave_print_internal( os, matrix.data(i), pr_as_read_syntax); + ", " << j+1 << ") -> "; + + octave_print_internal (os, matrix.data(i), pr_as_read_syntax); } } }