示例#1
0
        static public AnalysisDefs.FeynmanResult GetResultFromFeynmanGateDictionary(Dictionary <UInt32, UInt32> feynmanGateDictionary, bool copy)
        {
            AnalysisDefs.FeynmanResult result = new AnalysisDefs.FeynmanResult();

            double C, nC, n2C, n3C;
            double temp;
            double numNeutrons;

            C   = 0.0;
            nC  = 0.0;
            n2C = 0.0;
            n3C = 0.0;

            // result.gateWidth = gateWidthInTics;

            //for each entry in numGatesHavingNumNeutrons
            result.maxDictionaryKey = 0;
            foreach (KeyValuePair <UInt32, UInt32> pair in feynmanGateDictionary)
            {
                numNeutrons = pair.Key;
                temp        = (double)pair.Value; //the number of gates having that numNeutrons

                C    += temp;                     //so C will be the total number of complete gates with any numNeutrons
                temp *= numNeutrons;
                nC   += temp;                     //nC is the weighted sum of numGates * numNeutrons
                temp *= numNeutrons;
                n2C  += temp;                     //n2C is the weight sum of numGates * numNeutrons^2
                temp *= numNeutrons;
                n3C  += temp;                     //n3C is the weight sum of numGates * numNeutrons^3

                if (copy)
                {
                    result.numGatesHavingNumNeutrons.Add(pair.Key, pair.Value);
                    if (pair.Key > result.maxDictionaryKey)
                    {
                        result.maxDictionaryKey = pair.Key;
                    }
                }
            }


            if (C > 0.0)
            {
                result.C     = C;
                result.cbar  = nC / C;
                result.c2bar = n2C / C;
                result.c3bar = n3C / C;
            }
            return(result);
        }
示例#2
0
        static public AnalysisDefs.FeynmanResult GetResultFromFeynmanGateDictionary(Dictionary<UInt32, UInt32> feynmanGateDictionary, bool copy)
        {
            AnalysisDefs.FeynmanResult result = new AnalysisDefs.FeynmanResult();

            double C, nC, n2C, n3C;
            double temp;
            double numNeutrons;

            C = 0.0;
            nC = 0.0;
            n2C = 0.0;
            n3C = 0.0;

           // result.gateWidth = gateWidthInTics;

            //for each entry in numGatesHavingNumNeutrons
            result.maxDictionaryKey = 0;
            foreach (KeyValuePair<UInt32, UInt32> pair in feynmanGateDictionary)
            {
                numNeutrons = pair.Key;
                temp = (double)pair.Value;  //the number of gates having that numNeutrons

                C += temp;  //so C will be the total number of complete gates with any numNeutrons
                temp *= numNeutrons;
                nC += temp;  //nC is the weighted sum of numGates * numNeutrons
                temp *= numNeutrons;
                n2C += temp; //n2C is the weight sum of numGates * numNeutrons^2
                temp *= numNeutrons;
                n3C += temp; //n3C is the weight sum of numGates * numNeutrons^3

                if (copy)
                {
                    result.numGatesHavingNumNeutrons.Add(pair.Key, pair.Value);
                    if (pair.Key > result.maxDictionaryKey)
                    {
                        result.maxDictionaryKey = pair.Key;
                    }
                }
            }


            if (C > 0.0)
            {
                result.C = C;
                result.cbar = nC / C;
                result.c2bar = n2C / C;
                result.c3bar = n3C / C;
            }
            return (result);
        }
示例#3
0
 public AnalysisDefs.FeynmanResult GetResult()
 {
     AnalysisDefs.FeynmanResult result = GetResultFromFeynmanGateDictionary(numGatesHavingNumNeutrons, true);
     result.gateWidth = gateWidthInTics;
     return(result);
 }