Microsoft Research Community

problem with Variable.Array<VectorGaussian>

rated by 0 users
This post has 1 Reply | 2 Followers

Top 500 Contributor
Posts 3
julia Posted: 07-29-2009 4:06 PM

Hi

I am struggling with these four lines of code, I don't understand why I am getting an error.

******************************************************

VariableArray<VectorGaussian> D = Variable.Array<VectorGaussian>(classRange);
D[classRange] = Variable.New<VectorGaussian>().ForEach(classRange);

VariableArray<Vector> x = Variable.Array<Vector>(classRange).Named("x");
x[classRange] = Variable.Random<Vector, VectorGaussian>(D[classRange]);


gives me an error at the execution of line 2:
     Unhandled Exception: System.InvalidOperationException: vVectorGaussian[ ]1[classRange] was not defined in this condition block.

******************************************************

I'm guessing the problem comes from the fact that D is not properly initialized... but how can I define it other than what I have done?

Is there another way to store an array of distributions? My intention was to update the "observed value" of the distribution array D with the results of the inference, using
     D.ObservedValue = Distribution.ToArray<VectorGaussian[ ]>( (IDistribution<Vector[ ]>) inferred[0])

If I store D as an array of VectorGaussian instead of a VariableArray, then I am in trouble for the indexing, as x must be indexed by a range and D by an integer...

Any help welcome! Many thanks,

Julia

Top 10 Contributor
Posts 50

You don't want the second line at all.  The first line already creates an array with undefined elements.

Page 1 of 1 (2 items) | RSS
©2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Feedback