public ProbabilityTable(double[] vals, params IRandomVariable[] vars) { if (null == vals) { throw new IllegalArgumentException("Values must be specified"); } if (vals.Length != ProbUtil.expectedSizeOfProbabilityTable(vars)) { throw new IllegalArgumentException("ProbabilityTable of length " + vals.Length + " is not the correct size, should be " + ProbUtil.expectedSizeOfProbabilityTable(vars) + " in order to represent all possible combinations."); } if (null != vars) { foreach (IRandomVariable rv in vars) { // Track index information relevant to each variable. randomVarInfo.Put(rv, new RVInfo(rv)); } } values = new double[vals.Length]; System.Array.Copy(vals, 0, values, 0, vals.Length); radices = createRadixs(randomVarInfo); if (radices.Length > 0) { queryMRN = new MixedRadixNumber(0, radices); } }
public ProbabilityTable(params IRandomVariable[] vars) : this(new double[ProbUtil.expectedSizeOfProbabilityTable(vars)], vars) { }