Mercurial > octave
annotate liboctave/array/MArray.h @ 21139:538b57866b90
consistently use "typename" intead of "class" in template declarations
* Object.h, QtHandlesUtils.cc, QtHandlesUtils.h, ToolBarButton.cc,
ToolBarButton.h, Cell.h, __lin_interpn__.cc, bitfcns.cc, bsxfun.cc,
cellfun.cc, data.cc, filter.cc, gcd.cc, graphics.cc, help.cc, kron.cc,
lookup.cc, ls-mat5.cc, ls-oct-text.h, lu.cc, max.cc, mgorth.cc,
oct-map.cc, oct-map.h, oct-stream.cc, oct-stream.h, octave-link.h,
pr-output.cc, profiler.h, schur.cc, sparse-xdiv.cc, sparse-xpow.cc,
sqrtm.cc, symtab.h, tril.cc, typecast.cc, variables.cc, xdiv.cc,
zfstream.h, __init_fltk__.cc, __magick_read__.cc, chol.cc, qr.cc,
ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc, ov-base-int.h,
ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h,
ov-base-sparse.cc, ov-base-sparse.h, ov-base.h, ov-classdef.cc,
ov-int-traits.h, ov-java.h, ov-usr-fcn.h, ov.cc, ov.h,
op-dms-template.cc, oct-parse.in.yy, parse.h, pt-mat.cc, Array-b.cc,
Array.cc, Array.h, CDiagMatrix.h, CMatrix.h, CNDArray.h,
DiagArray2.cc, DiagArray2.h, MArray.cc, MArray.h, MDiagArray2.cc,
MDiagArray2.h, MSparse.cc, MSparse.h, MatrixType.cc, Sparse.cc,
Sparse.h, dDiagMatrix.h, dMatrix.h, dNDArray.h, fCDiagMatrix.h,
fCMatrix.h, fCNDArray.h, fDiagMatrix.h, fMatrix.h, fNDArray.h,
idx-vector.cc, idx-vector.h, intNDArray.cc, intNDArray.h, DET.h,
base-aepbal.h, base-lu.cc, base-lu.h, base-qr.cc, base-qr.h,
bsxfun-defs.cc, eigs-base.cc, lo-mappers.h, lo-specfun.cc,
lo-specfun.h, oct-convn.cc, oct-fftw.cc, oct-norm.cc,
sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc,
sparse-base-lu.h, sparse-dmsolve.cc, mx-inlines.cc,
action-container.h, base-list.h, lo-traits.h, lo-utils.h,
oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-inttypes.cc,
oct-inttypes.h, oct-locbuf.h, oct-refcount.h, oct-sort.cc, oct-sort.h:
Use "typename" instead of "class" in template declarations.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 24 Jan 2016 13:50:04 -0500 |
parents | 2a99b8b250cd |
children | 1473547f50f5 |
rev | line source |
---|---|
237 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19326
diff
changeset
|
3 Copyright (C) 1993-2015 John W. Eaton |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10396
diff
changeset
|
4 Copyright (C) 2010 VZLU Prague |
237 | 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 | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
237 | 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 | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
237 | 21 |
22 */ | |
23 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
24 #if ! defined (octave_MArray_h) |
382 | 25 #define octave_MArray_h 1 |
26 | |
237 | 27 #include "Array.h" |
20960
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
28 #include "mx-inlines.cc" |
237 | 29 |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
20960
diff
changeset
|
30 template <typename T> class MArray; |
3107 | 31 |
20960
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
32 template <typename T> MArray<T>& operator += (MArray<T>&, const T&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
33 template <typename T> MArray<T>& operator -= (MArray<T>&, const T&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
34 template <typename T> MArray<T>& operator *= (MArray<T>&, const T&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
35 template <typename T> MArray<T>& operator /= (MArray<T>&, const T&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
36 template <typename T> MArray<T>& operator += (MArray<T>&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
37 template <typename T> MArray<T>& operator -= (MArray<T>&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
38 template <typename T> MArray<T>& product_eq (MArray<T>&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
39 template <typename T> MArray<T>& quotient_eq (MArray<T>&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
40 template <typename T> MArray<T> operator + (const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
41 template <typename T> MArray<T> operator - (const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
42 template <typename T> MArray<T> operator + (const MArray<T>&, const T&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
43 template <typename T> MArray<T> operator - (const MArray<T>&, const T&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
44 template <typename T> MArray<T> operator * (const MArray<T>&, const T&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
45 template <typename T> MArray<T> operator / (const MArray<T>&, const T&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
46 template <typename T> MArray<T> operator + (const T&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
47 template <typename T> MArray<T> operator - (const T&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
48 template <typename T> MArray<T> operator * (const T&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
49 template <typename T> MArray<T> operator / (const T&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
50 template <typename T> MArray<T> operator + (const MArray<T>&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
51 template <typename T> MArray<T> operator - (const MArray<T>&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
52 template <typename T> MArray<T> quotient (const MArray<T>&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
53 template <typename T> MArray<T> product (const MArray<T>&, const MArray<T>&); |
3107 | 54 |
20960
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
55 //! Template for N-dimensional array classes with like-type math operators. |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
20960
diff
changeset
|
56 template <typename T> |
3585 | 57 class |
58 MArray : public Array<T> | |
237 | 59 { |
14951
4c9fd3e31436
Start of jit support for double matricies
Max Brister <max@2bass.com>
parents:
14138
diff
changeset
|
60 protected: |
4c9fd3e31436
Start of jit support for double matricies
Max Brister <max@2bass.com>
parents:
14138
diff
changeset
|
61 |
4c9fd3e31436
Start of jit support for double matricies
Max Brister <max@2bass.com>
parents:
14138
diff
changeset
|
62 // For jit support |
4c9fd3e31436
Start of jit support for double matricies
Max Brister <max@2bass.com>
parents:
14138
diff
changeset
|
63 MArray (T *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep) |
4c9fd3e31436
Start of jit support for double matricies
Max Brister <max@2bass.com>
parents:
14138
diff
changeset
|
64 : Array<T> (sdata, slen, adims, arep) { } |
4c9fd3e31436
Start of jit support for double matricies
Max Brister <max@2bass.com>
parents:
14138
diff
changeset
|
65 |
237 | 66 public: |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
67 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 MArray (void) : Array<T> () { } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
69 |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
70 explicit MArray (const dim_vector& dv) |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
71 : Array<T> (dv) { } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
72 |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
73 explicit MArray (const dim_vector& dv, const T& val) |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
74 : Array<T> (dv, val) { } |
3585 | 75 |
76 MArray (const MArray<T>& a) : Array<T> (a) { } | |
77 | |
21139
538b57866b90
consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents:
20960
diff
changeset
|
78 template <typename U> |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
79 MArray (const Array<U>& a) : Array<T> (a) { } |
237 | 80 |
1230 | 81 ~MArray (void) { } |
82 | |
237 | 83 MArray<T>& operator = (const MArray<T>& a) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
84 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
85 Array<T>::operator = (a); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
86 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
87 } |
3573 | 88 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
89 MArray<T> reshape (const dim_vector& new_dims) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
90 { return Array<T>::reshape (new_dims); } |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
91 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11570
diff
changeset
|
92 MArray<T> permute (const Array<octave_idx_type>& vec, |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
93 bool inv = false) const |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
94 { return Array<T>::permute (vec, inv); } |
9612
66970dd627f6
further liboctave design improvements
Jaroslav Hajek <highegg@gmail.com>
parents:
8934
diff
changeset
|
95 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
96 MArray<T> ipermute (const Array<octave_idx_type>& vec) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
97 { return Array<T>::ipermute (vec); } |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
98 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
99 MArray squeeze (void) const { return Array<T>::squeeze (); } |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
100 |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
101 MArray<T> transpose (void) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
102 { return Array<T>::transpose (); } |
5602 | 103 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
104 MArray<T> hermitian (T (*fcn) (const T&) = 0) const |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
105 { return Array<T>::hermitian (fcn); } |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
106 |
20960
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
107 //! Performs indexed accumulative addition. |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
108 //@{ |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
109 void idx_add (const idx_vector& idx, T val); |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
110 void idx_add (const idx_vector& idx, const MArray<T>& vals); |
20960
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
111 //@} |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
112 |
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
113 void idx_min (const idx_vector& idx, const MArray<T>& vals); |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
114 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
115 void idx_max (const idx_vector& idx, const MArray<T>& vals); |
3573 | 116 |
10396
a0b51ac0f88a
optimize accumdim with summation
Jaroslav Hajek <highegg@gmail.com>
parents:
10364
diff
changeset
|
117 void idx_add_nd (const idx_vector& idx, const MArray<T>& vals, int dim = -1); |
a0b51ac0f88a
optimize accumdim with summation
Jaroslav Hajek <highegg@gmail.com>
parents:
10364
diff
changeset
|
118 |
10350
12884915a8e4
merge MArray classes & improve Array interface
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
119 void changesign (void); |
237 | 120 }; |
121 | |
20960
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
122 // Define all the MArray forwarding functions for return type R and |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
123 // MArray element type T |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
124 #define MARRAY_FORWARD_DEFS(B, R, T) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
125 inline R operator += (R& x, const T& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
126 { return R (operator += (dynamic_cast<B<T>&> (x), (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
127 inline R operator -= (R& x, const T& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
128 { return R (operator -= (dynamic_cast<B<T>&> (x), (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
129 inline R operator *= (R& x, const T& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
130 { return R (operator *= (dynamic_cast<B<T>&> (x), (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
131 inline R operator /= (R& x, const T& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
132 { return R (operator /= (dynamic_cast<B<T>&> (x), (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
133 inline R operator += (R& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
134 { return R (operator += (dynamic_cast<B<T>&> (x), \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
135 dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
136 inline R operator -= (R& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
137 { return R (operator -= (dynamic_cast<B<T>&> (x), \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
138 dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
139 inline R product_eq (R& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
140 { return R (product_eq (dynamic_cast<B<T>&> (x), \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
141 dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
142 inline R quotient_eq (R& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
143 { return R (quotient_eq (dynamic_cast<B<T>&> (x), \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
144 dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
145 inline R operator + (const R& x) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
146 { return R (operator + (dynamic_cast<const B<T>&> (x))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
147 inline R operator - (const R& x) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
148 { return R (operator - (dynamic_cast<const B<T>&> (x))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
149 inline R operator + (const R& x, const T& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
150 { return R (operator + (dynamic_cast<const B<T>&> (x), (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
151 inline R operator - (const R& x, const T& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
152 { return R (operator - (dynamic_cast<const B<T>&> (x), (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
153 inline R operator * (const R& x, const T& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
154 { return R (operator * (dynamic_cast<const B<T>&> (x), (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
155 inline R operator / (const R& x, const T& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
156 { return R (operator / (dynamic_cast<const B<T>&> (x), (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
157 inline R operator + (const T& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
158 { return R (operator + ( (x), dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
159 inline R operator - (const T& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
160 { return R (operator - ( (x), dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
161 inline R operator * (const T& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
162 { return R (operator * ( (x), dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
163 inline R operator / (const T& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
164 { return R (operator / ( (x), dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
165 inline R operator + (const R& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
166 { return R (operator + (dynamic_cast<const B<T>&> (x), \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
167 dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
168 inline R operator - (const R& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
169 { return R (operator - (dynamic_cast<const B<T>&> (x), \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
170 dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
171 inline R product (const R& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
172 { return R (product (dynamic_cast<const B<T>&> (x), \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
173 dynamic_cast<const B<T>&> (y))); } \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
174 inline R quotient (const R& x, const R& y) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
175 { return R (quotient (dynamic_cast<const B<T>&> (x), \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
176 dynamic_cast<const B<T>&> (y))); } |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
177 |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
178 // Instantiate all the MArray friends for MArray element type T. |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
179 #define INSTANTIATE_MARRAY_FRIENDS(T, API) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
180 template API MArray<T>& operator += (MArray<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
181 template API MArray<T>& operator -= (MArray<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
182 template API MArray<T>& operator *= (MArray<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
183 template API MArray<T>& operator /= (MArray<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
184 template API MArray<T>& operator += (MArray<T>&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
185 template API MArray<T>& operator -= (MArray<T>&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
186 template API MArray<T>& product_eq (MArray<T>&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
187 template API MArray<T>& quotient_eq (MArray<T>&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
188 template API MArray<T> operator + (const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
189 template API MArray<T> operator - (const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
190 template API MArray<T> operator + (const MArray<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
191 template API MArray<T> operator - (const MArray<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
192 template API MArray<T> operator * (const MArray<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
193 template API MArray<T> operator / (const MArray<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
194 template API MArray<T> operator + (const T&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
195 template API MArray<T> operator - (const T&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
196 template API MArray<T> operator * (const T&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
197 template API MArray<T> operator / (const T&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
198 template API MArray<T> operator + (const MArray<T>&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
199 template API MArray<T> operator - (const MArray<T>&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
200 template API MArray<T> quotient (const MArray<T>&, const MArray<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
201 template API MArray<T> product (const MArray<T>&, const MArray<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
202 |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
203 // Instantiate all the MDiagArray2 friends for MDiagArray2 element type T. |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
204 #define INSTANTIATE_MDIAGARRAY2_FRIENDS(T, API) \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
205 template API MDiagArray2<T> operator + (const MDiagArray2<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
206 template API MDiagArray2<T> operator - (const MDiagArray2<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
207 template API MDiagArray2<T> operator * (const MDiagArray2<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
208 template API MDiagArray2<T> operator / (const MDiagArray2<T>&, const T&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
209 template API MDiagArray2<T> operator * (const T&, const MDiagArray2<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
210 template API MDiagArray2<T> operator + (const MDiagArray2<T>&, \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
211 const MDiagArray2<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
212 template API MDiagArray2<T> operator - (const MDiagArray2<T>&, \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
213 const MDiagArray2<T>&); \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
214 template API MDiagArray2<T> product (const MDiagArray2<T>&, \ |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
215 const MDiagArray2<T>&); |
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
216 |
237 | 217 #endif |
20960
2a99b8b250cd
MArray macro removal without loss of functionality to improve maintainability.
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
20791
diff
changeset
|
218 |