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> |
3585
|
42 class |
|
43 MArray2 : public Array2<T> |
1988
|
44 { |
|
45 protected: |
|
46 |
|
47 MArray2 (T *d, int n, int m) : Array2<T> (d, n, m) { } |
|
48 |
|
49 public: |
|
50 |
|
51 MArray2 (void) : Array2<T> () { } |
3585
|
52 |
1988
|
53 MArray2 (int n, int m) : Array2<T> (n, m) { } |
3585
|
54 |
1988
|
55 MArray2 (int n, int m, const T& val) : Array2<T> (n, m, val) { } |
3585
|
56 |
|
57 MArray2 (const MArray2<T>& a) : Array2<T> (a) { } |
|
58 |
1988
|
59 MArray2 (const Array2<T>& a) : Array2<T> (a) { } |
|
60 |
|
61 ~MArray2 (void) { } |
|
62 |
|
63 MArray2<T>& operator = (const MArray2<T>& a) |
|
64 { |
|
65 Array2<T>::operator = (a); |
|
66 return *this; |
|
67 } |
|
68 |
3225
|
69 MArray2<T>& insert (const Array2<T>& a, int r, int c) |
|
70 { |
|
71 Array2<T>::insert (a, r, c); |
|
72 return *this; |
|
73 } |
|
74 |
|
75 MArray2<T> transpose (void) const { return Array2<T>::transpose (); } |
1988
|
76 |
3573
|
77 // Currently, the OPS functions don't need to be friends, but that |
|
78 // may change. |
|
79 |
|
80 MARRAY_OPS_FRIEND_DECLS (MArray2) |
|
81 }; |
3107
|
82 |
2391
|
83 extern void |
|
84 gripe_nonconformant (const char *op, int op1_nr, int op1_nc, |
|
85 int op2_nr, int op2_nc); |
|
86 |
1988
|
87 #endif |
|
88 |
|
89 /* |
|
90 ;;; Local Variables: *** |
|
91 ;;; mode: C++ *** |
|
92 ;;; End: *** |
|
93 */ |