Mercurial > hg > octave-nkf
diff libinterp/octave-value/ov-cx-mat.cc @ 19510: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 |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-cx-mat.cc +++ b/libinterp/octave-value/ov-cx-mat.cc @@ -152,7 +152,7 @@ gripe_implicit_conversion ("Octave:imag-to-real", "complex matrix", "real matrix"); - retval = ::real (matrix.matrix_value ()); + retval = ::real (ComplexMatrix (matrix)); return retval; } @@ -166,7 +166,7 @@ gripe_implicit_conversion ("Octave:imag-to-real", "complex matrix", "real matrix"); - retval = ::real (matrix.matrix_value ()); + retval = ::real (ComplexMatrix (matrix)); return retval; } @@ -214,13 +214,13 @@ ComplexMatrix octave_complex_matrix::complex_matrix_value (bool) const { - return matrix.matrix_value (); + return ComplexMatrix (matrix); } FloatComplexMatrix octave_complex_matrix::float_complex_matrix_value (bool) const { - return FloatComplexMatrix (matrix.matrix_value ()); + return FloatComplexMatrix (ComplexMatrix (matrix)); } boolNDArray @@ -270,7 +270,7 @@ gripe_implicit_conversion ("Octave:imag-to-real", "complex matrix", "real matrix"); - retval = SparseMatrix (::real (matrix.matrix_value ())); + retval = SparseMatrix (::real (ComplexMatrix (matrix))); return retval; } @@ -278,7 +278,7 @@ SparseComplexMatrix octave_complex_matrix::sparse_complex_matrix_value (bool) const { - return SparseComplexMatrix (matrix.matrix_value ()); + return SparseComplexMatrix (ComplexMatrix (matrix)); } octave_value @@ -302,7 +302,7 @@ if (matrix.ndims () == 2 && (matrix.rows () == 1 || matrix.columns () == 1)) { - ComplexMatrix mat = matrix.matrix_value (); + ComplexMatrix mat (matrix); retval = mat.diag (m, n); }