dlib
dlib copied to clipboard
Adding backport of bessel functions + window functions
This is generally useful, but also this is laying down the foundation for stuff like filter design, computing STFTs and maybe who knows, some DSP.
The boost implementation is unbelievably complicated. Sod it, would it be agreeable to add PRs for filter design and STFTs and have __cpp_lib_math_special_functions as a contract pre-condition?
Looked at scipy implementation, it's Fortran...
The boost implementation is unbelievably complicated. Sod it, would it be agreeable to add PRs for filter design and STFTs and have
__cpp_lib_math_special_functionsas a contract pre-condition?
Eh, I don't want to have stuff that doesn't always work. Dlib is all about everything always working regardless of platform.
Nothing stopping you from doing this in another repo though. Dlib repo isn't special at the end of the day.
At some point I'll jump dlib to needing c++17 too. I usually make sure dlib works with compilers from the last 6 or 7 years. Which is coming up soonish for c++17.
Not sure. Libc++ doesn't support special math functions so clang on macOS wouldn't work. Some compilers don't fully support std::filesystem which is c++17. So I don't think c++17 is universally supported yet.
I'll crack on with stripping boost but my god they needlessly make things complicated. Like every single function is templated with a policy, like even something as trivial sign().
There you go, stripping boost only requires 1300 lines of code to implement two math functions. Nice and succinct in typical boost fashion.
Don't know what's going on but the Python/windows build configuration always fails with:
python setup.py bdist_wheel did not run successfully.
exit code: 1
[6 lines of output]
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
Don't know what's going on but the Python/windows build configuration always fails with:
python setup.py bdist_wheel did not run successfully. exit code: 1 [6 lines of output] usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: invalid command 'bdist_wheel'
Yeah it's on master too. Was just looking at that. Not sure what the deal is.
Otherwise are you happy with the code ?
Sorry i modified the API. I've opted for using strong types and function overloading for kaiser() instead of different function signatures. I think it's clearer and the user has to stop and think a bit about how to call the function correctly using the right strong type decorators. I think it's less error-prone.
Ok I think I have everything I need now. So if unit tests pass, we're good to go. For those who are interested, next PR will be STFT and ISTFT. This is useful generally in DSP and audio processing. But it's also useful in blind source separation algorithms like ILRMA and MNMF which use traditional machine learning algorithms operating on STFT domain to blindly separate channels which I think @davisking will enjoy.
@davisking what do you think ? Ok or horse manure ?
Looks ok. I looked a little last night. Will look more again soon. Seems sensible though :)