Example #1
0
 //preferred for nominal
 public VariableDescriptor(
     string feature_name,
     DataLevel feature_level,
     Dictionary <string, int> feature_value_levels)
     : this(feature_name, feature_level, ToolsCollection.ConvertToArray1D(feature_value_levels))
 {
 }
Example #2
0
        public void SolverLinearGMRESMathNetTrivial0()
        {
            SolverLinearGMRESMathNet gmres = new SolverLinearGMRESMathNet();

            double[,] a = new double[5, 5];
            a[0, 0]     = 1;
            a[1, 1]     = 2;
            a[2, 2]     = 3;
            a[3, 3]     = 4;
            a[4, 4]     = 5;

            Matrix <double>    A      = new DenseMatrix(5, 5, ToolsCollection.ConvertToArray1D(a));
            Vector <double>    x0     = new DenseVector(new double[5]);
            Vector <double>    b      = new DenseVector(new double[] { 1, 2, 3, 4, 5 });
            SolverLinearResult result = gmres.Solve(A, b, x0, 4);

            Assert.AreEqual(0.9203, result.SolutionList[4][0], 0.001);
            Assert.AreEqual(1.0399, result.SolutionList[4][1], 0.001);
            Assert.AreEqual(0.9823, result.SolutionList[4][2], 0.001);
            Assert.AreEqual(1.0050, result.SolutionList[4][3], 0.001);
            Assert.AreEqual(0.9994, result.SolutionList[4][4], 0.001);
            //[~, solutions, ~, ~] = gmres_simple(A, b, x0, 4, 1)
            //0         0         0         0         0   d
            //0.2298    0.4597    0.6895    0.9193    1.1491
            //0.4897    0.8318    1.0262    1.0729    0.9719
            //0.7346    1.0209    1.0404    0.9747    1.0050
            //0.9203    1.0399    0.9823    1.0050    0.9994
        }
 public AMatrix <Matrix <double> > Create(IList <double> operant_0, bool transpose = false)
 {
     if (transpose)
     {
         return(new MatrixMathNet(new DenseMatrix(operant_0.Count, 1, ToolsCollection.ConvertToArray1D(operant_0))));
     }
     else
     {
         return(new MatrixMathNet(new DenseMatrix(1, operant_0.Count, ToolsCollection.ConvertToArray1D(operant_0))));
     }
 }
 public AMatrix <Matrix <double> > Create(double[,] operant_0)
 {
     return(new MatrixMathNet(new DenseMatrix(operant_0.GetLength(0), operant_0.GetLength(1), ToolsCollection.ConvertToArray1D(operant_0, true))));
 }
 public static double MedianAll(IList <IList <double> > list_list)
 {
     return(Quantile(ToolsCollection.ConvertToArray1D(list_list), 0.5f));
 }