public static Vector Dot(Matrix x, Vector v) { if (v.Length != x.Cols) throw new InvalidOperationException("objects are not aligned"); Vector toReturn = Vector.Zeros(x.Rows); for (int i = 0; i < toReturn.Length; i++) toReturn[i] = Vector.Dot(x[i, VectorType.Row], v); return toReturn; }
/// <summary>Multiplication operator.</summary> /// <param name="v">The Vector to process.</param> /// <param name="m">The Matrix to process.</param> /// <returns>The result of the operation.</returns> public static Matrix operator *(Vector v, Matrix m) { Vector ans = Matrix.Dot(v, m); return(ans.ToMatrix(VectorType.Row)); }