1993
|
1 // Template array classes with like-type math ops |
1988
|
2 /* |
|
3 |
2847
|
4 Copyright (C) 1996, 1997 John W. Eaton |
1988
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if defined (__GNUG__) |
|
25 #pragma interface |
|
26 #endif |
|
27 |
|
28 #if !defined (octave_MArray2_h) |
|
29 #define octave_MArray2_h 1 |
|
30 |
|
31 #include "Array2.h" |
|
32 |
3573
|
33 // Two dimensional array with math ops. |
3107
|
34 |
3573
|
35 // But first, some preprocessor abuse... |
3107
|
36 |
3573
|
37 #include "MArray-defs.h" |
3107
|
38 |
3573
|
39 MARRAY_OPS_FORWARD_DECLS (MArray2) |
1988
|
40 |
|
41 template <class T> |
|
42 class MArray2 : public Array2<T> |
|
43 { |
|
44 protected: |
|
45 |
|
46 MArray2 (T *d, int n, int m) : Array2<T> (d, n, m) { } |
|
47 |
|
48 public: |
|
49 |
|
50 MArray2 (void) : Array2<T> () { } |
|
51 MArray2 (int n, int m) : Array2<T> (n, m) { } |
|
52 MArray2 (int n, int m, const T& val) : Array2<T> (n, m, val) { } |
|
53 MArray2 (const Array2<T>& a) : Array2<T> (a) { } |
|
54 MArray2 (const MArray2<T>& a) : Array2<T> (a) { } |
|
55 |
|
56 ~MArray2 (void) { } |
|
57 |
|
58 MArray2<T>& operator = (const MArray2<T>& a) |
|
59 { |
|
60 Array2<T>::operator = (a); |
|
61 return *this; |
|
62 } |
|
63 |
3225
|
64 MArray2<T>& insert (const Array2<T>& a, int r, int c) |
|
65 { |
|
66 Array2<T>::insert (a, r, c); |
|
67 return *this; |
|
68 } |
|
69 |
|
70 MArray2<T> transpose (void) const { return Array2<T>::transpose (); } |
1988
|
71 |
3573
|
72 // Currently, the OPS functions don't need to be friends, but that |
|
73 // may change. |
|
74 |
|
75 MARRAY_OPS_FRIEND_DECLS (MArray2) |
|
76 }; |
3107
|
77 |
2391
|
78 extern void |
|
79 gripe_nonconformant (const char *op, int op1_nr, int op1_nc, |
|
80 int op2_nr, int op2_nc); |
|
81 |
1988
|
82 #endif |
|
83 |
|
84 /* |
|
85 ;;; Local Variables: *** |
|
86 ;;; mode: C++ *** |
|
87 ;;; End: *** |
|
88 */ |