# Multivariate Linear-Gaussian Implementation Issue • ### Question

• In infer.NET, is it possible to define a multivariate linear gaussian variable Y so that

Y = A*X + E

where X is a multivariate gaussian random variable,

A is a constant matrix

and E is a zero mean multivariate gaussian

The following code results in the error below.

double[,] A_a = { { 4.0, 0.5 }, { 0.5, 7.2 } };
Matrix A = new Matrix(A_a);

Variable<Vector> E = Variable.VectorGaussianFromMeanAndVariance(ue, Se).Named("E");

Variable<Vector> X = Variable.VectorGaussianFromMeanAndPrecision(ux, Kx).Named("X");
Variable<Vector> Y = A*X + E;

error:

operator '*' cannot be applied to operands of type 'Matrix' and 'Variable<vector>'

Is there perhaps another type of matrix variable that should be use in such a case?

Monday, July 17, 2017 7:52 AM

### All replies

• You need to use Variable.MatrixTimesVector.
• Proposed as answer by Friday, July 21, 2017 10:24 PM
Monday, July 17, 2017 6:09 PM
• Does the matrix A must be observed or declared Constant somehow?
Tuesday, July 18, 2017 4:56 AM
• You can simply pass the Matrix A in your code into Variable.MatrixTimesVector.
Friday, July 21, 2017 5:46 PM