casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef SCIMATH_SPARSEDIFFMATH_H
27#define SCIMATH_SPARSEDIFFMATH_H
28
29//# Includes
30
31#include <casacore/casa/aips.h>
32#include <casacore/casa/BasicMath/Math.h>
33#include <casacore/scimath/Mathematics/SparseDiff.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37 // <summary>
38 // Implements all mathematical operators and functions for SparseDiff.
39 // </summary>
40 //
41 // <reviewed reviewer="UNKNOWN" date="" tests="tSparseDiff" demos="">
42 // </reviewed>
43 //
44 // <prerequisite>
45 // <li> <linkto class=SparseDiff>SparseDiff</linkto> class
46 // </prerequisite>
47 //
48 // <etymology>
49 // Implements all mathematical operators and functions for SparseDiff.
50 // </etymology>
51 //
52 // <todo asof="20001/08/12">
53 // <li> nothing I know of
54 // </todo>
55
56 // <group name="SparseDiff mathematical operations">
58 // Unary arithmetic operators.
59 // <group>
60 template<class T>
62 template<class T>
64 // </group>
65
66 // Arithmetic on two SparseDiff objects, returning a SparseDiff object
67 // <group>
68 template<class T>
70 template<class T>
72 template<class T>
74 template<class T>
76 // </group>
77
78 // Arithmetic on a SparseDiff and a scalar, returning a SparseDiff
79 // <group>
80 template<class T>
81 SparseDiff<T> operator+(const SparseDiff<T> &left, const T &right);
82 template<class T>
83 SparseDiff<T> operator-(const SparseDiff<T> &left, const T &right);
84 template<class T>
85 SparseDiff<T> operator*(const SparseDiff<T> &left, const T &right);
86 template<class T>
87 SparseDiff<T> operator/(const SparseDiff<T> &left, const T &right);
88 // </group>
89
90 // Arithmetic between a scalar and a SparseDiff returning a SparseDiff
91 // <group>
92 template<class T>
93 SparseDiff<T> operator+(const T &left, const SparseDiff<T> &right);
94 template<class T>
95 SparseDiff<T> operator-(const T &left, const SparseDiff<T> &right);
96 template<class T>
97 SparseDiff<T> operator*(const T &left, const SparseDiff<T> &right);
98 template<class T>
99 SparseDiff<T> operator/(const T &left, const SparseDiff<T> &right);
100 // </group>
101
102 // Transcendental functions
103 // <group>
104 template<class T> SparseDiff<T> acos(const SparseDiff<T> &ad);
105 template<class T> SparseDiff<T> asin(const SparseDiff<T> &ad);
106 template<class T> SparseDiff<T> atan(const SparseDiff<T> &ad);
107 template<class T> SparseDiff<T> atan2(const SparseDiff<T> &y,
108 const SparseDiff<T> &x);
109 template<class T> SparseDiff<T> cos(const SparseDiff<T> &ad);
110 template<class T> SparseDiff<T> cosh(const SparseDiff<T> &ad);
111 template<class T> SparseDiff<T> exp(const SparseDiff<T> &ad);
112 template<class T> SparseDiff<T> log(const SparseDiff<T> &ad);
113 template<class T> SparseDiff<T> log10(const SparseDiff<T> &ad);
114 template<class T> SparseDiff<T> erf(const SparseDiff<T> &ad);
115 template<class T> SparseDiff<T> erfc(const SparseDiff<T> &ad);
116 template<class T> SparseDiff<T> pow(const SparseDiff<T> &a,
117 const SparseDiff<T> &b);
118 template<class T> SparseDiff<T> pow(const SparseDiff<T> &a, const T &b);
119 template<class T> SparseDiff<T> square(const SparseDiff<T> &ad);
120 template<class T> SparseDiff<T> cube(const SparseDiff<T> &ad);
121 template<class T> SparseDiff<T> sin(const SparseDiff<T> &ad);
122 template<class T> SparseDiff<T> sinh(const SparseDiff<T> &ad);
123 template<class T> SparseDiff<T> sqrt(const SparseDiff<T> &ad);
124 template<class T> SparseDiff<T> tan(const SparseDiff<T> &ad);
125 template<class T> SparseDiff<T> tanh(const SparseDiff<T> &ad);
126 template<class T> SparseDiff<T> abs(const SparseDiff<T> &ad);
127 // </group>
128 // Floating-point remainder of x/c, with the same sign as x, where c is
129 // a constant.
130 // <group>
131 template<class T> SparseDiff<T> fmod(const SparseDiff<T> &x, const T &c);
132 template<class T> SparseDiff<T> fmod(const SparseDiff<T> &x,
133 const SparseDiff<T> &c);
134 // </group>
135 // Floor and ceil of values
136 // <group>
137 template<class T> SparseDiff<T> floor(const SparseDiff<T> &ad);
138 template<class T> SparseDiff<T> ceil(const SparseDiff<T> &ad);
139 // </group>
140
141 // Comparison operators. Only the values are compared: in the actual
142 // functions, comparisons are used to decide on algorithms. To check
143 // if two SparseDiff values are equal, use comparison for both
144 // value and derivatives.
145 // <note role=tip> To check if two SparseDiff values are equal, use the
146 // member method <src>equals()</src> (e.g. for debugging and testing).
147 // </note>
148 // <group>
149 // Compare two SparseDiff's
150 template<class T> Bool operator>(const SparseDiff<T> &left,
151 const SparseDiff<T> &right);
152 template<class T> Bool operator<(const SparseDiff<T> &left,
153 const SparseDiff<T> &right);
154 template<class T> Bool operator>=(const SparseDiff<T> &left,
155 const SparseDiff<T> &right);
156 template<class T> Bool operator<=(const SparseDiff<T> &left,
157 const SparseDiff<T> &right);
158 template<class T> Bool operator==(const SparseDiff<T> &left,
159 const SparseDiff<T> &right);
160 template<class T> Bool operator!=(const SparseDiff<T> &left,
161 const SparseDiff<T> &right);
162 template<class T> Bool near(const SparseDiff<T> &left,
163 const SparseDiff<T> &right);
164 template<class T> Bool near(const SparseDiff<T> &left,
165 const SparseDiff<T> &right, const Double tol);
166 template<class T> Bool allnear(const SparseDiff<T> &left,
167 const SparseDiff<T> &right, const Double tol);
168 template<class T> Bool nearAbs(const SparseDiff<T> &left,
169 const SparseDiff<T> &right, const Double tol);
170 template<class T> Bool allnearAbs(const SparseDiff<T> &left,
171 const SparseDiff<T> &right, const Double tol);
172 // </group>
173 // Compare a SparseDiff and a constant
174 // <group>
175 template<class T> Bool operator>(const SparseDiff<T> &left, const T &right);
176 template<class T> Bool operator<(const SparseDiff<T> &left, const T &right);
177 template<class T> Bool operator>=(const SparseDiff<T> &left, const T &right);
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 near(const SparseDiff<T> &left, const T &right);
182 template<class T> Bool near(const SparseDiff<T> &left, const T &right,
183 const Double tol);
184 template<class T> Bool allnear(const SparseDiff<T> &left, const T &right,
185 const Double tol);
186 template<class T> Bool nearAbs(const SparseDiff<T> &left, const T &right,
187 const Double tol);
188 template<class T> Bool allnearAbs(const SparseDiff<T> &left, const T &right,
189 const Double tol);
190 // </group>
191 // Compare a constant and a SparseDiff
192 // <group>
193 template<class T> Bool operator>(const T &left, const SparseDiff<T> &right);
194 template<class T> Bool operator<(const T &left, const SparseDiff<T> &right);
195 template<class T> Bool operator>=(const T &left, const SparseDiff<T> &right);
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 near(const T &left, const SparseDiff<T> &right,
200 const Double tol);
201 template<class T> Bool allnear(const T &left, const SparseDiff<T> &right,
202 const Double tol);
203 template<class T> Bool nearAbs(const T &left, const SparseDiff<T> &right,
204 const Double tol);
205 template<class T> Bool allnearAbs(const T &left, const SparseDiff<T> &right,
206 const Double tol);
207 // </group>
208 // Test special values
209 // <group>
210 template<class T> Bool isNaN(const SparseDiff<T> &val);
211 template<class T> Bool isInf(SparseDiff<T> &val);
212 // </group>
213 // Minimum/maximum
214 // <group>
215 template<class T> SparseDiff<T> min(const SparseDiff<T> &left,
216 const SparseDiff<T> &right);
217 template<class T> SparseDiff<T> max(const SparseDiff<T> &left,
218 const SparseDiff<T> &right);
219 // </group>
220
221 // </group>
222
223
224} //# NAMESPACE CASACORE - END
225
226#ifndef CASACORE_NO_AUTO_TEMPLATES
227#include <casacore/scimath/Mathematics/SparseDiffMath.tcc>
228#endif //# CASACORE_NO_AUTO_TEMPLATES
229#endif
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53
Bool operator<(const SparseDiff< T > &left, const T &right)
Bool near(const T &left, const SparseDiff< T > &right, const Double tol)
SparseDiff< T > operator-(const T &left, const SparseDiff< T > &right)
SparseDiff< T > operator+(const T &left, const SparseDiff< T > &right)
Arithmetic between a scalar and a SparseDiff returning a SparseDiff.
SparseDiff< T > pow(const SparseDiff< T > &a, const SparseDiff< T > &b)
Bool operator!=(const SparseDiff< T > &left, const SparseDiff< T > &right)
SparseDiff< T > acos(const SparseDiff< T > &ad)
Transcendental functions.
SparseDiff< T > operator+(const SparseDiff< T > &other)
Unary arithmetic operators.
SparseDiff< T > min(const SparseDiff< T > &left, const SparseDiff< T > &right)
Minimum/maximum.
SparseDiff< T > operator*(const SparseDiff< T > &left, const T &right)
SparseDiff< T > operator/(const T &left, const SparseDiff< T > &right)
SparseDiff< T > operator-(const SparseDiff< T > &left, const SparseDiff< T > &right)
SparseDiff< T > operator*(const SparseDiff< T > &left, const SparseDiff< T > &right)
Bool allnearAbs(const SparseDiff< T > &left, const T &right, const Double tol)
Bool near(const SparseDiff< T > &left, const SparseDiff< T > &right, const Double tol)
Bool operator>=(const SparseDiff< T > &left, const T &right)
Bool operator==(const T &left, const SparseDiff< T > &right)
SparseDiff< T > operator+(const SparseDiff< T > &left, const SparseDiff< T > &right)
Arithmetic on two SparseDiff objects, returning a SparseDiff object.
Bool operator<(const SparseDiff< T > &left, const SparseDiff< T > &right)
Bool operator<=(const SparseDiff< T > &left, const SparseDiff< T > &right)
SparseDiff< T > operator+(const SparseDiff< T > &left, const T &right)
Arithmetic on a SparseDiff and a scalar, returning a SparseDiff.
Bool allnear(const SparseDiff< T > &left, const SparseDiff< T > &right, const Double tol)
SparseDiff< T > atan2(const SparseDiff< T > &y, const SparseDiff< T > &x)
Bool operator==(const SparseDiff< T > &left, const SparseDiff< T > &right)
SparseDiff< T > max(const SparseDiff< T > &left, const SparseDiff< T > &right)
Bool operator<(const T &left, const SparseDiff< T > &right)
Bool near(const SparseDiff< T > &left, const T &right, const Double tol)
SparseDiff< T > operator/(const SparseDiff< T > &left, const SparseDiff< T > &right)
Bool operator<=(const T &left, const SparseDiff< T > &right)
Bool allnearAbs(const T &left, const SparseDiff< T > &right, const Double tol)
Bool operator>(const T &left, const SparseDiff< T > &right)
Compare a constant and a SparseDiff.
Bool operator>=(const SparseDiff< T > &left, const SparseDiff< T > &right)
Bool near(const SparseDiff< T > &left, const SparseDiff< T > &right)
Bool allnear(const T &left, const SparseDiff< T > &right, const Double tol)
Bool operator!=(const SparseDiff< T > &left, const T &right)
Bool operator>=(const T &left, const SparseDiff< T > &right)
SparseDiff< T > operator*(const T &left, const SparseDiff< T > &right)
Bool operator>(const SparseDiff< T > &left, const SparseDiff< T > &right)
Comparison operators.
Bool nearAbs(const SparseDiff< T > &left, const SparseDiff< T > &right, const Double tol)
SparseDiff< T > fmod(const SparseDiff< T > &x, const T &c)
Floating-point remainder of x/c, with the same sign as x, where c is a constant.
Bool allnear(const SparseDiff< T > &left, const T &right, const Double tol)
Bool operator==(const SparseDiff< T > &left, const T &right)
SparseDiff< T > fmod(const SparseDiff< T > &x, const SparseDiff< T > &c)
SparseDiff< T > pow(const SparseDiff< T > &a, const T &b)
Bool nearAbs(const T &left, const SparseDiff< T > &right, const Double tol)
Bool allnearAbs(const SparseDiff< T > &left, const SparseDiff< T > &right, const Double tol)
SparseDiff< T > floor(const SparseDiff< T > &ad)
Floor and ceil of values.
SparseDiff< T > operator-(const SparseDiff< T > &left, const T &right)
Bool operator>(const SparseDiff< T > &left, const T &right)
Compare a SparseDiff and a constant.
Bool nearAbs(const SparseDiff< T > &left, const T &right, const Double tol)
Bool operator<=(const SparseDiff< T > &left, const T &right)
SparseDiff< T > operator/(const SparseDiff< T > &left, const T &right)
Bool operator!=(const T &left, const SparseDiff< T > &right)
Bool isNaN(const SparseDiff< T > &val)
Test special values.