casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TVecMath.h
Go to the documentation of this file.
00001 //# TVecMath.h: Global helper functions for table vector mathematics
00002 //# Copyright (C) 1994,1995,1999
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: TVecMath.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef TABLES_TVECMATH_H
00029 #define TABLES_TVECMATH_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 //# Forward Declarations
00037 template<class T> class TabVecRep;
00038 
00039 
00040 // <summary>
00041 // Basic math for table vectors.
00042 // </summary>
00043 
00044 // <use visibility=local>
00045 
00046 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00047 // </reviewed>
00048 
00049 // <synopsis>
00050 // These global functions do the basic math for table vectors.
00051 // This means addition, subtraction, multiplication, division
00052 // and negation.
00053 // In case two table vectors are used, the left and right operand
00054 // must be conformant (i.e. have equal length).
00055 // </synopsis>
00056 
00057 // <group name=basicMath>
00058 // Add 2 table vectors storing result in first one.
00059 template<class T> void tabVecReptvassadd (TabVecRep<T>&, const TabVecRep<T>&);
00060 // Subtract 2 table vectors storing result in first one.
00061 template<class T> void tabVecReptvasssub (TabVecRep<T>&, const TabVecRep<T>&);
00062 // Multiple 2 table vectors storing result in first one.
00063 template<class T> void tabVecReptvasstim (TabVecRep<T>&, const TabVecRep<T>&);
00064 // Divide 2 table vectors storing result in first one.
00065 template<class T> void tabVecReptvassdiv (TabVecRep<T>&, const TabVecRep<T>&);
00066 
00067 // Add a scalar to each element in the table vector.
00068 template<class T> void tabVecRepvalassadd (TabVecRep<T>&, const T&);
00069 // Subtract a scalar from each element in the table vector.
00070 template<class T> void tabVecRepvalasssub (TabVecRep<T>&, const T&);
00071 // Multiple each element in the table vector with a scalar.
00072 template<class T> void tabVecRepvalasstim (TabVecRep<T>&, const T&);
00073 // Divide each element in the table vector by a scalar.
00074 template<class T> void tabVecRepvalassdiv (TabVecRep<T>&, const T&);
00075 
00076 // Unary minus - store result in a new vector.
00077 // <note role=tip>
00078 // (unary plus is already handled in TabVecMath).
00079 // </note>
00080 //
00081 template<class T> TabVecRep<T>& tabVecRepnegate (const TabVecRep<T>&);
00082 
00083 // Add 2 table vectors storing result in a new one.
00084 template<class T> TabVecRep<T>& tabVecReptvadd (const TabVecRep<T>&,
00085                                                 const TabVecRep<T>&);
00086 // Subtract 2 table vectors storing result in a new one.
00087 template<class T> TabVecRep<T>& tabVecReptvsub (const TabVecRep<T>&,
00088                                                 const TabVecRep<T>&);
00089 // Multiple 2 table vectors storing result in a new one.
00090 template<class T> TabVecRep<T>& tabVecReptvtim (const TabVecRep<T>&,
00091                                                 const TabVecRep<T>&);
00092 // Divide 2 table vectors storing result in a new one.
00093 template<class T> TabVecRep<T>& tabVecReptvdiv (const TabVecRep<T>&,
00094                                                 const TabVecRep<T>&);
00095 
00096 // Add a scalar to each element in the table vector storing result
00097 // in a new table vector.
00098 template<class T> TabVecRep<T>& tabVecRepvalradd (const TabVecRep<T>&,
00099                                                   const T&);
00100 // Subtract a scalar from each element in the table vector storing result
00101 // in a new table vector.
00102 template<class T> TabVecRep<T>& tabVecRepvalrsub (const TabVecRep<T>&,
00103                                                   const T&);
00104 // Multiple each element in the table vector with a scalar storing result
00105 // in a new table vector.
00106 template<class T> TabVecRep<T>& tabVecRepvalrtim (const TabVecRep<T>&,
00107                                                   const T&);
00108 // Divide each element in the table vector by a scalar storing result
00109 // in a new table vector.
00110 template<class T> TabVecRep<T>& tabVecRepvalrdiv (const TabVecRep<T>&,
00111                                                   const T&);
00112 
00113 // Add a scalar to each element in the table vector storing result
00114 // in a new table vector.
00115 template<class T> TabVecRep<T>& tabVecRepvalladd (const T&,
00116                                                   const TabVecRep<T>&);
00117 // Subtract a scalar from each element in the table vector storing result
00118 // in a new table vector.
00119 template<class T> TabVecRep<T>& tabVecRepvallsub (const T&,
00120                                                   const TabVecRep<T>&);
00121 // Multiple each element in the table vector with a scalar storing result
00122 // in a new table vector.
00123 template<class T> TabVecRep<T>& tabVecRepvalltim (const T&,
00124                                                   const TabVecRep<T>&);
00125 // Divide each element in the table vector by a scalar storing result
00126 // in a new table vector.
00127 template<class T> TabVecRep<T>& tabVecRepvalldiv (const T&,
00128                                                   const TabVecRep<T>&);
00129 // </group>
00130 
00131 
00132 
00133 // <summary>
00134 // Transcendental math for table vectors.
00135 // </summary>
00136 
00137 // <use visibility=local>
00138 
00139 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00140 // </reviewed>
00141 
00142 // <synopsis>
00143 // These global functions do the transcendental math for table vectors
00144 // for essentially all numeric types.
00145 // The functions are sin, sinh, exp, log, pow, etc..
00146 // In case two table vectors are used, the left and right operand
00147 // must be conformant (i.e. have equal length).
00148 // </synopsis>
00149 
00150 // <group name=basicTransMath>
00151 template<class T> TabVecRep<T>& tabVecRepcos  (const TabVecRep<T>&);
00152 template<class T> TabVecRep<T>& tabVecRepcosh (const TabVecRep<T>&);
00153 template<class T> TabVecRep<T>& tabVecRepexp  (const TabVecRep<T>&);
00154 template<class T> TabVecRep<T>& tabVecReplog  (const TabVecRep<T>&);
00155 template<class T> TabVecRep<T>& tabVecReplog10(const TabVecRep<T>&);
00156 template<class T> TabVecRep<T>& tabVecReppow  (const TabVecRep<T>&,
00157                                                const TabVecRep<T>&);
00158 template<class T> TabVecRep<T>& tabVecRepsin  (const TabVecRep<T>&);
00159 template<class T> TabVecRep<T>& tabVecRepsinh (const TabVecRep<T>&);
00160 template<class T> TabVecRep<T>& tabVecRepsqrt (const TabVecRep<T>&);
00161 // </group>
00162 
00163 
00164 
00165 // <summary>
00166 // Further transcendental math for table vectors.
00167 // </summary>
00168 
00169 // <use visibility=local>
00170 
00171 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00172 // </reviewed>
00173 
00174 // <synopsis>
00175 // These global functions do the transcendental math for table vectors
00176 // for a limited set of numeric types.
00177 // The functions are asin, ceil, etc..
00178 // In case two table vectors are used, the left and right operand
00179 // must be conformant (i.e. have equal length).
00180 // </synopsis>
00181 
00182 // <group name=advTransMath>
00183 template<class T> TabVecRep<T>& tabVecRepacos (const TabVecRep<T>&);
00184 template<class T> TabVecRep<T>& tabVecRepasin (const TabVecRep<T>&);
00185 template<class T> TabVecRep<T>& tabVecRepatan (const TabVecRep<T>&);
00186 template<class T> TabVecRep<T>& tabVecRepatan2(const TabVecRep<T>&,
00187                                                const TabVecRep<T>&);
00188 template<class T> TabVecRep<T>& tabVecRepceil (const TabVecRep<T>&);
00189 template<class T> TabVecRep<T>& tabVecRepfabs (const TabVecRep<T>&);
00190 template<class T> TabVecRep<T>& tabVecRepfloor(const TabVecRep<T>&);
00191 template<class T> TabVecRep<T>& tabVecRepfmod (const TabVecRep<T>&,
00192                                                const TabVecRep<T>&);
00193 template<class T> TabVecRep<T>& tabVecReppow  (const TabVecRep<T>&,
00194                                                const double&);
00195 template<class T> TabVecRep<T>& tabVecReptan  (const TabVecRep<T>&);
00196 template<class T> TabVecRep<T>& tabVecReptanh (const TabVecRep<T>&);
00197 // </group>
00198 
00199 
00200 
00201 // <summary>
00202 // Miscellaneous table vector operations.
00203 // </summary>
00204 
00205 // <use visibility=local>
00206 
00207 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00208 // </reviewed>
00209 
00210 // <synopsis>
00211 // Fill a table vector or calculate the sum, product, minimum or
00212 // maximum of its elements.
00213 // </synopsis>
00214 
00215 // <group name=miscellaneous>
00216 // Determine minimum and maximum value in a table vector.
00217 // Requires that the type "T" has comparison operators.
00218 template<class T> void tabVecRepminmax (T& min, T& max, const TabVecRep<T>&);
00219 
00220 // Fills all elements of the table vector with a sequence starting with
00221 // "start" and incrementing by "inc" for each element.
00222 template<class T> void tabVecRepindgen (TabVecRep<T>&, Int start, Int inc);
00223 
00224 // Sum of all the elements of a table vector.
00225 template<class T> T tabVecRepsum (const TabVecRep<T>&);
00226 
00227 // Product of all the elements of a table vector.
00228 // <note role=warning>
00229 // product can easily overflow.
00230 // </note>
00231 template<class T> T tabVecRepproduct (const TabVecRep<T>&);
00232 // </group>
00233 
00234 
00235 
00236 
00237 // <summary>
00238 // Vector operations on a table vector.
00239 // </summary>
00240 
00241 // <use visibility=local>
00242 
00243 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00244 // </reviewed>
00245 
00246 // <synopsis>
00247 // Do vector operations on a table vector (like inner product).
00248 // </synopsis>
00249 
00250 // <group name=vectorMath>
00251 // The inner product of 2 table vectors.
00252 template<class T> T tabVecRepinnerproduct (const TabVecRep<T>&,
00253                                            const TabVecRep<T>&);
00254 
00255 // The norm of a table vector.
00256 template<class T> T tabVecRepnorm (const TabVecRep<T>&);
00257 
00258 // The cross product of 2 table vectors containing 3 elements.
00259 template<class T> TabVecRep<T>& tabVecRepcrossproduct (const TabVecRep<T>&,
00260                                                        const TabVecRep<T>&);
00261 // </group>
00262 
00263 
00264 
00265 } //# NAMESPACE CASA - END
00266 
00267 #ifndef CASACORE_NO_AUTO_TEMPLATES
00268 #include <tables/Tables/TVecMath.tcc>
00269 #endif //# CASACORE_NO_AUTO_TEMPLATES
00270 #endif