# HG changeset patch # User John W. Eaton # Date 1254632669 14400 # Node ID 90abfd8a2895bdfd169930e8729a6c56844c6338 # Parent 86aa08bbc887d29cfc757eff0a71b8d563156284 make squeeze and diag return char for char argument diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-10-04 John W. Eaton + + * 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 * graphics.h.in (image::update_xdata): Add a half-pixel to each limit. diff --git a/src/ov-str-mat.h b/src/ov-str-mat.h --- 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,