DenseMatrix<T, TSlice, TStorage2D>.Add Method

Adds two DenseMatrix<T, TSlice, TStorage2D> objects and stores the result in a third DenseMatrix<T, TSlice, TStorage2D>.

Definition

Namespace: Numerics.NET.LinearAlgebra
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.0
C#
public static DenseMatrix<T> Add(
	DenseMatrix<T> matrix1,
	T factor,
	DenseMatrix<T> matrix2,
	DenseMatrix<T> resultMatrix
)

Parameters

matrix1  DenseMatrix<T>
The first DenseMatrix<T, TSlice, TStorage2D>.
factor  T
A number that specifies the multiplier for the second matrix.
matrix2  DenseMatrix<T>
The second DenseMatrix<T, TSlice, TStorage2D>.
resultMatrix  DenseMatrix<T>
A DenseMatrix<T, TSlice, TStorage2D> that is to receive the result of the multiplication.

Return Value

DenseMatrix<T>
A reference to resultMatrix.

Remarks

This method uses level 1 BLAS routines to perform the addition. It is the most efficient way to add matrices of type DenseMatrix<T, TSlice, TStorage2D>.

The dimensions of the three matrices must be the same. Otherwise, an exception of type DimensionMismatchException is thrown.

Exceptions

ArgumentNullException

matrix1 is null.

-or-

matrix2 is null.

-or-

resultMatrix is null.

DimensionMismatchException

The dimensions of matrix2 does not equal the dimensions of matrix1.

-or-

The dimensions of resultMatrix does not equal the dimensions of matrix1.

See Also