public Vector Multiplied(math_Matrix theRight) { if (Length() != theRight.RowNumber()) { throw new ArgumentOutOfRangeException(nameof(theRight), "Vector.Multiplied() - input matrix has wrong dimensions"); } var Result = new Vector(theRight.LowerColIndex, theRight.UpperColIndex); for (var J2 = theRight.LowerColIndex; J2 <= theRight.UpperColIndex; J2++) { Result[J2] = 0.0; var theI2 = theRight.LowerRowIndex; for (var I = Lower(); I <= Upper(); I++) { Result[J2] = Result[J2] + this[I] * theRight.Array[theI2, J2]; theI2++; } } return(Result); }
public void Multiply(math_Matrix theLeft, Vector theRight) { if ((Length() != theLeft.RowNumber()) || (theLeft.ColNumber() != theRight.Length())) { throw new ArgumentOutOfRangeException(nameof(theLeft), "Vector::Multiply() - input matrix and/or vector have wrong dimensions"); } var Index = Lower(); for (var I = theLeft.LowerRowIndex; I <= theLeft.UpperRowIndex; I++) { this[Index] = 0.0; var K = theRight.Lower(); for (var J = theLeft.LowerColIndex; J <= theLeft.UpperColIndex; J++) { this[Index] = this[Index] + theLeft.Array[I, J] * theRight[K]; K++; } Index++; } }