Adds two GeneralMatrix objects and returns the result.

Namespace: Extreme.Mathematics.LinearAlgebra
Assembly: Extreme.Numerics (Extreme.Numerics)

Syntax

Visual Basic (Declaration)
Public Shared Function Add ( _
	matrix1 As GeneralMatrix, _
	matrix2 As GeneralMatrix _
) As GeneralMatrix
C#
public static GeneralMatrix Add (
	GeneralMatrix matrix1,
	GeneralMatrix matrix2
)
C++
public:
static GeneralMatrix^ Add (
	GeneralMatrix^ matrix1, 
	GeneralMatrix^ matrix2
)

Parameters

matrix1 (Extreme.Mathematics.LinearAlgebra.GeneralMatrix)
The first GeneralMatrix.
matrix2 (Extreme.Mathematics.LinearAlgebra.GeneralMatrix)
The second GeneralMatrix.

Return Value

A GeneralMatrix that is the sum of matrix1 and matrix2.

Remarks

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

The result is returned in matrix1 new matrix. Another Add(GeneralMatrix, Double, GeneralMatrix, GeneralMatrix) lets you specify the matrix that is to contain the result. This may be more efficient in some applications.

Exceptions

ExceptionCondition
ArgumentNullExceptionmatrix1 is nullNothingnullptr

-or-

matrix2 is nullNothingnullptr

DimensionMismatchExceptionThe dimensions of matrix1 do not equal the dimensions of matrix2.