casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TVecMath.h
Go to the documentation of this file.
1 //# TVecMath.h: Global helper functions for table vector mathematics
2 //# Copyright (C) 1994,1995,1999
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 TABLES_TVECMATH_H
29 #define TABLES_TVECMATH_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 
34 namespace casacore { //# NAMESPACE CASACORE - BEGIN
35 
36 //# Forward Declarations
37 template<class T> class TabVecRep;
38 
39 
40 // <summary>
41 // Basic math for table vectors.
42 // </summary>
43 
44 // <use visibility=local>
45 
46 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
47 // </reviewed>
48 
49 // <synopsis>
50 // These global functions do the basic math for table vectors.
51 // This means addition, subtraction, multiplication, division
52 // and negation.
53 // In case two table vectors are used, the left and right operand
54 // must be conformant (i.e. have equal length).
55 // </synopsis>
56 
57 // <group name=basicMath>
58 // Add 2 table vectors storing result in first one.
59 template<class T> void tabVecReptvassadd (TabVecRep<T>&, const TabVecRep<T>&);
60 // Subtract 2 table vectors storing result in first one.
61 template<class T> void tabVecReptvasssub (TabVecRep<T>&, const TabVecRep<T>&);
62 // Multiple 2 table vectors storing result in first one.
63 template<class T> void tabVecReptvasstim (TabVecRep<T>&, const TabVecRep<T>&);
64 // Divide 2 table vectors storing result in first one.
65 template<class T> void tabVecReptvassdiv (TabVecRep<T>&, const TabVecRep<T>&);
66 
67 // Add a scalar to each element in the table vector.
68 template<class T> void tabVecRepvalassadd (TabVecRep<T>&, const T&);
69 // Subtract a scalar from each element in the table vector.
70 template<class T> void tabVecRepvalasssub (TabVecRep<T>&, const T&);
71 // Multiple each element in the table vector with a scalar.
72 template<class T> void tabVecRepvalasstim (TabVecRep<T>&, const T&);
73 // Divide each element in the table vector by a scalar.
74 template<class T> void tabVecRepvalassdiv (TabVecRep<T>&, const T&);
75 
76 // Unary minus - store result in a new vector.
77 // <note role=tip>
78 // (unary plus is already handled in TabVecMath).
79 // </note>
80 //
81 template<class T> TabVecRep<T>& tabVecRepnegate (const TabVecRep<T>&);
82 
83 // Add 2 table vectors storing result in a new one.
84 template<class T> TabVecRep<T>& tabVecReptvadd (const TabVecRep<T>&,
85  const TabVecRep<T>&);
86 // Subtract 2 table vectors storing result in a new one.
87 template<class T> TabVecRep<T>& tabVecReptvsub (const TabVecRep<T>&,
88  const TabVecRep<T>&);
89 // Multiple 2 table vectors storing result in a new one.
90 template<class T> TabVecRep<T>& tabVecReptvtim (const TabVecRep<T>&,
91  const TabVecRep<T>&);
92 // Divide 2 table vectors storing result in a new one.
93 template<class T> TabVecRep<T>& tabVecReptvdiv (const TabVecRep<T>&,
94  const TabVecRep<T>&);
95 
96 // Add a scalar to each element in the table vector storing result
97 // in a new table vector.
98 template<class T> TabVecRep<T>& tabVecRepvalradd (const TabVecRep<T>&,
99  const T&);
100 // Subtract a scalar from each element in the table vector storing result
101 // in a new table vector.
102 template<class T> TabVecRep<T>& tabVecRepvalrsub (const TabVecRep<T>&,
103  const T&);
104 // Multiple each element in the table vector with a scalar storing result
105 // in a new table vector.
106 template<class T> TabVecRep<T>& tabVecRepvalrtim (const TabVecRep<T>&,
107  const T&);
108 // Divide each element in the table vector by a scalar storing result
109 // in a new table vector.
110 template<class T> TabVecRep<T>& tabVecRepvalrdiv (const TabVecRep<T>&,
111  const T&);
112 
113 // Add a scalar to each element in the table vector storing result
114 // in a new table vector.
115 template<class T> TabVecRep<T>& tabVecRepvalladd (const T&,
116  const TabVecRep<T>&);
117 // Subtract a scalar from each element in the table vector storing result
118 // in a new table vector.
119 template<class T> TabVecRep<T>& tabVecRepvallsub (const T&,
120  const TabVecRep<T>&);
121 // Multiple each element in the table vector with a scalar storing result
122 // in a new table vector.
123 template<class T> TabVecRep<T>& tabVecRepvalltim (const T&,
124  const TabVecRep<T>&);
125 // Divide each element in the table vector by a scalar storing result
126 // in a new table vector.
127 template<class T> TabVecRep<T>& tabVecRepvalldiv (const T&,
128  const TabVecRep<T>&);
129 // </group>
130 
131 
132 
133 // <summary>
134 // Transcendental math for table vectors.
135 // </summary>
136 
137 // <use visibility=local>
138 
139 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
140 // </reviewed>
141 
142 // <synopsis>
143 // These global functions do the transcendental math for table vectors
144 // for essentially all numeric types.
145 // The functions are sin, sinh, exp, log, pow, etc..
146 // In case two table vectors are used, the left and right operand
147 // must be conformant (i.e. have equal length).
148 // </synopsis>
149 
150 // <group name=basicTransMath>
151 template<class T> TabVecRep<T>& tabVecRepcos (const TabVecRep<T>&);
152 template<class T> TabVecRep<T>& tabVecRepcosh (const TabVecRep<T>&);
153 template<class T> TabVecRep<T>& tabVecRepexp (const TabVecRep<T>&);
154 template<class T> TabVecRep<T>& tabVecReplog (const TabVecRep<T>&);
155 template<class T> TabVecRep<T>& tabVecReplog10(const TabVecRep<T>&);
156 template<class T> TabVecRep<T>& tabVecReppow (const TabVecRep<T>&,
157  const TabVecRep<T>&);
158 template<class T> TabVecRep<T>& tabVecRepsin (const TabVecRep<T>&);
159 template<class T> TabVecRep<T>& tabVecRepsinh (const TabVecRep<T>&);
160 template<class T> TabVecRep<T>& tabVecRepsqrt (const TabVecRep<T>&);
161 // </group>
162 
163 
164 
165 // <summary>
166 // Further transcendental math for table vectors.
167 // </summary>
168 
169 // <use visibility=local>
170 
171 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
172 // </reviewed>
173 
174 // <synopsis>
175 // These global functions do the transcendental math for table vectors
176 // for a limited set of numeric types.
177 // The functions are asin, ceil, etc..
178 // In case two table vectors are used, the left and right operand
179 // must be conformant (i.e. have equal length).
180 // </synopsis>
181 
182 // <group name=advTransMath>
183 template<class T> TabVecRep<T>& tabVecRepacos (const TabVecRep<T>&);
184 template<class T> TabVecRep<T>& tabVecRepasin (const TabVecRep<T>&);
185 template<class T> TabVecRep<T>& tabVecRepatan (const TabVecRep<T>&);
186 template<class T> TabVecRep<T>& tabVecRepatan2(const TabVecRep<T>&,
187  const TabVecRep<T>&);
188 template<class T> TabVecRep<T>& tabVecRepceil (const TabVecRep<T>&);
189 template<class T> TabVecRep<T>& tabVecRepfabs (const TabVecRep<T>&);
190 template<class T> TabVecRep<T>& tabVecRepfloor(const TabVecRep<T>&);
191 template<class T> TabVecRep<T>& tabVecRepfmod (const TabVecRep<T>&,
192  const TabVecRep<T>&);
193 template<class T> TabVecRep<T>& tabVecReppow (const TabVecRep<T>&,
194  const double&);
195 template<class T> TabVecRep<T>& tabVecReptan (const TabVecRep<T>&);
196 template<class T> TabVecRep<T>& tabVecReptanh (const TabVecRep<T>&);
197 // </group>
198 
199 
200 
201 // <summary>
202 // Miscellaneous table vector operations.
203 // </summary>
204 
205 // <use visibility=local>
206 
207 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
208 // </reviewed>
209 
210 // <synopsis>
211 // Fill a table vector or calculate the sum, product, minimum or
212 // maximum of its elements.
213 // </synopsis>
214 
215 // <group name=miscellaneous>
216 // Determine minimum and maximum value in a table vector.
217 // Requires that the type "T" has comparison operators.
218 template<class T> void tabVecRepminmax (T& min, T& max, const TabVecRep<T>&);
219 
220 // Fills all elements of the table vector with a sequence starting with
221 // "start" and incrementing by "inc" for each element.
222 template<class T> void tabVecRepindgen (TabVecRep<T>&, T start, T inc);
223 
224 // Sum of all the elements of a table vector.
225 template<class T> T tabVecRepsum (const TabVecRep<T>&);
226 
227 // Product of all the elements of a table vector.
228 // <note role=warning>
229 // product can easily overflow.
230 // </note>
231 template<class T> T tabVecRepproduct (const TabVecRep<T>&);
232 // </group>
233 
234 
235 
236 
237 // <summary>
238 // Vector operations on a table vector.
239 // </summary>
240 
241 // <use visibility=local>
242 
243 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
244 // </reviewed>
245 
246 // <synopsis>
247 // Do vector operations on a table vector (like inner product).
248 // </synopsis>
249 
250 // <group name=vectorMath>
251 // The inner product of 2 table vectors.
252 template<class T> T tabVecRepinnerproduct (const TabVecRep<T>&,
253  const TabVecRep<T>&);
254 
255 // The norm of a table vector.
256 template<class T> T tabVecRepnorm (const TabVecRep<T>&);
257 
258 // The cross product of 2 table vectors containing 3 elements.
259 template<class T> TabVecRep<T>& tabVecRepcrossproduct (const TabVecRep<T>&,
260  const TabVecRep<T>&);
261 // </group>
262 
263 
264 
265 } //# NAMESPACE CASACORE - END
266 
267 #ifndef CASACORE_NO_AUTO_TEMPLATES
268 #include <casacore/tables/Tables/TVecMath.tcc>
269 #endif //# CASACORE_NO_AUTO_TEMPLATES
270 #endif
LatticeExprNode max(const LatticeExprNode &left, const LatticeExprNode &right)
Templated base class for table vectors.
Definition: TVec.h:107
LatticeExprNode min(const LatticeExprNode &left, const LatticeExprNode &right)