nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
signal/include/nk/signal/convolution/extras.hpp
Go to the documentation of this file.
1
3// toolboxes/signal/include/nk/signal/convolution/extras.hpp
4//
5// Convolution / correlation extras (E1):
6// cconv(x, y[, n]) — circular convolution
7// convmtx(h, n) — convolution matrix
8// xcorr2(A, B) — 2-D cross-correlation
9// finddelay(x, y[, max]) — lag of max(xcorr(x, y))
10// alignsignals(x, y[, max]) — align two signals by zero-padding
11
12#pragma once
13
14#include <memory_resource>
15#include <nk/value/value.hpp>
16
17#include <tuple>
18
19namespace nk::signal {
20
23
24
42Value cconv(const Value & x,
43 const Value & y,
44 size_t n = 0,
45 std::pmr::memory_resource * mr = nullptr);
46
63 size_t n,
64 std::pmr::memory_resource * mr = nullptr);
65
77Value xcorr2(const Value & A,
78 const Value & B,
79 std::pmr::memory_resource * mr = nullptr);
80
93long finddelay(const Value & x,
94 const Value & y,
95 long max_lag = 0,
96 std::pmr::memory_resource * mr = nullptr);
97
109std::tuple<Value, Value>
111 const Value & y,
112 long max_lag = 0,
113 std::pmr::memory_resource * mr = nullptr);
114
115
117} // namespace nk::signal
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
std::tuple< Value, Value > alignsignals(const Value &x, const Value &y, long max_lag=0, std::pmr::memory_resource *mr=nullptr)
Align two signals by zero-padding the leading one.
Value cconv(const Value &x, const Value &y, size_t n=0, std::pmr::memory_resource *mr=nullptr)
Circular (cyclic) convolution of two real vectors.
Value convmtx(const Value &h, size_t n, std::pmr::memory_resource *mr=nullptr)
Convolution matrix for an impulse response.
long finddelay(const Value &x, const Value &y, long max_lag=0, std::pmr::memory_resource *mr=nullptr)
Estimate the integer delay between two signals.
Value xcorr2(const Value &A, const Value &B, std::pmr::memory_resource *mr=nullptr)
2-D cross-correlation of two real matrices.