comparison libinterp/octave-value/ov-flt-cx-mat.cc @ 19352:d0c73e23a505

Change inheritance tree so that <T>Matrix inherit from <T>NDArray. * liboctave/array/CMatrix.cc, liboctave/array/CMatrix.h, liboctave/array/CNDArray.cc, liboctave/array/CNDArray.h, liboctave/array/dMatrix.cc, liboctave/array/dMatrix.h, liboctave/array/dNDArray.cc, liboctave/array/dNDArray.h, liboctave/array/fCMatrix.cc, liboctave/array/fCMatrix.h, liboctave/array/fCNDArray.cc, liboctave/array/fCNDArray.h, liboctave/array/fMatrix.cc, liboctave/array/fMatrix.h, liboctave/array/fNDArray.cc, liboctave/array/fNDArray.h: change base class of Matrix, FloatMatrix, ComplexMatrix, and FloatComplexMatrix to NDArray, FloatNDArray, ComplexNDArray, and FloatComplexNDArray respectively. This will allow to reduce duplicated code since the Matrix classes will be able to inherit many of their methods from their NDArray counterparts. Also remove the matrix_value () method since a constructor now suffices. * liboctave/array/CSparse.h: include CMatrix * libinterp/corefcn/pr-output.cc, libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-flt-cx-mat.cc, libinterp/octave-value/ov-flt-re-mat.cc, libinterp/octave-value/ov-re-mat.cc: replace calls to matrix_value () with constructor with respective Matrix subclass.
author Carnë Draug <carandraug@octave.org>
date Fri, 07 Nov 2014 08:15:55 +0000
parents 6a71e5030df5
children 76478d2da117
comparison
equal deleted inserted replaced
19351:8b4a24081e47 19352:d0c73e23a505
138 138
139 if (! force_conversion) 139 if (! force_conversion)
140 gripe_implicit_conversion ("Octave:imag-to-real", 140 gripe_implicit_conversion ("Octave:imag-to-real",
141 "complex matrix", "real matrix"); 141 "complex matrix", "real matrix");
142 142
143 retval = ::real (matrix.matrix_value ()); 143 retval = ::real (FloatComplexMatrix (matrix));
144 144
145 return retval; 145 return retval;
146 } 146 }
147 147
148 FloatMatrix 148 FloatMatrix
152 152
153 if (! force_conversion) 153 if (! force_conversion)
154 gripe_implicit_conversion ("Octave:imag-to-real", 154 gripe_implicit_conversion ("Octave:imag-to-real",
155 "complex matrix", "real matrix"); 155 "complex matrix", "real matrix");
156 156
157 retval = ::real (matrix.matrix_value ()); 157 retval = ::real (FloatComplexMatrix (matrix));
158 158
159 return retval; 159 return retval;
160 } 160 }
161 161
162 Complex 162 Complex
200 } 200 }
201 201
202 ComplexMatrix 202 ComplexMatrix
203 octave_float_complex_matrix::complex_matrix_value (bool) const 203 octave_float_complex_matrix::complex_matrix_value (bool) const
204 { 204 {
205 return matrix.matrix_value (); 205 return FloatComplexMatrix (matrix);
206 } 206 }
207 207
208 FloatComplexMatrix 208 FloatComplexMatrix
209 octave_float_complex_matrix::float_complex_matrix_value (bool) const 209 octave_float_complex_matrix::float_complex_matrix_value (bool) const
210 { 210 {
211 return FloatComplexMatrix (matrix.matrix_value ()); 211 return FloatComplexMatrix (matrix);
212 } 212 }
213 213
214 boolNDArray 214 boolNDArray
215 octave_float_complex_matrix::bool_array_value (bool warn) const 215 octave_float_complex_matrix::bool_array_value (bool warn) const
216 { 216 {
288 octave_value retval; 288 octave_value retval;
289 289
290 if (matrix.ndims () == 2 290 if (matrix.ndims () == 2
291 && (matrix.rows () == 1 || matrix.columns () == 1)) 291 && (matrix.rows () == 1 || matrix.columns () == 1))
292 { 292 {
293 FloatComplexMatrix mat = matrix.matrix_value (); 293 FloatComplexMatrix mat (matrix);
294 294
295 retval = mat.diag (m, n); 295 retval = mat.diag (m, n);
296 } 296 }
297 else 297 else
298 error ("diag: expecting vector argument"); 298 error ("diag: expecting vector argument");