Repository navigation
Fix/const views - #355
Open
weefuzzy wants to merge 4 commits into
Open
Fix/const views#355weefuzzy wants to merge 4 commits into
weefuzzy wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The changes introduce a compilation failure in ChromaFilterBank by mutating a read-only Eigen map and inconsistent dictionary normalization in NMFFilterClient that halves output in the single-basis example.
2 open issues
What changed in this PR
This PR addresses #353 by making algorithm inputs accept views over const data and removing input mutations where needed.
Changes:
- Replace mutable input-view types with
InputRealandInputComplexviews across algorithm APIs. - Adapt Eigen mappings and use copies or expressions where processing previously modified inputs.
- Clean up includes and correct integer division in NMFCross attenuation.
| File | Description |
|---|---|
| include/flucoma/algorithms/util/TruePeak.hpp | Accept const input frames and remove an unused include. |
| include/flucoma/algorithms/public/YINFFT.hpp | Accept const input frames. |
| include/flucoma/algorithms/public/TransientSegmentation.hpp | Accept const input samples. |
| include/flucoma/algorithms/public/TransientExtraction.hpp | Update input views and statistic callback signatures. |
| include/flucoma/algorithms/public/STFT.hpp | Accept const audio and spectra in analysis helpers. |
| include/flucoma/algorithms/public/Standardization.hpp | Support const initialization and processing inputs. |
| include/flucoma/algorithms/public/SpectralShape.hpp | Accept const spectral input. |
| include/flucoma/algorithms/public/RobustScaling.hpp | Support const inputs and inferred Eigen mappings. |
| include/flucoma/algorithms/public/PCA.hpp | Center input within the projection expression without mutation. |
| include/flucoma/algorithms/public/NoveltySegmentation.hpp | Accept const feature input. |
| include/flucoma/algorithms/public/NoveltyFeature.hpp | Accept const feature input. |
| include/flucoma/algorithms/public/Normalization.hpp | Support const inputs and inferred Eigen mappings. |
| include/flucoma/algorithms/public/NMFCross.hpp | Update input types and use floating-point attenuation. |
| include/flucoma/algorithms/public/NMF.hpp | Accept const inputs and copy the frame-processing dictionary. |
| include/flucoma/algorithms/public/MultiStats.hpp | Accept const matrix input. |
| include/flucoma/algorithms/public/MelBands.hpp | Add reusable scratch storage for input transformations. |
| include/flucoma/algorithms/public/Loudness.hpp | Accept const frames and infer the Eigen map type. |
| include/flucoma/algorithms/public/HPS.hpp | Accept const spectral input. |
| include/flucoma/algorithms/public/DCT.hpp | Accept const frames and infer the Eigen map type. |
| include/flucoma/algorithms/public/ChromaFilterBank.hpp | Change input to a const view and infer its Eigen mapping. |
| include/flucoma/algorithms/public/CepstrumF0.hpp | Accept const spectral input. |
Review effort: Balanced
| using namespace std; | ||
|
|
||
| FluidEigenMap<Eigen::Array> frame = _impl::asEigen<Eigen::Array>(in); | ||
| auto frame = _impl::asEigen<Eigen::Array>(in); |
Comment on lines
+52
to
+53
| ScopedEigenMap<MatrixXd> W{W0.rows(),W0.cols(),alloc}; | ||
| W = asEigen<Matrix>(W0); |
Contributor
|
Thought some of the items that the co-pilot review surfaced in #354 might still be at play. I think there might still be more to check. Tests don't compile everything as far as I can see - probably usage with one of the CCE repos might reveal more, although it looks like one of the fixes also breaks NMF (see above). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Make inputs to algorithms const correct with
Input(Real|Complex)(Vector|Matrix)View. Repair with the fallout (cases where inputs were being mutated). Fixes #353Builds and passes tests (here) but not given a proper road test. Functionality should be unaltered.