locked
Jagged array Tutorial page contains error? RRS feed

  • Question

  • Jagged Array Tutorial Page example

                var outerSizeVar = Variable.New<int>();
                Range outer = new Range(outerSizeVar);
                var innerSizesVar = Variable.Array<int>(outer);
                Range inner = new Range (innerSizesVar [outer]);
                var aObs = Variable.Array(Variable.Array<double>(outer), inner); // problem!

                var a = new double[][] { new double[] {1.1, 3.3}, new double[] {1.1, 2.2, 4.4} };
                outerSizeVar.ObservedValue = a.Length;
                var innerSizes = new int[a.Length];
                for (int i = 0; i < a.Length; i++)
                    innerSizes[i] = a[i].Length;
                innerSizesVar.ObservedValue = innerSizes;
                aObs.ObservedValue = a;

                Console.WriteLine(_engine.Infer(aObs));

    It only runs if I swap the outer and inner in the commented line.

    Thursday, October 16, 2014 2:47 PM

Answers

  • Thanks, we will fix this.
    • Marked as answer by colinfang Friday, October 17, 2014 12:20 PM
    Friday, October 17, 2014 10:37 AM
    Owner