Skip to content

Commit bae23cf

Browse files
authored
Span API support (#51)
* Span API support - Remove auto cast `arr_real` to `arr_cmplx`; - Add `complex(re)` function; - Add `span` implementation; - Return `span` from `slice` function for step=1; - Remove `base_array` reference from `slice`; - Check same array by pointer range; - Simplify cast for `cmplx_t` type; - Add span iterators; - Add span api for some functions; - Add span API for `concatenate`. Empty span support; - Remove base_array::operator(int i); - Add non-copy fft solve functions; - Add CMakePresets.json; - Remove deprecated; - Rename `slice_t` to `mut_slice_t`; - Rename `const_slice_t` to `slice_t`; - Limit the set of types for base_array<T>; - Rename `span` to `make_span`; - Add some `DSPLIB_ASSERT`; - Fix benchs error; - Code refactoring; - Fix CI config; - Update tests;
1 parent 294e32f commit bae23cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1026
-493
lines changed

.github/workflows/android-ndk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
paths-ignore: ["README.md"]
66

77
pull_request:
8-
branches: [master]
8+
branches: [master, develop]
99

1010
env:
1111
BUILD_TYPE: Release

.github/workflows/linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
paths-ignore: ["README.md"]
66

77
pull_request:
8-
branches: [master]
8+
branches: [master, develop]
99

1010
env:
1111
BUILD_TYPE: Debug

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
paths-ignore: ["README.md"]
66

77
pull_request:
8-
branches: [master]
8+
branches: [master, develop]
99

1010
env:
1111
BUILD_TYPE: Release

CMakePresets.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"version": 8,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 18,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "default",
11+
"hidden": true,
12+
"generator": "Ninja",
13+
"binaryDir": "${sourceDir}/build",
14+
"cacheVariables": {
15+
"CMAKE_BUILD_TYPE": "Debug",
16+
"DSPLIB_BUILD_TESTS": "OFF",
17+
"DSPLIB_BUILD_BENCHS": "OFF",
18+
"DSPLIB_BUILD_EXAMPLES": "OFF",
19+
"DSPLIB_USE_FLOAT32": "OFF",
20+
"DSPLIB_EXCLUDE_FFT": "OFF",
21+
"DSPLIB_ASAN_ENABLED": "OFF",
22+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
23+
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
24+
},
25+
"environment": {
26+
"CC": "clang",
27+
"CXX": "clang++"
28+
},
29+
"architecture": {
30+
"value": "x64",
31+
"strategy": "external"
32+
}
33+
},
34+
{
35+
"name": "tests",
36+
"inherits": "default",
37+
"cacheVariables": {
38+
"DSPLIB_BUILD_TESTS": "ON",
39+
"DSPLIB_ASAN_ENABLED": "ON"
40+
}
41+
},
42+
{
43+
"name": "benchs-float64",
44+
"inherits": "default",
45+
"cacheVariables": {
46+
"DSPLIB_BUILD_BENCHS": "ON",
47+
"CMAKE_BUILD_TYPE": "Release"
48+
}
49+
},
50+
{
51+
"name": "benchs-float32",
52+
"inherits": "default",
53+
"cacheVariables": {
54+
"DSPLIB_BUILD_BENCHS": "ON",
55+
"CMAKE_BUILD_TYPE": "Release",
56+
"DSPLIB_USE_FLOAT32": "ON"
57+
}
58+
},
59+
{
60+
"name": "examples",
61+
"inherits": "default",
62+
"cacheVariables": {
63+
"DSPLIB_BUILD_EXAMPLES": "ON",
64+
"CMAKE_BUILD_TYPE": "Release"
65+
}
66+
}
67+
]
68+
}

benchs/adaptive.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
static std::pair<dsplib::arr_real, dsplib::arr_real> _prepare_frame(int M, int L) {
55
const auto h = dsplib::randn(M);
6-
auto flt = dsplib::FftFilter(h);
6+
auto flt = dsplib::FirFilter(h);
77
auto x = dsplib::randn(L);
88
auto n = 0.01 * dsplib::randn(L);
99
auto d = flt(x) + n;

examples/fftw-backend/fft.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FFTWPlanC : public FftPlanC
2828
fftw_free(in_);
2929
}
3030

31-
dsplib::arr_cmplx solve(const dsplib::arr_cmplx& x) const final {
31+
dsplib::arr_cmplx solve(span_t<cmplx_t> x) const final {
3232
DSPLIB_ASSERT(x.size() == n_, "input size must be equal `n`");
3333
std::memcpy(in_, x.data(), n_ * sizeof(x[0]));
3434
fftw_execute(plan_);
@@ -66,7 +66,7 @@ class FFTWPlanR : public FftPlanR
6666
fftw_free(in_);
6767
}
6868

69-
dsplib::arr_cmplx solve(const dsplib::arr_real& x) const final {
69+
dsplib::arr_cmplx solve(span_t<real_t> x) const final {
7070
DSPLIB_ASSERT(x.size() == n_, "input size must be equal `n`");
7171
std::memcpy(in_, x.data(), n_ * sizeof(x[0]));
7272
fftw_execute(plan_);
@@ -105,7 +105,7 @@ class IFFTWPlanR : public IfftPlanR
105105
fftw_free(in_);
106106
}
107107

108-
dsplib::arr_real solve(const dsplib::arr_cmplx& x) const final {
108+
dsplib::arr_real solve(span_t<cmplx_t> x) const final {
109109
const int n2 = n_ / 2 + 1;
110110
DSPLIB_ASSERT((x.size() == n_) || (x.size() == n2), "input size must be equal `n` or `n/2+1`");
111111
std::memcpy(in_, x.data(), n2 * sizeof(x[0]));

0 commit comments

Comments
 (0)