casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeExprNode.h
Go to the documentation of this file.
1 //# LatticeExprNode.h: LatticeExprNode.h
2 //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
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 LATTICES_LATTICEEXPRNODE_H
29 #define LATTICES_LATTICEEXPRNODE_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
43 
44 namespace casacore { //# NAMESPACE CASACORE - BEGIN
45 
46 //# Forward Declarations
47 template <class T> class LatticeExpr;
48 template <class T> class Lattice;
49 template <class T> class MaskedLattice;
50 template <class T> class Block;
51 class LCRegion;
52 class Slicer;
53 class LattRegionHolder;
54 class LatticeExprNode;
55 
56 // Global functions operating on a LatticeExprNode.
57 // <group name=GlobalLatticeExprNode>
58  // Unary functions.
59  // <group>
60  LatticeExprNode operator+ (const LatticeExprNode& expr);
61  LatticeExprNode operator- (const LatticeExprNode& expr);
62  LatticeExprNode operator! (const LatticeExprNode& expr);
63  // </group>
64 
65  // Numerical binary operators
66  // <group>
67  LatticeExprNode operator+ (const LatticeExprNode& left,
68  const LatticeExprNode& right);
69  LatticeExprNode operator- (const LatticeExprNode& left,
70  const LatticeExprNode& right);
71  LatticeExprNode operator* (const LatticeExprNode& left,
72  const LatticeExprNode& right);
73  LatticeExprNode operator/ (const LatticeExprNode& left,
74  const LatticeExprNode& right);
75  LatticeExprNode operator% (const LatticeExprNode& left,
76  const LatticeExprNode& right);
77  LatticeExprNode operator^ (const LatticeExprNode& left,
78  const LatticeExprNode& right);
79  // </group>
80 
81  // Relational binary operators
82  // <group>
83  LatticeExprNode operator== (const LatticeExprNode& left,
84  const LatticeExprNode& right);
85  LatticeExprNode operator> (const LatticeExprNode& left,
86  const LatticeExprNode& right);
87  LatticeExprNode operator>= (const LatticeExprNode& left,
88  const LatticeExprNode& right);
89  LatticeExprNode operator< (const LatticeExprNode& left,
90  const LatticeExprNode& right);
91  LatticeExprNode operator<= (const LatticeExprNode& left,
92  const LatticeExprNode& right);
93  LatticeExprNode operator!= (const LatticeExprNode& left,
94  const LatticeExprNode& right);
95  // </group>
96 
97  // Logical binary operators
98  // <group>
99  LatticeExprNode operator&& (const LatticeExprNode& left,
100  const LatticeExprNode& right);
101  LatticeExprNode operator|| (const LatticeExprNode& left,
102  const LatticeExprNode& right);
103  // </group>
104 
105  // Numerical 1-argument functions
106  // <group>
107  LatticeExprNode sin (const LatticeExprNode& expr);
108  LatticeExprNode sinh (const LatticeExprNode& expr);
109  LatticeExprNode asin (const LatticeExprNode& expr);
110  LatticeExprNode cos (const LatticeExprNode& expr);
111  LatticeExprNode cosh (const LatticeExprNode& expr);
112  LatticeExprNode acos (const LatticeExprNode& expr);
113  LatticeExprNode tan (const LatticeExprNode& expr);
114  LatticeExprNode tanh (const LatticeExprNode& expr);
115  LatticeExprNode atan (const LatticeExprNode& expr);
116  LatticeExprNode exp (const LatticeExprNode& expr);
117  LatticeExprNode log (const LatticeExprNode& expr);
118  LatticeExprNode log10(const LatticeExprNode& expr);
119  LatticeExprNode sqrt (const LatticeExprNode& expr);
120  LatticeExprNode sign (const LatticeExprNode& expr);
121  LatticeExprNode round(const LatticeExprNode& expr);
122  LatticeExprNode ceil (const LatticeExprNode& expr);
123  LatticeExprNode floor(const LatticeExprNode& expr);
124  LatticeExprNode conj (const LatticeExprNode& expr);
125  // </group>
126 
127  // Numerical 2-argument functions
128  // <group>
129  LatticeExprNode atan2 (const LatticeExprNode& left,
130  const LatticeExprNode& right);
131  LatticeExprNode pow (const LatticeExprNode& left,
132  const LatticeExprNode& right);
133  LatticeExprNode fmod (const LatticeExprNode& left,
134  const LatticeExprNode& right);
135  LatticeExprNode min (const LatticeExprNode& left,
136  const LatticeExprNode& right);
137  LatticeExprNode max (const LatticeExprNode& left,
138  const LatticeExprNode& right);
139  // </group>
140 
141  // Form a complex number from two real numbers.
142  LatticeExprNode formComplex (const LatticeExprNode& left,
143  const LatticeExprNode& right);
144 
145  // Numerical 1-argument functions which result in a real number
146  // regardless of input expression type
147  // <group>
148  LatticeExprNode abs (const LatticeExprNode& expr);
149  LatticeExprNode arg (const LatticeExprNode& expr);
150  LatticeExprNode real (const LatticeExprNode& expr);
151  LatticeExprNode imag (const LatticeExprNode& expr);
152  // </group>
153 
154  // 1-argument functions operating on a numeric expression resulting
155  // in a scalar
156  // <group>
157  LatticeExprNode min (const LatticeExprNode& expr);
158  LatticeExprNode max (const LatticeExprNode& expr);
159  LatticeExprNode sum (const LatticeExprNode& expr);
160  LatticeExprNode median (const LatticeExprNode& expr);
161  LatticeExprNode mean (const LatticeExprNode& expr);
162  LatticeExprNode variance (const LatticeExprNode& expr);
163  LatticeExprNode stddev (const LatticeExprNode& expr);
164  LatticeExprNode avdev (const LatticeExprNode& expr);
165  // </group>
166 
167  // Determine the value of the element at the part <src>fraction</src>
168  // from the beginning of the given lattice.
169  // Thus <src>fraction=0.5</src> is equal to the median.
170  LatticeExprNode fractile (const LatticeExprNode& expr,
171  const LatticeExprNode& fraction);
172 
173  // Determine the value range of the elements at the part <src>fraction1</src>
174  // and fraction2 from the beginning of the given lattice. Both fractions
175  // must be >=0 and <=1 and fraction1 must be <= fraction2.
176  // By default <src>fraction2</src> is equal to <src>1-fraction1</src>.
177  // Thus <src>fraction=0.25</src> gives the quartile range of the lattice.
178  // <group>
179  LatticeExprNode fractileRange (const LatticeExprNode& expr,
180  const LatticeExprNode& fraction1,
181  const LatticeExprNode& fraction2);
182  LatticeExprNode fractileRange (const LatticeExprNode& expr,
183  const LatticeExprNode& fraction);
184  // </group>
185 
186  // 1-argument function to get the number of elements in a lattice.
187  // If the lattice is masked, only the True elements are counted.
188  // Results in a scalar Double.
189  LatticeExprNode nelements (const LatticeExprNode& expr);
190 
191  // 1-argument function to get the dimensionality of a lattice.
192  // 0 is returned if it is a scalar.
193  // Results in a scalar Float.
194  LatticeExprNode ndim (const LatticeExprNode& expr);
195 
196  // 2-argument function to get the length of an axis.
197  // Results in a scalar Float.
198  // The 2nd expression (giving the axis number) has to be a real scalar.
199  // <note role=caution>
200  // Axes start counting at 0.
201  // If the axis is a number < 0, an exception is thrown.
202  // If the axis is a number exceeding the dimensionality, 1 is returned.
203  // </note>
204  LatticeExprNode length (const LatticeExprNode& expr,
205  const LatticeExprNode& axis);
206 
207  // 2-argument function telling per pixel if its index on the given axis
208  // is contained in the 2nd argument. The 2nd argument should be a boolean
209  // vector where True means that the index is contained.
210  // For indices >= vector_length, the 2nd argument defaults to False.
211  // Results in a Bool array.
212  // <note role=caution>
213  // Axes start counting at 0.
214  // If the axis is a number < 0 or >= ndim, an exception is thrown.
215  // </note>
216  LatticeExprNode indexin (const LatticeExprNode& axis,
217  const LatticeExprNode& indexFlags);
218 
219  // 2-argument function rebinning Lattice by given factors. The 2nd argument
220  // should be a vector (preferably Float - really Int but Int not well
221  // supported in LEL yet). Results in a T array.
222  LatticeExprNode rebin (const LatticeExprNode& expr,
223  const LatticeExprNode& bin);
224 
225 // Test if a value is a NaN.
226  LatticeExprNode isNaN (const LatticeExprNode& expr);
227 
228  // Functions operating on a logical expression resulting in a scalar;
229  // Functions "any" (are any pixels "True") and "all" (are all pixels
230  // "True") result in a Bool; functions "ntrue" and "nfalse" result
231  // in a Double.
232  // <group>
233  LatticeExprNode any (const LatticeExprNode& expr);
234  LatticeExprNode all (const LatticeExprNode& expr);
235  LatticeExprNode ntrue (const LatticeExprNode& expr);
236  LatticeExprNode nfalse(const LatticeExprNode& expr);
237  // </group>
238 
239  // This function returns the mask of the given expression.
240  // If it has no mask, the result is an array with all True values.
241  LatticeExprNode mask (const LatticeExprNode& expr);
242 
243  // This function returns the value of the expression without a mask.
244  LatticeExprNode value (const LatticeExprNode& expr);
245 
246  // This function finds <src>sqrt(left^2+right^2)</src>. This
247  // could be used to find the (biased) polarized intensity if
248  // left and right are images of Stokes Q and U.
249  LatticeExprNode amp (const LatticeExprNode& left,
250  const LatticeExprNode& right);
251 
252  // This function finds <src>180/pi*atan2(left,right)/2</src>. This could be
253  // used to find the position of linear polarization if left
254  // and right are images of Stokes U and Q, respectively.
255  LatticeExprNode pa (const LatticeExprNode& left,
256  const LatticeExprNode& right);
257 
258  // This function finds the spectral index
259  // <src>alpha = log(s1/s2) / log(f1/f2)</src>.
260  LatticeExprNode spectralindex (const LatticeExprNode& left,
261  const LatticeExprNode& right);
262 
263  // Function resembling the ternary <src>?:</src> construct in C++.
264  // The argument "condition" has to be a Bool scalar or lattice.
265  // If an element in "condition" is True, the corresponding element from
266  // "arg1" is taken, otherwise it is taken from "arg2".
267  LatticeExprNode iif (const LatticeExprNode& condition,
268  const LatticeExprNode& arg1,
269  const LatticeExprNode& arg2);
270 
271  // This function replaces every masked-off element in the first argument
272  // with the corresponding element from the second argument.
273  // The first argument has to be a lattice (expression), the second can
274  // be a scalar or lattice. The mask of the first argument is not changed.
275  // If the first argument does not have a mask, this function does nothing.
276  LatticeExprNode replace (const LatticeExprNode& arg1,
277  const LatticeExprNode& arg2);
278 
279  // Functions to convert to the given data type. These are mostly
280  // meaningful for down-conversions (e.g. double to float),
281  // since up-conversions are automatically done to get matching data types
282  // when needed. Note that some conversions are not supported, such
283  // as Complex to Double or Float.
284  // <br>The conversion to Bool is useful to convert a region to a
285  // boolean lattice, which is only possible if the region is given
286  // in world coordinates. Otherwise an exception is thrown.
287  // <group>
288  LatticeExprNode toFloat (const LatticeExprNode& expr);
289  LatticeExprNode toDouble (const LatticeExprNode& expr);
290  LatticeExprNode toComplex (const LatticeExprNode& expr);
291  LatticeExprNode toDComplex(const LatticeExprNode& expr);
292  LatticeExprNode toBool (const LatticeExprNode& expr);
293  LatticeExprNode convertType (const LatticeExprNode& expr, const Float*);
294  LatticeExprNode convertType (const LatticeExprNode& expr, const Double*);
295  LatticeExprNode convertType (const LatticeExprNode& expr, const Complex*);
296  LatticeExprNode convertType (const LatticeExprNode& expr, const DComplex*);
297  LatticeExprNode convertType (const LatticeExprNode& expr, const Bool*);
298  // </group>
299 // </group>
300 
301 
302 
303 // <summary>
304 // Bridging class to allow C++ expressions involving lattices
305 // </summary>
306 //
307 // <use visibility=export>
308 //
309 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
310 // </reviewed>
311 //
312 // <prerequisite>
313 // <li> <linkto class="Lattice"> Lattice</linkto>
314 // <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
315 // <li> <linkto class="LELInterface"> LELInterface</linkto>
316 // </prerequisite>
317 //
318 // <etymology>
319 // The name is derived from the fact that this class provides
320 // an expression interface to the user which s/he may use to
321 // write C++ expressions involving Lattices. This class actually
322 // constructs the nodes of the expression tree, hence its name.
323 // It is used by the envelope class LatticeExpr and provides a
324 // bridge to the letter classes derived from LELInterface.
325 // </etymology>
326 //
327 // <synopsis>
328 // This class is part of the interface which allows the C++ programmer
329 // to enter mathematical expressions involving Lattices. It is
330 // is part of a Letter/envelope scheme. It's actually a bridge
331 // between the envelope class (LatticeExpr) and the letter classes
332 // (derived from LELInterface) and it exists largely to handle
333 // type conversions. In a single type environment, the envelope
334 // class could have directly called the letter classes.
335 //
336 // The envelope and bridge provide the interface which the programmer
337 // sees. The letter classes do the real work and are hidden from
338 // the programmer.
339 //
340 // All the expression manipulation functionality that the user has
341 // access to is viewable in this class; it is here that the operators,
342 // functions and constructors are defined. These allow the programmer
343 // to write mathematical expressions which involve Lattices. The
344 // letter classes take care of the optimal traversal of the Lattice
345 // and the memory mangement thereof. Thus the Lattices are iterated
346 // through and the expressions evaluated for each chunk (usually
347 // a tile shape) of the iteration.
348 //
349 // A description of the implementation details of these classes can
350 // be found in
351 // <a href="../notes/216.html">Note 216</a>
352 //
353 // The available functionality is defined by the global friend functions
354 // and operators, plus the public constructors. The other public members
355 // functions are generally not of interest to the user of this class.
356 //
357 // Generally, if one writes an expression such as <src>a.copyData(sin(b))</src>,
358 // the expression is automatically converted first to a LatticeExprNode and
359 // then to a LatticeExpr (which is a Lattice) before evaluation occurs.
360 // However, it may occur that you wish to build an expression from
361 // subexpressions. To do this, you must explcitly create objects of
362 // class LatticeExprNode. You cannot manipulate subexpressions of type
363 // LatticeExpr<T>. See below for an example.
364 // </synopsis>
365 //
366 // <example>
367 // <srcblock>
368 // ArrayLattice<Float> f1(IPosition (2,nx,ny));
369 // ArrayLattice<Float> f2(IPosition (2,nx,ny));
370 // f2.set(2.0);
371 // f1.copyData(2*f2+f2);
372 // </srcblock>
373 // In this example, the values of the pixels in Lattice f1 are set
374 // to the values resulting from the expression "2*f2 + f2"
375 // I.e. the expression is evaluated for each pixel in the Lattices
376 //
377 // Note that :
378 //
379 // 1) the Lattice::copyData function is expecting a Lattice argument.
380 // 2) LatticeExpr inherits from Lattice and therefore a LatticeExpr
381 // object is a valid argument object type
382 // 3) The expression in the copyData call is automatically converted to
383 // a LatticeExprNode by the constructors and operators in LatticeExprNode
384 // 4) The LatticeExprNode object so created is automatically converted
385 // to a LatticeExpr by casting functions in LatticeExprNode.
386 //
387 // </example>
388 //
389 // <example>
390 // <srcblock>
391 // ArrayLattice<Float> f1(IPosition (2,nx,ny));
392 // ArrayLattice<Float> f2(IPosition (2,nx,ny));
393 // ArrayLattice<Double> d(IPosition (2,nx,ny));
394 // ArrayLattice<Complex> c(IPosition (2,nx,ny));
395 // ArrayLattice<Bool> b(IPosition (2,nx,ny));
396 //
397 // f2.set(1.0); d.set(2.0); c.set(Complex(2.0,3.0)); b.set(True);
398 // f1.copyData( (3.5*f2) + (cos(d)) - (10/min(d,f2)*(-abs(c))*ntrue(b)) - (C::pi) );
399 // </srcblock>
400 //
401 // In this rather silly example, we fill Lattice "f1" with the result of the
402 // expression. The expression shows the use of constants, unary operations,
403 // binary operations, 1D and 2D functions. It also shows how mixed types can
404 // be handled. The output Lattice is a Float, whereas mixed into the
405 // expression are subexpressions involving Float, Double, Complex and Bool
406 // Lattices.
407 //
408 // </example>
409 //
410 // <example>
411 // <srcblock>
412 // ArrayLattice<Float> f1(IPosition (2,nx,ny));
413 // ArrayLattice<Float> f2(IPosition (2,nx,ny));
414 // f2.set(2.0);
415 // LatticeExprNode exp1(sin(f2));
416 // LatticeExprNode exp2(pow(f2,2.0));
417 // f1.copyData(exp1+exp2);
418 // </srcblock>
419 // In this example, the expression is "sin(f2) + pow(f2,2.0)",
420 // but we have put it together from two subexpressions contained
421 // in LatticeExprNode objects exp1 and exp2. Again the LatticeExprNode
422 // object formed from summing exp1 and exp2 is automatically converted
423 // to a LatticeExpr for consumption by copyData
424 //
425 // </example>
426 //
427 // <motivation>
428 // The Lattice expression classes enable the C++ programmer much simpler
429 // handling of mathematical expressions involving lattices. In addition,
430 // these classes provide the infrastructure on top of which we can build
431 // an image calculator for Glish users
432 // </motivation>
433 //
434 // <todo asof="1997/01/15">
435 // <li> masks
436 // <li> regions
437 // </todo>
438 
439 
441 {
442 // All global functions need to be declared as friends.
443 // <group>
444  friend LatticeExprNode operator+ (const LatticeExprNode& expr);
445  friend LatticeExprNode operator- (const LatticeExprNode& expr);
446  friend LatticeExprNode operator! (const LatticeExprNode& expr);
447  friend LatticeExprNode operator+ (const LatticeExprNode& left,
448  const LatticeExprNode& right);
449  friend LatticeExprNode operator- (const LatticeExprNode& left,
450  const LatticeExprNode& right);
451  friend LatticeExprNode operator* (const LatticeExprNode& left,
452  const LatticeExprNode& right);
453  friend LatticeExprNode operator/ (const LatticeExprNode& left,
454  const LatticeExprNode& right);
455  friend LatticeExprNode operator% (const LatticeExprNode& left,
456  const LatticeExprNode& right);
457  friend LatticeExprNode operator^ (const LatticeExprNode& left,
458  const LatticeExprNode& right);
459  friend LatticeExprNode operator== (const LatticeExprNode& left,
460  const LatticeExprNode& right);
461  friend LatticeExprNode operator> (const LatticeExprNode& left,
462  const LatticeExprNode& right);
463  friend LatticeExprNode operator>= (const LatticeExprNode& left,
464  const LatticeExprNode& right);
465  friend LatticeExprNode operator< (const LatticeExprNode& left,
466  const LatticeExprNode& right);
467  friend LatticeExprNode operator<= (const LatticeExprNode& left,
468  const LatticeExprNode& right);
469  friend LatticeExprNode operator!= (const LatticeExprNode& left,
470  const LatticeExprNode& right);
471  friend LatticeExprNode operator&& (const LatticeExprNode& left,
472  const LatticeExprNode& right);
473  friend LatticeExprNode operator|| (const LatticeExprNode& left,
474  const LatticeExprNode& right);
475  friend LatticeExprNode sin (const LatticeExprNode& expr);
476  friend LatticeExprNode sinh (const LatticeExprNode& expr);
477  friend LatticeExprNode asin (const LatticeExprNode& expr);
478  friend LatticeExprNode cos (const LatticeExprNode& expr);
479  friend LatticeExprNode cosh (const LatticeExprNode& expr);
480  friend LatticeExprNode acos (const LatticeExprNode& expr);
481  friend LatticeExprNode tan (const LatticeExprNode& expr);
482  friend LatticeExprNode tanh (const LatticeExprNode& expr);
483  friend LatticeExprNode atan (const LatticeExprNode& expr);
484  friend LatticeExprNode exp (const LatticeExprNode& expr);
485  friend LatticeExprNode log (const LatticeExprNode& expr);
486  friend LatticeExprNode log10(const LatticeExprNode& expr);
487  friend LatticeExprNode sqrt (const LatticeExprNode& expr);
488  friend LatticeExprNode sign (const LatticeExprNode& expr);
489  friend LatticeExprNode round(const LatticeExprNode& expr);
490  friend LatticeExprNode ceil (const LatticeExprNode& expr);
491  friend LatticeExprNode floor(const LatticeExprNode& expr);
492  friend LatticeExprNode conj (const LatticeExprNode& expr);
493  friend LatticeExprNode atan2 (const LatticeExprNode& left,
494  const LatticeExprNode& right);
495  friend LatticeExprNode pow (const LatticeExprNode& left,
496  const LatticeExprNode& right);
497  friend LatticeExprNode fmod (const LatticeExprNode& left,
498  const LatticeExprNode& right);
499  friend LatticeExprNode min (const LatticeExprNode& left,
500  const LatticeExprNode& right);
501  friend LatticeExprNode max (const LatticeExprNode& left,
502  const LatticeExprNode& right);
503  friend LatticeExprNode formComplex (const LatticeExprNode& left,
504  const LatticeExprNode& right);
505  friend LatticeExprNode abs (const LatticeExprNode& expr);
506  friend LatticeExprNode arg (const LatticeExprNode& expr);
507  friend LatticeExprNode real (const LatticeExprNode& expr);
508  friend LatticeExprNode imag (const LatticeExprNode& expr);
509  friend LatticeExprNode min (const LatticeExprNode& expr);
510  friend LatticeExprNode max (const LatticeExprNode& expr);
511  friend LatticeExprNode sum (const LatticeExprNode& expr);
512  friend LatticeExprNode median (const LatticeExprNode& expr);
513  friend LatticeExprNode mean (const LatticeExprNode& expr);
514  friend LatticeExprNode variance (const LatticeExprNode& expr);
515  friend LatticeExprNode stddev (const LatticeExprNode& expr);
516  friend LatticeExprNode avdev (const LatticeExprNode& expr);
517  friend LatticeExprNode fractile (const LatticeExprNode& expr,
518  const LatticeExprNode& fraction);
519  friend LatticeExprNode fractileRange (const LatticeExprNode& expr,
520  const LatticeExprNode& fraction1,
521  const LatticeExprNode& fraction2);
522  friend LatticeExprNode fractileRange (const LatticeExprNode& expr,
523  const LatticeExprNode& fraction);
524  friend LatticeExprNode nelements (const LatticeExprNode& expr);
525  friend LatticeExprNode ndim (const LatticeExprNode& expr);
526  friend LatticeExprNode length (const LatticeExprNode& expr,
527  const LatticeExprNode& axis);
528  friend LatticeExprNode indexin (const LatticeExprNode& axis,
529  const LatticeExprNode& indexFlags);
530  friend LatticeExprNode rebin (const LatticeExprNode& expr,
531  const LatticeExprNode& bin);
532  friend LatticeExprNode isNaN (const LatticeExprNode& expr);
533  friend LatticeExprNode any (const LatticeExprNode& expr);
534  friend LatticeExprNode all (const LatticeExprNode& expr);
535  friend LatticeExprNode ntrue (const LatticeExprNode& expr);
536  friend LatticeExprNode nfalse(const LatticeExprNode& expr);
537  friend LatticeExprNode mask (const LatticeExprNode& expr);
538  friend LatticeExprNode value (const LatticeExprNode& expr);
539  friend LatticeExprNode amp (const LatticeExprNode& left,
540  const LatticeExprNode& right);
541  friend LatticeExprNode pa (const LatticeExprNode& left,
542  const LatticeExprNode& right);
543  friend LatticeExprNode spectralindex (const LatticeExprNode& left,
544  const LatticeExprNode& right);
545  friend LatticeExprNode iif (const LatticeExprNode& condition,
546  const LatticeExprNode& arg1,
547  const LatticeExprNode& arg2);
548  friend LatticeExprNode replace (const LatticeExprNode& arg1,
549  const LatticeExprNode& arg2);
550  friend LatticeExprNode toFloat (const LatticeExprNode& expr);
551  friend LatticeExprNode toDouble (const LatticeExprNode& expr);
552  friend LatticeExprNode toComplex (const LatticeExprNode& expr);
553  friend LatticeExprNode toDComplex(const LatticeExprNode& expr);
554  friend LatticeExprNode toBool (const LatticeExprNode& expr);
555 // </group>
556 
557 public:
558 
559 // Default constructor
560  LatticeExprNode();
561 
562 // Unary constant expression constructors.
563 // <group>
564  LatticeExprNode (Int64 constant);
565  LatticeExprNode (Int constant);
566  LatticeExprNode (uInt constant);
567  LatticeExprNode (Long constant);
568  LatticeExprNode (Float constant);
569  LatticeExprNode (Double constant);
570  LatticeExprNode (const Complex& constant);
571  LatticeExprNode (const DComplex& constant);
572  LatticeExprNode (Bool constant);
573 // </group>
574 
575 // Constructor from an IPosition (containing indices or axes).
576  LatticeExprNode (const IPosition&);
577 
578 // Lattice expression (gets Lattice pixels) constructors.
579 // <group>
580  LatticeExprNode (const Lattice<Float>& lattice);
581  LatticeExprNode (const Lattice<Double>& lattice);
582  LatticeExprNode (const Lattice<Complex>& lattice);
583  LatticeExprNode (const Lattice<DComplex>& lattice);
584  LatticeExprNode (const Lattice<Bool>& lattice);
585  LatticeExprNode (const MaskedLattice<Float>& lattice);
586  LatticeExprNode (const MaskedLattice<Double>& lattice);
587  LatticeExprNode (const MaskedLattice<Complex>& lattice);
588  LatticeExprNode (const MaskedLattice<DComplex>& lattice);
589  LatticeExprNode (const MaskedLattice<Bool>& lattice);
590 // </group>
591 
592 // Create a lattice expression from a region.
593 // It results in a boolean expression node.
594 // <group>
595  LatticeExprNode (const LCRegion& region);
596  LatticeExprNode (const Slicer& slicer);
597  LatticeExprNode (const LattRegionHolder& region);
598 // </group>
599 
600 // Masking operator using a condition.
601 // The given boolean expression forms a mask/region for this expression node.
602  LatticeExprNode operator[] (const LatticeExprNode& cond) const;
603 
604 // Copy constructor (reference semantics)
605  LatticeExprNode (const LatticeExprNode& other);
606 
607 // Destructor, does nothing
608  virtual ~LatticeExprNode();
609 
610 // Assignment (reference semantics)
612 
613 // Get the IPosition.
614 // It throws an exception if the node does not contain an IPosition.
615  const IPosition& getIPosition() const;
616 
617 // Convert the expression to another data type.
618 // <group>
624 // </group>
625 
626 // Evaluate the expression.
627 // One can be sure that the result is not a reference to another array.
628 // This function should be used by LatticeExpr and other users.
629 // <group>
630  void eval (LELArray<Float>& result, const Slicer& section) const;
631  void eval (LELArray<Double>& result, const Slicer& section) const;
632  void eval (LELArray<Complex>& result, const Slicer& section) const;
633  void eval (LELArray<DComplex>& result, const Slicer& section) const;
634  void eval (LELArray<Bool>& result, const Slicer& section) const;
635 // </group>
636 
637 // Evaluate the expression.
638 // The result can be a reference to some internal array (in particular
639 // to an array in an ArrayLattice object used as a lattice).
640 // This function is meant for internal use by the LEL classes and
641 // should not be used externally.
642 // <group>
643  void evalRef (LELArrayRef<Float>& result, const Slicer& section) const
644  { pExprFloat_p->evalRef (result, section); }
645  void evalRef (LELArrayRef<Double>& result, const Slicer& section) const
646  { pExprDouble_p->evalRef (result, section); }
647  void evalRef (LELArrayRef<Complex>& result, const Slicer& section) const
648  { pExprComplex_p->evalRef (result, section); }
649  void evalRef (LELArrayRef<DComplex>& result, const Slicer& section) const
650  { pExprDComplex_p->evalRef (result, section); }
651  void evalRef (LELArrayRef<Bool>& result, const Slicer& section) const
652  { pExprBool_p->evalRef (result, section); }
653 // </group>
654 
655 // Evaluate the expression (in case it is a scalar). The "eval"
656 // and "get*" functions do the same thing, they just have
657 // a slightly different interface.
658 // <group>
659  void eval (Float& result) const;
660  void eval (Double& result) const;
661  void eval (Complex& result) const;
662  void eval (DComplex& result) const;
663  void eval (Bool& result) const;
664  Float getFloat() const;
665  Double getDouble() const;
666  Complex getComplex() const;
667  DComplex getDComplex() const;
668  Bool getBool() const;
669 // </group>
670 
671 // Evaluate the expression (in case it is a constant array).
672 // <group>
673  Array<Float> getArrayFloat() const;
677  Array<Bool> getArrayBool() const;
678 // </group>
679 
680 // Get the data type of the expression.
681  DataType dataType() const
682  {return dtype_p;}
683 
684 // Is the expression node a region?
685  Bool isRegion() const
686  {return pAttr_p->isRegion();}
687 
688 // Is the result of "eval" a scalar?
689  Bool isScalar() const
690  {return pAttr_p->isScalar();}
691 
692 // Is the result of "eval" masked?
693  Bool isMasked() const
694  {return pAttr_p->isMasked();}
695 
696 // Holds the node an invalid scalar?
698  {
699  if (!donePrepare_p) doPrepare();
700  return isInvalid_p;
701  }
702 
703 // Return the shape of the Lattice including all degenerate axes
704 // (ie. axes with a length of one)
705  const IPosition& shape() const
706  {return pAttr_p->shape();}
707 
708 // Get the attribute object of the expression.
709  const LELAttribute& getAttribute() const
710  {return *pAttr_p;}
711 
712 // Replace a scalar subexpression by its result.
714 
715 // Make the object from a Counted<LELInterface> pointer.
716 // Ideally this function is private, but alas it is needed in LELFunction1D,
717 // operator==, and more (too many to make them friend).
718 // <group>
724 // </group>
725 
726 // Determine the resulting data type from the given data types.
727 // An exception is thrown if they are incompatible.
728  static DataType resultDataType (DataType left, DataType right);
729 
730 // Check the arguments of a function and return the resulting attribute object.
731 // The matchAxes argument tells if the axes have to match exactly or
732 // whether it is possible that one expression is a subset of another
733 // (i.e. that axes may be missing).
734 // <br>The expectArray argument tells if the result should be an array
735 // which is the case if one of the arguments is an array.
736  static LELAttribute checkArg (const Block<LatticeExprNode>& arg,
737  const Block<Int>& argType,
738  Bool expectArray,
739  Bool matchAxes = True);
740 
741  // Handle locking of the LatticeExpr which is delegated to all of its parts.
742  // <group>
743  Bool lock (FileLocker::LockType, uInt nattempts);
744  void unlock();
746  void resync();
747  // </group>
748 
749 
750 private:
751 // Make the object from a LELInterface* pointer.
752 // <group>
758 // </group>
759 
760 // Test if both operands represent a region.
761 // An exception is thrown if only one of them is a region.
762  static Bool areRegions (const LatticeExprNode& left,
763  const LatticeExprNode& right);
764 
765 // Create a new node for a numerical unary operation.
766 // The result has the same data type as the input.
768  const LatticeExprNode& expr);
769 
770 // Create a new node for a numerical function with 1 argument.
771 // The result has the same data type as the input.
773  const LatticeExprNode& expr);
774 
775 // Create a new node for a real numerical function with 1 argument.
776 // The result has the same data type as the input.
778  const LatticeExprNode& expr);
779 
780 // Create a new node for a complex numerical function with 1 argument.
781 // The result has the same data type as the input.
783  const LatticeExprNode& expr);
784 
785 // Create a new node for a numerical function with 1 argument that
786 // returns a real number
788  const LatticeExprNode& expr);
789 
790 // Create a new node for a numerical function with 2 arguments.
791 // The result has the same data type as the combined input type.
793  const LatticeExprNode& left,
794  const LatticeExprNode& right);
795 
796 // Create a new node for a numerical binary operator.
797 // The result has the same data type as the combined input type.
799  const LatticeExprNode& left,
800  const LatticeExprNode& right);
801 
802 // Create a new node for a logical binary operator.
803 // The result has the same data type as the combined input type.
805  const LatticeExprNode& left,
806  const LatticeExprNode& right);
807 
808 // Create a new node for a comparison binary operator.
809 // The result has the same data type as the combined input type.
811  const LatticeExprNode& left,
812  const LatticeExprNode& right);
813 
814 // Make (if needed and if possible) the expression nodes such that
815 // the dimensionalities are equal. This is only possible if both
816 // nodes have a coordinate system.
817 // It is done by creating an ExtendLattice object for the node
818 // with the lower dimensionality.
819  static Int makeEqualDim (LatticeExprNode& expr0,
820  LatticeExprNode& expr1);
821 
822 // Do the preparation for the evaluation.
823  void doPrepare() const;
824 
825 
826 // Member variables.
827 
829  DataType dtype_p;
838 };
839 
840 
841 
843  const LatticeExprNode& right)
844  { return fmod (left, right); }
846  const LatticeExprNode& right)
847  { return pow (left, right); }
848 
850  { return toFloat (expr); }
852  { return toDouble (expr); }
854  { return toComplex (expr); }
856  { return toDComplex (expr); }
857 inline LatticeExprNode convertType(const LatticeExprNode& expr, const Bool*)
858  { return toBool (expr); }
859 
860 } //# NAMESPACE CASACORE - END
861 
862 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
LatticeExprNode log10(const LatticeExprNode &expr)
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
friend LatticeExprNode tan(const LatticeExprNode &expr)
friend LatticeExprNode operator^(const LatticeExprNode &left, const LatticeExprNode &right)
int Int
Definition: aipstype.h:50
LatticeExprNode log(const LatticeExprNode &expr)
const LELAttribute & getAttribute() const
Get the attribute object of the expression.
static LatticeExprNode newLogBinary(LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right)
Create a new node for a logical binary operator.
friend LatticeExprNode all(const LatticeExprNode &expr)
This LEL class holds an array with a mask.
Definition: LatticeExpr.h:43
LatticeExprNode arg(const LatticeExprNode &expr)
friend LatticeExprNode ntrue(const LatticeExprNode &expr)
friend LatticeExprNode sqrt(const LatticeExprNode &expr)
friend LatticeExprNode real(const LatticeExprNode &expr)
LatticeExprNode median(const LatticeExprNode &expr)
LatticeExprNode toComplex(const LatticeExprNode &expr)
static LatticeExprNode newNumUnary(LELUnaryEnums::Operation oper, const LatticeExprNode &expr)
Create a new node for a numerical unary operation.
friend LatticeExprNode spectralindex(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds the spectral index alpha = log(s1/s2) / log(f1/f2).
friend LatticeExprNode median(const LatticeExprNode &expr)
friend LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
friend LatticeExprNode exp(const LatticeExprNode &expr)
friend LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode imag(const LatticeExprNode &expr)
LatticeExprNode toBool(const LatticeExprNode &expr)
friend LatticeExprNode sign(const LatticeExprNode &expr)
friend LatticeExprNode operator*(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode floor(const LatticeExprNode &expr)
Bool lock(FileLocker::LockType, uInt nattempts)
Handle locking of the LatticeExpr which is delegated to all of its parts.
LatticeExprNode sum(const LatticeExprNode &expr)
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode round(const LatticeExprNode &expr)
friend LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode operator%(const LatticeExprNode &left, const LatticeExprNode &right)
Bool isScalar() const
Is the result of &quot;eval&quot; a scalar?
friend LatticeExprNode sinh(const LatticeExprNode &expr)
Bool isScalar() const
Is expression a scalar?
Definition: LELAttribute.h:117
friend LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type...
friend LatticeExprNode atan(const LatticeExprNode &expr)
CountedPtr< LELInterface< Double > > makeDouble() const
void doPrepare() const
Do the preparation for the evaluation.
LatticeExprNode ntrue(const LatticeExprNode &expr)
friend LatticeExprNode indexin(const LatticeExprNode &axis, const LatticeExprNode &indexFlags)
2-argument function telling per pixel if its index on the given axis is contained in the 2nd argument...
friend LatticeExprNode operator==(const LatticeExprNode &left, const LatticeExprNode &right)
Relational binary operators.
DataType dataType() const
Get the data type of the expression.
A templated, abstract base class for array-like objects with masks.
Definition: ImageConcat.h:46
Bool isMasked() const
Is the expression result masked?
Definition: LELAttribute.h:126
LatticeExprNode fractile(const LatticeExprNode &expr, const LatticeExprNode &fraction)
Determine the value of the element at the part fraction from the beginning of the given lattice...
static LatticeExprNode newNumReal1D(LELFunctionEnums::Function func, const LatticeExprNode &expr)
Create a new node for a numerical function with 1 argument that returns a real number.
Array< Float > getArrayFloat() const
Evaluate the expression (in case it is a constant array).
LatticeExprNode exp(const LatticeExprNode &expr)
Array< Complex > getArrayComplex() const
friend LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode & operator=(const LatticeExprNode &other)
Assignment (reference semantics)
static LatticeExprNode newComplexFunc1D(LELFunctionEnums::Function func, const LatticeExprNode &expr)
Create a new node for a complex numerical function with 1 argument.
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:129
LatticeExprNode toFloat(const LatticeExprNode &expr)
Functions to convert to the given data type.
friend LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
This LEL class holds a possible referenced array with a mask.
Definition: LELArray.h:132
friend LatticeExprNode operator%(const LatticeExprNode &left, const LatticeExprNode &right)
Bool replaceScalarExpr()
Replace a scalar subexpression by its result.
virtual ~LatticeExprNode()
Destructor, does nothing.
LatticeExprNode fractileRange(const LatticeExprNode &expr, const LatticeExprNode &fraction1, const LatticeExprNode &fraction2)
Determine the value range of the elements at the part fraction1 and fraction2 from the beginning of t...
LatticeExprNode any(const LatticeExprNode &expr)
Functions operating on a logical expression resulting in a scalar; Functions &quot;any&quot; (are any pixels &quot;T...
LatticeExprNode floor(const LatticeExprNode &expr)
LatticeExprNode cos(const LatticeExprNode &expr)
static LatticeExprNode newNumBinary(LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right)
Create a new node for a numerical binary operator.
static LatticeExprNode newNumFunc1D(LELFunctionEnums::Function func, const LatticeExprNode &expr)
Create a new node for a numerical function with 1 argument.
friend LatticeExprNode fractile(const LatticeExprNode &expr, const LatticeExprNode &fraction)
Determine the value of the element at the part fraction from the beginning of the given lattice...
CountedPtr< LELInterface< Float > > makeFloat() const
Convert the expression to another data type.
friend LatticeExprNode log(const LatticeExprNode &expr)
DComplex getDComplex() const
static DataType resultDataType(DataType left, DataType right)
Determine the resulting data type from the given data types.
friend LatticeExprNode imag(const LatticeExprNode &expr)
LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode formComplex(const LatticeExprNode &left, const LatticeExprNode &right)
Form a complex number from two real numbers.
LatticeExprNode conj(const LatticeExprNode &expr)
friend LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode asin(const LatticeExprNode &expr)
friend LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
friend LatticeExprNode toFloat(const LatticeExprNode &expr)
Functions to convert to the given data type.
long Long
Definition: aipstype.h:52
void evalRef(LELArrayRef< Double > &result, const Slicer &section) const
LatticeExprNode nfalse(const LatticeExprNode &expr)
friend LatticeExprNode toBool(const LatticeExprNode &expr)
friend LatticeExprNode operator!=(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode operator!(const LatticeExprNode &expr)
friend LatticeExprNode log10(const LatticeExprNode &expr)
friend LatticeExprNode toComplex(const LatticeExprNode &expr)
friend LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.
void eval(LELArray< Float > &result, const Slicer &section) const
Evaluate the expression.
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
friend LatticeExprNode operator+(const LatticeExprNode &expr)
All global functions need to be declared as friends.
LatticeExprNode tanh(const LatticeExprNode &expr)
LatticeExprNode spectralindex(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds the spectral index alpha = log(s1/s2) / log(f1/f2).
Referenced counted pointer for constant data.
Definition: CountedPtr.h:80
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode avdev(const LatticeExprNode &expr)
Double getDouble() const
static LatticeExprNode newNumFunc2D(LELFunctionEnums::Function func, const LatticeExprNode &left, const LatticeExprNode &right)
Create a new node for a numerical function with 2 arguments.
friend LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
const LELAttribute * pAttr_p
void evalRef(LELArrayRef< Bool > &result, const Slicer &section) const
friend LatticeExprNode cosh(const LatticeExprNode &expr)
LatticeExprNode replace(const LatticeExprNode &arg1, const LatticeExprNode &arg2)
This function replaces every masked-off element in the first argument with the corresponding element ...
friend LatticeExprNode conj(const LatticeExprNode &expr)
friend LatticeExprNode fractileRange(const LatticeExprNode &expr, const LatticeExprNode &fraction1, const LatticeExprNode &fraction2)
Determine the value range of the elements at the part fraction1 and fraction2 from the beginning of t...
Bool isRegion() const
Is the expression node a region?
LatticeExprNode operator[](const LatticeExprNode &cond) const
Masking operator using a condition.
double Double
Definition: aipstype.h:55
friend LatticeExprNode atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type...
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
friend LatticeExprNode variance(const LatticeExprNode &expr)
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
LatticeExprNode operator<=(const LatticeExprNode &left, const LatticeExprNode &right)
void evalRef(LELArrayRef< Complex > &result, const Slicer &section) const
Array< Double > getArrayDouble() const
LatticeExprNode toDouble(const LatticeExprNode &expr)
static LELAttribute checkArg(const Block< LatticeExprNode > &arg, const Block< Int > &argType, Bool expectArray, Bool matchAxes=True)
Check the arguments of a function and return the resulting attribute object.
LatticeExprNode amp(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds sqrt(left^2+right^2).
friend LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode()
Default constructor.
LatticeExprNode formComplex(const LatticeExprNode &left, const LatticeExprNode &right)
Form a complex number from two real numbers.
LatticeExprNode iif(const LatticeExprNode &condition, const LatticeExprNode &arg1, const LatticeExprNode &arg2)
Function resembling the ternary ?: construct in C++.
LatticeExprNode nelements(const LatticeExprNode &expr)
1-argument function to get the number of elements in a lattice.
friend LatticeExprNode toDouble(const LatticeExprNode &expr)
LatticeExprNode sign(const LatticeExprNode &expr)
LatticeExprNode sqrt(const LatticeExprNode &expr)
LatticeExprNode tan(const LatticeExprNode &expr)
friend LatticeExprNode ceil(const LatticeExprNode &expr)
LatticeExprNode atan(const LatticeExprNode &expr)
Class to hold a region of interest in an image.
friend LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const IPosition & getIPosition() const
Get the IPosition.
static Bool areRegions(const LatticeExprNode &left, const LatticeExprNode &right)
Test if both operands represent a region.
LatticeExprNode convertType(const LatticeExprNode &expr, const Float *)
const IPosition & shape() const
Return the shape of the Lattice including all degenerate axes (ie.
LatticeExprNode stddev(const LatticeExprNode &expr)
friend LatticeExprNode nfalse(const LatticeExprNode &expr)
LatticeExprNode round(const LatticeExprNode &expr)
float Float
Definition: aipstype.h:54
friend LatticeExprNode cos(const LatticeExprNode &expr)
CountedPtr< LELInterface< Complex > > makeComplex() const
CountedPtr< LELInterface< Double > > pExprDouble_p
CountedPtr< LELInterface< Bool > > pExprBool_p
Bool donePrepare_p
Member variables.
friend LatticeExprNode tanh(const LatticeExprNode &expr)
friend LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
Bool isMasked() const
Is the result of &quot;eval&quot; masked?
Ancillary information for the LEL letter classes.
Definition: LELAttribute.h:81
friend LatticeExprNode operator!(const LatticeExprNode &expr)
CountedPtr< LELInterface< DComplex > > pExprDComplex_p
LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:288
simple 1-D array
Definition: Allocator.h:210
LatticeExprNode toDComplex(const LatticeExprNode &expr)
friend LatticeExprNode replace(const LatticeExprNode &arg1, const LatticeExprNode &arg2)
This function replaces every masked-off element in the first argument with the corresponding element ...
Complex getComplex() const
friend LatticeExprNode operator-(const LatticeExprNode &expr)
CountedPtr< LELInterface< Bool > > makeBool() const
friend LatticeExprNode sum(const LatticeExprNode &expr)
Bool isInvalidScalar() const
Holds the node an invalid scalar?
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.
static LatticeExprNode newRealFunc1D(LELFunctionEnums::Function func, const LatticeExprNode &expr)
Create a new node for a real numerical function with 1 argument.
friend LatticeExprNode stddev(const LatticeExprNode &expr)
friend LatticeExprNode mean(const LatticeExprNode &expr)
LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
Bridging class to allow C++ expressions involving lattices.
friend LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
LatticeExprNode asin(const LatticeExprNode &expr)
friend LatticeExprNode arg(const LatticeExprNode &expr)
LatticeExprNode mean(const LatticeExprNode &expr)
CountedPtr< LELInterface< Complex > > pExprComplex_p
const IPosition & shape() const
What is the shape of the expression?
Definition: LELAttribute.h:129
void evalRef(LELArrayRef< DComplex > &result, const Slicer &section) const
LatticeExprNode sinh(const LatticeExprNode &expr)
friend LatticeExprNode avdev(const LatticeExprNode &expr)
LatticeExprNode acos(const LatticeExprNode &expr)
friend LatticeExprNode iif(const LatticeExprNode &condition, const LatticeExprNode &arg1, const LatticeExprNode &arg2)
Function resembling the ternary ?: construct in C++.
Array< DComplex > getArrayDComplex() const
static Int makeEqualDim(LatticeExprNode &expr0, LatticeExprNode &expr1)
Make (if needed and if possible) the expression nodes such that the dimensionalities are equal...
LatticeExprNode operator-(const LatticeExprNode &expr)
Bool isRegion() const
Is expression a region?
Definition: LELAttribute.h:123
friend LatticeExprNode nelements(const LatticeExprNode &expr)
1-argument function to get the number of elements in a lattice.
friend LatticeExprNode toDComplex(const LatticeExprNode &expr)
LatticeExprNode operator^(const LatticeExprNode &left, const LatticeExprNode &right)
Array< Bool > getArrayBool() const
LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
CountedPtr< LELInterface< DComplex > > makeDComplex() const
static LatticeExprNode newBinaryCmp(LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right)
Create a new node for a comparison binary operator.
friend LatticeExprNode operator<=(const LatticeExprNode &left, const LatticeExprNode &right)
Bool hasLock(FileLocker::LockType) const
LatticeExprNode variance(const LatticeExprNode &expr)
void evalRef(LELArrayRef< Float > &result, const Slicer &section) const
Evaluate the expression.
LockType
Define the possible lock types.
Definition: FileLocker.h:95
LatticeExprNode ceil(const LatticeExprNode &expr)
LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode indexin(const LatticeExprNode &axis, const LatticeExprNode &indexFlags)
2-argument function telling per pixel if its index on the given axis is contained in the 2nd argument...
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:135
LatticeExprNode all(const LatticeExprNode &expr)
CountedPtr< LELInterface< Float > > pExprFloat_p
friend LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode operator||(const LatticeExprNode &left, const LatticeExprNode &right)
const Bool True
Definition: aipstype.h:43
friend LatticeExprNode any(const LatticeExprNode &expr)
Functions operating on a logical expression resulting in a scalar; Functions &quot;any&quot; (are any pixels &quot;T...
LatticeExprNode operator||(const LatticeExprNode &left, const LatticeExprNode &right)
MVBaseline operator*(const RotMatrix &left, const MVBaseline &right)
Rotate a Baseline vector with rotation matrix and other multiplications.
LatticeExprNode cosh(const LatticeExprNode &expr)
friend LatticeExprNode amp(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds sqrt(left^2+right^2).
LatticeExprNode real(const LatticeExprNode &expr)
friend LatticeExprNode rebin(const LatticeExprNode &expr, const LatticeExprNode &bin)
2-argument function rebinning Lattice by given factors.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.
LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
unsigned int uInt
Definition: aipstype.h:51
friend LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87
friend LatticeExprNode acos(const LatticeExprNode &expr)
LatticeExprNode rebin(const LatticeExprNode &expr, const LatticeExprNode &bin)
2-argument function rebinning Lattice by given factors.