# HG changeset patch # User jwe # Date 1116416618 0 # Node ID cf44c749ba5215825d90981efc494eebb112e256 # Parent d33c3ef151cfcd11b9ee90778ce86bd4cec0cb65 [project @ 2005-05-18 11:43:37 by jwe] diff -r d33c3ef151cf -r cf44c749ba52 scripts/ChangeLog --- a/scripts/ChangeLog Wed May 18 02:48:35 2005 +0000 +++ b/scripts/ChangeLog Wed May 18 11:43:38 2005 +0000 @@ -1,3 +1,7 @@ +2005-05-18 John W. Eaton + + * general/num2str.m: Return early if X is a character string. + 2005-05-11 John W. Eaton * strings/findstr.m: Allow non-string arguments for compatiblity. diff -r d33c3ef151cf -r cf44c749ba52 scripts/general/num2str.m --- a/scripts/general/num2str.m Wed May 18 02:48:35 2005 +0000 +++ b/scripts/general/num2str.m Wed May 18 11:43:38 2005 +0000 @@ -38,6 +38,7 @@ if (isstr (x)) retval = x; + return; endif if (iscomplex (x)) diff -r d33c3ef151cf -r cf44c749ba52 src/ChangeLog --- a/src/ChangeLog Wed May 18 02:48:35 2005 +0000 +++ b/src/ChangeLog Wed May 18 11:43:38 2005 +0000 @@ -1,3 +1,11 @@ +2005-05-18 John W. Eaton + + * ov-base-sparse.cc (octave_base_sparse::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 * ov.cc (install_types): Don't call octave_stream::register_type. diff -r d33c3ef151cf -r cf44c749ba52 src/DLD-FUNCTIONS/rand.cc --- a/src/DLD-FUNCTIONS/rand.cc Wed May 18 02:48:35 2005 +0000 +++ b/src/DLD-FUNCTIONS/rand.cc Wed May 18 11:43:38 2005 +0000 @@ -219,6 +219,8 @@ gen_matrix: + dims.chop_trailing_singletons (); + return octave_rand::nd_array (dims); } diff -r d33c3ef151cf -r cf44c749ba52 src/ov-base-sparse.cc --- a/src/ov-base-sparse.cc Wed May 18 02:48:35 2005 +0000 +++ b/src/ov-base-sparse.cc Wed May 18 11:43:38 2005 +0000 @@ -243,15 +243,19 @@ template void octave_base_sparse::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); } } }