casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SparseDiffMath.h
Go to the documentation of this file.
1 //# SparseDiffMath.h: Implements all mathematical functions for SparseDiff.
2 //# Copyright (C) 2007
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 //#
27 //# $Id: SparseDiffMath.h,v 1.1 2007/11/16 04:34:46 wbrouw Exp $
28 
29 #ifndef SCIMATH_SPARSEDIFFMATH_H
30 #define SCIMATH_SPARSEDIFFMATH_H
31 
32 //# Includes
33 
34 #include <casacore/casa/aips.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40  // <summary>
41  // Implements all mathematical operators and functions for SparseDiff.
42  // </summary>
43  //
44  // <reviewed reviewer="UNKNOWN" date="" tests="tSparseDiff" demos="">
45  // </reviewed>
46  //
47  // <prerequisite>
48  // <li> <linkto class=SparseDiff>SparseDiff</linkto> class
49  // </prerequisite>
50  //
51  // <etymology>
52  // Implements all mathematical operators and functions for SparseDiff.
53  // </etymology>
54  //
55  // <todo asof="20001/08/12">
56  // <li> nothing I know of
57  // </todo>
58 
59  // <group name="SparseDiff mathematical operations">
60 
61  // Unary arithmetic operators.
62  // <group>
63  template<class T>
65  template<class T>
67  // </group>
68 
69  // Arithmetic on two SparseDiff objects, returning a SparseDiff object
70  // <group>
71  template<class T>
72  SparseDiff<T> operator+(const SparseDiff<T> &left, const SparseDiff<T> &right);
73  template<class T>
74  SparseDiff<T> operator-(const SparseDiff<T> &left, const SparseDiff<T> &right);
75  template<class T>
76  SparseDiff<T> operator*(const SparseDiff<T> &left, const SparseDiff<T> &right);
77  template<class T>
78  SparseDiff<T> operator/(const SparseDiff<T> &left, const SparseDiff<T> &right);
79  // </group>
80 
81  // Arithmetic on a SparseDiff and a scalar, returning a SparseDiff
82  // <group>
83  template<class T>
84  SparseDiff<T> operator+(const SparseDiff<T> &left, const T &right);
85  template<class T>
86  SparseDiff<T> operator-(const SparseDiff<T> &left, const T &right);
87  template<class T>
88  SparseDiff<T> operator*(const SparseDiff<T> &left, const T &right);
89  template<class T>
90  SparseDiff<T> operator/(const SparseDiff<T> &left, const T &right);
91  // </group>
92 
93  // Arithmetic between a scalar and a SparseDiff returning a SparseDiff
94  // <group>
95  template<class T>
96  SparseDiff<T> operator+(const T &left, const SparseDiff<T> &right);
97  template<class T>
98  SparseDiff<T> operator-(const T &left, const SparseDiff<T> &right);
99  template<class T>
100  SparseDiff<T> operator*(const T &left, const SparseDiff<T> &right);
101  template<class T>
102  SparseDiff<T> operator/(const T &left, const SparseDiff<T> &right);
103  // </group>
104 
105  // Transcendental functions
106  // <group>
107  template<class T> SparseDiff<T> acos(const SparseDiff<T> &ad);
108  template<class T> SparseDiff<T> asin(const SparseDiff<T> &ad);
109  template<class T> SparseDiff<T> atan(const SparseDiff<T> &ad);
110  template<class T> SparseDiff<T> atan2(const SparseDiff<T> &y,
111  const SparseDiff<T> &x);
112  template<class T> SparseDiff<T> cos(const SparseDiff<T> &ad);
113  template<class T> SparseDiff<T> cosh(const SparseDiff<T> &ad);
114  template<class T> SparseDiff<T> exp(const SparseDiff<T> &ad);
115  template<class T> SparseDiff<T> log(const SparseDiff<T> &ad);
116  template<class T> SparseDiff<T> log10(const SparseDiff<T> &ad);
117  template<class T> SparseDiff<T> erf(const SparseDiff<T> &ad);
118  template<class T> SparseDiff<T> erfc(const SparseDiff<T> &ad);
119  template<class T> SparseDiff<T> pow(const SparseDiff<T> &a,
120  const SparseDiff<T> &b);
121  template<class T> SparseDiff<T> pow(const SparseDiff<T> &a, const T &b);
122  template<class T> SparseDiff<T> square(const SparseDiff<T> &ad);
123  template<class T> SparseDiff<T> cube(const SparseDiff<T> &ad);
124  template<class T> SparseDiff<T> sin(const SparseDiff<T> &ad);
125  template<class T> SparseDiff<T> sinh(const SparseDiff<T> &ad);
126  template<class T> SparseDiff<T> sqrt(const SparseDiff<T> &ad);
127  template<class T> SparseDiff<T> tan(const SparseDiff<T> &ad);
128  template<class T> SparseDiff<T> tanh(const SparseDiff<T> &ad);
129  template<class T> SparseDiff<T> abs(const SparseDiff<T> &ad);
130  // </group>
131  // Floating-point remainder of x/c, with the same sign as x, where c is
132  // a constant.
133  // <group>
134  template<class T> SparseDiff<T> fmod(const SparseDiff<T> &x, const T &c);
135  template<class T> SparseDiff<T> fmod(const SparseDiff<T> &x,
136  const SparseDiff<T> &c);
137  // </group>
138  // Floor and ceil of values
139  // <group>
140  template<class T> SparseDiff<T> floor(const SparseDiff<T> &ad);
141  template<class T> SparseDiff<T> ceil(const SparseDiff<T> &ad);
142  // </group>
143 
144  // Comparison operators. Only the values are compared: in the actual
145  // functions, comparisons are used to decide on algorithms. To check
146  // if two SparseDiff values are equal, use comparison for both
147  // value and derivatives.
148  // <note role=tip> To check if two SparseDiff values are equal, use the
149  // member method <src>equals()</src> (e.g. for debugging and testing).
150  // </note>
151  // <group>
152  // Compare two SparseDiff's
153  template<class T> Bool operator>(const SparseDiff<T> &left,
154  const SparseDiff<T> &right);
155  template<class T> Bool operator<(const SparseDiff<T> &left,
156  const SparseDiff<T> &right);
157  template<class T> Bool operator>=(const SparseDiff<T> &left,
158  const SparseDiff<T> &right);
159  template<class T> Bool operator<=(const SparseDiff<T> &left,
160  const SparseDiff<T> &right);
161  template<class T> Bool operator==(const SparseDiff<T> &left,
162  const SparseDiff<T> &right);
163  template<class T> Bool operator!=(const SparseDiff<T> &left,
164  const SparseDiff<T> &right);
165  template<class T> Bool near(const SparseDiff<T> &left,
166  const SparseDiff<T> &right);
167  template<class T> Bool near(const SparseDiff<T> &left,
168  const SparseDiff<T> &right, const Double tol);
169  template<class T> Bool allnear(const SparseDiff<T> &left,
170  const SparseDiff<T> &right, const Double tol);
171  template<class T> Bool nearAbs(const SparseDiff<T> &left,
172  const SparseDiff<T> &right, const Double tol);
173  template<class T> Bool allnearAbs(const SparseDiff<T> &left,
174  const SparseDiff<T> &right, const Double tol);
175  // </group>
176  // Compare a SparseDiff and a constant
177  // <group>
178  template<class T> Bool operator>(const SparseDiff<T> &left, const T &right);
179  template<class T> Bool operator<(const SparseDiff<T> &left, const T &right);
180  template<class T> Bool operator>=(const SparseDiff<T> &left, const T &right);
181  template<class T> Bool operator<=(const SparseDiff<T> &left, const T &right);
182  template<class T> Bool operator==(const SparseDiff<T> &left, const T &right);
183  template<class T> Bool operator!=(const SparseDiff<T> &left, const T &right);
184  template<class T> Bool near(const SparseDiff<T> &left, const T &right);
185  template<class T> Bool near(const SparseDiff<T> &left, const T &right,
186  const Double tol);
187  template<class T> Bool allnear(const SparseDiff<T> &left, const T &right,
188  const Double tol);
189  template<class T> Bool nearAbs(const SparseDiff<T> &left, const T &right,
190  const Double tol);
191  template<class T> Bool allnearAbs(const SparseDiff<T> &left, const T &right,
192  const Double tol);
193  // </group>
194  // Compare a constant and a SparseDiff
195  // <group>
196  template<class T> Bool operator>(const T &left, const SparseDiff<T> &right);
197  template<class T> Bool operator<(const T &left, const SparseDiff<T> &right);
198  template<class T> Bool operator>=(const T &left, const SparseDiff<T> &right);
199  template<class T> Bool operator<=(const T &left, const SparseDiff<T> &right);
200  template<class T> Bool operator==(const T &left, const SparseDiff<T> &right);
201  template<class T> Bool operator!=(const T &left, const SparseDiff<T> &right);
202  template<class T> Bool near(const T &left, const SparseDiff<T> &right,
203  const Double tol);
204  template<class T> Bool allnear(const T &left, const SparseDiff<T> &right,
205  const Double tol);
206  template<class T> Bool nearAbs(const T &left, const SparseDiff<T> &right,
207  const Double tol);
208  template<class T> Bool allnearAbs(const T &left, const SparseDiff<T> &right,
209  const Double tol);
210  // </group>
211  // Test special values
212  // <group>
213  template<class T> Bool isNaN(const SparseDiff<T> &val);
214  template<class T> Bool isInf(SparseDiff<T> &val);
215  // </group>
216  // Minimum/maximum
217  // <group>
218  template<class T> SparseDiff<T> min(const SparseDiff<T> &left,
219  const SparseDiff<T> &right);
220  template<class T> SparseDiff<T> max(const SparseDiff<T> &left,
221  const SparseDiff<T> &right);
222  // </group>
223 
224  // </group>
225 
226 
227 } //# NAMESPACE CASACORE - END
228 
229 #ifndef CASACORE_NO_AUTO_TEMPLATES
230 #include <casacore/scimath/Mathematics/SparseDiffMath.tcc>
231 #endif //# CASACORE_NO_AUTO_TEMPLATES
232 #endif
LatticeExprNode log10(const LatticeExprNode &expr)
LatticeExprNode log(const LatticeExprNode &expr)
LatticeExprNode operator/(const LatticeExprNode &left, const LatticeExprNode &right)
Class that computes partial derivatives by automatic differentiation.
Definition: SparseDiff.h:45
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)
LatticeExprNode exp(const LatticeExprNode &expr)
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:129
LatticeExprNode floor(const LatticeExprNode &expr)
LatticeExprNode cos(const LatticeExprNode &expr)
LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode tanh(const LatticeExprNode &expr)
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)
TableExprNode isInf(const TableExprNode &node)
Definition: ExprNode.h:1626
double Double
Definition: aipstype.h:55
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type...
LatticeExprNode sqrt(const LatticeExprNode &expr)
LatticeExprNode tan(const LatticeExprNode &expr)
LatticeExprNode atan(const LatticeExprNode &expr)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
TableExprNode cube(const TableExprNode &node)
Definition: ExprNode.h:1351
LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode atan2(const LatticeExprNode &left, const LatticeExprNode &right)
Numerical 2-argument functions.
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.
LatticeExprNode fmod(const LatticeExprNode &left, const LatticeExprNode &right)
LatticeExprNode asin(const LatticeExprNode &expr)
LatticeExprNode sinh(const LatticeExprNode &expr)
const Double c
Fundamental physical constants (SI units):
LatticeExprNode acos(const LatticeExprNode &expr)
TableExprNode square(const TableExprNode &node)
Definition: ExprNode.h:1346
LatticeExprNode operator-(const LatticeExprNode &expr)
TableExprNode nearAbs(const TableExprNode &left, const TableExprNode &right)
Definition: ExprNode.h:1250
LatticeExprNode isNaN(const LatticeExprNode &expr)
Test if a value is a NaN.
LatticeExprNode ceil(const LatticeExprNode &expr)
LatticeExprNode pow(const LatticeExprNode &left, const LatticeExprNode &right)
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:135
MVBaseline operator*(const RotMatrix &left, const MVBaseline &right)
Rotate a Baseline vector with rotation matrix and other multiplications.
LatticeExprNode cosh(const LatticeExprNode &expr)
LatticeExprNode sin(const LatticeExprNode &expr)
Numerical 1-argument functions.