numl.Math.LinearAlgebra.Matrix.Dot C# (CSharp) Method

Dot() public static method

Dot product between a matrix and a vector.
Thrown when the requested operation is invalid.
public static Dot ( Matrix x, Vector v ) : Vector
x Matrix Matrix x.
v Vector Vector v.
return Vector
        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;
        }

Same methods

Matrix::Dot ( Vector v, Matrix x ) : Vector

Usage Example

Exemplo n.º 1
0
        /// <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));
        }
All Usage Examples Of numl.Math.LinearAlgebra.Matrix::Dot