Mercurial > hg > octave-nkf
changeset 9688:90abfd8a2895
make squeeze and diag return char for char argument
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 04 Oct 2009 01:04:29 -0400 |
parents | 86aa08bbc887 |
children | 34d6f005db4b |
files | src/ChangeLog src/ov-str-mat.h |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-10-04 John W. Eaton <jwe@octave.org> + + * ov-str-mat.h (octave_char_matrix_str::squeeze, + octave_char_matrix_sq_str::squeeze, octave_char_matrix_str::diag, + octave_char_matrix_sq_str::diag): New functions. + 2009-10-03 Shai Ayal <shaiay@users.sourceforge.net> * graphics.h.in (image::update_xdata): Add a half-pixel to each limit.
--- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -91,6 +91,9 @@ bool resize_ok = false) { return do_index_op_internal (idx, resize_ok); } + octave_value squeeze (void) const + { return octave_value (charNDArray (matrix.squeeze ()), true); } + octave_value reshape (const dim_vector& new_dims) const { return octave_value (charNDArray (matrix.reshape (new_dims)), true); } @@ -99,6 +102,9 @@ octave_value resize (const dim_vector& dv, bool fill = false) const; + octave_value diag (octave_idx_type k = 0) const + { return octave_value (matrix.diag (k), true); } + bool is_string (void) const { return true; } bool is_real_type (void) const { return false; } @@ -255,6 +261,9 @@ octave_base_value *clone (void) const { return new octave_char_matrix_sq_str (*this); } octave_base_value *empty_clone (void) const { return new octave_char_matrix_sq_str (); } + octave_value squeeze (void) const + { return octave_value (charNDArray (matrix.squeeze ()), true, '\''); } + octave_value reshape (const dim_vector& new_dims) const { return octave_value (charNDArray (matrix.reshape (new_dims)), true, '\''); } @@ -268,6 +277,9 @@ return octave_value (retval, true, '\''); } + octave_value diag (octave_idx_type k = 0) const + { return octave_value (matrix.diag (k), true, '\''); } + bool is_sq_string (void) const { return true; } octave_value do_index_op (const octave_value_list& idx,