Mercurial > octave
comparison liboctave/array/fCMatrix.h @ 19320: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
19319:8b4a24081e47 | 19320:d0c73e23a505 |
---|---|
21 */ | 21 */ |
22 | 22 |
23 #if !defined (octave_fCMatrix_h) | 23 #if !defined (octave_fCMatrix_h) |
24 #define octave_fCMatrix_h 1 | 24 #define octave_fCMatrix_h 1 |
25 | 25 |
26 #include "fCNDArray.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" |
32 #include "oct-cmplx.h" | 33 #include "oct-cmplx.h" |
33 #include "DET.h" | 34 #include "DET.h" |
34 | 35 |
35 class | 36 class |
36 OCTAVE_API | 37 OCTAVE_API |
37 FloatComplexMatrix : public MArray<FloatComplex> | 38 FloatComplexMatrix : public FloatComplexNDArray |
38 { | 39 { |
39 public: | 40 public: |
40 | 41 |
41 typedef FloatComplexColumnVector column_vector_type; | 42 typedef FloatComplexColumnVector column_vector_type; |
42 typedef FloatComplexRowVector row_vector_type; | 43 typedef FloatComplexRowVector row_vector_type; |
43 | 44 |
44 typedef void (*solve_singularity_handler) (float rcon); | 45 typedef void (*solve_singularity_handler) (float rcon); |
45 | 46 |
46 FloatComplexMatrix (void) : MArray<FloatComplex> () { } | 47 FloatComplexMatrix (void) : FloatComplexNDArray () { } |
47 | 48 |
48 FloatComplexMatrix (octave_idx_type r, octave_idx_type c) | 49 FloatComplexMatrix (octave_idx_type r, octave_idx_type c) |
49 : MArray<FloatComplex> (dim_vector (r, c)) { } | 50 : FloatComplexNDArray (dim_vector (r, c)) { } |
50 | 51 |
51 FloatComplexMatrix (octave_idx_type r, octave_idx_type c, | 52 FloatComplexMatrix (octave_idx_type r, octave_idx_type c, |
52 const FloatComplex& val) | 53 const FloatComplex& val) |
53 : MArray<FloatComplex> (dim_vector (r, c), val) { } | 54 : FloatComplexNDArray (dim_vector (r, c), val) { } |
54 | 55 |
55 FloatComplexMatrix (const dim_vector& dv) | 56 FloatComplexMatrix (const dim_vector& dv) |
56 : MArray<FloatComplex> (dv.redim (2)) { } | 57 : FloatComplexNDArray (dv.redim (2)) { } |
57 | 58 |
58 FloatComplexMatrix (const dim_vector& dv, const FloatComplex& val) | 59 FloatComplexMatrix (const dim_vector& dv, const FloatComplex& val) |
59 : MArray<FloatComplex> (dv.redim (2), val) { } | 60 : FloatComplexNDArray (dv.redim (2), val) { } |
60 | 61 |
61 FloatComplexMatrix (const FloatComplexMatrix& a) | 62 FloatComplexMatrix (const FloatComplexMatrix& a) |
62 : MArray<FloatComplex> (a) { } | 63 : FloatComplexNDArray (a) { } |
63 | 64 |
64 template <class U> | 65 template <class U> |
65 FloatComplexMatrix (const MArray<U>& a) | 66 FloatComplexMatrix (const MArray<U>& a) |
66 : MArray<FloatComplex> (a.as_matrix ()) { } | 67 : FloatComplexNDArray (a.reshape (a.dims ().redim (2))) { } |
67 | 68 |
68 template <class U> | 69 template <class U> |
69 FloatComplexMatrix (const Array<U>& a) | 70 FloatComplexMatrix (const Array<U>& a) |
70 : MArray<FloatComplex> (a.as_matrix ()) { } | 71 : FloatComplexNDArray (a.reshape (a.dims ().redim (2))) { } |
71 | 72 |
72 explicit FloatComplexMatrix (const FloatMatrix& a); | 73 explicit FloatComplexMatrix (const FloatMatrix& a); |
73 | 74 |
74 explicit FloatComplexMatrix (const FloatRowVector& rv); | 75 explicit FloatComplexMatrix (const FloatRowVector& rv); |
75 | 76 |