00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef TABLES_TABVECMATH_H
00029 #define TABLES_TABVECMATH_H
00030
00031
00032
00033
00034
00035 #include <casacore/casa/aips.h>
00036 #include <casacore/casa/BasicMath/Math.h>
00037 #include <casacore/tables/Tables/TableVector.h>
00038 #include <casacore/tables/Tables/TVecMath.h>
00039
00040
00041 namespace casacore {
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 template<class T> inline
00063 void operator+= (TableVector<T>& left, const TableVector<T>& right);
00064
00065 template<class T> inline
00066 void operator-= (TableVector<T>& left, const TableVector<T>& right);
00067
00068 template<class T> inline
00069 void operator*= (TableVector<T>& left, const TableVector<T>& right);
00070
00071 template<class T> inline
00072 void operator/= (TableVector<T>& left, const TableVector<T>& right);
00073
00074
00075 template<class T> inline
00076 void operator+= (TableVector<T>& left, const T& right);
00077
00078 template<class T> inline
00079 void operator-= (TableVector<T>& left, const T& right);
00080
00081 template<class T> inline
00082 void operator*= (TableVector<T>& left, const T& right);
00083
00084 template<class T> inline
00085 void operator/= (TableVector<T>& left, const T& right);
00086
00087
00088 template<class T> inline
00089 TableVector<T> operator+ (const TableVector<T>&);
00090
00091 template<class T> inline
00092 TableVector<T> operator- (const TableVector<T>&);
00093
00094
00095 template<class T> inline
00096 TableVector<T> operator+ (const TableVector<T>& left,
00097 const TableVector<T>& right);
00098
00099 template<class T> inline
00100 TableVector<T> operator- (const TableVector<T>& left,
00101 const TableVector<T>& right);
00102
00103 template<class T> inline
00104 TableVector<T> operator* (const TableVector<T>& left,
00105 const TableVector<T>& right);
00106
00107 template<class T> inline
00108 TableVector<T> operator/ (const TableVector<T>& left,
00109 const TableVector<T>& right);
00110
00111
00112
00113 template<class T> inline
00114 TableVector<T> operator+ (const TableVector<T>& left, const T& right);
00115
00116
00117 template<class T> inline
00118 TableVector<T> operator- (const TableVector<T>& left, const T& right);
00119
00120
00121 template<class T> inline
00122 TableVector<T> operator* (const TableVector<T>& left, const T& right);
00123
00124
00125 template<class T> inline
00126 TableVector<T> operator/ (const TableVector<T>& left, const T& right);
00127
00128
00129
00130 template<class T> inline
00131 TableVector<T> operator+ (const T& left, const TableVector<T>& right);
00132
00133
00134 template<class T> inline
00135 TableVector<T> operator- (const T& left, const TableVector<T>& right);
00136
00137
00138 template<class T> inline
00139 TableVector<T> operator* (const T& left, const TableVector<T>& right);
00140
00141
00142 template<class T> inline
00143 TableVector<T> operator/ (const T& left, const TableVector<T>& right);
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 template<class T> inline TableVector<T> cos (const TableVector<T>&);
00167 template<class T> inline TableVector<T> cosh (const TableVector<T>&);
00168 template<class T> inline TableVector<T> exp (const TableVector<T>&);
00169 template<class T> inline TableVector<T> log (const TableVector<T>&);
00170 template<class T> inline TableVector<T> log10(const TableVector<T>&);
00171 template<class T> inline TableVector<T> pow (const TableVector<T>& value,
00172 const TableVector<T>& exponent);
00173 template<class T> inline TableVector<T> sin (const TableVector<T>&);
00174 template<class T> inline TableVector<T> sinh (const TableVector<T>&);
00175 template<class T> inline TableVector<T> sqrt (const TableVector<T>&);
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 template<class T> inline TableVector<T> acos (const TableVector<T>&);
00199 template<class T> inline TableVector<T> asin (const TableVector<T>&);
00200 template<class T> inline TableVector<T> atan (const TableVector<T>&);
00201 template<class T> inline TableVector<T> atan2(const TableVector<T>& y,
00202 const TableVector<T>& x);
00203 template<class T> inline TableVector<T> ceil (const TableVector<T>&);
00204 template<class T> inline TableVector<T> fabs (const TableVector<T>&);
00205 template<class T> inline TableVector<T> floor(const TableVector<T>&);
00206 template<class T> inline TableVector<T> fmod (const TableVector<T>& value,
00207 const TableVector<T>& modulo);
00208 template<class T> inline TableVector<T> pow (const TableVector<T>& value,
00209 const double& exponent);
00210 template<class T> inline TableVector<T> tan (const TableVector<T>&);
00211 template<class T> inline TableVector<T> tanh (const TableVector<T>&);
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234 template<class T> inline
00235 void minMax (T& min, T& max, const TableVector<T>&);
00236
00237
00238
00239 template<class T> inline
00240 T min (const TableVector<T>&);
00241
00242
00243
00244 template<class T> inline
00245 T max (const TableVector<T>&);
00246
00247
00248
00249 template<class T> inline
00250 void indgen (TableVector<T>&, Int start, Int inc);
00251
00252
00253
00254 template<class T> inline
00255 void indgen (TableVector<T>&, Int start);
00256
00257
00258
00259 template<class T> inline
00260 void indgen (TableVector<T>&);
00261
00262
00263 template<class T> inline
00264 T sum (const TableVector<T>&);
00265
00266
00267
00268
00269
00270 template<class T> inline T
00271 product (const TableVector<T>&);
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 template<class T> inline
00294 T innerProduct (const TableVector<T>& left,
00295 const TableVector<T>& right);
00296
00297
00298 template<class T> inline
00299 T norm (const TableVector<T>&);
00300
00301
00302 template<class T> inline
00303 TableVector<T> crossProduct (const TableVector<T>& left,
00304 const TableVector<T>& right);
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315 #define TABVECMATHOPER(NAME,OP,OPA) \
00316 template<class T> inline \
00317 TableVector<T> aips_name2(operato,OP) (const TableVector<T>& tv, \
00318 const T& v) \
00319 { return TableVector<T> (aips_name2(tabVecRepvalr,NAME) (tv.tabVec(), \
00320 v)); } \
00321 template<class T> inline \
00322 TableVector<T> aips_name2(operato,OP) (const T& v, \
00323 const TableVector<T>& tv) \
00324 { return TableVector<T> (aips_name2(tabVecRepvall,NAME) (v, \
00325 tv.tabVec())); } \
00326 template<class T> inline \
00327 TableVector<T> aips_name2(operato,OP) (const TableVector<T>& l, \
00328 const TableVector<T>& r) \
00329 { return TableVector<T> (aips_name2(tabVecReptv,NAME) (l.tabVec(), \
00330 r.tabVec())); } \
00331 template<class T> inline \
00332 void aips_name2(operato,OPA) (TableVector<T>& tv, const T& v) \
00333 { aips_name2(tabVecRepvalass,NAME) (tv.tabVec(), v); } \
00334 template<class T> inline \
00335 void aips_name2(operato,OPA) (TableVector<T>& l, \
00336 const TableVector<T>& r) \
00337 { aips_name2(tabVecReptvass,NAME) (l.tabVec(), r.tabVec()); }
00338
00339 TABVECMATHOPER(add,r+,r+=)
00340 TABVECMATHOPER(sub,r-,r-=)
00341 TABVECMATHOPER(tim,r*,r*=)
00342 TABVECMATHOPER(div,r/,r/=)
00343
00344
00345 #define TABVECMATHFUNC(NAME) \
00346 template<class T> inline \
00347 TableVector<T> NAME (const TableVector<T>& tv) \
00348 { return TableVector<T> (aips_name2(tabVecRep,NAME) (tv.tabVec())); }
00349 #define TABVECMATHFUNC2(NAME) \
00350 template<class T> inline \
00351 TableVector<T> NAME (const TableVector<T>& l, \
00352 const TableVector<T>& r) \
00353 { return TableVector<T> (aips_name2(tabVecRep,NAME) (l.tabVec(), \
00354 r.tabVec())); }
00355
00356 TABVECMATHFUNC (cos)
00357 TABVECMATHFUNC (cosh)
00358 TABVECMATHFUNC (exp)
00359 TABVECMATHFUNC (log)
00360 TABVECMATHFUNC (log10)
00361 TABVECMATHFUNC2(pow)
00362 TABVECMATHFUNC (sin)
00363 TABVECMATHFUNC (sinh)
00364 TABVECMATHFUNC (sqrt)
00365 TABVECMATHFUNC (acos)
00366 TABVECMATHFUNC (asin)
00367 TABVECMATHFUNC (atan)
00368 TABVECMATHFUNC2(atan2)
00369 TABVECMATHFUNC (ceil)
00370 TABVECMATHFUNC (fabs)
00371 TABVECMATHFUNC (floor)
00372 TABVECMATHFUNC2(fmod)
00373 TABVECMATHFUNC (tan)
00374 TABVECMATHFUNC (tanh)
00375
00376 template<class T> inline
00377 TableVector<T> pow (const TableVector<T>& tv, const double& exp)
00378 { return TableVector<T> (tabVecReppowd (tv.tabVec(), exp)); }
00379
00380
00381 template<class T> inline
00382 T sum (const TableVector<T>& tv)
00383 { return tabVecRepsum (tv.tabVec()); }
00384 template<class T> inline
00385 T product (const TableVector<T>& tv)
00386 { return tabVecRepproduct (tv.tabVec()); }
00387
00388
00389 template<class T> inline
00390 void minMax (T& min, T& max, const TableVector<T>& tv)
00391 { tabVecRepminmax (min, max, tv.tabVec()); }
00392 template<class T> inline
00393 T min (const TableVector<T>& tv)
00394 { T Min,Max; tabVecRepminmax (Min, Max, tv.tabVec()); return Min; }
00395 template<class T> inline
00396 T max (const TableVector<T>& tv)
00397 { T Min,Max; tabVecRepminmax (Min, Max, tv.tabVec()); return Max; }
00398
00399 template<class T> inline
00400 void indgen (TableVector<T>& tv, Int start, Int inc)
00401 { tabVecRepindgen (tv.tabVec(), start, inc); }
00402 template<class T> inline
00403 void indgen (TableVector<T>& tv, Int start)
00404 { tabVecRepindgen (tv.tabVec(), start, 1); }
00405 template<class T> inline
00406 void indgen (TableVector<T>& tv)
00407 { tabVecRepindgen (tv.tabVec(), 0, 1); }
00408
00409
00410 template<class T> inline
00411 T innerProduct (const TableVector<T>& l, const TableVector<T>& r)
00412 { return tabVecRepinnerproduct (l.tabVec(), r.tabVec()); }
00413 template<class T> inline
00414 T norm (const TableVector<T>& tv)
00415 { return tabVecRepnorm (tv.tabVec()); }
00416 template<class T> inline
00417 TableVector<T> crossProduct (const TableVector<T>& l,
00418 const TableVector<T>& r)
00419 { return TableVector<T> (tabVecRepcrossproduct (l.tabVec(), r.tabVec())); }
00420
00421
00422
00423 }
00424
00425 #endif