4647
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 2003, 2004, 2005, 2006, 2007 John W. Eaton |
4647
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
7016
|
9 Free Software Foundation; either version 3 of the License, or (at your |
|
10 option) any later version. |
4647
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
7016
|
18 along with Octave; see the file COPYING. If not, see |
|
19 <http://www.gnu.org/licenses/>. |
4647
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
|
27 #include <iostream> |
|
28 |
|
29 #include "ArrayN.h" |
4648
|
30 #include "Array-util.h" |
5775
|
31 // FIXME -- we are including the MArray{,2,N}.h files just for |
4647
|
32 // their gripe_nonconformant function decls. |
|
33 #include "MArray.h" |
|
34 #include "MArray2.h" |
|
35 #include "MArrayN.h" |
|
36 #include "MArray-defs.h" |
|
37 #include "boolMatrix.h" |
|
38 #include "boolNDArray.h" |
|
39 #include "mx-op-defs.h" |
|
40 #include "so-array.h" |
|
41 |
|
42 boolNDArray |
|
43 streamoff_array::all (int dim) const |
|
44 { |
|
45 MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (MX_ND_ALL_EXPR), true); |
|
46 } |
|
47 |
|
48 boolNDArray |
|
49 streamoff_array::any (int dim) const |
|
50 { |
|
51 MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (MX_ND_ANY_EXPR), false); |
|
52 } |
|
53 |
|
54 streamoff_array& |
|
55 operator += (streamoff_array& a, const std::streamoff& s) |
|
56 { |
|
57 DO_VS_OP2 (std::streamoff, a, +=, s) |
|
58 return a; |
|
59 } |
|
60 |
|
61 streamoff_array& |
|
62 operator -= (streamoff_array& a, const std::streamoff& s) |
|
63 { |
|
64 DO_VS_OP2 (std::streamoff, a, -=, s); |
|
65 return a; |
|
66 } |
|
67 |
|
68 streamoff_array& |
|
69 operator += (streamoff_array& a, const streamoff_array& b) |
|
70 { |
5275
|
71 octave_idx_type l = a.length (); |
4647
|
72 if (l > 0) |
|
73 { |
5275
|
74 octave_idx_type bl = b.length (); |
4647
|
75 if (l != bl) |
|
76 gripe_nonconformant ("operator +=", l, bl); |
|
77 else |
|
78 DO_VV_OP2 (std::streamoff, a, +=, b); |
|
79 } |
|
80 return a; |
|
81 } |
|
82 |
|
83 streamoff_array& |
|
84 operator -= (streamoff_array& a, const streamoff_array& b) |
|
85 { |
5275
|
86 octave_idx_type l = a.length (); |
4647
|
87 if (l > 0) |
|
88 { |
5275
|
89 octave_idx_type bl = b.length (); |
4647
|
90 if (l != bl) |
|
91 gripe_nonconformant ("operator -=", l, bl); |
|
92 else |
|
93 DO_VV_OP2 (std::streamoff, a, -=, b); |
|
94 } |
|
95 return a; |
|
96 } |
|
97 |
5275
|
98 octave_idx_type |
6867
|
99 streamoff_array::compute_index (Array<octave_idx_type>& ra_idx, |
4647
|
100 const dim_vector& dimensions) |
|
101 { |
|
102 return ::compute_index (ra_idx, dimensions); |
|
103 } |
|
104 |
4835
|
105 SND_CMP_OP (mx_el_eq, ==, std::streamoff, , streamoff_array, ) |
|
106 SND_CMP_OP (mx_el_ne, !=, std::streamoff, , streamoff_array, ) |
4647
|
107 |
4835
|
108 NDS_CMP_OP (mx_el_eq, ==, streamoff_array, , std::streamoff, ) |
|
109 NDS_CMP_OP (mx_el_ne, !=, streamoff_array, , std::streamoff, ) |
4647
|
110 |
4835
|
111 NDND_CMP_OP (mx_el_eq, ==, streamoff_array, , streamoff_array, ) |
|
112 NDND_CMP_OP (mx_el_ne, !=, streamoff_array, , streamoff_array, ) |
4647
|
113 |
|
114 NDND_BIN_OP (streamoff_array, operator +, |
|
115 streamoff_array, streamoff_array, mx_inline_add) |
|
116 |
|
117 NDND_BIN_OP (streamoff_array, operator -, |
|
118 streamoff_array, streamoff_array, mx_inline_subtract) |
|
119 |
|
120 |
|
121 NDS_BIN_OP (streamoff_array, operator +, |
|
122 streamoff_array, std::streamoff, mx_inline_add) |
|
123 |
|
124 NDS_BIN_OP (streamoff_array, operator -, |
|
125 streamoff_array, std::streamoff, mx_inline_subtract) |
|
126 |
|
127 |
|
128 SND_BIN_OP (streamoff_array, operator +, |
|
129 std::streamoff, streamoff_array, mx_inline_add) |
|
130 |
|
131 SND_BIN_OP (streamoff_array, operator -, |
|
132 std::streamoff, streamoff_array, mx_inline_subtract) |
|
133 |
|
134 /* |
|
135 ;;; Local Variables: *** |
|
136 ;;; mode: C++ *** |
|
137 ;;; End: *** |
|
138 */ |