public List <double> GetSynthesis(WaveletAnalysisCollection analysisCollection) { var reconstructedValues = new List <double>(); var scaledUpLow = UpscaleLow(analysisCollection.RearrangedLow); var scaledUpHigh = UpscaleHigh(analysisCollection.RearrangedHigh); var formattedLow = WaveletValuesListMirroringHelper.GetValuesListWithMirroredExtremities(scaledUpLow); var formattedHigh = WaveletValuesListMirroringHelper.GetValuesListWithMirroredExtremities(scaledUpHigh); for (var i = 0; i < analysisCollection.RearrangedLow.Count + analysisCollection.RearrangedHigh.Count; i++) { var low = 0d; var high = 0d; for (var j = 0; j < 9; j++) { low += formattedLow[i + j] * synthesisLowCoefficients[j]; high += formattedHigh[i + j] * synthesisHighCoefficients[j]; } reconstructedValues.Add(low + high); } return(reconstructedValues); }
public WaveletAnalysisCollection GetAnalysis(List <double> values) { var analysisCollection = new WaveletAnalysisCollection(); var formattedValues = WaveletValuesListMirroringHelper.GetValuesListWithMirroredExtremities(values); for (var i = 0; i < values.Count; i++) { var low = 0d; var high = 0d; for (var j = 0; j < 9; j++) { low += formattedValues[i + j] * analysisLowCoefficients[j]; high += formattedValues[i + j] * analysisHighCoefficients[j]; } if (i % 2 == 0) { low = Math.Round(low, 6); analysisCollection.RearrangedLow.Add(low); } else { high = Math.Round(high, 6); analysisCollection.RearrangedHigh.Add(high); } } return(analysisCollection); }