1#ifndef CASACORE_ALTERNATE_MANS_STOKES_I_CONVERSIONS_H_
2#define CASACORE_ALTERNATE_MANS_STOKES_I_CONVERSIONS_H_
15 for (
size_t i = 0; i != n; ++i) {
16 const size_t index = n - i - 1;
17 const T
value = data[index];
18 data[index * 4] =
value;
19 data[index * 4 + 1] = T();
20 data[index * 4 + 2] = T();
21 data[index * 4 + 3] =
value;
27 for (
size_t i = 0; i != n; ++i) {
28 const size_t index = n - i - 1;
29 const bool value = data[index];
30 data[index * 4] =
value;
31 data[index * 4 + 1] =
value;
32 data[index * 4 + 2] =
value;
33 data[index * 4 + 3] =
value;
44 for (
size_t i = n*2; i > 0; i -= 2) {
45 const size_t index = i - 2;
46 data[index * 2 + 3] = data[index + 1];
47 data[index * 2 + 2] = T();
48 data[index * 2 + 1] = T();
49 data[index * 2] = data[index];
66 for (
size_t i = 0; i != n; ++i) {
67 buffer[i] = T((input[i * 4] + input[i * 4 + 3]) * T(0.5));
68 if (input[i * 4 + 1] != T(0) || input[i * 4 + 2] != T(0))
69 throw std::runtime_error(
70 "Stokes-I storage modes cannot store data for which the 2nd and 3rd "
71 "correlation are non-zero");
82 for (
size_t i = 0; i != n; ++i) {
83 const bool a = input[i * 4];
84 const bool b = input[i * 4 + 1];
85 const bool c = input[i * 4 + 2];
86 const bool d = input[i * 4 + 3];
87 if (a != b || a != c || a != d)
88 throw std::runtime_error(
89 "Stokes-I storage modes cannot store boolean data for which not all "
90 "correlations are equal");
106 for (
size_t i = 0; i != n; ++i) {
107 const T b = input[i * 4 + 1];
108 const T c = input[i * 4 + 2];
109 if (b != T(0) || c != T(0))
110 throw std::runtime_error(
111 "Diagonal storage modes cannot store data for which the 2nd and 3rd "
112 "correlation are non-zero");
this file contains all the compiler specific defines
void ExpandFromDiagonal(T *data, size_t n)
Performs in-place expansion of n pair of diagonal values such that each pair becomes 4 values with ze...
T * TransformToStokesI(const T *input, T *buffer, size_t n)
Calculates for every set of 4 input values the Stokes-I values by doing out = 0.5 * (in_pp + in_qq),...
void CheckIsDiagonal(const T *input, size_t n)
Check if every set of 4 input values contains only non-zeros on the diagonal (pp or qq).
NewDelAllocator< T > NewDelAllocator< T >::value
void ExpandFromStokesI(T *data, size_t n)
Expands n values from single Stokes I values to have 4 values, in place.