casacore
Functors.h
Go to the documentation of this file.
1 //# Functors.h: Define STL functors for basic math functions.
2 //# Copyright (C) 2008
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef CASA_FUNCTORS_H
29 #define CASA_FUNCTORS_H
30 
31 #include <casacore/casa/aips.h>
32 #include <casacore/casa/BasicMath/Math.h>
33 #include <casacore/casa/BasicSL/Complex.h>
34 #include <casacore/casa/BasicSL/String.h>
35 #include <functional>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 
40  // Define a function to do a binary transform in place.
41  // It is functionally equivalent to std::transform where the first and result
42  // iterator are the same, but it is faster for non-trivial iterators.
43  template<typename InputIterator1, typename InputIterator2, typename BinaryOperator>
44  inline void transformInPlace (InputIterator1 first1, InputIterator1 last1,
45  InputIterator2 first2, BinaryOperator op)
46  {
47  for (; first1!=last1; ++first1, ++first2) {
48  *first1 = op(*first1, *first2);
49  }
50  }
51 
52  // Define a function to do a unary transform in place.
53  // It is functionally equivalent to std::transform where the first and result
54  // iterator are the same, but it is faster for non-trivial iterators.
55  template<typename InputIterator1, typename UnaryOperator>
56  inline void transformInPlace (InputIterator1 first1, InputIterator1 last1,
57  UnaryOperator op)
58  {
59  for (; first1!=last1; ++first1) {
60  *first1 = op(*first1);
61  }
62  }
63 
64  // Define a function (similar to std::accumulate) to do accumulation of
65  // elements for which the corresponding mask value is true.
66  // The default accumulation is addition.
67  template<typename InputIterator, typename MaskIterator, typename Accum, typename BinaryOperator>
68  inline Accum accumulateTrue (InputIterator first, InputIterator last,
69  MaskIterator mask, Accum acc,
70  BinaryOperator op = std::plus<Accum>())
71  {
72  for (; first!=last; ++first, ++mask) {
73  if (*mask) acc = op(acc, *first);
74  }
75  return acc;
76  }
77 
78  // Define a function (similar to std::accumulate) to do accumulation of
79  // elements for which the corresponding mask value is false.
80  // The default accumulation is addition.
81  template<typename InputIterator, typename MaskIterator, typename Accum, typename BinaryOperator>
82  inline Accum accumulateFalse (InputIterator first, InputIterator last,
83  MaskIterator mask, Accum acc,
84  BinaryOperator op = std::plus<Accum>())
85  {
86  for (; first!=last; ++first, ++mask) {
87  if (!*mask) acc = op(acc, *first);
88  }
89  return acc;
90  }
91 
92  // Define a function to compare all elements of two sequences.
93  // It returns true if all elements compare true.
94  // An example compare operator is <src>std::equal_to</src>.
95  // <group>
96  template<typename InputIterator1, typename InputIterator2, typename CompareOperator>
97  inline bool compareAll (InputIterator1 first1, InputIterator1 last1,
98  InputIterator2 first2, CompareOperator op)
99  {
100  for (; first1!=last1; ++first1, ++first2) {
101  if (!op(*first1, *first2)) return false;
102  }
103  return true;
104  }
105  // For use with a constant left value.
106  // This avoids use of bind1st or bind2nd which can fail for gcc-4.3.
107  // (see ArrayMath.h).
108  template<typename InputIterator1, typename T, typename CompareOperator>
109  inline bool compareAllLeft (InputIterator1 first1, InputIterator1 last1,
110  T left, CompareOperator op)
111  {
112  for (; first1!=last1; ++first1) {
113  if (!op(left, *first1)) return false;
114  }
115  return true;
116  }
117  // For use with a constant right value.
118  // This avoids use of bind1st or bind2nd which can fail for gcc-4.3.
119  // (see ArrayMath.h).
120  template<typename InputIterator1, typename T, typename CompareOperator>
121  inline bool compareAllRight (InputIterator1 first1, InputIterator1 last1,
122  T right, CompareOperator op)
123  {
124  for (; first1!=last1; ++first1) {
125  if (!op(*first1, right)) return false;
126  }
127  return true;
128  }
129  // </group>
130 
131  // Define a function to compare all elements of two sequences.
132  // It returns true if any element compares true.
133  // An example compare operator is <src>std::equal_to</src>.
134  // <group>
135  template<typename InputIterator1, typename InputIterator2, typename CompareOperator>
136  inline bool compareAny (InputIterator1 first1, InputIterator1 last1,
137  InputIterator2 first2, CompareOperator op)
138  {
139  for (; first1!=last1; ++first1, ++first2) {
140  if (op(*first1, *first2)) return true;
141  }
142  return false;
143  }
144  // For use with a constant left value.
145  // This avoids use of bind1st or bind2nd which can fail for gcc-4.3.
146  // (see ArrayMath.h).
147  template<typename InputIterator1, typename T, typename CompareOperator>
148  inline bool compareAnyLeft (InputIterator1 first1, InputIterator1 last1,
149  T left, CompareOperator op)
150  {
151  for (; first1!=last1; ++first1) {
152  if (op(left, *first1)) return true;
153  }
154  return false;
155  }
156  // For use with a constant right value.
157  // This avoids use of bind1st or bind2nd which can fail for gcc-4.3.
158  // (see ArrayMath.h).
159  template<typename InputIterator1, typename T, typename CompareOperator>
160  inline bool compareAnyRight (InputIterator1 first1, InputIterator1 last1,
161  T right, CompareOperator op)
162  {
163  for (; first1!=last1; ++first1) {
164  if (op(*first1, right)) return true;
165  }
166  return false;
167  }
168  // </group>
169 
170 
171 
172  // Functor to add variables of possibly different types.
173  // This is unlike std::plus which requires equal types.
174  template <typename L, typename R=L, typename RES=L>
175  struct Plus : public std::binary_function<L,R,RES>
176  {
177  RES operator() (const L& x, const R& y) const
178  { return RES(x)+y; }
179  };
180 
181  // Functor to subtract variables of possibly different types.
182  // This is unlike std::minus which requires equal types.
183  template <typename L, typename R=L, typename RES=L>
184  struct Minus : public std::binary_function<L,R,RES>
185  {
186  RES operator() (const L& x, const R& y) const
187  { return RES(x)-y; }
188  };
189 
190  // Functor to multiply variables of possibly different types.
191  // This is unlike std::multiplies which requires equal types.
192  template <typename L, typename R=L, typename RES=L>
193  struct Multiplies : public std::binary_function<L,R,RES>
194  {
195  RES operator() (const L& x, const R& y) const
196  { return RES(x)*y; }
197  };
198 
199  // Functor to divide variables of possibly different types.
200  // This is unlike std::divides which requires equal types.
201  template <typename L, typename R=L, typename RES=L>
202  struct Divides : public std::binary_function<L,R,RES>
203  {
204  RES operator() (const L& x, const R& y) const
205  { return RES(x)/y; }
206  };
207 
208  // Functor to take modulo of (integer) variables of possibly different types.
209  // This is unlike std::divides which requires equal types.
210  template <typename L, typename R=L, typename RES=L>
211  struct Modulo : public std::binary_function<L,R,RES>
212  {
213  RES operator() (const L& x, const R& y) const
214  { return RES(x)%y; }
215  };
216 
217  // Functor for bitwise and of (integer) values.
218  template <typename T>
219  struct BitAnd : public std::binary_function<T,T,T>
220  {
221  T operator() (const T& x, const T& y) const
222  { return x&y; }
223  };
224 
225  // Functor for bitwise or of (integer) values.
226  template <typename T>
227  struct BitOr : public std::binary_function<T,T,T>
228  {
229  T operator() (const T& x, const T& y) const
230  { return x|y; }
231  };
232 
233  // Functor for bitwise xor of (integer) values.
234  template <typename T>
235  struct BitXor : public std::binary_function<T,T,T>
236  {
237  T operator() (const T& x, const T& y) const
238  { return x^y; }
239  };
240 
241  // Functor for bitwise negate of (integer) values.
242  template <typename T>
243  struct BitNegate : public std::unary_function<T,T>
244  {
245  T operator() (const T& x) const
246  { return ~x; }
247  };
248 
249  // Functor to test for NaN.
250  // It can be used in something like:
251  // <srcblock>
252  // std::transform (array.begin(), array.end(),
253  // result.begin(), IsNaN<T>());
254  // </srcblock>
255  template<typename T>
256  struct IsNaN : public std::unary_function<T,bool>
257  {
258  bool operator() (T value) const
259  { return isNaN (value); }
260  };
261 
262  // Functor to test for infinity.
263  template<typename T>
264  struct IsInf : public std::unary_function<T,bool>
265  {
266  bool operator() (T value) const
267  { return isInf (value); }
268  };
269 
270  // Functor to test for finiteness.
271  template<typename T>
272  struct IsFinite : public std::unary_function<T,bool>
273  {
274  bool operator() (T value) const
275  { return isFinite (value); }
276  };
277 
278  // Functor to test if two values are relatively near each other.
279  // It can be used in something like:
280  // <srcblock>
281  // std::transform (left.begin(), left.cend(), right.begin(),
282  // result.cbegin(), Near<T>(tolerance));
283  // </srcblock>
284  template<typename L, typename R=L>
285  struct Near : public std::binary_function<L,R,bool>
286  {
287  explicit Near (double tolerance=1e-5)
288  : itsTolerance (tolerance)
289  {}
290  bool operator() (L left, R right) const
291  { return near (left, L(right), itsTolerance); }
292  private:
293  double itsTolerance;
294  };
295 
296  // Functor to test for if two values are absolutely near each other.
297  template<typename L, typename R=L>
298  struct NearAbs : public std::binary_function<L,R,bool>
299  {
300  explicit NearAbs (double tolerance=1e-13)
301  : itsTolerance (tolerance)
302  {}
303  bool operator() (L left, R right) const
304  { return nearAbs (left, L(right), itsTolerance); }
305  private:
306  double itsTolerance;
307  };
308 
309 
310  // Functor to apply sin.
311  template<typename T, typename RES=T>
312  struct Sin : public std::unary_function<T,RES>
313  {
314  RES operator() (T value) const
315  { return RES(sin (value)); }
316  };
317 
318  // Functor to apply sinh.
319  template<typename T, typename RES=T>
320  struct Sinh : public std::unary_function<T,RES>
321  {
322  RES operator() (T value) const
323  { return RES(sinh (value)); }
324  };
325 
326  // Functor to apply asin.
327  template<typename T, typename RES=T>
328  struct Asin : public std::unary_function<T,RES>
329  {
330  RES operator() (T value) const
331  { return RES(asin (value)); }
332  };
333 
334  // Functor to apply cos.
335  template<typename T, typename RES=T>
336  struct Cos : public std::unary_function<T,RES>
337  {
338  RES operator() (T value) const
339  { return RES(cos (value)); }
340  };
341 
342  // Functor to apply cosh.
343  template<typename T, typename RES=T>
344  struct Cosh : public std::unary_function<T,RES>
345  {
346  RES operator() (T value) const
347  { return RES(cosh (value)); }
348  };
349 
350  // Functor to apply acos.
351  template<typename T, typename RES=T>
352  struct Acos : public std::unary_function<T,RES>
353  {
354  RES operator() (T value) const
355  { return RES(acos (value)); }
356  };
357 
358  // Functor to apply tan.
359  template<typename T, typename RES=T>
360  struct Tan : public std::unary_function<T,RES>
361  {
362  RES operator() (T value) const
363  { return RES(tan (value)); }
364  };
365 
366  // Functor to apply tanh.
367  template<typename T, typename RES=T>
368  struct Tanh : public std::unary_function<T,RES>
369  {
370  RES operator() (T value) const
371  { return RES(tanh (value)); }
372  };
373 
374  // Functor to apply atan.
375  template<typename T, typename RES=T>
376  struct Atan : public std::unary_function<T,RES>
377  {
378  RES operator() (T value) const
379  { return RES(atan (value)); }
380  };
381 
382  // Functor to apply atan2.
383  template<typename L, typename R=L, typename RES=L>
384  struct Atan2 : public std::binary_function<L,R,RES>
385  {
386  RES operator() (L left, R right) const
387  { return RES(atan2 (left, L(right))); }
388  };
389 
390  // Functor to apply sqr (power of 2).
391  template<typename T, typename RES=T>
392  struct Sqr : public std::unary_function<T,RES>
393  {
394  RES operator() (T value) const
395  { return RES(value*value); }
396  };
397 
398  // Functor to apply a power of 3.
399  template<typename T, typename RES=T>
400  struct Pow3 : public std::unary_function<T,RES>
401  {
402  RES operator() (T value) const
403  { return RES(value*value*value); }
404  };
405 
406  // Functor to apply sqrt.
407  template<typename T, typename RES=T>
408  struct Sqrt : public std::unary_function<T,RES>
409  {
410  RES operator() (T value) const
411  { return RES(sqrt (value)); }
412  };
413 
414  // Functor to apply exp.
415  template<typename T, typename RES=T>
416  struct Exp : public std::unary_function<T,RES>
417  {
418  RES operator() (T value) const
419  { return RES(exp (value)); }
420  };
421 
422  // Functor to apply log.
423  template<typename T, typename RES=T>
424  struct Log : public std::unary_function<T,RES>
425  {
426  RES operator() (T value) const
427  { return RES(log (value)); }
428  };
429 
430  // Functor to apply log10.
431  template<typename T, typename RES=T>
432  struct Log10 : public std::unary_function<T,RES>
433  {
434  RES operator() (T value) const
435  { return RES(log10 (value)); }
436  };
437 
438  // Functor to apply abs.
439  template<typename T, typename RES=T>
440  struct Abs : public std::unary_function<T,RES>
441  {
442  RES operator() (T value) const
443  { return RES(abs (value)); }
444  };
445 
446  // Functor to apply floor.
447  template<typename T, typename RES=T>
448  struct Floor : public std::unary_function<T,RES>
449  {
450  RES operator() (T value) const
451  { return RES(floor (value)); }
452  };
453 
454  // Functor to apply ceil.
455  template<typename T, typename RES=T>
456  struct Ceil : public std::unary_function<T,RES>
457  {
458  RES operator() (T value) const
459  { return RES(ceil (value)); }
460  };
461 
462  // Functor to apply round (e.g. -3.7 gets -4).
463  template<typename T, typename RES=T>
464  struct Round : public std::unary_function<T,RES>
465  {
466  RES operator() (T value) const
467  { return RES(value<0 ? ceil(value-0.5) : floor(value+0.5)); }
468  };
469 
470  // Functor to apply sign (result is -1, 0, or 1).
471  template<typename T, typename RES=T>
472  struct Sign : public std::unary_function<T,RES>
473  {
474  RES operator() (T value) const
475  { return (value<0 ? -1 : (value>0 ? 1:0)); }
476  };
477 
478  // Functor to form a complex number from the left and right value.
479  template<typename L, typename R, typename RES>
480  struct MakeComplex : public std::binary_function<L,R,RES>
481  {
482  RES operator() (L l, R r) const
483  { return RES(l, r); }
484  };
485 
486  // Functor to form a complex number from the real part of the
487  // left value and the right value.
488  template<typename L, typename R, typename RES>
489  struct MakeComplexReal : public std::binary_function<L,R,RES>
490  {
491  RES operator() (L l, R r) const
492  { return RES(real(l), r); }
493  };
494 
495  // Functor to form a complex number from the left value and the
496  // imaginary part of the right value.
497  template<typename L, typename R, typename RES>
498  struct MakeComplexImag : public std::binary_function<L,R,RES>
499  {
500  RES operator() (L l, R r) const
501  { return RES(l, imag(r)); }
502  };
503 
504  // Functor to form a complex number from the real part of the
505  // left value and the imaginary part of the right value.
506  template<typename L, typename R, typename RES>
507  struct MakeComplexRealImag : public std::binary_function<L,R,RES>
508  {
509  RES operator() (L l, R r) const
510  { return RES(real(l), imag(r)); }
511  };
512 
513  // Functor to apply complex function conj.
514  template<typename T, typename RES=T>
515  struct Conj : public std::unary_function<T,RES>
516  {
517  RES operator() (T value) const
518  { return RES(conj (value)); }
519  };
520 
521  // Functor to apply complex function real.
522  template<typename T, typename RES>
523  struct Real : public std::unary_function<T,RES>
524  {
525  RES operator() (T value) const
526  { return RES(real (value)); }
527  };
528 
529  // Functor to apply complex function imag.
530  template<typename T, typename RES>
531  struct Imag : public std::unary_function<T,RES>
532  {
533  RES operator() (T value) const
534  { return RES(imag (value)); }
535  };
536 
537  // Functor to apply complex function arg.
538  template<typename T, typename RES>
539  struct CArg : public std::unary_function<T,RES>
540  {
541  RES operator() (T value) const
542  { return RES(arg (value)); }
543  };
544 
545  // Functor to apply complex function fabs.
546  template<typename T, typename RES>
547  struct CAbs : public std::unary_function<T,RES>
548  {
549  RES operator() (T value) const
550  { return RES(fabs (value)); }
551  };
552 
553  // Functor to apply pow.
554  template<typename T, typename E=T, typename RES=T>
555  struct Pow : public std::binary_function<T,E,RES>
556  {
557  RES operator() (T left, E exponent) const
558  { return RES(pow (left, exponent)); }
559  };
560 
561  // Functor to apply fmod.
562  template<typename L, typename R=L, typename RES=L>
563  struct Fmod : public std::binary_function<L,R,RES>
564  {
565  RES operator() (R left, L right) const
566  { return RES(fmod (left, L(right))); }
567  };
568 
569  // Functor to get minimum of two values.
570  template<typename L, typename R=L, typename RES=L>
571  struct Min : public std::binary_function<L,R,RES>
572  {
573  RES operator() (L left, R right) const
574  { return RES(left<right ? left : right); }
575  };
576 
577  // Functor to get maximum of two values.
578  template<typename L, typename R=L, typename RES=L>
579  struct Max : public std::binary_function<L,R,RES>
580  {
581  RES operator() (L left, R right) const
582  { return RES(left<right ? right : left); }
583  };
584 
585  // Functor to add square of right to left.
586  template<typename T, typename Accum=T>
587  struct SumSqr : public std::binary_function<Accum,T,Accum>
588  {
589  Accum operator() (Accum left, T right) const
590  { return left + Accum(right)*Accum(right); }
591  };
592 
593  // Functor to add squared diff of right and base value to left.
594  // It can be used to calculate the standard deviation.
595  template<typename T, typename Accum=T>
596  struct SumSqrDiff : public std::binary_function<Accum,T,Accum>
597  {
598  explicit SumSqrDiff(T base) : itsBase(base) {}
599  Accum operator() (Accum left, T right) const
600  { return left + (right-itsBase)*(right-itsBase); }
601  private:
602  Accum itsBase; // store as Accum, so subtraction results in Accum
603  };
604 
605  // Functor to add absolute diff of right and base value to left.
606  // It can be used to calculate the average deviation.
607  template<typename T, typename Accum=T>
608  struct SumAbsDiff : public std::binary_function<Accum,T,Accum>
609  {
610  explicit SumAbsDiff(T base) : itsBase(base) {}
611  Accum operator() (Accum left, T right) const
612  { return left + abs((right-itsBase)); }
613  private:
614  Accum itsBase; // store as Accum, so subtracttion results in Accum
615  };
616 
617  // Functor to downcase a std::string. The result is a casacore::String.
618  struct Downcase : public std::unary_function<std::string,String>
619  {
620  String operator() (const std::string& value) const
621  { return downcase(value); }
622  };
623 
624  // Functor to upcase a std::string. The result is a casacore::String.
625  struct Upcase : public std::unary_function<std::string,String>
626  {
627  String operator() (const std::string& value) const
628  { return upcase(value); }
629  };
630 
631  // Functor to capitalize a std::string. The result is a casacore::String.
632  struct Capitalize : public std::unary_function<std::string,String>
633  {
634  String operator() (const std::string& value) const
635  { return capitalize(value); }
636  };
637 
638  // Functor to trim a std::string. The result is a casacore::String.
639  // Leading and trailing whitespace is removed.
640  struct Trim : public std::unary_function<std::string,String>
641  {
642  String operator() (const std::string& value) const
643  { return trim(value); }
644  };
645 
646 
647 } //# NAMESPACE CASACORE - END
648 
649 #endif
LatticeExprNode log10(const LatticeExprNode &expr)
Functor to test for if two values are absolutely near each other.
Definition: Functors.h:298
Functor for bitwise and of (integer) values.
Definition: Functors.h:219
Accum accumulateTrue(InputIterator first, InputIterator last, MaskIterator mask, Accum acc, BinaryOperator op=std::plus< Accum >())
Define a function (similar to std::accumulate) to do accumulation of elements for which the correspon...
Definition: Functors.h:68
Functor to apply asin.
Definition: Functors.h:328
LatticeExprNode log(const LatticeExprNode &expr)
Functor to apply log10.
Definition: Functors.h:432
LatticeExprNode arg(const LatticeExprNode &expr)
TableExprNode downcase(const TableExprNode &node)
Definition: ExprNode.h:1530
Functor to apply round (e.g.
Definition: Functors.h:464
Functor to add square of right to left.
Definition: Functors.h:587
Functor to add absolute diff of right and base value to left.
Definition: Functors.h:608
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
Functor to apply a power of 3.
Definition: Functors.h:400
LatticeExprNode imag(const LatticeExprNode &expr)
Functor to form a complex number from the real part of the left value and the imaginary part of the r...
Definition: Functors.h:507
Functor to apply sqrt.
Definition: Functors.h:408
Functor for bitwise negate of (integer) values.
Definition: Functors.h:243
Near(double tolerance=1e-5)
Definition: Functors.h:287
struct Node * first
Definition: malloc.h:330
bool compareAllLeft(InputIterator1 first1, InputIterator1 last1, T left, CompareOperator op)
For use with a constant left value.
Definition: Functors.h:109
Functor to get maximum of two values.
Definition: Functors.h:579
Functor to test for NaN.
Definition: Functors.h:256
Functor to downcase a std::string.
Definition: Functors.h:618
Functor to form a complex number from the left and right value.
Definition: Functors.h:480
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)
Functor to test for finiteness.
Definition: Functors.h:272
Functor to trim a std::string.
Definition: Functors.h:640
Functor for bitwise or of (integer) values.
Definition: Functors.h:227
Functor to apply atan2.
Definition: Functors.h:384
LatticeExprNode exp(const LatticeExprNode &expr)
Functor to subtract variables of possibly different types.
Definition: Functors.h:184
LatticeExprNode floor(const LatticeExprNode &expr)
Functor to apply fmod.
Definition: Functors.h:563
LatticeExprNode cos(const LatticeExprNode &expr)
Functor to apply sqr (power of 2).
Definition: Functors.h:392
Functor to get minimum of two values.
Definition: Functors.h:571
LatticeExprNode conj(const LatticeExprNode &expr)
Functor to add variables of possibly different types.
Definition: Functors.h:175
Functor to apply complex function fabs.
Definition: Functors.h:547
Functor to apply sin.
Definition: Functors.h:312
Float pow(Float f1, Float f2)
Definition: math.h:90
LatticeExprNode tanh(const LatticeExprNode &expr)
void transformInPlace(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryOperator op)
Define a function to do a binary transform in place.
Definition: Functors.h:44
Functor to test if two values are relatively near each other.
Definition: Functors.h:285
TableExprNode isInf(const TableExprNode &node)
Definition: ExprNode.h:1683
Functor to apply sinh.
Definition: Functors.h:320
NearAbs(double tolerance=1e-13)
Definition: Functors.h:300
Functor to apply complex function imag.
Definition: Functors.h:531
Functor for bitwise xor of (integer) values.
Definition: Functors.h:235
Functor to apply exp.
Definition: Functors.h:416
Functor to apply log.
Definition: Functors.h:424
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type...
TableExprNode trim(const TableExprNode &node)
Definition: ExprNode.h:1641
Functor to test for infinity.
Definition: Functors.h:264
Functor to apply tanh.
Definition: Functors.h:368
Functor to form a complex number from the real part of the left value and the right value...
Definition: Functors.h:489
Functor to apply acos.
Definition: Functors.h:352
LatticeExprNode sqrt(const LatticeExprNode &expr)
LatticeExprNode tan(const LatticeExprNode &expr)
TableExprNode isFinite(const TableExprNode &node)
Function to test if a scalar or array is finite.
Definition: ExprNode.h:1687
Functor to apply ceil.
Definition: Functors.h:456
LatticeExprNode atan(const LatticeExprNode &expr)
Functor to capitalize a std::string.
Definition: Functors.h:632
TableExprNode upcase(const TableExprNode &node)
Definition: ExprNode.h:1525
bool compareAnyRight(InputIterator1 first1, InputIterator1 last1, T right, CompareOperator op)
For use with a constant right value.
Definition: Functors.h:160
Functor to apply complex function real.
Definition: Functors.h:523
bool compareAny(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, CompareOperator op)
Define a function to compare all elements of two sequences.
Definition: Functors.h:136
Functor to apply complex function conj.
Definition: Functors.h:515
Functor to apply atan.
Definition: Functors.h:376
double itsTolerance
Definition: Functors.h:293
Functor to multiply variables of possibly different types.
Definition: Functors.h:193
bool compareAllRight(InputIterator1 first1, InputIterator1 last1, T right, CompareOperator op)
For use with a constant right value.
Definition: Functors.h:121
LatticeExprNode atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
Functor to apply cos.
Definition: Functors.h:336
bool compareAnyLeft(InputIterator1 first1, InputIterator1 last1, T left, CompareOperator op)
For use with a constant left value.
Definition: Functors.h:148
Accum accumulateFalse(InputIterator first, InputIterator last, MaskIterator mask, Accum acc, BinaryOperator op=std::plus< Accum >())
Define a function (similar to std::accumulate) to do accumulation of elements for which the correspon...
Definition: Functors.h:82
Functor to apply floor.
Definition: Functors.h:448
RES operator()(const L &x, const R &y) const
Definition: Functors.h:177
LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
Functor to apply sign (result is -1, 0, or 1).
Definition: Functors.h:472
double itsTolerance
Definition: Functors.h:306
LatticeExprNode asin(const LatticeExprNode &expr)
const Double e
e and functions thereof:
Functor to divide variables of possibly different types.
Definition: Functors.h:202
Functor to apply abs.
Definition: Functors.h:440
LatticeExprNode sinh(const LatticeExprNode &expr)
Functor to form a complex number from the left value and the imaginary part of the right value...
Definition: Functors.h:498
LatticeExprNode acos(const LatticeExprNode &expr)
Functor to apply tan.
Definition: Functors.h:360
TableExprNode capitalize(const TableExprNode &node)
Definition: ExprNode.h:1535
String: the storage and methods of handling collections of characters.
Definition: String.h:223
TableExprNode nearAbs(const TableExprNode &left, const TableExprNode &right)
Definition: ExprNode.h:1316
Functor to take modulo of (integer) variables of possibly different types.
Definition: Functors.h:211
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
bool compareAll(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, CompareOperator op)
Define a function to compare all elements of two sequences.
Definition: Functors.h:97
Functor to apply cosh.
Definition: Functors.h:344
Functor to upcase a std::string.
Definition: Functors.h:625
LatticeExprNode ceil(const LatticeExprNode &expr)
Functor to apply pow.
Definition: Functors.h:555
this file contains all the compiler specific defines
Definition: mainpage.dox:28
LatticeExprNode cosh(const LatticeExprNode &expr)
LatticeExprNode real(const LatticeExprNode &expr)
Functor to add squared diff of right and base value to left.
Definition: Functors.h:596
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.
Functor to apply complex function arg.
Definition: Functors.h:539