From 1c67ecf5689dafb24ac62523085475e97c2b4ef0 Mon Sep 17 00:00:00 2001 From: Alex Harker Date: Mon, 9 Nov 2026 23:40:26 +0000 Subject: [PATCH 1/2] Use TensorTypes for const correctness --- include/flucoma/algorithms/public/CepstrumF0.hpp | 2 +- include/flucoma/algorithms/public/ChromaFilterBank.hpp | 2 +- include/flucoma/algorithms/public/DCT.hpp | 2 +- include/flucoma/algorithms/public/HPS.hpp | 2 +- include/flucoma/algorithms/public/Loudness.hpp | 2 +- include/flucoma/algorithms/public/MelBands.hpp | 2 +- include/flucoma/algorithms/public/NMF.hpp | 2 +- include/flucoma/algorithms/public/Normalization.hpp | 2 +- include/flucoma/algorithms/public/NoveltyFeature.hpp | 2 +- include/flucoma/algorithms/public/NoveltySegmentation.hpp | 2 +- include/flucoma/algorithms/public/PCA.hpp | 2 +- include/flucoma/algorithms/public/RobustScaling.hpp | 2 +- include/flucoma/algorithms/public/SpectralShape.hpp | 2 +- include/flucoma/algorithms/public/Standardization.hpp | 4 ++-- include/flucoma/algorithms/public/TransientSegmentation.hpp | 2 +- include/flucoma/algorithms/public/YINFFT.hpp | 2 +- include/flucoma/algorithms/util/TruePeak.hpp | 6 +++--- 17 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/flucoma/algorithms/public/CepstrumF0.hpp b/include/flucoma/algorithms/public/CepstrumF0.hpp index d6b8a55a1..c3e8b5865 100644 --- a/include/flucoma/algorithms/public/CepstrumF0.hpp +++ b/include/flucoma/algorithms/public/CepstrumF0.hpp @@ -41,7 +41,7 @@ class CepstrumF0 mCepstrum.setZero(); } - void processFrame(const RealVectorView& input, RealVectorView output, + void processFrame(const InputRealVectorView& input, RealVectorView output, double minFreq, double maxFreq, double sampleRate, Allocator& alloc) { using namespace Eigen; diff --git a/include/flucoma/algorithms/public/ChromaFilterBank.hpp b/include/flucoma/algorithms/public/ChromaFilterBank.hpp index 6705b83ac..808aead6c 100644 --- a/include/flucoma/algorithms/public/ChromaFilterBank.hpp +++ b/include/flucoma/algorithms/public/ChromaFilterBank.hpp @@ -80,7 +80,7 @@ class ChromaFilterBank mSampleRate = sampleRate; } - void processFrame(const RealVectorView in, RealVectorView out, + void processFrame(const InputRealVectorView in, RealVectorView out, double minFreq = 0, double maxFreq = -1, index normalize = 0) { using namespace Eigen; diff --git a/include/flucoma/algorithms/public/DCT.hpp b/include/flucoma/algorithms/public/DCT.hpp index f53ae8264..3afb00ef1 100644 --- a/include/flucoma/algorithms/public/DCT.hpp +++ b/include/flucoma/algorithms/public/DCT.hpp @@ -61,7 +61,7 @@ class DCT mInitialized = true; } - void processFrame(const RealVectorView in, RealVectorView out) + void processFrame(const InputRealVectorView in, RealVectorView out) { assert(mInitialized && "DCT: processFrame() called before init()"); assert(in.size() == mInputSize && diff --git a/include/flucoma/algorithms/public/HPS.hpp b/include/flucoma/algorithms/public/HPS.hpp index 8a2aa224c..83f0b3411 100644 --- a/include/flucoma/algorithms/public/HPS.hpp +++ b/include/flucoma/algorithms/public/HPS.hpp @@ -22,7 +22,7 @@ class HPS { public: - void processFrame(const RealVectorView& input, RealVectorView output, + void processFrame(const InputRealVectorView& input, RealVectorView output, index nHarmonics, double minFreq, double maxFreq, double sampleRate, Allocator& alloc) { diff --git a/include/flucoma/algorithms/public/Loudness.hpp b/include/flucoma/algorithms/public/Loudness.hpp index d042df4f4..a6fbef2eb 100644 --- a/include/flucoma/algorithms/public/Loudness.hpp +++ b/include/flucoma/algorithms/public/Loudness.hpp @@ -40,7 +40,7 @@ class Loudness mInitialized = true; } - void processFrame(const RealVectorView& input, RealVectorView output, + void processFrame(const InputRealVectorView& input, RealVectorView output, bool weighting, bool truePeak, Allocator& alloc = FluidDefaultAllocator()) { using namespace Eigen; diff --git a/include/flucoma/algorithms/public/MelBands.hpp b/include/flucoma/algorithms/public/MelBands.hpp index edd42cbef..85a7170d4 100644 --- a/include/flucoma/algorithms/public/MelBands.hpp +++ b/include/flucoma/algorithms/public/MelBands.hpp @@ -76,7 +76,7 @@ class MelBands mNBins = nBins; } - void processFrame(const RealVectorView in, RealVectorView out, bool magNorm, + void processFrame(const InputRealVectorView in, RealVectorView out, bool magNorm, bool usePower, bool logOutput, Allocator&) { using namespace Eigen; diff --git a/include/flucoma/algorithms/public/NMF.hpp b/include/flucoma/algorithms/public/NMF.hpp index 6c6a4d161..83b03dce3 100644 --- a/include/flucoma/algorithms/public/NMF.hpp +++ b/include/flucoma/algorithms/public/NMF.hpp @@ -42,7 +42,7 @@ class NMF } // processFrame computes activations of a dictionary W in a given frame - void processFrame(const RealVectorView x, const RealMatrixView W0, + void processFrame(const InputRealVectorView x, const RealMatrixView W0, RealVectorView out, index nIterations, RealVectorView v, index randomSeed, Allocator& alloc) { diff --git a/include/flucoma/algorithms/public/Normalization.hpp b/include/flucoma/algorithms/public/Normalization.hpp index 3847c9d79..3c0d4412f 100644 --- a/include/flucoma/algorithms/public/Normalization.hpp +++ b/include/flucoma/algorithms/public/Normalization.hpp @@ -58,7 +58,7 @@ class Normalization mInitialized = true; } - void processFrame(const RealVectorView in, RealVectorView out, + void processFrame(const InputRealVectorView in, RealVectorView out, bool inverse = false) const { using namespace Eigen; diff --git a/include/flucoma/algorithms/public/NoveltyFeature.hpp b/include/flucoma/algorithms/public/NoveltyFeature.hpp index ebfc31eb6..94be368a8 100644 --- a/include/flucoma/algorithms/public/NoveltyFeature.hpp +++ b/include/flucoma/algorithms/public/NoveltyFeature.hpp @@ -41,7 +41,7 @@ class NoveltyFeature mInitialized = true; } - double processFrame(const RealVectorView input, Allocator& alloc) + double processFrame(const InputRealVectorView input, Allocator& alloc) { assert(mInitialized); double novelty = diff --git a/include/flucoma/algorithms/public/NoveltySegmentation.hpp b/include/flucoma/algorithms/public/NoveltySegmentation.hpp index 854471f4e..c5441538d 100644 --- a/include/flucoma/algorithms/public/NoveltySegmentation.hpp +++ b/include/flucoma/algorithms/public/NoveltySegmentation.hpp @@ -40,7 +40,7 @@ class NoveltySegmentation mPeakBuffer.setZero(); } - double processFrame(const RealVectorView input, double threshold, + double processFrame(const InputRealVectorView input, double threshold, index minSliceLength, Allocator& alloc = FluidDefaultAllocator()) { double detected = 0.; diff --git a/include/flucoma/algorithms/public/PCA.hpp b/include/flucoma/algorithms/public/PCA.hpp index 24e7717f9..79cec576c 100644 --- a/include/flucoma/algorithms/public/PCA.hpp +++ b/include/flucoma/algorithms/public/PCA.hpp @@ -53,7 +53,7 @@ class PCA mInitialized = true; } - void processFrame(const RealVectorView in, RealVectorView out, index k, + void processFrame(const InputRealVectorView in, RealVectorView out, index k, bool whiten = false) const { using namespace Eigen; diff --git a/include/flucoma/algorithms/public/RobustScaling.hpp b/include/flucoma/algorithms/public/RobustScaling.hpp index ddf0a8988..d84e76b4e 100644 --- a/include/flucoma/algorithms/public/RobustScaling.hpp +++ b/include/flucoma/algorithms/public/RobustScaling.hpp @@ -68,7 +68,7 @@ class RobustScaling mInitialized = true; } - void processFrame(const RealVectorView in, RealVectorView out, + void processFrame(const InputRealVectorView in, RealVectorView out, bool inverse = false) const { using namespace Eigen; diff --git a/include/flucoma/algorithms/public/SpectralShape.hpp b/include/flucoma/algorithms/public/SpectralShape.hpp index fcb84e28a..c5f98fa7c 100644 --- a/include/flucoma/algorithms/public/SpectralShape.hpp +++ b/include/flucoma/algorithms/public/SpectralShape.hpp @@ -101,7 +101,7 @@ class SpectralShape mOutputBuffer(6) = 20 * log10(max(crest, epsilon)); } - void processFrame(const RealVectorView input, RealVectorView output, + void processFrame(const InputRealVectorView input, RealVectorView output, double sampleRate, double minFreq, double maxFreq, double rolloffTarget, bool logFreq, bool usePower, Allocator& alloc) diff --git a/include/flucoma/algorithms/public/Standardization.hpp b/include/flucoma/algorithms/public/Standardization.hpp index bf8deb604..6e8f4e92b 100644 --- a/include/flucoma/algorithms/public/Standardization.hpp +++ b/include/flucoma/algorithms/public/Standardization.hpp @@ -38,7 +38,7 @@ class Standardization mInitialized = true; } - void init(const RealVectorView mean, const RealVectorView std) + void init(const InputRealVectorView mean, const InputRealVectorView std) { using namespace Eigen; using namespace _impl; @@ -48,7 +48,7 @@ class Standardization mInitialized = true; } - void processFrame(const RealVectorView in, RealVectorView out, + void processFrame(const InputRealVectorView in, RealVectorView out, bool inverse = false) const { using namespace Eigen; diff --git a/include/flucoma/algorithms/public/TransientSegmentation.hpp b/include/flucoma/algorithms/public/TransientSegmentation.hpp index 176dcf4fb..8cad697e6 100644 --- a/include/flucoma/algorithms/public/TransientSegmentation.hpp +++ b/include/flucoma/algorithms/public/TransientSegmentation.hpp @@ -40,7 +40,7 @@ class TransientSegmentation : public algorithm::TransientExtraction mDebounce = 0; } - void process(const RealVectorView input, RealVectorView output, + void process(const InputRealVectorView input, RealVectorView output, Allocator& alloc = FluidDefaultAllocator()) { detect(input.data(), input.extent(0), alloc); diff --git a/include/flucoma/algorithms/public/YINFFT.hpp b/include/flucoma/algorithms/public/YINFFT.hpp index 0408ba7b9..55f15bb86 100644 --- a/include/flucoma/algorithms/public/YINFFT.hpp +++ b/include/flucoma/algorithms/public/YINFFT.hpp @@ -30,7 +30,7 @@ class YINFFT : mFFT(2 * maxInputSize - 1, alloc) {} - void processFrame(const RealVectorView& input, RealVectorView output, + void processFrame(const InputRealVectorView& input, RealVectorView output, double minFreq, double maxFreq, double sampleRate, Allocator& alloc = FluidDefaultAllocator()) { diff --git a/include/flucoma/algorithms/util/TruePeak.hpp b/include/flucoma/algorithms/util/TruePeak.hpp index c242e3ed6..2b6741d36 100644 --- a/include/flucoma/algorithms/util/TruePeak.hpp +++ b/include/flucoma/algorithms/util/TruePeak.hpp @@ -88,8 +88,8 @@ class Interpolator mInitialized = true; } - void processFrame(FluidTensorView in, - FluidTensorView out) + void processFrame(const InputRealVectorView in, + RealVectorView out) { assert(mInitialized); assert(in.size()); @@ -161,7 +161,7 @@ class TruePeak mInterpolator.init(nTaps, mFactor); } - double processFrame(const RealVectorView& input, Allocator&) + double processFrame(const InputRealVectorView& input, Allocator&) { using namespace Eigen; From 7b92947ab2f55d7909c04a9683b5bb3b45abbdcb Mon Sep 17 00:00:00 2001 From: Alex Harker Date: Mon, 9 Nov 2026 23:46:27 +0000 Subject: [PATCH 2/2] More involved cases of using TensorTypes --- include/flucoma/algorithms/public/KDTree.hpp | 13 +++--- .../algorithms/public/RunningStats.hpp | 2 +- include/flucoma/algorithms/public/STFT.hpp | 19 +++----- .../algorithms/public/TransientExtraction.hpp | 36 +++++++-------- include/flucoma/algorithms/util/ARModel.hpp | 45 ++++++++++--------- 5 files changed, 54 insertions(+), 61 deletions(-) diff --git a/include/flucoma/algorithms/public/KDTree.hpp b/include/flucoma/algorithms/public/KDTree.hpp index 457718d50..7d3af97e0 100644 --- a/include/flucoma/algorithms/public/KDTree.hpp +++ b/include/flucoma/algorithms/public/KDTree.hpp @@ -31,7 +31,6 @@ class KDTree using string = std::string; using DataSet = FluidDataSet; - using ConstRealVectorView = FluidTensorView; struct Node; using NodePtr = std::shared_ptr; using knnCandidate = std::pair; @@ -72,13 +71,13 @@ class KDTree mInitialized = true; } - void addNode(string id, ConstRealVectorView data) + void addNode(string id, const InputRealVectorView data) { mRoot = addNode(mRoot.get(), id, data, 0); mNPoints++; } - KNNResult kNearest(ConstRealVectorView data, index k = 1, double radius = 0, + KNNResult kNearest(const InputRealVectorView data, index k = 1, double radius = 0, Allocator& alloc = FluidDefaultAllocator()) const { assert(data.size() == mDims); @@ -156,12 +155,12 @@ class KDTree return current; } - NodePtr makeNode(string id, ConstRealVectorView data) const + NodePtr makeNode(string id, const InputRealVectorView data) const { return std::make_shared(Node{id, RealVector{data}, nullptr, nullptr}); } - NodePtr addNode(Node* current, string id, ConstRealVectorView data, + NodePtr addNode(Node* current, string id, const InputRealVectorView data, const index depth) const { if (current == nullptr) { return makeNode(id, data); } @@ -176,7 +175,7 @@ class KDTree return NodePtr(current); } - double distance(ConstRealVectorView p1, ConstRealVectorView p2) const + double distance(const InputRealVectorView p1, const InputRealVectorView p2) const { using namespace Eigen; auto v1 = _impl::asEigen(p1); @@ -201,7 +200,7 @@ class KDTree print(current->right.get(), depth + 1); } - void kNearest(const Node* current, ConstRealVectorView data, knnQueue& knn, + void kNearest(const Node* current, const InputRealVectorView data, knnQueue& knn, index k, double radius, index depth) const { if (current == nullptr) return; diff --git a/include/flucoma/algorithms/public/RunningStats.hpp b/include/flucoma/algorithms/public/RunningStats.hpp index 7d7e5df7c..a6f6d0621 100644 --- a/include/flucoma/algorithms/public/RunningStats.hpp +++ b/include/flucoma/algorithms/public/RunningStats.hpp @@ -42,7 +42,7 @@ class RunningStats } template - void process(FluidTensorView in, FluidTensorView meanOut, + void process(FluidTensorView in, FluidTensorView meanOut, FluidTensorView stdDevOut) { // Moving average and _sample_ standard deviation diff --git a/include/flucoma/algorithms/public/STFT.hpp b/include/flucoma/algorithms/public/STFT.hpp index cef092e0d..f280f7fe7 100644 --- a/include/flucoma/algorithms/public/STFT.hpp +++ b/include/flucoma/algorithms/public/STFT.hpp @@ -58,36 +58,31 @@ class STFT mFFT.resize(fftSize); } - static void magnitude(const FluidTensorView, 2> in, - FluidTensorView out) + static void magnitude(const InputComplexMatrixView in, RealMatrixView out) { _impl::asEigen(out) = _impl::asEigen(in).abs().real(); } - static void magnitude(const FluidTensorView, 1> in, - FluidTensorView out) + static void magnitude(const InputComplexVectorView in, RealVectorView out) { _impl::asEigen(out) = _impl::asEigen(in).abs().real(); } - static void phase(const FluidTensorView, 2> in, - FluidTensorView out) + static void phase(const InputComplexMatrixView in, RealMatrixView out) { _impl::asEigen(out) = _impl::asEigen(in).arg().real(); } - static void phase(const FluidTensorView, 1> in, - FluidTensorView out) + static void phase(const InputComplexVectorView in, RealVectorView out) { - phase(FluidTensorView, 2>(in), - FluidTensorView(out)); + phase(InputComplexMatrixView(in), RealMatrixView(out)); } - void process(const RealVectorView audio, ComplexMatrixView spectrogram) + void process(const InputRealVectorView audio, ComplexMatrixView spectrogram) { index halfWindow = mWindowSize / 2; ArrayXdMap window(mWindowBuffer.data(), mWindowSize); @@ -107,7 +102,7 @@ class STFT spectrogram <<= _impl::asFluid(result); } - void processFrame(const RealVectorView frame, ComplexVectorView out) + void processFrame(const InputRealVectorView frame, ComplexVectorView out) { assert(frame.size() == mWindowSize); ArrayXdMap window(mWindowBuffer.data(), mWindowSize); diff --git a/include/flucoma/algorithms/public/TransientExtraction.hpp b/include/flucoma/algorithms/public/TransientExtraction.hpp index e9cff04a6..b8c3426cb 100644 --- a/include/flucoma/algorithms/public/TransientExtraction.hpp +++ b/include/flucoma/algorithms/public/TransientExtraction.hpp @@ -108,7 +108,7 @@ class TransientExtraction return mCount; } - void process(const RealVectorView input, RealVectorView transients, + void process(const InputRealVectorView input, RealVectorView transients, RealVectorView residual, Allocator& alloc = FluidDefaultAllocator()) { assert(mInitialized && "Call init() before processing"); @@ -121,7 +121,7 @@ class TransientExtraction interpolate(transients.data(), residual.data(), alloc); } - void process(const RealVectorView input, const RealVectorView unknowns, + void process(const InputRealVectorView input, const InputRealVectorView unknowns, RealVectorView transients, RealVectorView residual, Allocator& alloc = FluidDefaultAllocator()) { @@ -156,7 +156,7 @@ class TransientExtraction void analyze(Allocator& alloc) { mModel.setMinVariance(0.0000001); - mModel.estimate(FluidTensorView( + mModel.estimate(InputRealVectorView( mInput.data(), modelOrder(), analysisSize()), 3, 3.0, alloc); } @@ -168,12 +168,12 @@ class TransientExtraction // Forward and backward error const double normFactor = 1.0 / sqrt(mModel.variance()); - auto inputView = FluidTensorView(mInput.data(), + auto inputView = InputRealVectorView(mInput.data(), modelOrder() + padSize(), blockSize() + modelOrder() + mDetectHalfWindow); - auto fwdError = FluidTensorView( - mForwardError.data(), 0, blockSize() + mDetectHalfWindow); - auto backError = FluidTensorView( + auto fwdError = RealVectorView( + mForwardError.data(), 0, blockSize() + mDetectHalfWindow); + auto backError = RealVectorView( mBackwardError.data(), 0, blockSize() + mDetectHalfWindow); errorCalculation<&ARModel::forwardErrorArray>( @@ -183,9 +183,9 @@ class TransientExtraction // Window error functions (brute force convolution) auto fwdWindowedError = - FluidTensorView(mForwardWindowedError.data(), 0, hopSize()); + RealVectorView(mForwardWindowedError.data(), 0, hopSize()); auto backWindowedError = - FluidTensorView(mBackwardWindowedError.data(), 0, hopSize()); + RealVectorView(mBackwardWindowedError.data(), 0, hopSize()); windowError(fwdError(Slice(modelOrder())), fwdWindowedError); windowError(backError(Slice(modelOrder())), backWindowedError); @@ -263,7 +263,7 @@ class TransientExtraction mCount = count; } - template + template double calcStat(const double* input, index size) { RealVectorView view(const_cast(input), 0, size); @@ -334,7 +334,7 @@ class TransientExtraction residual[i] = input[i + order]; } - // if (mRefine) refine(FluidTensorView(residual, 0, size), Au, + // if (mRefine) refine(RealVectorView(residual, 0, size), Au, // u); for (index i = 0; i < (size - order); i++) @@ -345,8 +345,7 @@ class TransientExtraction mInput.data() + padSize() + order + order); } - void refine( - FluidTensorView io, Eigen::MatrixXd& Au, Eigen::MatrixXd& ls) + void refine(RealVectorView io, Eigen::MatrixXd& Au, Eigen::MatrixXd& ls) { const double energy = mModel.variance() * mCount; double energyLS = 0.0; @@ -394,10 +393,9 @@ class TransientExtraction return sum; } - template , FluidTensorView)> - void errorCalculation(FluidTensorView input, - FluidTensorView error, double normFactor) + template + void errorCalculation(InputRealVectorView input, RealVectorView error, + double normFactor) { (mModel.*Method)(input, error); @@ -409,8 +407,8 @@ class TransientExtraction // Triangle window double calcWindow(double norm) { return std::min(norm, 1.0 - norm); } - void windowError(FluidTensorView error, - FluidTensorView errorWindowed) + void windowError(const InputRealVectorView error, + RealVectorView errorWindowed) { assert(error.descriptor().start >= mDetectHalfWindow && "insufficient offset for filter size"); diff --git a/include/flucoma/algorithms/util/ARModel.hpp b/include/flucoma/algorithms/util/ARModel.hpp index 3c4e4f0c3..967bfbf0b 100644 --- a/include/flucoma/algorithms/util/ARModel.hpp +++ b/include/flucoma/algorithms/util/ARModel.hpp @@ -17,6 +17,7 @@ under the European Union’s Horizon 2020 research and innovation programme #include "../../data/FluidIndex.hpp" #include "../../data/FluidMemory.hpp" #include "../../data/FluidTensor.hpp" +#include "../../data/TensorTypes.hpp" #include #include #include @@ -56,7 +57,7 @@ class ARModel double variance() const { return mVariance; } index order() const { return mOrder; } - void estimate(FluidTensorView input, index nIterations, + void estimate(const InputRealVectorView input, index nIterations, double robustFactor, Allocator& alloc) { if (nIterations > 0) @@ -65,44 +66,44 @@ class ARModel directEstimate(input, true, alloc); } - double fowardPrediction(FluidTensorView input) + double fowardPrediction(const InputRealVectorView input) { double prediction; - modelPredict(input, FluidTensorView(&prediction, 0, 1), + modelPredict(input, RealVectorView(&prediction, 0, 1), std::negate{}, Predict{}); return prediction; } - double backwardPrediction(FluidTensorView input) + double backwardPrediction(const InputRealVectorView input) { double prediction; - modelPredict(input, FluidTensorView(&prediction, 0, 1), + modelPredict(input, RealVectorView(&prediction, 0, 1), Identity{}, Predict{}); return prediction; } - double forwardError(FluidTensorView input) + double forwardError(const InputRealVectorView input) { double error; - forwardErrorArray(input, FluidTensorView(&error, 0, 1)); + forwardErrorArray(input, RealVectorView(&error, 0, 1)); return error; } - double backwardError(FluidTensorView input) + double backwardError(const InputRealVectorView input) { double error; - backwardErrorArray(input, FluidTensorView(&error, 0, 1)); + backwardErrorArray(input, RealVectorView(&error, 0, 1)); return error; } - void forwardErrorArray(FluidTensorView input, - FluidTensorView errors) + void forwardErrorArray(const InputRealVectorView input, + RealVectorView errors) { modelPredict(input, errors, std::negate{}, Error{}); } - void backwardErrorArray(FluidTensorView input, - FluidTensorView errors) + void backwardErrorArray(const InputRealVectorView input, + RealVectorView errors) { modelPredict(input, errors, Identity{}, Error{}); } @@ -129,8 +130,8 @@ class ARModel }; template - void modelPredict(FluidTensorView input, - FluidTensorView output, Indexer fIdx, + void modelPredict(const InputRealVectorView input, + RealVectorView output, Indexer fIdx, OutputFn fOut) { index numPredictions = output.size(); @@ -162,7 +163,7 @@ class ARModel } } - void directEstimate(FluidTensorView input, + void directEstimate(const InputRealVectorView input, bool updateVariance, Allocator& alloc) { index size = input.size(); @@ -217,7 +218,7 @@ class ARModel } } - void robustEstimate(FluidTensorView input, index nIterations, + void robustEstimate(const InputRealVectorView input, index nIterations, double robustFactor, Allocator& alloc) { FluidTensor estimates(input.size() + mOrder, alloc); @@ -246,8 +247,8 @@ class ARModel return cs * psiFunction((input - prediction) / cs); } - void robustVariance(FluidTensorView estimates, - FluidTensorView input, + void robustVariance(RealVectorView estimates, + const InputRealVectorView input, double robustFactor) { double residualSqSum = 0.0; @@ -264,9 +265,9 @@ class ARModel setVariance(residualSqSum / input.size()); } - void robustIteration(FluidTensorView estimates, - FluidTensorView input, - double robustFactor, Allocator& alloc) + void robustIteration(RealVectorView estimates, + const InputRealVectorView input, + double robustFactor, Allocator& alloc) { // Iterate to find new filtered input for (index i = 0; i < input.size(); i++)