nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
transform_helpers.hpp
Go to the documentation of this file.
1
3// toolboxes/signal/include/nk/signal/transforms/transform_helpers.hpp
4//
5// Cross-cutting helpers for transform-domain code: nextpow2 (length
6// rounding for FFT), fftshift / ifftshift (DC-to-center reordering).
7
8#pragma once
9
10#include <memory_resource>
11#include <nk/value/value.hpp>
12
13namespace nk::signal {
14
17
18
29Value nextpow2(double n, std::pmr::memory_resource *mr = nullptr);
30
36Value nextpow2(const Value &x, std::pmr::memory_resource *mr = nullptr);
37
50Value fftshift(const Value &x, std::pmr::memory_resource *mr = nullptr);
51
61Value ifftshift(const Value &x, std::pmr::memory_resource *mr = nullptr);
62
70 int dim,
71 std::pmr::memory_resource * mr = nullptr);
72
79Value ifftshift(const Value &x, int dim,
80 std::pmr::memory_resource *mr = nullptr);
81
82
84} // namespace nk::signal
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
Value nextpow2(double n, std::pmr::memory_resource *mr=nullptr)
Smallest integer p such that (scalar form).
Value ifftshift(const Value &x, std::pmr::memory_resource *mr=nullptr)
Inverse of fftshift — shift by floor(extent/2).
Value fftshift(const Value &x, std::pmr::memory_resource *mr=nullptr)
DC-to-center reordering for FFT output (multidim form).