Mercurial > hg > octave-nkf
diff liboctave/array/CMatrix.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 | 65554f5847ac |
children | 3746b92739f7 |
line wrap: on
line diff
--- a/liboctave/array/CMatrix.cc +++ b/liboctave/array/CMatrix.cc @@ -40,6 +40,7 @@ #include "chMatrix.h" #include "dMatrix.h" #include "CMatrix.h" +#include "CNDArray.h" #include "CRowVector.h" #include "dRowVector.h" #include "CDiagMatrix.h" @@ -267,39 +268,39 @@ // Complex Matrix class ComplexMatrix::ComplexMatrix (const Matrix& a) - : MArray<Complex> (a) + : ComplexNDArray (a) { } ComplexMatrix::ComplexMatrix (const RowVector& rv) - : MArray<Complex> (rv) + : ComplexNDArray (rv) { } ComplexMatrix::ComplexMatrix (const ColumnVector& cv) - : MArray<Complex> (cv) + : ComplexNDArray (cv) { } ComplexMatrix::ComplexMatrix (const DiagMatrix& a) - : MArray<Complex> (a.dims (), 0.0) + : ComplexNDArray (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); } ComplexMatrix::ComplexMatrix (const ComplexRowVector& rv) - : MArray<Complex> (rv) + : ComplexNDArray (rv) { } ComplexMatrix::ComplexMatrix (const ComplexColumnVector& cv) - : MArray<Complex> (cv) + : ComplexNDArray (cv) { } ComplexMatrix::ComplexMatrix (const ComplexDiagMatrix& a) - : MArray<Complex> (a.dims (), 0.0) + : ComplexNDArray (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); @@ -308,12 +309,12 @@ // FIXME: could we use a templated mixed-type copy function here? ComplexMatrix::ComplexMatrix (const boolMatrix& a) - : MArray<Complex> (a) + : ComplexNDArray (a) { } ComplexMatrix::ComplexMatrix (const charMatrix& a) - : MArray<Complex> (a.dims (), 0.0) + : ComplexNDArray (a.dims (), 0.0) { for (octave_idx_type i = 0; i < a.rows (); i++) for (octave_idx_type j = 0; j < a.cols (); j++) @@ -321,7 +322,7 @@ } ComplexMatrix::ComplexMatrix (const Matrix& re, const Matrix& im) - : MArray<Complex> (re.dims ()) + : ComplexNDArray (re.dims ()) { if (im.rows () != rows () || im.cols () != cols ()) (*current_liboctave_error_handler) ("complex: internal error"); @@ -468,7 +469,7 @@ ComplexMatrix::insert (const ComplexMatrix& a, octave_idx_type r, octave_idx_type c) { - Array<Complex>::insert (a, r, c); + ComplexNDArray::insert (a, r, c); return *this; } @@ -3248,7 +3249,7 @@ ComplexMatrix ComplexMatrix::diag (octave_idx_type k) const { - return MArray<Complex>::diag (k); + return ComplexNDArray::diag (k); } ComplexDiagMatrix