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 CASA_ARRAYMATH_H
00029 #define CASA_ARRAYMATH_H
00030
00031 #include <casacore/casa/aips.h>
00032 #include <casacore/casa/BasicMath/Math.h>
00033 #include <casacore/casa/BasicMath/Functors.h>
00034 #include <casacore/casa/Arrays/Array.h>
00035
00036 #include <casacore/casa/BasicSL/Complex.h>
00037 #include <casacore/casa/Utilities/Assert.h>
00038 #include <casacore/casa/Exceptions/Error.h>
00039 #include <numeric>
00040 #include <functional>
00041
00042 namespace casacore {
00043
00044 template<class T> class Matrix;
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 template<typename _InputIterator1, typename T,
00150 typename _OutputIterator, typename _BinaryOperation>
00151 void
00152 myltransform(_InputIterator1 __first1, _InputIterator1 __last1,
00153 _OutputIterator __result, T left,
00154 _BinaryOperation __binary_op)
00155 {
00156 for ( ; __first1 != __last1; ++__first1, ++__result)
00157 *__result = __binary_op(left, *__first1);
00158 }
00159
00160 template<typename _InputIterator1, typename T,
00161 typename _OutputIterator, typename _BinaryOperation>
00162 void
00163 myrtransform(_InputIterator1 __first1, _InputIterator1 __last1,
00164 _OutputIterator __result, T right,
00165 _BinaryOperation __binary_op)
00166 {
00167 for ( ; __first1 != __last1; ++__first1, ++__result)
00168 *__result = __binary_op(*__first1, right);
00169 }
00170
00171 template<typename _InputIterator1, typename T,
00172 typename _BinaryOperation>
00173 void
00174 myiptransform(_InputIterator1 __first1, _InputIterator1 __last1,
00175 T right,
00176 _BinaryOperation __binary_op)
00177 {
00178 for ( ; __first1 != __last1; ++__first1)
00179 *__first1 = __binary_op(*__first1, right);
00180 }
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191 template<typename L, typename R, typename RES, typename BinaryOperator>
00192 inline void arrayContTransform (const Array<L>& left, const Array<R>& right,
00193 Array<RES>& result, BinaryOperator op)
00194 {
00195 DebugAssert (result.contiguousStorage(), AipsError);
00196 if (left.contiguousStorage() && right.contiguousStorage()) {
00197 std::transform (left.cbegin(), left.cend(), right.cbegin(),
00198 result.cbegin(), op);
00199 } else {
00200 std::transform (left.begin(), left.end(), right.begin(),
00201 result.cbegin(), op);
00202 }
00203 }
00204
00205
00206
00207 template<typename L, typename R, typename RES, typename BinaryOperator>
00208 inline void arrayContTransform (const Array<L>& left, R right,
00209 Array<RES>& result, BinaryOperator op)
00210 {
00211 DebugAssert (result.contiguousStorage(), AipsError);
00212 if (left.contiguousStorage()) {
00213 myrtransform (left.cbegin(), left.cend(),
00214 result.cbegin(), right, op);
00217 } else {
00218 myrtransform (left.begin(), left.end(),
00219 result.cbegin(), right, op);
00222 }
00223 }
00224
00225
00226
00227 template<typename L, typename R, typename RES, typename BinaryOperator>
00228 inline void arrayContTransform (L left, const Array<R>& right,
00229 Array<RES>& result, BinaryOperator op)
00230 {
00231 DebugAssert (result.contiguousStorage(), AipsError);
00232 if (right.contiguousStorage()) {
00233 myltransform (right.cbegin(), right.cend(),
00234 result.cbegin(), left, op);
00237 } else {
00238 myltransform (right.begin(), right.end(),
00239 result.cbegin(), left, op);
00242 }
00243 }
00244
00245
00246
00247 template<typename T, typename RES, typename UnaryOperator>
00248 inline void arrayContTransform (const Array<T>& arr,
00249 Array<RES>& result, UnaryOperator op)
00250 {
00251 DebugAssert (result.contiguousStorage(), AipsError);
00252 if (arr.contiguousStorage()) {
00253 std::transform (arr.cbegin(), arr.cend(), result.cbegin(), op);
00254 } else {
00255 std::transform (arr.begin(), arr.end(), result.cbegin(), op);
00256 }
00257 }
00258
00259
00260
00261 template<typename L, typename R, typename RES, typename BinaryOperator>
00262 void arrayTransform (const Array<L>& left, const Array<R>& right,
00263 Array<RES>& result, BinaryOperator op);
00264
00265
00266
00267 template<typename L, typename R, typename RES, typename BinaryOperator>
00268 void arrayTransform (const Array<L>& left, R right,
00269 Array<RES>& result, BinaryOperator op);
00270
00271
00272
00273 template<typename L, typename R, typename RES, typename BinaryOperator>
00274 void arrayTransform (L left, const Array<R>& right,
00275 Array<RES>& result, BinaryOperator op);
00276
00277
00278
00279 template<typename T, typename RES, typename UnaryOperator>
00280 void arrayTransform (const Array<T>& arr,
00281 Array<RES>& result, UnaryOperator op);
00282
00283
00284
00285 template<typename T, typename BinaryOperator>
00286 Array<T> arrayTransformResult (const Array<T>& left, const Array<T>& right,
00287 BinaryOperator op);
00288
00289
00290
00291 template<typename T, typename BinaryOperator>
00292 Array<T> arrayTransformResult (const Array<T>& left, T right, BinaryOperator op);
00293
00294
00295
00296 template<typename T, typename BinaryOperator>
00297 Array<T> arrayTransformResult (T left, const Array<T>& right, BinaryOperator op);
00298
00299
00300
00301 template<typename T, typename UnaryOperator>
00302 Array<T> arrayTransformResult (const Array<T>& arr, UnaryOperator op);
00303
00304
00305
00306 template<typename L, typename R, typename BinaryOperator>
00307 inline void arrayTransformInPlace (Array<L>& left, const Array<R>& right,
00308 BinaryOperator op)
00309 {
00310 if (left.contiguousStorage() && right.contiguousStorage()) {
00311 transformInPlace (left.cbegin(), left.cend(), right.cbegin(), op);
00312 } else {
00313 transformInPlace (left.begin(), left.end(), right.begin(), op);
00314 }
00315 }
00316
00317
00318
00319 template<typename L, typename R, typename BinaryOperator>
00320 inline void arrayTransformInPlace (Array<L>& left, R right, BinaryOperator op)
00321 {
00322 if (left.contiguousStorage()) {
00323 myiptransform (left.cbegin(), left.cend(), right, op);
00325 } else {
00326 myiptransform (left.begin(), left.end(), right, op);
00328 }
00329 }
00330
00331
00332
00333
00334 template<typename T, typename UnaryOperator>
00335 inline void arrayTransformInPlace (Array<T>& arr, UnaryOperator op)
00336 {
00337 if (arr.contiguousStorage()) {
00338 transformInPlace (arr.cbegin(), arr.cend(), op);
00339 } else {
00340 transformInPlace (arr.begin(), arr.end(), op);
00341 }
00342 }
00343
00344
00345
00346
00347
00348
00349 template<class T> void operator+= (Array<T> &left, const Array<T> &other);
00350 template<class T> void operator-= (Array<T> &left, const Array<T> &other);
00351 template<class T> void operator*= (Array<T> &left, const Array<T> &other);
00352 template<class T> void operator/= (Array<T> &left, const Array<T> &other);
00353 template<class T> void operator%= (Array<T> &left, const Array<T> &other);
00354 template<class T> void operator&= (Array<T> &left, const Array<T> &other);
00355 template<class T> void operator|= (Array<T> &left, const Array<T> &other);
00356 template<class T> void operator^= (Array<T> &left, const Array<T> &other);
00357
00358
00359
00360
00361
00362
00363 template<class T> void operator+= (Array<T> &left, const T &other);
00364 template<class T> void operator-= (Array<T> &left, const T &other);
00365 template<class T> void operator*= (Array<T> &left, const T &other);
00366 template<class T> void operator/= (Array<T> &left, const T &other);
00367 template<class T> void operator%= (Array<T> &left, const T &other);
00368 template<class T> void operator&= (Array<T> &left, const T &other);
00369 template<class T> void operator|= (Array<T> &left, const T &other);
00370 template<class T> void operator^= (Array<T> &left, const T &other);
00371
00372
00373
00374
00375
00376 template<class T> Array<T> operator+(const Array<T> &a);
00377 template<class T> Array<T> operator-(const Array<T> &a);
00378 template<class T> Array<T> operator~(const Array<T> &a);
00379
00380
00381
00382
00383
00384 template<class T>
00385 Array<T> operator+ (const Array<T> &left, const Array<T> &right);
00386 template<class T>
00387 Array<T> operator- (const Array<T> &left, const Array<T> &right);
00388 template<class T>
00389 Array<T> operator* (const Array<T> &left, const Array<T> &right);
00390 template<class T>
00391 Array<T> operator/ (const Array<T> &left, const Array<T> &right);
00392 template<class T>
00393 Array<T> operator% (const Array<T> &left, const Array<T> &right);
00394 template<class T>
00395 Array<T> operator| (const Array<T> &left, const Array<T> &right);
00396 template<class T>
00397 Array<T> operator& (const Array<T> &left, const Array<T> &right);
00398 template<class T>
00399 Array<T> operator^ (const Array<T> &left, const Array<T> &right);
00400
00401
00402
00403
00404
00405
00406 template<class T>
00407 Array<T> operator+ (const Array<T> &left, const T &right);
00408 template<class T>
00409 Array<T> operator- (const Array<T> &left, const T &right);
00410 template<class T>
00411 Array<T> operator* (const Array<T> &left, const T &right);
00412 template<class T>
00413 Array<T> operator/ (const Array<T> &left, const T &right);
00414 template<class T>
00415 Array<T> operator% (const Array<T> &left, const T &right);
00416 template<class T>
00417 Array<T> operator| (const Array<T> &left, const T &right);
00418 template<class T>
00419 Array<T> operator& (const Array<T> &left, const T &right);
00420 template<class T>
00421 Array<T> operator^ (const Array<T> &left, const T &right);
00422
00423
00424
00425
00426
00427
00428 template<class T>
00429 Array<T> operator+ (const T &left, const Array<T> &right);
00430 template<class T>
00431 Array<T> operator- (const T &left, const Array<T> &right);
00432 template<class T>
00433 Array<T> operator* (const T &left, const Array<T> &right);
00434 template<class T>
00435 Array<T> operator/ (const T &left, const Array<T> &right);
00436 template<class T>
00437 Array<T> operator% (const T &left, const Array<T> &right);
00438 template<class T>
00439 Array<T> operator| (const T &left, const Array<T> &right);
00440 template<class T>
00441 Array<T> operator& (const T &left, const Array<T> &right);
00442 template<class T>
00443 Array<T> operator^ (const T &left, const Array<T> &right);
00444
00445
00446
00447
00448
00449
00450 template<class T> Array<T> cos(const Array<T> &a);
00451 template<class T> Array<T> cosh(const Array<T> &a);
00452 template<class T> Array<T> exp(const Array<T> &a);
00453 template<class T> Array<T> log(const Array<T> &a);
00454 template<class T> Array<T> log10(const Array<T> &a);
00455 template<class T> Array<T> pow(const Array<T> &a, const Array<T> &b);
00456 template<class T> Array<T> pow(const T &a, const Array<T> &b);
00457 template<class T> Array<T> sin(const Array<T> &a);
00458 template<class T> Array<T> sinh(const Array<T> &a);
00459 template<class T> Array<T> sqrt(const Array<T> &a);
00460
00461
00462
00463
00464
00465
00466
00467 template<class T> Array<T> acos(const Array<T> &a);
00468 template<class T> Array<T> asin(const Array<T> &a);
00469 template<class T> Array<T> atan(const Array<T> &a);
00470 template<class T> Array<T> atan2(const Array<T> &y, const Array<T> &x);
00471 template<class T> Array<T> atan2(const T &y, const Array<T> &x);
00472 template<class T> Array<T> atan2(const Array<T> &y, const T &x);
00473 template<class T> Array<T> ceil(const Array<T> &a);
00474 template<class T> Array<T> fabs(const Array<T> &a);
00475 template<class T> Array<T> abs(const Array<T> &a);
00476 template<class T> Array<T> floor(const Array<T> &a);
00477 template<class T> Array<T> round(const Array<T> &a);
00478 template<class T> Array<T> sign(const Array<T> &a);
00479 template<class T> Array<T> fmod(const Array<T> &a, const Array<T> &b);
00480 template<class T> Array<T> fmod(const T &a, const Array<T> &b);
00481 template<class T> Array<T> fmod(const Array<T> &a, const T &b);
00482 template<class T> Array<T> floormod(const Array<T> &a, const Array<T> &b);
00483 template<class T> Array<T> floormod(const T &a, const Array<T> &b);
00484 template<class T> Array<T> floormod(const Array<T> &a, const T &b);
00485 template<class T> Array<T> pow(const Array<T> &a, const Double &b);
00486 template<class T> Array<T> tan(const Array<T> &a);
00487 template<class T> Array<T> tanh(const Array<T> &a);
00488
00489 template<class T> Array<T> fabs(const Array<T> &a);
00490
00491
00492
00493
00494
00495 template<class ScalarType>
00496 void minMax(ScalarType &minVal, ScalarType &maxVal, IPosition &minPos,
00497 IPosition &maxPos, const Array<ScalarType> &array);
00498
00499
00500
00501 template<class ScalarType>
00502 void minMax(ScalarType &minVal, ScalarType &maxVal, IPosition &minPos,
00503 IPosition &maxPos, const Array<ScalarType> &array,
00504 const Array<Bool> &mask, Bool valid=True);
00505
00506 template<class ScalarType>
00507 void minMaxMasked(ScalarType &minVal, ScalarType &maxVal, IPosition &minPos,
00508 IPosition &maxPos, const Array<ScalarType> &array,
00509 const Array<ScalarType> &weight);
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519 template<class T> void minMax(T &min, T &max, const Array<T> &a);
00520
00521
00522
00523 template<class T> T min(const Array<T> &a);
00524
00525
00526 template<class T> T max(const Array<T> &a);
00527
00528
00529
00530 template<class T> void max(Array<T> &result, const Array<T> &a,
00531 const Array<T> &b);
00532
00533
00534 template<class T> void min(Array<T> &result, const Array<T> &a,
00535 const Array<T> &b);
00536
00537
00538 template<class T> Array<T> max(const Array<T> &a, const Array<T> &b);
00539 template<class T> Array<T> max(const T &a, const Array<T> &b);
00540
00541
00542 template<class T> Array<T> min(const Array<T> &a, const Array<T> &b);
00543
00544
00545
00546 template<class T> void max(Array<T> &result, const Array<T> &a,
00547 const T &b);
00548 template<class T> inline void max(Array<T> &result, const T &a,
00549 const Array<T> &b)
00550 { max (result, b, a); }
00551
00552
00553 template<class T> void min(Array<T> &result, const Array<T> &a,
00554 const T &b);
00555 template<class T> inline void min(Array<T> &result, const T &a,
00556 const Array<T> &b)
00557 { min (result, b, a); }
00558
00559 template<class T> Array<T> max(const Array<T> &a, const T &b);
00560 template<class T> inline Array<T> max(const T &a, const Array<T> &b)
00561 { return max(b, a); }
00562
00563 template<class T> Array<T> min(const Array<T> &a, const T &b);
00564 template<class T> inline Array<T> min(const T &a, const Array<T> &b)
00565 { return min(b, a); }
00566
00567
00568
00569
00570
00571
00572 template<class T> void indgen(Array<T> &a, T start, T inc);
00573
00574
00575
00576
00577 template<class T> inline void indgen(Array<T> &a)
00578 { indgen(a, T(0), T(1)); }
00579
00580
00581
00582
00583 template<class T> inline void indgen(Array<T> &a, T start)
00584 { indgen(a, start, T(1)); }
00585
00586
00587
00588 template<class T> inline Vector<T> indgen(uInt length, T start, T inc)
00589 {
00590 Vector<T> x(length);
00591 indgen(x, start, inc);
00592 return x;
00593 }
00594
00595
00596
00597 template<class T> T sum(const Array<T> &a);
00598
00599
00600 template<class T> T sumsqr(const Array<T> &a);
00601
00602
00603
00604 template<class T> T product(const Array<T> &a);
00605
00606
00607
00608
00609 template<class T> T mean(const Array<T> &a);
00610
00611
00612
00613
00614 template<class T> T variance(const Array<T> &a);
00615
00616
00617
00618
00619 template<class T> T variance(const Array<T> &a, T mean);
00620
00621
00622
00623 template<class T> T stddev(const Array<T> &a);
00624
00625
00626
00627 template<class T> T stddev(const Array<T> &a, T mean);
00628
00629
00630
00631
00632 template<class T> T avdev(const Array<T> &a);
00633
00634
00635
00636
00637 template<class T> T avdev(const Array<T> &a,T mean);
00638
00639
00640
00641 template<class T> T rms(const Array<T> &a);
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662 template<class T> T median(const Array<T> &a, Block<T> &tmp, Bool sorted,
00663 Bool takeEvenMean, Bool inPlace=False);
00664 template<class T> T median(const Array<T> &a, Bool sorted, Bool takeEvenMean,
00665 Bool inPlace=False)
00666 { Block<T> tmp; return median (a, tmp, sorted, takeEvenMean, inPlace); }
00667 template<class T> inline T median(const Array<T> &a, Bool sorted)
00668 { return median (a, sorted, (a.nelements() <= 100), False); }
00669 template<class T> inline T median(const Array<T> &a)
00670 { return median (a, False, (a.nelements() <= 100), False); }
00671 template<class T> inline T medianInPlace(const Array<T> &a, Bool sorted=False)
00672 { return median (a, sorted, (a.nelements() <= 100), True); }
00673
00674
00675
00676
00677
00678 template<class T> T madfm(const Array<T> &a, Block<T> &tmp, Bool sorted,
00679 Bool takeEvenMean, Bool inPlace = False);
00680 template<class T> T madfm(const Array<T> &a, Bool sorted, Bool takeEvenMean,
00681 Bool inPlace=False)
00682 { Block<T> tmp; return madfm(a, tmp, sorted, takeEvenMean, inPlace); }
00683 template<class T> inline T madfm(const Array<T> &a, Bool sorted)
00684 { return madfm(a, sorted, (a.nelements() <= 100), False); }
00685 template<class T> inline T madfm(const Array<T> &a)
00686 { return madfm(a, False, (a.nelements() <= 100), False); }
00687 template<class T> inline T madfmInPlace(const Array<T> &a, Bool sorted=False)
00688 { return madfm(a, sorted, (a.nelements() <= 100), True); }
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698 template<class T> T fractile(const Array<T> &a, Block<T> &tmp, Float fraction,
00699 Bool sorted=False, Bool inPlace=False);
00700 template<class T> T fractile(const Array<T> &a, Float fraction,
00701 Bool sorted=False, Bool inPlace=False)
00702 { Block<T> tmp; return fractile (a, tmp, fraction, sorted, inPlace); }
00703
00704
00705
00706
00707 template<class T> T interFractileRange(const Array<T> &a, Block<T> &tmp,
00708 Float fraction,
00709 Bool sorted=False, Bool inPlace=False);
00710 template<class T> T interFractileRange(const Array<T> &a, Float fraction,
00711 Bool sorted=False, Bool inPlace=False)
00712 { Block<T> tmp; return interFractileRange(a, tmp, fraction, sorted, inPlace); }
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722 template<class T> T interHexileRange(const Array<T> &a, Block<T> &tmp,
00723 Bool sorted=False, Bool inPlace=False)
00724 { return interFractileRange(a, tmp, 1./6., sorted, inPlace); }
00725 template<class T> T interHexileRange(const Array<T> &a, Bool sorted=False,
00726 Bool inPlace=False)
00727 { return interFractileRange(a, 1./6., sorted, inPlace); }
00728
00729
00730
00731
00732
00733
00734 template<class T> T interQuartileRange(const Array<T> &a, Block<T> &tmp,
00735 Bool sorted=False, Bool inPlace=False)
00736 { return interFractileRange(a, tmp, 0.25, sorted, inPlace); }
00737 template<class T> T interQuartileRange(const Array<T> &a, Bool sorted=False,
00738 Bool inPlace=False)
00739 { return interFractileRange(a, 0.25, sorted, inPlace); }
00740
00741
00742
00743
00744
00745
00746 template<typename T>
00747 void operator*= (Array<std::complex<T> > &left, const Array<T> &other);
00748 template<typename T>
00749 void operator*= (Array<std::complex<T> > &left, const T &other);
00750 template<typename T>
00751 void operator/= (Array<std::complex<T> > &left, const Array<T> &other);
00752 template<typename T>
00753 void operator/= (Array<std::complex<T> > &left, const T &other);
00754 template<typename T>
00755 Array<std::complex<T> > operator* (const Array<std::complex<T> > &left,
00756 const Array<T> &right);
00757 template<typename T>
00758 Array<std::complex<T> > operator* (const Array<std::complex<T> > &left,
00759 const T &right);
00760 template<typename T>
00761 Array<std::complex<T> > operator* (const std::complex<T> &left,
00762 const Array<T> &right);
00763 template<typename T>
00764 Array<std::complex<T> > operator/ (const Array<std::complex<T> > &left,
00765 const Array<T> &right);
00766 template<typename T>
00767 Array<std::complex<T> > operator/ (const Array<std::complex<T> > &left,
00768 const T &right);
00769 template<typename T>
00770 Array<std::complex<T> > operator/ (const std::complex<T> &left,
00771 const Array<T> &right);
00772
00773
00774
00775
00776 Array<Complex> conj(const Array<Complex> &carray);
00777 Array<DComplex> conj(const Array<DComplex> &carray);
00778
00779 void conj(Array<Complex> &rarray, const Array<Complex> &carray);
00780 void conj(Array<DComplex> &rarray, const Array<DComplex> &carray);
00781
00782
00783 Matrix<Complex> conj(const Matrix<Complex> &carray);
00784 Matrix<DComplex> conj(const Matrix<DComplex> &carray);
00785
00786
00787
00788
00789
00790
00791 template<typename T>
00792 Array<std::complex<T> > makeComplex(const Array<T> &real, const Array<T>& imag);
00793 template<typename T>
00794 Array<std::complex<T> > makeComplex(const T &real, const Array<T>& imag);
00795 template<typename T>
00796 Array<std::complex<T> > makeComplex(const Array<T> &real, const T& imag);
00797
00798
00799
00800 template<typename L, typename R>
00801 void setReal(Array<L> &carray, const Array<R> &rarray);
00802
00803
00804 template<typename R, typename L>
00805 void setImag(Array<R> &carray, const Array<L> &rarray);
00806
00807
00808
00809 Array<Float> real(const Array<Complex> &carray);
00810 Array<Double> real(const Array<DComplex> &carray);
00811
00812 void real(Array<Float> &rarray, const Array<Complex> &carray);
00813 void real(Array<Double> &rarray, const Array<DComplex> &carray);
00814
00815
00816
00817
00818
00819 Array<Float> imag(const Array<Complex> &carray);
00820 Array<Double> imag(const Array<DComplex> &carray);
00821
00822 void imag(Array<Float> &rarray, const Array<Complex> &carray);
00823 void imag(Array<Double> &rarray, const Array<DComplex> &carray);
00824
00825
00826
00827
00828
00829
00830
00831 Array<Float> amplitude(const Array<Complex> &carray);
00832 Array<Double> amplitude(const Array<DComplex> &carray);
00833
00834 void amplitude(Array<Float> &rarray, const Array<Complex> &carray);
00835 void amplitude(Array<Double> &rarray, const Array<DComplex> &carray);
00836
00837
00838
00839
00840
00841
00842
00843 Array<Float> phase(const Array<Complex> &carray);
00844 Array<Double> phase(const Array<DComplex> &carray);
00845
00846 void phase(Array<Float> &rarray, const Array<Complex> &carray);
00847 void phase(Array<Double> &rarray, const Array<DComplex> &carray);
00848
00849
00850
00851
00852
00853
00854 Array<Float> ComplexToReal(const Array<Complex> &carray);
00855 Array<Double> ComplexToReal(const Array<DComplex> &carray);
00856
00857
00858 void ComplexToReal(Array<Float> &rarray, const Array<Complex> &carray);
00859 void ComplexToReal(Array<Double> &rarray, const Array<DComplex> &carray);
00860
00861
00862
00863
00864
00865
00866 Array<Complex> RealToComplex(const Array<Float> &rarray);
00867 Array<DComplex> RealToComplex(const Array<Double> &rarray);
00868
00869
00870 void RealToComplex(Array<Complex> &carray, const Array<Float> &rarray);
00871 void RealToComplex(Array<DComplex> &carray, const Array<Double> &rarray);
00872
00873
00874
00875
00876
00877
00878 template<class T, class U> void convertArray(Array<T> &to,
00879 const Array<U> &from);
00880
00881
00882
00883 template<class T> Array<T> square(const Array<T> &val);
00884
00885
00886 template<class T> Array<T> cube(const Array<T> &val);
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898 template<class T> void expandArray (Array<T>& out, const Array<T>& in,
00899 const IPosition& alternate=IPosition());
00900
00901 template<class T>
00902 T* expandRecursive (int axis, const IPosition& shp, const IPosition& mult,
00903 const IPosition& inSteps,
00904 const T* in, T* out, const IPosition& alternate);
00905
00906
00907 IPosition checkExpandArray (IPosition& mult,
00908 const IPosition& inShape,
00909 const IPosition& outShape,
00910 const IPosition& alternate);
00911
00912
00913
00914
00915
00916 }
00917
00918 #ifndef CASACORE_NO_AUTO_TEMPLATES
00919 #include <casacore/casa/Arrays/ArrayMath.tcc>
00920 #endif //# CASACORE_NO_AUTO_TEMPLATES
00921 #endif