Exemplo n.º 1
0
        /// <summary>
        /// Build the regression equation matxix and variances
        /// </summary>
        /// <param name="points">The data to regress </param>
        /// <param name="order">The order of the polynomial</param>
        /// <param name="matValue">Matrix to fill</param>
        /// <param name="varValue">Varaicne vector to fill</param>
        private void BuildLinEquations(IList <EfficiencyMeasurement> points, int order, ref double[,] matValue, ref double[] varValue)
        {
            //row (num efficiney points)
            for (int i = 0; i < points.Count; i++)
            {
                EfficiencyMeasurement point = points[i];
                double weight = ComputeWeight(point);
                varValue[i] = weight * Math.Log10(point.Efficiency);
                //columns (order)
                for (int j = 0; j < order; j++)
                {
                    matValue[i, j] = weight * Math.Pow(1 / point.Energy, j - 1);
                }
            }

            /**
             * for (int k = 0; k < order; k++)
             * {
             *  for (int j = 0; j < order; j++)
             *  {
             *      foreach (EfficiencyMeasurement point in points)
             *      {
             *          double weight = ComputeLinWeight(point);
             *          matValue[k, j] += weight * Math.Pow(1 / point.Energy, j - 1) * Math.Pow(1 / point.Energy, k - 1);
             *          varValue[k] += j == 0 ? weight * Math.Log10(point.Efficiency) * Math.Pow(1 / point.Energy, k - 1) : 0;
             *      }
             *  }
             * }
             **/
        }
Exemplo n.º 2
0
 /// <summary>
 /// Build the regression equation matxix and variances
 /// </summary>
 /// <param name="points">The data to regress </param>
 /// <param name="order">The order of the polynomial</param>
 /// <param name="matValue">Matrix to fill</param>
 /// <param name="varValue">Varaicne vector to fill</param>
 private void BuildLinEquations(IList <EfficiencyMeasurement> points, int order, ref double[,] matValue, ref double[] varValue)
 {
     //row (num efficiney points)
     for (int i = 0; i < points.Count; i++)
     {
         EfficiencyMeasurement point = points[i];
         double weight = ComputeWeight(point);
         varValue[i] = weight * Math.Log10(point.Efficiency);
         //columns (order)
         for (int j = 0; j < order; j++)
         {
             matValue[i, j] = weight * Math.Pow(1 / point.Energy, j - 1);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Build the regression equation matxix and variances
        /// </summary>
        /// <param name="points">The data to regress </param>
        /// <param name="order">The order of the polynomial</param>
        /// <param name="matValue">Matrix to fill</param>
        /// <param name="varValue">Varaicne vector to fill</param>
        private void BuildEmpEquations(IList <EfficiencyMeasurement> points, int order, ref double[,] matValue, ref double[] varValue)
        {
            double ca = (points[0].Energy + points[points.Count - 1].Energy) / 2;

            //row (num efficiney points)
            for (int i = 0; i < points.Count; i++)
            {
                EfficiencyMeasurement point = points[i];
                double weight = ComputeWeight(point);
                varValue[i] = weight * Math.Log(point.Efficiency);
                //columns (order)
                for (int j = 0; j < order; j++)
                {
                    matValue[i, j] = weight * Math.Pow(Math.Log(ca / point.Energy), j);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Build the regression equation matxix and variances
        /// </summary>
        /// <param name="points">The data to regress </param>
        /// <param name="order">The order of the polynomial</param>
        /// <param name="matValue">Matrix to fill</param>
        /// <param name="varValue">Varaicne vector to fill</param>
        private void BuildEmpEquations(IList <EfficiencyMeasurement> points, int order, ref double[,] matValue, ref double[] varValue)
        {
            double ca = (points[0].Energy + points[points.Count - 1].Energy) / 2;

            //row (num efficiney points)
            for (int i = 0; i < points.Count; i++)
            {
                EfficiencyMeasurement point = points[i];
                double weight = ComputeWeight(point);
                varValue[i] = weight * Math.Log(point.Efficiency);
                //columns (order)
                for (int j = 0; j < order; j++)
                {
                    matValue[i, j] = weight * Math.Pow(Math.Log(ca / point.Energy), j);
                }
            }

            /**
             * double ca = (points[0].Energy + points[points.Count-1].Energy) / 2;
             * matValue = new double[order, order];
             * varValue = new double[order];
             * for (int k = 0; k < order; k++)
             * {
             *  for (int j = 0; j < order; j++)
             *  {
             *
             *      foreach (EfficiencyMeasurement point in points)
             *      {
             *          double weight = ComputeEmpWeight(point);
             *          matValue[k, j] += weight * Math.Pow(ca / point.Energy, j - 1) * Math.Pow(ca / point.Energy, k - 1);
             *          varValue[k] += j == 0 ? weight * Math.Log(point.Efficiency) * Math.Pow(Math.Log(ca / point.Energy), k - 1) : 0;
             *      }
             *  }
             * }
             **/
        }
Exemplo n.º 5
0
 /// <summary>
 /// Compute the weight
 /// </summary>
 /// <param name="point">Data point for weight</param>
 /// <returns>Weight</returns>
 private double ComputeWeight(EfficiencyMeasurement point)
 {
     return(Math.Pow(point.Efficiency / point.EfficiencyUncertainty, 2));
 }