MpcLib.Circuits.LPSortingCalculationCache.PopulateBetaCache C# (CSharp) Method

PopulateBetaCache() private method

private PopulateBetaCache ( int lastBitstring, int nextBit, double lastEvalValue, int lastLength, int maxLength, int whichEval ) : void
lastBitstring int
nextBit int
lastEvalValue double
lastLength int
maxLength int
whichEval int
return void
        private void PopulateBetaCache(int lastBitstring, int nextBit, double lastEvalValue, int lastLength, int maxLength, int whichEval)
        {
            int nextBitstring = (nextBit << lastLength) | lastBitstring;
            double nextValue;

            if (nextBit == 0)
                nextValue = 1 - Math.Sqrt(1 - lastEvalValue);
            else
                nextValue = Math.Sqrt(lastEvalValue);

            int currentLength = lastLength + 1;

            if (currentLength == maxLength)
            {
                BetaCache[maxLength, whichEval][nextBitstring] = nextValue;
            }
            else
            {
                PopulateBetaCache(nextBitstring, 0, nextValue, currentLength, maxLength, whichEval);
                PopulateBetaCache(nextBitstring, 1, nextValue, currentLength, maxLength, whichEval);
            }
        }