comparison src/ov-str-mat.h @ 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 d865363208d6
children 34d6f005db4b
comparison
equal deleted inserted replaced
9687:86aa08bbc887 9688:90abfd8a2895
89 89
90 octave_value do_index_op (const octave_value_list& idx, 90 octave_value do_index_op (const octave_value_list& idx,
91 bool resize_ok = false) 91 bool resize_ok = false)
92 { return do_index_op_internal (idx, resize_ok); } 92 { return do_index_op_internal (idx, resize_ok); }
93 93
94 octave_value squeeze (void) const
95 { return octave_value (charNDArray (matrix.squeeze ()), true); }
96
94 octave_value reshape (const dim_vector& new_dims) const 97 octave_value reshape (const dim_vector& new_dims) const
95 { return octave_value (charNDArray (matrix.reshape (new_dims)), true); } 98 { return octave_value (charNDArray (matrix.reshape (new_dims)), true); }
96 99
97 octave_value permute (const Array<int>& vec, bool inv = false) const 100 octave_value permute (const Array<int>& vec, bool inv = false) const
98 { return octave_value (charNDArray (matrix.permute (vec, inv)), true); } 101 { return octave_value (charNDArray (matrix.permute (vec, inv)), true); }
99 102
100 octave_value resize (const dim_vector& dv, bool fill = false) const; 103 octave_value resize (const dim_vector& dv, bool fill = false) const;
104
105 octave_value diag (octave_idx_type k = 0) const
106 { return octave_value (matrix.diag (k), true); }
101 107
102 bool is_string (void) const { return true; } 108 bool is_string (void) const { return true; }
103 109
104 bool is_real_type (void) const { return false; } 110 bool is_real_type (void) const { return false; }
105 111
253 ~octave_char_matrix_sq_str (void) { } 259 ~octave_char_matrix_sq_str (void) { }
254 260
255 octave_base_value *clone (void) const { return new octave_char_matrix_sq_str (*this); } 261 octave_base_value *clone (void) const { return new octave_char_matrix_sq_str (*this); }
256 octave_base_value *empty_clone (void) const { return new octave_char_matrix_sq_str (); } 262 octave_base_value *empty_clone (void) const { return new octave_char_matrix_sq_str (); }
257 263
264 octave_value squeeze (void) const
265 { return octave_value (charNDArray (matrix.squeeze ()), true, '\''); }
266
258 octave_value reshape (const dim_vector& new_dims) const 267 octave_value reshape (const dim_vector& new_dims) const
259 { return octave_value (charNDArray (matrix.reshape (new_dims)), true, '\''); } 268 { return octave_value (charNDArray (matrix.reshape (new_dims)), true, '\''); }
260 269
261 octave_value permute (const Array<int>& vec, bool inv = false) const 270 octave_value permute (const Array<int>& vec, bool inv = false) const
262 { return octave_value (charNDArray (matrix.permute (vec, inv)), true, '\''); } 271 { return octave_value (charNDArray (matrix.permute (vec, inv)), true, '\''); }
266 charNDArray retval (matrix); 275 charNDArray retval (matrix);
267 retval.resize (dv); 276 retval.resize (dv);
268 return octave_value (retval, true, '\''); 277 return octave_value (retval, true, '\'');
269 } 278 }
270 279
280 octave_value diag (octave_idx_type k = 0) const
281 { return octave_value (matrix.diag (k), true, '\''); }
282
271 bool is_sq_string (void) const { return true; } 283 bool is_sq_string (void) const { return true; }
272 284
273 octave_value do_index_op (const octave_value_list& idx, 285 octave_value do_index_op (const octave_value_list& idx,
274 bool resize_ok = false) 286 bool resize_ok = false)
275 { return do_index_op_internal (idx, resize_ok, '\''); } 287 { return do_index_op_internal (idx, resize_ok, '\''); }