expectedSizeOfProbabilityTable() public static method

public static expectedSizeOfProbabilityTable ( ) : int
return int
Ejemplo n.º 1
0
        public ProbabilityTable(double[] vals, params RandomVariable[] vars)
        {
            if (null == vals)
            {
                throw new ArgumentException("Values must be specified");
            }
            if (vals.Length != ProbUtil.expectedSizeOfProbabilityTable(vars))
            {
                throw new ArgumentException("ProbabilityTable of Length "
                                            + values.Length + " is not the correct size, should be "
                                            + ProbUtil.expectedSizeOfProbabilityTable(vars)
                                            + " in order to represent all possible combinations.");
            }
            if (null != vars)
            {
                foreach (RandomVariable rv in vars)
                {
                    // Track index information relevant to each variable.
                    randomVarInfo.Add(rv, new RVInfo(rv));
                }
            }

            values = new double[vals.Length];
            Array.Copy(vals, 0, values, 0, vals.Length);

            radices = createRadixs(randomVarInfo);

            if (radices.Length > 0)
            {
                queryMRN = new MixedRadixNumber(0, radices);
            }
        }
Ejemplo n.º 2
0
 public ProbabilityTable(params RandomVariable[] vars)
     : this(new double[ProbUtil.expectedSizeOfProbabilityTable(vars)], vars)
 {
     ;
 }