diff options
Diffstat (limited to 'sc/source/core/tool/interpr3.cxx')
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index f219beca9386..31dee4ce707e 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -51,6 +51,8 @@ using namespace formula; const double ScInterpreter::fMaxGammaArgument = 171.624376956302; // found experimental const double fMachEps = ::std::numeric_limits<double>::epsilon(); +namespace { + class ScDistFunc { public: @@ -60,6 +62,8 @@ protected: ~ScDistFunc() {} }; +} + // iteration for inverse distributions //template< class T > double lcl_IterateInverse( const T& rFunction, double x0, double x1, bool& rConvError ) @@ -4765,6 +4769,8 @@ static SCSIZE lcl_bitReverse(SCSIZE nIn, SCSIZE nBound) return nOut; } +namespace { + // Computes and stores twiddle factors for computing DFT later. struct ScTwiddleFactors { @@ -4790,6 +4796,8 @@ struct ScTwiddleFactors bool mbInverse; }; +} + void ScTwiddleFactors::Compute() { mfWReal.resize(mnN); @@ -4905,6 +4913,8 @@ void ScTwiddleFactors::Compute() } } +namespace { + // A radix-2 decimation in time FFT algorithm for complex valued input. class ScComplexFFT2 { @@ -4995,6 +5005,8 @@ private: bool mbSubSampleTFs:1; }; +} + void ScComplexFFT2::prepare() { SCSIZE nPoints = mnPoints; @@ -5094,6 +5106,8 @@ void ScComplexFFT2::Compute() lcl_normalize(mrArray, mbPolar); } +namespace { + // Bluestein's algorithm or chirp z-transform algorithm that can be used to // compute DFT of a complex valued input of any length N in O(N lgN) time. class ScComplexBluesteinFFT @@ -5123,6 +5137,8 @@ private: bool mbDisableNormalize:1; }; +} + void ScComplexBluesteinFFT::Compute() { std::vector<double> aRealScalars(mnPoints); @@ -5213,6 +5229,8 @@ void ScComplexBluesteinFFT::Compute() lcl_normalize(mrArray, mbPolar); } +namespace { + // Computes DFT of an even length(N) real-valued input by using a // ScComplexFFT2 if N == 2^k for some k or else by using a ScComplexBluesteinFFT // with a complex valued input of length = N/2. @@ -5239,6 +5257,8 @@ private: bool mbPolar:1; }; +} + void ScRealFFT::Compute() { // input length has to be even to do this optimization. @@ -5338,6 +5358,8 @@ void ScRealFFT::Compute() using ScMatrixGenerator = ScMatrixRef(SCSIZE, SCSIZE, std::vector<double>&); +namespace { + // Generic FFT class that decides which FFT implementation to use. class ScFFT { @@ -5361,6 +5383,8 @@ private: bool mbPolar:1; }; +} + ScMatrixRef ScFFT::Compute(const std::function<ScMatrixGenerator>& rMatGenFunc) { std::vector<double> aArray; |