Inheritance: global::java.lang.Object, global::java.io.Serializable
 public NumberProperty(PropertyHolder element, string name, Number defaultValue)
   : base((Class) ClassLiteral<Number>.Value, element, name, (object) defaultValue)
 {
 }
Example #2
0
 public static double getCorrelation(Number[] data1, Number[] data2)
 {
   if (data1 == null)
   {
     string str = "Null 'data1' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (data2 == null)
   {
     string str = "Null 'data2' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (data1.Length != data2.Length)
   {
     string str = "'data1' and 'data2' arrays must have same length.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     int length = data1.Length;
     double num1 = 0.0;
     double num2 = 0.0;
     double num3 = 0.0;
     double num4 = 0.0;
     double num5 = 0.0;
     for (int index = 0; index < length; ++index)
     {
       double num6 = 0.0;
       if (data1[index] != null)
         num6 = data1[index].doubleValue();
       double num7 = 0.0;
       if (data2[index] != null)
         num7 = data2[index].doubleValue();
       num1 += num6;
       num2 += num7;
       num5 += num6 * num7;
       num3 += num6 * num6;
       num4 += num7 * num7;
     }
     return ((double) length * num5 - num1 * num2) / Math.pow(((double) length * num3 - num1 * num1) * ((double) length * num4 - num2 * num2), 0.5);
   }
 }
Example #3
0
 public static double[][] getMovingAverage(Number[] xData, Number[] yData, int period)
 {
   if (xData.Length != yData.Length)
   {
     string str = "Array lengths must be equal.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (period > xData.Length)
   {
     string str = "Period can't be longer than dataset.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     int num1 = xData.Length - period;
     int num2 = 2;
     int[] numArray1 = new int[2];
     int num3 = num2;
     numArray1[1] = num3;
     int num4 = num1;
     numArray1[0] = num4;
     // ISSUE: type reference
     double[][] numArray2 = (double[][]) ByteCodeHelper.multianewarray(__typeref (double[][]), numArray1);
     for (int index1 = 0; index1 < numArray2.Length; ++index1)
     {
       numArray2[index1][0] = xData[index1 + period].doubleValue();
       double num5 = 0.0;
       for (int index2 = 0; index2 < period; ++index2)
         num5 += yData[index1 + index2].doubleValue();
       double num6 = num5 / (double) period;
       numArray2[index1][1] = num6;
     }
     return numArray2;
   }
 }
Example #4
0
 public static double[] getLinearFit(Number[] xData, Number[] yData)
 {
   if (xData == null)
   {
     string str = "Null 'xData' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (yData == null)
   {
     string str = "Null 'yData' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (xData.Length != yData.Length)
   {
     string str = "Statistics.getLinearFit(): array lengths must be equal.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     double[] numArray = new double[2]
     {
       0.0,
       Statistics.getSlope(xData, yData)
     };
     numArray[0] = Statistics.calculateMean(yData) - numArray[1] * Statistics.calculateMean(xData);
     return numArray;
   }
 }
Example #5
0
 public static double getStdDev(Number[] data)
 {
   if (data == null)
   {
     string str = "Null 'data' array.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (data.Length == 0)
   {
     string str = "Zero length 'data' array.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     double num1 = Statistics.calculateMean(data);
     double num2 = 0.0;
     for (int index = 0; index < data.Length; ++index)
     {
       double num3 = data[index].doubleValue() - num1;
       num2 += num3 * num3;
     }
     return Math.sqrt(num2 / (double) (data.Length - 1));
   }
 }
Example #6
0
 public static double getSlope(Number[] xData, Number[] yData)
 {
   if (xData == null)
   {
     string str = "Null 'xData' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (yData == null)
   {
     string str = "Null 'yData' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (xData.Length != yData.Length)
   {
     string str = "Array lengths must be equal.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     double num1 = 0.0;
     double num2 = 0.0;
     double num3 = 0.0;
     double num4 = 0.0;
     int index;
     for (index = 0; index < xData.Length; ++index)
     {
       num1 += xData[index].doubleValue();
       num2 += Math.pow(xData[index].doubleValue(), 2.0);
       num3 += yData[index].doubleValue() * xData[index].doubleValue();
       num4 += yData[index].doubleValue();
     }
     return (num3 - num1 * num4 / (double) index) / (num2 - num1 * num1 / (double) index);
   }
 }
Example #7
0
 public static double calculateMean(Number[] values)
 {
   return Statistics.calculateMean(values, true);
 }
Example #8
0
 public static double calculateMean(Number[] values, bool includeNullAndNaN)
 {
   int num1 = includeNullAndNaN ? 1 : 0;
   if (values == null)
   {
     string str = "Null 'values' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     double num2 = 0.0;
     int num3 = 0;
     for (int index = 0; index < values.Length; ++index)
     {
       double num4 = values[index] == null ? double.NaN : values[index].doubleValue();
       if (num1 != 0 || !Double.isNaN(num4))
       {
         num2 += num4;
         ++num3;
       }
     }
     return num2 / (double) num3;
   }
 }