dst
-
constexpr std::vector<Complex> dst(const std::vector<Complex> &X, int type = 2) noexcept
Calculates the discrete sine transform [1] of a complex sequence. For all DST types, algorithms from Chan and Ho [2] are used.
Parameters
Returns
The discrete sine transform performs the following operation:
\[\DeclareMathOperator\H{H}
X_k = \sum_{n = 0}^{N - 1}x_n \sin[\frac{\pi}{N}(n + \frac{1}{2})(k + 1)] \quad k = 0, \ldots, n-1,\]
The formula is slightly modified depending on the type.
Example
std::vector<Complex> X = {1 + 2_j, 2 + 3_j, 3, 4, 5};
std::vector<Complex> Y = dst(X, 2); // it's 2 by default.
for(int i = 0; i < Y.size(); i++){
std::cout << Y[i] << "\n";
}
Output:
19.4164 + 6.09017j
-8.50651 + 8.05748j
7.41641 + 5.09017j
-5.25731 + 0.277515j
6 - 2j
References