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