Exemplo n.º 1
0
    protected virtual void Initialize(int p, int N, double alpha)
    {
        _fibonacciSequence = FibonacciSequence.GetSequence(p, N);
        this.alpha         = alpha;

        var cacheMatrices = Cache.TryGetFHTMatrix(new Tuple <int, int>(p, N));

        if (cacheMatrices != null)
        {
            _fhtMatrix        = cacheMatrices.Item1;
            _fhtMatrixInverse = cacheMatrices.Item2;
        }
        else
        {
            _fhtMatrix        = FibonacciHaarTransformationMatrix(p, N);
            _fhtMatrixInverse = new SparseMatrix(_fhtMatrix.RowCount);
            _fhtMatrix.Transpose(_fhtMatrixInverse);
            _fhtMatrix.Multiply(0.5, _fhtMatrix);

            Cache.AddFHTMatrix(new Tuple <int, int>(p, N), new Tuple <Matrix, Matrix>(_fhtMatrix, _fhtMatrixInverse));
        }
    }