## Linear Algebra Factors

This page lists the built-in methods for linear algebra operations. In these methods, you can often pass in random variables as arguments e.g. Variable<Vector> instead of Vector. For compactness, this is not shown in the syntax below.

These methods provide a convenient short alternative to using Variable<T>.Factor and passing in the factor method, as described on this page

 Operation Syntax Description Inner product Variable.InnerProduct(Vector a, Vector b) Creates a double random variable equal to the inner product of vectors a and b. Matrix times vector Variable.MatrixTimesVector(Matrix a, Vector b) Creates a Vector random variable equal to product of matrix a and vector b. Matrix times matrix Variable.MatrixMultiply(double[,] a, double[,] b) Creates a double[,] random variable equal to the matrix product of ab. Sum of elements Variable.Sum(double[] array)Variable.Sum(IList array) Creates a double random variable equal to  the sum of the elements of the array. Conditional sum of elements Variable.SumWhere(bool[] a, Vector b) Creates a double random variable equal to the sum of the elements of b where a is true.