casacore
MaskArrLogi.h
Go to the documentation of this file.
1//# MaskArrLogi.h: Element by element logical operations on masked arrays.
2//# Copyright (C) 1993,1994,1995,1999,2001
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: aips2-request@nrao.edu.
21//# Postal address: AIPS++ Project Office
22//# National Radio Astronomy Observatory
23//# 520 Edgemont Road
24//# Charlottesville, VA 22903-2475 USA
25//#
26//# $Id$
27
28#ifndef CASA_MASKARRLOGI_2_H
29#define CASA_MASKARRLOGI_2_H
30
31#include "Array.h"
32#include "MaskedArray.h"
33#include "MaskLogiArr.h"
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37// <summary>
38// Logical operations for MaskedArrays, and between MaskedArrays and Arrays.
39// </summary>
40// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMaskArrLogi tMaskArrExcp">
41//
42// <prerequisite>
43// <li> <linkto class=Array>Array</linkto>
44// <li> <linkto group="LogiArray.h#LogicalArray">LogicalArray</linkto>
45// <li> <linkto class=MaskedArray>MaskedArray</linkto>
46// </prerequisite>
47//
48// <etymology>
49// MaskArrLogi is short for MaskedArrayLogical, which is too long by the
50// old AIPS++ file naming conventions. This file contains global functions
51// which perform element by element logical operations on masked arrays.
52// </etymology>
53//
54// <synopsis>
55// These functions perform element by element logical operations on
56// masked arrays. With two arrays, they must both conform, and the result
57// is done element by element, for those locations where the mask of the
58// MaskedArray is true. For two MaskedArrays, the "and" of the masks is used.
59//
60// There are two classes of functions. One class returns a MaskedLogicalArray.
61// In these functions, the value of an element of the MaskedLogicalArray is
62// the value of the logical operation applied to the corresponding elements
63// of the input MaskedArrays. The other class of functions returns a single
64// bool. The return value is true if the logical operation returns true for
65// all elements of the input masked arrays for the "all" functions
66// (e.g. allLE()), and returns true if the logical operation returns true for
67// any elements of the input masked arrays for the "any" functions
68// (e.g. anyLE()). The functions which return a single bool throw an exception
69// if the AND of the masks of the input masked arrays has no true elements.
70//
71// For instance allLE (a, b) imples that every element of a is
72// less than or equal to every element of b. Note that with this definition
73// allLE (a, b) and allGE (a, b) can both be false (e.g. a = [1,0] b = [0,1]).
74//
75// NB comparison between two zero-sized arrays is not defined (should it
76// throw an exception?).
77// </synopsis>
78//
79// <example>
80// <srcblock>
81// Vector<int> a(10);
82// Vector<int> b(10);
83// LogicalVector l(10);
84// . . .
85// l = a(a>0) < b(b>0);
86// </srcblock>
87// This example sets those elements of l where ((a>0) && (b>0)) to (a<b).
88// Elements of l where !((a>0) && (b>0)) are unchanged. The result of
89// the comparison is a MaskedLogicalArray. The assignment from this
90// MaskedLogicalArray to the LogicalArray l only assigns those elements
91// where the mask is true.
92// </example>
93//
94// <example>
95// <srcblock>
96// Vector<int> a(10);
97// Vector<int> b(10);
98// bool result;
99// . . .
100// result = allLT (a(a>0), b(b>0));
101// </srcblock>
102// This example sets result to true if, for all elements where
103// ((a>0) && (b>0)), a<b.
104// </example>
105//
106// <motivation>
107// One wants to be able to mask arrays and perform logical operations on
108// those masked arrays. Since the masked arrays are only defined where
109// the masks are true, the result must be a MaskedLogicalArray, or a single
110// bool.
111// </motivation>
112//
113// <todo asof="$DATE:$>
114// <li> Reconsider where the origin of the returned LogicalArray should
115// be located.
116// </todo>
117//
118// <linkfrom anchor="MaskedArray logical operations" classes="MaskedArray Array Vector Matrix Cube">
119// <here>MaskedArray logical operations</here> -- Logical operations
120// for MaskedArrays, and between MaskedArrays and Arrays.
121// </linkfrom>
122//
123// <group name="MaskedArray logical operations">
125
126//
127// Element by element comparisons between the "l" and "r" arrays. The result
128// is true only if the comparison is true for every element of the arrays
129// for which the mask of the MaskedArray is true. For two MaskedArrays,
130// the "and" of the masks is used.
131//
132// <thrown>
133// <li> ArrayConformanceError
134// <li> ArrayError
135// </thrown>
136//
137// <group>
138template<class T> bool allLE (const MaskedArray<T> &l, const Array<T> &r);
139template<class T> bool allLT (const MaskedArray<T> &l, const Array<T> &r);
140template<class T> bool allGE (const MaskedArray<T> &l, const Array<T> &r);
141template<class T> bool allGT (const MaskedArray<T> &l, const Array<T> &r);
142template<class T> bool allEQ (const MaskedArray<T> &l, const Array<T> &r);
143template<class T> bool allNE (const MaskedArray<T> &l, const Array<T> &r);
144//
145// This only makes sense if the array element type is logical valued.
146// <group>
147template<class T> bool allAND (const MaskedArray<T> &l, const Array<T> &r);
148template<class T> bool allOR (const MaskedArray<T> &l, const Array<T> &r);
149// </group>
150
151template<class T> bool allLE (const Array<T> &l, const MaskedArray<T> &r);
152template<class T> bool allLT (const Array<T> &l, const MaskedArray<T> &r);
153template<class T> bool allGE (const Array<T> &l, const MaskedArray<T> &r);
154template<class T> bool allGT (const Array<T> &l, const MaskedArray<T> &r);
155template<class T> bool allEQ (const Array<T> &l, const MaskedArray<T> &r);
156template<class T> bool allNE (const Array<T> &l, const MaskedArray<T> &r);
157//
158// This only makes sense if the array element type is logical valued.
159// <group>
160template<class T> bool allAND (const Array<T> &l, const MaskedArray<T> &r);
161template<class T> bool allOR (const Array<T> &l, const MaskedArray<T> &r);
162// </group>
163
164template<class T>
165 bool allLE (const MaskedArray<T> &l, const MaskedArray<T> &r);
166template<class T>
167 bool allLT (const MaskedArray<T> &l, const MaskedArray<T> &r);
168template<class T>
169 bool allGE (const MaskedArray<T> &l, const MaskedArray<T> &r);
170template<class T>
171 bool allGT (const MaskedArray<T> &l, const MaskedArray<T> &r);
172template<class T>
173 bool allEQ (const MaskedArray<T> &l, const MaskedArray<T> &r);
174template<class T>
175 bool allNE (const MaskedArray<T> &l, const MaskedArray<T> &r);
176//
177// This only makes sense if the array element type is logical valued.
178// <group>
179template<class T>
180 bool allAND (const MaskedArray<T> &l, const MaskedArray<T> &r);
181template<class T>
182 bool allOR (const MaskedArray<T> &l, const MaskedArray<T> &r);
183// </group>
184
185// </group>
186
187
188//
189// Element by element comparisons between the "l" and "r" arrays. The result
190// is a MaskedLogicalArray.
191//
192// The arrays must conform or an exception is thrown.
193//
194// <thrown>
195// <li> ArrayConformanceError
196// </thrown>
197//
198// <group>
199template<class T>
201template<class T>
203template<class T>
205template<class T>
207template<class T>
209template<class T>
211//
212// This only makes sense if the array element type is logical valued.
213// <group>
214template<class T>
216template<class T>
218// </group>
219
220template<class T>
222template<class T>
224template<class T>
226template<class T>
228template<class T>
230template<class T>
232//
233// This only makes sense if the array element type is logical valued.
234// <group>
235template<class T>
237template<class T>
239// </group>
240
241template<class T>
243 const MaskedArray<T> &r);
244template<class T>
246 const MaskedArray<T> &r);
247template<class T>
249 const MaskedArray<T> &r);
250template<class T>
252 const MaskedArray<T> &r);
253template<class T>
255 const MaskedArray<T> &r);
256template<class T>
258 const MaskedArray<T> &r);
259//
260// This only makes sense if the array element type is logical valued.
261// <group>
262template<class T>
264 const MaskedArray<T> &r);
265template<class T>
267 const MaskedArray<T> &r);
268// </group>
269
270// </group>
271
272
273//
274// Logical negation of a MaskedArray. This only makes sense if the array
275// element type is logical valued.
276template<class T>
278
279
280//
281// Element by element comparisons between an array and a scalar, which
282// behaves as if it were a conformant array filled with the value "val."
283// The result is true only if the comparison is true for every element
284// for which the mask of the MaskedArray is true.
285// <thrown>
286// <li> ArrayError
287// </thrown>
288//
289// <group>
290template<class T> bool allLE (const MaskedArray<T> &array, const T &val);
291template<class T> bool allLE (const T &val, const MaskedArray<T> &array);
292template<class T> bool allLT (const MaskedArray<T> &array, const T &val);
293template<class T> bool allLT (const T &val, const MaskedArray<T> &array);
294template<class T> bool allGE (const MaskedArray<T> &array, const T &val);
295template<class T> bool allGE (const T &val, const MaskedArray<T> &array);
296template<class T> bool allGT (const MaskedArray<T> &array, const T &val);
297template<class T> bool allGT (const T &val, const MaskedArray<T> &array);
298template<class T> bool allEQ (const MaskedArray<T> &array, const T &val);
299template<class T> bool allEQ (const T &val, const MaskedArray<T> &array);
300template<class T> bool allNE (const MaskedArray<T> &array, const T &val);
301template<class T> bool allNE (const T &val, const MaskedArray<T> &array);
302//
303// This only makes sense if the array element type is logical valued.
304// <group>
305template<class T> bool allAND (const MaskedArray<T> &array, const T &val);
306template<class T> bool allAND (const T &val, const MaskedArray<T> &array);
307template<class T> bool allOR (const MaskedArray<T> &array, const T &val);
308template<class T> bool allOR (const T &val, const MaskedArray<T> &array);
309// </group>
310//
311// </group>
312
313
314//
315// Element by element comparisons between an array and a scalar, which
316// behaves as if it were a conformant array filled with the value "val."
317// The result is an MaskedLogicalArray.
318// <group>
319//
320template<class T>
322template<class T>
324template<class T>
326template<class T>
328template<class T>
330template<class T>
332template<class T>
334template<class T>
336template<class T>
338template<class T>
340template<class T>
342template<class T>
344//
345// This only makes sense if the array element type is logical valued.
346// <group>
347template<class T>
349template<class T>
351template<class T>
353template<class T>
355// </group>
356//
357// </group>
358
359
360//# With two arrays, they must both conform, and the result is done element
361//# by element. For instance anyLE (a, b) imples that some element of a is
362//# less than or equal to every element of b.
363//# NB comparison between two zero-sized arrays is not defined (should it
364//# throw an exception?).
365
366//
367// Element by element comparisons between the "l" and "r" arrays. The result
368// is true only if the comparison is true for some element of the arrays
369// for which the mask of the MaskedArray is true. For two MaskedArrays,
370// the "and" of the masks is used.
371//
372// <thrown>
373// <li> ArrayConformanceError
374// <li> ArrayError
375// </thrown>
376//
377// <group>
378//
379template<class T> bool anyLE (const MaskedArray<T> &l, const Array<T> &r);
380template<class T> bool anyLT (const MaskedArray<T> &l, const Array<T> &r);
381template<class T> bool anyGE (const MaskedArray<T> &l, const Array<T> &r);
382template<class T> bool anyGT (const MaskedArray<T> &l, const Array<T> &r);
383template<class T> bool anyEQ (const MaskedArray<T> &l, const Array<T> &r);
384template<class T> bool anyNE (const MaskedArray<T> &l, const Array<T> &r);
385//
386// This only makes sense if the array element type is logical valued.
387// <group>
388template<class T> bool anyAND (const MaskedArray<T> &l, const Array<T> &r);
389template<class T> bool anyOR (const MaskedArray<T> &l, const Array<T> &r);
390// </group>
391
392
393template<class T> bool anyLE (const Array<T> &l, const MaskedArray<T> &r);
394template<class T> bool anyLT (const Array<T> &l, const MaskedArray<T> &r);
395template<class T> bool anyGE (const Array<T> &l, const MaskedArray<T> &r);
396template<class T> bool anyGT (const Array<T> &l, const MaskedArray<T> &r);
397template<class T> bool anyEQ (const Array<T> &l, const MaskedArray<T> &r);
398template<class T> bool anyNE (const Array<T> &l, const MaskedArray<T> &r);
399//
400// This only makes sense if the array element type is logical valued.
401// <group>
402template<class T> bool anyAND (const Array<T> &l, const MaskedArray<T> &r);
403template<class T> bool anyOR (const Array<T> &l, const MaskedArray<T> &r);
404// </group>
405
406
407template<class T>
408 bool anyLE (const MaskedArray<T> &l, const MaskedArray<T> &r);
409template<class T>
410 bool anyLT (const MaskedArray<T> &l, const MaskedArray<T> &r);
411template<class T>
412 bool anyGE (const MaskedArray<T> &l, const MaskedArray<T> &r);
413template<class T>
414 bool anyGT (const MaskedArray<T> &l, const MaskedArray<T> &r);
415template<class T>
416 bool anyEQ (const MaskedArray<T> &l, const MaskedArray<T> &r);
417template<class T>
418 bool anyNE (const MaskedArray<T> &l, const MaskedArray<T> &r);
419//
420// This only makes sense if the array element type is logical valued.
421// <group>
422template<class T>
423 bool anyAND (const MaskedArray<T> &l, const MaskedArray<T> &r);
424template<class T>
425 bool anyOR (const MaskedArray<T> &l, const MaskedArray<T> &r);
426// </group>
427
428// </group>
429
430
431//
432// Element by element comparisons between an array and a scalar, which
433// behaves as if it were a conformant array filled with the value "val."
434// The result is true only if the comparison is true for some element
435// for which the mask of the MaskedArray is true.
436//
437// <thrown>
438// <li> ArrayError
439// </thrown>
440//
441// <group>
442//
443template<class T> bool anyLE (const MaskedArray<T> &array, const T &val);
444template<class T> bool anyLE (const T &val, const MaskedArray<T> &array);
445template<class T> bool anyLT (const MaskedArray<T> &array, const T &val);
446template<class T> bool anyLT (const T &val, const MaskedArray<T> &array);
447template<class T> bool anyGE (const MaskedArray<T> &array, const T &val);
448template<class T> bool anyGE (const T &val, const MaskedArray<T> &array);
449template<class T> bool anyGT (const MaskedArray<T> &array, const T &val);
450template<class T> bool anyGT (const T &val, const MaskedArray<T> &array);
451template<class T> bool anyEQ (const MaskedArray<T> &array, const T &val);
452template<class T> bool anyEQ (const T &val, const MaskedArray<T> &array);
453template<class T> bool anyNE (const MaskedArray<T> &array, const T &val);
454template<class T> bool anyNE (const T &val, const MaskedArray<T> &array);
455//
456// This only makes sense if the array element type is logical valued.
457// <group>
458template<class T> bool anyAND (const MaskedArray<T> &array, const T &val);
459template<class T> bool anyAND (const T &val, const MaskedArray<T> &array);
460template<class T> bool anyOR (const MaskedArray<T> &array, const T &val);
461template<class T> bool anyOR (const T &val, const MaskedArray<T> &array);
462// </group>
463//
464// </group>
465
466// </group>
467
468
469} //# NAMESPACE CASACORE - END
470
471#include "MaskArrLogi.tcc"
472
473#endif
this file contains all the compiler specific defines
Definition: mainpage.dox:28
LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1929
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:129
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:135
LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
TableExprNode marray(const TableExprNode &array, const TableExprNode &mask)
Form a masked array.
Definition: ExprNode.h:1935
LatticeExprNode operator!(const LatticeExprNode &expr)
LatticeExprNode operator<=(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode operator||(const LatticeExprNode &left, const LatticeExprNode &right)
bool anyNE(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool allGT(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool anyNE(const Array< T > &l, const MaskedArray< T > &r)
bool allLT(const MaskedArray< T > &l, const Array< T > &r)
bool anyOR(const MaskedArray< T > &l, const Array< T > &r)
bool allAND(const MaskedArray< T > &l, const MaskedArray< T > &r)
This only makes sense if the array element type is logical valued.
bool allGE(const MaskedArray< T > &array, const T &val)
bool allEQ(const T &val, const MaskedArray< T > &array)
bool allAND(const T &val, const MaskedArray< T > &array)
bool allNE(const MaskedArray< T > &l, const Array< T > &r)
bool anyAND(const Array< T > &l, const MaskedArray< T > &r)
This only makes sense if the array element type is logical valued.
bool anyAND(const T &val, const MaskedArray< T > &array)
bool allNE(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool allGE(const T &val, const MaskedArray< T > &array)
bool allLT(const MaskedArray< T > &l, const MaskedArray< T > &r)
MaskedLogicalArray operator==(const MaskedArray< T > &l, const Array< T > &r)
bool allAND(const MaskedArray< T > &array, const T &val)
This only makes sense if the array element type is logical valued.
bool anyGE(const MaskedArray< T > &array, const T &val)
bool anyGT(const Array< T > &l, const MaskedArray< T > &r)
bool anyLT(const MaskedArray< T > &array, const T &val)
MaskedLogicalArray operator&&(const MaskedArray< T > &l, const Array< T > &r)
This only makes sense if the array element type is logical valued.
bool anyOR(const MaskedArray< T > &array, const T &val)
bool allEQ(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool allGT(const T &val, const MaskedArray< T > &array)
MaskedLogicalArray operator||(const MaskedArray< T > &l, const Array< T > &r)
bool anyOR(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool anyGT(const T &val, const MaskedArray< T > &array)
bool allAND(const MaskedArray< T > &l, const Array< T > &r)
This only makes sense if the array element type is logical valued.
bool allNE(const Array< T > &l, const MaskedArray< T > &r)
bool allLT(const Array< T > &l, const MaskedArray< T > &r)
bool allLT(const MaskedArray< T > &array, const T &val)
bool anyGT(const MaskedArray< T > &array, const T &val)
bool allOR(const T &val, const MaskedArray< T > &array)
bool allEQ(const Array< T > &l, const MaskedArray< T > &r)
bool anyAND(const MaskedArray< T > &array, const T &val)
This only makes sense if the array element type is logical valued.
bool allLE(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool anyLE(const Array< T > &l, const MaskedArray< T > &r)
bool anyEQ(const T &val, const MaskedArray< T > &array)
bool anyEQ(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool anyLT(const Array< T > &l, const MaskedArray< T > &r)
bool allAND(const Array< T > &l, const MaskedArray< T > &r)
This only makes sense if the array element type is logical valued.
bool anyAND(const MaskedArray< T > &l, const MaskedArray< T > &r)
This only makes sense if the array element type is logical valued.
bool anyGE(const T &val, const MaskedArray< T > &array)
bool allNE(const T &val, const MaskedArray< T > &array)
bool anyAND(const MaskedArray< T > &l, const Array< T > &r)
This only makes sense if the array element type is logical valued.
bool allEQ(const MaskedArray< T > &l, const Array< T > &r)
bool anyLT(const MaskedArray< T > &l, const Array< T > &r)
bool anyOR(const T &val, const MaskedArray< T > &array)
bool anyLE(const T &val, const MaskedArray< T > &array)
bool anyEQ(const MaskedArray< T > &l, const Array< T > &r)
bool allLE(const MaskedArray< T > &l, const Array< T > &r)
Element by element comparisons between the "l" and "r" arrays.
bool anyEQ(const Array< T > &l, const MaskedArray< T > &r)
bool anyLT(const T &val, const MaskedArray< T > &array)
MaskedLogicalArray operator<=(const MaskedArray< T > &l, const Array< T > &r)
Element by element comparisons between the "l" and "r" arrays.
bool allGT(const MaskedArray< T > &l, const Array< T > &r)
MaskedLogicalArray operator>=(const MaskedArray< T > &l, const Array< T > &r)
bool allOR(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool allOR(const Array< T > &l, const MaskedArray< T > &r)
bool anyNE(const MaskedArray< T > &l, const Array< T > &r)
bool allGE(const Array< T > &l, const MaskedArray< T > &r)
MaskedLogicalArray operator>(const MaskedArray< T > &l, const Array< T > &r)
bool anyGT(const MaskedArray< T > &l, const Array< T > &r)
MaskedLogicalArray operator<(const MaskedArray< T > &l, const Array< T > &r)
bool allGE(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool allGT(const Array< T > &l, const MaskedArray< T > &r)
MaskedLogicalArray operator!(const MaskedArray< T > &marray)
Logical negation of a MaskedArray.
bool allLT(const T &val, const MaskedArray< T > &array)
bool allLE(const MaskedArray< T > &array, const T &val)
Element by element comparisons between an array and a scalar, which behaves as if it were a conforman...
MaskedLogicalArray operator!=(const MaskedArray< T > &l, const Array< T > &r)
bool anyGT(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool anyGE(const MaskedArray< T > &l, const Array< T > &r)
bool anyGE(const Array< T > &l, const MaskedArray< T > &r)
bool allOR(const MaskedArray< T > &l, const Array< T > &r)
bool anyLE(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool allEQ(const MaskedArray< T > &array, const T &val)
bool anyGE(const MaskedArray< T > &l, const MaskedArray< T > &r)
bool anyEQ(const MaskedArray< T > &array, const T &val)
bool allNE(const MaskedArray< T > &array, const T &val)
bool anyNE(const MaskedArray< T > &array, const T &val)
bool allLE(const T &val, const MaskedArray< T > &array)
bool allLE(const Array< T > &l, const MaskedArray< T > &r)
bool anyOR(const Array< T > &l, const MaskedArray< T > &r)
bool anyLE(const MaskedArray< T > &array, const T &val)
Element by element comparisons between an array and a scalar, which behaves as if it were a conforman...
bool anyNE(const T &val, const MaskedArray< T > &array)
bool anyLE(const MaskedArray< T > &l, const Array< T > &r)
Element by element comparisons between the "l" and "r" arrays.
bool allOR(const MaskedArray< T > &array, const T &val)
bool allGT(const MaskedArray< T > &array, const T &val)
bool allGE(const MaskedArray< T > &l, const Array< T > &r)
bool anyLT(const MaskedArray< T > &l, const MaskedArray< T > &r)