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