casacore
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>
34 #include <casacore/lattices/LEL/LELInterface.h>
35 #include <casacore/lattices/LEL/LELAttribute.h>
36 #include <casacore/lattices/LEL/LELBinaryEnums.h>
37 #include <casacore/lattices/LEL/LELUnaryEnums.h>
38 #include <casacore/lattices/LEL/LELFunctionEnums.h>
39 #include <casacore/casa/Arrays/ArrayFwd.h>
40 #include <casacore/casa/Arrays/IPosition.h>
41 #include <casacore/casa/Utilities/CountedPtr.h>
42 #include <casacore/casa/Utilities/DataType.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>
63  // </group>
64 
65  // Numerical binary operators
66  // <group>
68  const LatticeExprNode& right);
70  const LatticeExprNode& right);
72  const LatticeExprNode& right);
74  const LatticeExprNode& right);
76  const LatticeExprNode& right);
78  const LatticeExprNode& right);
79  // </group>
80 
81  // Relational binary operators
82  // <group>
84  const LatticeExprNode& right);
86  const LatticeExprNode& right);
88  const LatticeExprNode& right);
90  const LatticeExprNode& right);
92  const LatticeExprNode& right);
94  const LatticeExprNode& right);
95  // </group>
96 
97  // Logical binary operators
98  // <group>
100  const LatticeExprNode& right);
102  const LatticeExprNode& right);
103  // </group>
104 
105  // Numerical 1-argument functions
106  // <group>
125  // </group>
126 
127  // Numerical 2-argument functions
128  // <group>
130  const LatticeExprNode& right);
132  const LatticeExprNode& right);
134  const LatticeExprNode& right);
136  const LatticeExprNode& right);
138  const LatticeExprNode& right);
139  // </group>
140 
141  // Form a complex number from two real numbers.
143  const LatticeExprNode& right);
144 
145  // Numerical 1-argument functions which result in a real number
146  // regardless of input expression type
147  // <group>
152  // </group>
153 
154  // 1-argument functions operating on a numeric expression resulting
155  // in a scalar
156  // <group>
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.
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>
180  const LatticeExprNode& fraction1,
181  const LatticeExprNode& fraction2);
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.
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.
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>
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>
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.
223  const LatticeExprNode& bin);
224 
225 // Test if a value is a NaN.
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>
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.
242 
243  // This function returns the value of the expression without a mask.
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.
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.
256  const LatticeExprNode& right);
257 
258  // This function finds the spectral index
259  // <src>alpha = log(s1/s2) / log(f1/f2)</src>.
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".
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.
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>
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>
448  const LatticeExprNode& right);
450  const LatticeExprNode& right);
452  const LatticeExprNode& right);
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);
460  const LatticeExprNode& right);
462  const LatticeExprNode& right);
464  const LatticeExprNode& right);
466  const LatticeExprNode& right);
468  const LatticeExprNode& right);
470  const LatticeExprNode& right);
472  const LatticeExprNode& right);
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);
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);
515  friend LatticeExprNode stddev (const LatticeExprNode& expr);
516  friend LatticeExprNode avdev (const LatticeExprNode& expr);
518  const LatticeExprNode& fraction);
520  const LatticeExprNode& fraction1,
521  const LatticeExprNode& fraction2);
523  const LatticeExprNode& fraction);
525  friend LatticeExprNode ndim (const LatticeExprNode& expr);
527  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);
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);
544  const LatticeExprNode& right);
545  friend LatticeExprNode iif (const LatticeExprNode& condition,
546  const LatticeExprNode& arg1,
547  const LatticeExprNode& arg2);
549  const LatticeExprNode& arg2);
554  friend LatticeExprNode toBool (const LatticeExprNode& expr);
555 // </group>
556 
557 public:
558 
559 // Default constructor
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);
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).
577 
578 // Lattice expression (gets Lattice pixels) constructors.
579 // <group>
580  LatticeExprNode (const Lattice<Float>& lattice);
584  LatticeExprNode (const Lattice<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);
598 // </group>
599 
600 // Masking operator using a condition.
601 // The given boolean expression forms a mask/region for this expression node.
603 
604 // Copy constructor (reference semantics)
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;
668  Bool getBool() const;
669 // </group>
670 
671 // Evaluate the expression (in case it is a constant array).
672 // <group>
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.
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>
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.
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
simple 1-D array
Definition: Block.h:200
Referenced counted pointer for constant data.
Definition: CountedPtr.h:81
LockType
Define the possible lock types.
Definition: FileLocker.h:95
This LEL class holds a possible referenced array with a mask.
Definition: LELArray.h:133
Bool isRegion() const
Is expression a region?
Definition: LELAttribute.h:123
Bool isScalar() const
Is expression a scalar?
Definition: LELAttribute.h:117
Bool isMasked() const
Is the expression result masked?
Definition: LELAttribute.h:126
const IPosition & shape() const
What is the shape of the expression?
Definition: LELAttribute.h:129
friend LatticeExprNode avdev(const LatticeExprNode &expr)
friend LatticeExprNode tan(const LatticeExprNode &expr)
const IPosition & shape() const
Return the shape of the Lattice including all degenerate axes (ie.
friend LatticeExprNode round(const LatticeExprNode &expr)
LatticeExprNode(LELInterface< Double > *expr)
void evalRef(LELArrayRef< Double > &result, const Slicer &section) const
const LELAttribute & getAttribute() const
Get the attribute object of the expression.
CountedPtr< LELInterface< Complex > > makeComplex() const
void evalRef(LELArrayRef< Float > &result, const Slicer &section) const
Evaluate the expression.
void eval(LELArray< Complex > &result, const Slicer &section) const
void evalRef(LELArrayRef< DComplex > &result, const Slicer &section) const
friend 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.
void eval(Bool &result) const
LatticeExprNode operator[](const LatticeExprNode &cond) const
Masking operator using a condition.
friend LatticeExprNode max(const LatticeExprNode &expr)
CountedPtr< LELInterface< Complex > > pExprComplex_p
LatticeExprNode(const DComplex &constant)
friend LatticeExprNode asin(const LatticeExprNode &expr)
friend LatticeExprNode toComplex(const LatticeExprNode &expr)
friend LatticeExprNode log10(const LatticeExprNode &expr)
static LatticeExprNode newBinaryCmp(LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right)
Create a new node for a comparison binary operator.
void evalRef(LELArrayRef< Complex > &result, const Slicer &section) const
LatticeExprNode(const Lattice< Float > &lattice)
Lattice expression (gets Lattice pixels) constructors.
friend LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
void eval(Double &result) const
Double getDouble() const
friend LatticeExprNode exp(const LatticeExprNode &expr)
friend LatticeExprNode median(const LatticeExprNode &expr)
LatticeExprNode(const LCRegion &region)
Create a lattice expression from a region.
friend LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
DComplex getDComplex() const
friend LatticeExprNode ceil(const LatticeExprNode &expr)
friend LatticeExprNode operator-(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...
LatticeExprNode(const MaskedLattice< Bool > &lattice)
friend LatticeExprNode tanh(const LatticeExprNode &expr)
friend LatticeExprNode operator+(const LatticeExprNode &expr)
All global functions need to be declared as friends.
void doPrepare() const
Do the preparation for the evaluation.
Array< Float > getArrayFloat() const
Evaluate the expression (in case it is a constant array).
LatticeExprNode(const CountedPtr< LELInterface< Complex > > &expr)
friend LatticeExprNode rebin(const LatticeExprNode &expr, const LatticeExprNode &bin)
2-argument function rebinning Lattice by given factors.
const IPosition & getIPosition() const
Get the IPosition.
LatticeExprNode(const CountedPtr< LELInterface< Double > > &expr)
LatticeExprNode & operator=(const LatticeExprNode &other)
Assignment (reference semantics)
void eval(LELArray< Float > &result, const Slicer &section) const
Evaluate the expression.
friend LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode real(const LatticeExprNode &expr)
friend LatticeExprNode floor(const LatticeExprNode &expr)
Bool replaceScalarExpr()
Replace a scalar subexpression by its result.
friend LatticeExprNode arg(const LatticeExprNode &expr)
CountedPtr< LELInterface< Float > > pExprFloat_p
static LatticeExprNode newRealFunc1D(LELFunctionEnums::Function func, const LatticeExprNode &expr)
Create a new node for a real numerical function with 1 argument.
friend LatticeExprNode operator^(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
friend LatticeExprNode toDouble(const LatticeExprNode &expr)
static LatticeExprNode newLogBinary(LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right)
Create a new node for a logical binary operator.
Array< Bool > getArrayBool() const
void eval(Complex &result) const
void eval(LELArray< Double > &result, const Slicer &section) const
CountedPtr< LELInterface< Bool > > pExprBool_p
friend LatticeExprNode sign(const LatticeExprNode &expr)
LatticeExprNode(const Lattice< Bool > &lattice)
friend LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode(const CountedPtr< LELInterface< Float > > &expr)
Make the object from a Counted<LELInterface> pointer.
static LatticeExprNode newNumFunc1D(LELFunctionEnums::Function func, const LatticeExprNode &expr)
Create a new node for a numerical function with 1 argument.
Bool hasLock(FileLocker::LockType) const
LatticeExprNode(const LattRegionHolder &region)
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.
friend LatticeExprNode atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
LatticeExprNode(LELInterface< Bool > *expr)
Array< DComplex > getArrayDComplex() const
friend LatticeExprNode nfalse(const LatticeExprNode &expr)
friend LatticeExprNode stddev(const LatticeExprNode &expr)
const LELAttribute * pAttr_p
friend LatticeExprNode amp(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds sqrt(left^2+right^2).
friend LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode(Long constant)
friend LatticeExprNode operator!=(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode(uInt constant)
friend LatticeExprNode conj(const LatticeExprNode &expr)
LatticeExprNode(const Complex &constant)
friend LatticeExprNode ntrue(const LatticeExprNode &expr)
friend LatticeExprNode fractileRange(const LatticeExprNode &expr, const LatticeExprNode &fraction)
LatticeExprNode(const Lattice< Complex > &lattice)
static LatticeExprNode newNumFunc2D(LELFunctionEnums::Function func, const LatticeExprNode &left, const LatticeExprNode &right)
Create a new node for a numerical function with 2 arguments.
LatticeExprNode(const Slicer &slicer)
friend LatticeExprNode atan(const LatticeExprNode &expr)
CountedPtr< LELInterface< Float > > makeFloat() const
Convert the expression to another data type.
LatticeExprNode(const Lattice< Double > &lattice)
Bool isScalar() const
Is the result of "eval" a scalar?
Array< Complex > getArrayComplex() const
LatticeExprNode(const MaskedLattice< Double > &lattice)
LatticeExprNode(LELInterface< Complex > *expr)
friend LatticeExprNode toBool(const LatticeExprNode &expr)
friend LatticeExprNode operator<=(const LatticeExprNode &left, const LatticeExprNode &right)
void evalRef(LELArrayRef< Bool > &result, const Slicer &section) const
friend LatticeExprNode min(const LatticeExprNode &expr)
1-argument functions operating on a numeric expression resulting in a scalar
friend LatticeExprNode all(const LatticeExprNode &expr)
friend LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
Array< Double > getArrayDouble() const
friend LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type.
LatticeExprNode(const MaskedLattice< Complex > &lattice)
friend LatticeExprNode replace(const LatticeExprNode &arg1, const LatticeExprNode &arg2)
This function replaces every masked-off element in the first argument with the corresponding element ...
LatticeExprNode(const MaskedLattice< Float > &lattice)
Bool isRegion() const
Is the expression node a region?
Bool isMasked() const
Is the result of "eval" masked?
void eval(LELArray< Bool > &result, const Slicer &section) const
friend LatticeExprNode log(const LatticeExprNode &expr)
friend LatticeExprNode variance(const LatticeExprNode &expr)
static Int makeEqualDim(LatticeExprNode &expr0, LatticeExprNode &expr1)
Make (if needed and if possible) the expression nodes such that the dimensionalities are equal.
void eval(LELArray< DComplex > &result, const Slicer &section) const
LatticeExprNode()
Default constructor.
LatticeExprNode(Bool constant)
friend LatticeExprNode cosh(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.
friend LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.
friend LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
CountedPtr< LELInterface< DComplex > > makeDComplex() const
friend LatticeExprNode operator*(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode(Int constant)
CountedPtr< LELInterface< Double > > pExprDouble_p
friend LatticeExprNode toFloat(const LatticeExprNode &expr)
Functions to convert to the given data type.
friend LatticeExprNode any(const LatticeExprNode &expr)
Functions operating on a logical expression resulting in a scalar; Functions "any" (are any pixels "T...
friend LatticeExprNode operator||(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode(Float constant)
Bool isInvalidScalar() const
Holds the node an invalid scalar?
friend LatticeExprNode cos(const LatticeExprNode &expr)
static Bool areRegions(const LatticeExprNode &left, const LatticeExprNode &right)
Test if both operands represent a region.
LatticeExprNode(const LatticeExprNode &other)
Copy constructor (reference semantics)
void eval(DComplex &result) const
LatticeExprNode(Int64 constant)
Unary constant expression constructors.
virtual ~LatticeExprNode()
Destructor, does nothing.
friend LatticeExprNode sinh(const LatticeExprNode &expr)
friend LatticeExprNode sum(const LatticeExprNode &expr)
friend LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
friend LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
static LatticeExprNode newNumUnary(LELUnaryEnums::Operation oper, const LatticeExprNode &expr)
Create a new node for a numerical unary operation.
CountedPtr< LELInterface< DComplex > > pExprDComplex_p
friend LatticeExprNode spectralindex(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds the spectral index alpha = log(s1/s2) / log(f1/f2).
LatticeExprNode(Double constant)
Bool lock(FileLocker::LockType, uInt nattempts)
Handle locking of the LatticeExpr which is delegated to all of its parts.
friend LatticeExprNode operator!(const LatticeExprNode &expr)
LatticeExprNode(LELInterface< Float > *expr)
Make the object from a LELInterface* pointer.
friend LatticeExprNode acos(const LatticeExprNode &expr)
void eval(Float &result) const
Evaluate the expression (in case it is a scalar).
friend LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
friend LatticeExprNode sqrt(const LatticeExprNode &expr)
LatticeExprNode(const CountedPtr< LELInterface< Bool > > &expr)
LatticeExprNode(const IPosition &)
Constructor from an IPosition (containing indices or axes).
friend LatticeExprNode operator%(const LatticeExprNode &left, const LatticeExprNode &right)
Bool donePrepare_p
Member variables.
LatticeExprNode(LELInterface< DComplex > *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...
CountedPtr< LELInterface< Double > > makeDouble() const
friend LatticeExprNode toDComplex(const LatticeExprNode &expr)
friend LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
LatticeExprNode(const CountedPtr< LELInterface< DComplex > > &expr)
Complex getComplex() const
CountedPtr< LELInterface< Bool > > makeBool() const
friend LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
DataType dataType() const
Get the data type of the expression.
friend LatticeExprNode mean(const LatticeExprNode &expr)
friend LatticeExprNode nelements(const LatticeExprNode &expr)
1-argument function to get the number of elements in a lattice.
LatticeExprNode(const MaskedLattice< DComplex > &lattice)
friend LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
static LatticeExprNode newNumBinary(LELBinaryEnums::Operation oper, const LatticeExprNode &left, const LatticeExprNode &right)
Create a new node for a numerical binary operator.
LatticeExprNode(const Lattice< DComplex > &lattice)
static DataType resultDataType(DataType left, DataType right)
Determine the resulting data type from the given data types.
friend LatticeExprNode imag(const LatticeExprNode &expr)
static LatticeExprNode newComplexFunc1D(LELFunctionEnums::Function func, const LatticeExprNode &expr)
Create a new node for a complex numerical function with 1 argument.
friend LatticeExprNode iif(const LatticeExprNode &condition, const LatticeExprNode &arg1, const LatticeExprNode &arg2)
Function resembling the ternary ?: construct in C++.
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.
friend LatticeExprNode operator==(const LatticeExprNode &left, const LatticeExprNode &right)
Relational binary operators.
this file contains all the compiler specific defines
Definition: mainpage.dox:28
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
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.
LatticeExprNode exp(const LatticeExprNode &expr)
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
LatticeExprNode operator&&(const LatticeExprNode &left, const LatticeExprNode &right)
Logical binary operators.
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 asin(const LatticeExprNode &expr)
LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode acos(const LatticeExprNode &expr)
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
LatticeExprNode replace(const LatticeExprNode &arg1, const LatticeExprNode &arg2)
This function replaces every masked-off element in the first argument with the corresponding element ...
LatticeExprNode mean(const LatticeExprNode &expr)
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
long Long
Definition: aipstype.h:52
LatticeExprNode cosh(const LatticeExprNode &expr)
LatticeExprNode atan(const LatticeExprNode &expr)
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...
LatticeExprNode tanh(const LatticeExprNode &expr)
LatticeExprNode sign(const LatticeExprNode &expr)
LatticeExprNode arg(const LatticeExprNode &expr)
LatticeExprNode log10(const LatticeExprNode &expr)
LatticeExprNode toFloat(const LatticeExprNode &expr)
Functions to convert to the given data type.
LatticeExprNode conj(const LatticeExprNode &expr)
LatticeExprNode formComplex(const LatticeExprNode &left, const LatticeExprNode &right)
Form a complex number from two real numbers.
LatticeExprNode operator%(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode sinh(const LatticeExprNode &expr)
LatticeExprNode sum(const LatticeExprNode &expr)
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.
MVBaseline operator*(const RotMatrix &left, const MVBaseline &right)
Rotate a Baseline vector with rotation matrix and other multiplications.
unsigned int uInt
Definition: aipstype.h:51
LatticeExprNode stddev(const LatticeExprNode &expr)
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type.
LatticeExprNode operator-(const LatticeExprNode &expr)
LatticeExprNode tan(const LatticeExprNode &expr)
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:129
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.
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 atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
LatticeExprNode variance(const LatticeExprNode &expr)
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
LatticeExprNode toDouble(const LatticeExprNode &expr)
LatticeExprNode any(const LatticeExprNode &expr)
Functions operating on a logical expression resulting in a scalar; Functions "any" (are any pixels "T...
LatticeExprNode sqrt(const LatticeExprNode &expr)
float Float
Definition: aipstype.h:54
LatticeExprNode ntrue(const LatticeExprNode &expr)
LatticeExprNode amp(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds sqrt(left^2+right^2).
LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode toBool(const LatticeExprNode &expr)
LatticeExprNode avdev(const LatticeExprNode &expr)
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
LatticeExprNode convertType(const LatticeExprNode &expr, const Float *)
LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode toComplex(const LatticeExprNode &expr)
LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode toDComplex(const LatticeExprNode &expr)
LatticeExprNode log(const LatticeExprNode &expr)
LatticeExprNode iif(const LatticeExprNode &condition, const LatticeExprNode &arg1, const LatticeExprNode &arg2)
Function resembling the ternary ?: construct in C++.
LatticeExprNode spectralindex(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds the spectral index alpha = log(s1/s2) / log(f1/f2).
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
LatticeExprNode operator^(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
LatticeExprNode cos(const LatticeExprNode &expr)
LatticeExprNode operator!(const LatticeExprNode &expr)
LatticeExprNode floor(const LatticeExprNode &expr)
const Bool True
Definition: aipstype.h:43
double Double
Definition: aipstype.h:55
LatticeExprNode median(const LatticeExprNode &expr)
LatticeExprNode all(const LatticeExprNode &expr)
LatticeExprNode nelements(const LatticeExprNode &expr)
1-argument function to get the number of elements in a lattice.
LatticeExprNode round(const LatticeExprNode &expr)
LatticeExprNode operator<=(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode ceil(const LatticeExprNode &expr)
LatticeExprNode real(const LatticeExprNode &expr)
LatticeExprNode operator||(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode nfalse(const LatticeExprNode &expr)
LatticeExprNode imag(const LatticeExprNode &expr)
LatticeExprNode rebin(const LatticeExprNode &expr, const LatticeExprNode &bin)
2-argument function rebinning Lattice by given factors.