22 return ::malloc(bytes);
31inline void copy(
const T* src, T* dst, int32_t n)
33 memcpy(dst, src, n *
sizeof(T));
37inline void add(
const T* src1,
const T* src2, T* dst, int32_t n)
39 for (int32_t i = 0; i < n; i++)
40 dst[i] = src1[i] + src2[i];
44inline void subtract(
const T* src1,
const T* src2, T* dst, int32_t n)
46 for (int32_t i = 0; i < n; i++)
47 dst[i] = src2[i] - src1[i];
53 for (int32_t i = 0; i < n; i++)
54 dst[i] = src[i] * constant;
60 for (int32_t i = 0; i < n; i++)
61 dst[i] += src[i] * constant;
65inline void multiply(
const T* src1,
const T* src2, T* dst, int32_t n)
67 for (int32_t i = 0; i < n; i++)
68 dst[i] = src1[i] * src2[i];
74 std::fill(dst, dst + n, 0.f);
78inline void findMaxElement(
const T* src, int32_t n, int32_t& maxIndex, T& maxValue)
83 for (int32_t i = 1; i < n; i++)
85 if (src[i] > maxValue)
93inline void calcPhases(
const std::complex<float>* src,
float* dst, int32_t n)
95 for (int32_t i = 0; i < n; i++)
96 dst[i] = std::arg(src[i]);
99inline void calcMagnitudes(
const std::complex<float>* src,
float* dst, int32_t n)
101 for (int32_t i = 0; i < n; i++)
102 dst[i] = std::abs(src[i]);
107 for (int32_t i = 0; i < n; i++)
108 dst[i] = std::polar<float>(srcMag[i], srcPh[i]);
void * allocate(int32_t bytes)
void subtract(const T *src1, const T *src2, T *dst, int32_t n)
void multiply(const T *src1, const T *src2, T *dst, int32_t n)
void calcPhases(const std::complex< float > *src, float *dst, int32_t n)
void setToZero(T *dst, int32_t n)
void findMaxElement(const T *src, int32_t n, int32_t &maxIndex, T &maxValue)
void add(const T *src1, const T *src2, T *dst, int32_t n)
void convertPolarToCartesian(const float *srcMag, const float *srcPh, std::complex< float > *dst, int32_t n)
void constantMultiplyAndAdd(const T *src, T constant, T *dst, int32_t n)
void calcMagnitudes(const std::complex< float > *src, float *dst, int32_t n)
void copy(const T *src, T *dst, int32_t n)
void constantMultiply(const T *src, T constant, T *dst, int32_t n)