public static Vector operator *(Matrix A, Vector B) { if (A.Columns == B.length) { double[] C = MatrixMath.MultiplyMatrixVector(A.matrix, B.vector); return(new Vector(C)); } else { throw new IndexOutOfRangeException("The number of columns of the matrix must equal the number of elements in the vector."); } }
public static Vector Multiply(Matrix matrix, Vector vector) { if (matrix.Columns == vector.Length) { double[] result = MatrixMath.MultiplyMatrixVector(matrix.matrix, vector.vector); return(new Vector(result)); } else { throw new IndexOutOfRangeException("The number of columns of the matrix must equal the number of elements in the vector."); } }
//This is just an alias for the same function in the MatrixMath class public static double[] MultiplyMatrixVector(double[,] A, double[] B) { return(MatrixMath.MultiplyMatrixVector(A, B)); }