public static WaveletCollection FromWaveletData(IEnumerable <double> waveletData) { int index = 0; double smoothingCoefficient = waveletData.ElementAt(index++); List <List <double> > decomposition = new List <List <double> >(); int levelCount = (int)Scalars.Logarithm(2, waveletData.Count()); for (int levelIndex = 0; levelIndex < levelCount; levelIndex++) { List <double> level = new List <double>(); int itemCount = (int)Scalars.Exponentiate(2, levelIndex); for (int itemIndex = 0; itemIndex < itemCount; itemIndex++) { level.Add(waveletData.ElementAt(index++)); } decomposition.Add(level); } return(new WaveletCollection(smoothingCoefficient, decomposition)); }
// Intended for synthesis // Input \ Output | Real | Imaginary // ---------------|------|---------- // Real | + | - // Imaginary | + | + static MatrixComplex GetReverseTransformation(int size) { MatrixComplex transformation = new MatrixComplex(size, size); Complex factor = (2 * Math.PI / size) * Complex.ImaginaryOne; for (int row = 0; row < transformation.RowCount; row++) { for (int column = 0; column < transformation.ColumnCount; column++) { transformation[row, column] = Scalars.Exponentiate(-factor * row * column); } } return((1 / Scalars.SquareRoot(size)) * transformation); }
public WaveletCollection(double smoothingCoefficient, IEnumerable <IEnumerable <double> > decomposition) { if (decomposition == null) { throw new ArgumentNullException("levels"); } for (int levelIndex = 0; levelIndex < decomposition.Count(); levelIndex++) { if (decomposition.ElementAt(levelIndex).Count() != (int)Scalars.Exponentiate(2, levelIndex)) { throw new ArgumentException("parameter 'decomposition' doesn't have the correct format"); } } this.smoothingCoefficient = smoothingCoefficient; this.decomposition = decomposition; }
public double NextExponential(double minimum, double maximum) { return(Scalars.Logarithm(NextDouble(Scalars.Exponentiate(minimum), Scalars.Exponentiate(maximum)))); }