comparison liboctave/array/dMatrix.h @ 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 ebb3ef964372
children 3746b92739f7
comparison
equal deleted inserted replaced
19509:8b4a24081e47 19510:d0c73e23a505
21 */ 21 */
22 22
23 #if !defined (octave_dMatrix_h) 23 #if !defined (octave_dMatrix_h)
24 #define octave_dMatrix_h 1 24 #define octave_dMatrix_h 1
25 25
26 #include "dNDArray.h"
26 #include "MArray.h" 27 #include "MArray.h"
27 #include "MDiagArray2.h" 28 #include "MDiagArray2.h"
28 #include "MatrixType.h" 29 #include "MatrixType.h"
29 30
30 #include "mx-defs.h" 31 #include "mx-defs.h"
31 #include "mx-op-decl.h" 32 #include "mx-op-decl.h"
32 #include "DET.h" 33 #include "DET.h"
33 34
34 class 35 class
35 OCTAVE_API 36 OCTAVE_API
36 Matrix : public MArray<double> 37 Matrix : public NDArray
37 { 38 {
38 public: 39 public:
39 40
40 typedef ColumnVector column_vector_type; 41 typedef ColumnVector column_vector_type;
41 typedef RowVector row_vector_type; 42 typedef RowVector row_vector_type;
42 43
43 typedef void (*solve_singularity_handler) (double rcon); 44 typedef void (*solve_singularity_handler) (double rcon);
44 45
45 Matrix (void) : MArray<double> () { } 46 Matrix (void) : NDArray () { }
46 47
47 Matrix (octave_idx_type r, octave_idx_type c) 48 Matrix (octave_idx_type r, octave_idx_type c)
48 : MArray<double> (dim_vector (r, c)) { } 49 : NDArray (dim_vector (r, c)) { }
49 50
50 Matrix (octave_idx_type r, octave_idx_type c, double val) 51 Matrix (octave_idx_type r, octave_idx_type c, double val)
51 : MArray<double> (dim_vector (r, c), val) { } 52 : NDArray (dim_vector (r, c), val) { }
52 53
53 Matrix (const dim_vector& dv) : MArray<double> (dv.redim (2)) { } 54 Matrix (const dim_vector& dv) : NDArray (dv.redim (2)) { }
54 55
55 Matrix (const dim_vector& dv, double val) 56 Matrix (const dim_vector& dv, double val)
56 : MArray<double> (dv.redim (2), val) { } 57 : NDArray (dv.redim (2), val) { }
57 58
58 Matrix (const Matrix& a) : MArray<double> (a) { } 59 Matrix (const Matrix& a) : NDArray (a) { }
59 60
60 template <class U> 61 template <class U>
61 Matrix (const MArray<U>& a) : MArray<double> (a.as_matrix ()) { } 62 Matrix (const MArray<U>& a) : NDArray (a.as_matrix ()) { }
62 63
63 template <class U> 64 template <class U>
64 Matrix (const Array<U>& a) : MArray<double> (a.as_matrix ()) { } 65 Matrix (const Array<U>& a) : NDArray (a.as_matrix ()) { }
65 66
66 explicit Matrix (const RowVector& rv); 67 explicit Matrix (const RowVector& rv);
67 68
68 explicit Matrix (const ColumnVector& cv); 69 explicit Matrix (const ColumnVector& cv);
69 70