|
|
@ -228,34 +228,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 |
|
|
/// <param name="result">The matrix to store the result of the addition.</param>
|
|
|
/// <param name="result">The matrix to store the result of the addition.</param>
|
|
|
/// <exception cref="ArgumentNullException">If the other matrix is <see langword="null"/>.</exception>
|
|
|
/// <exception cref="ArgumentNullException">If the other matrix is <see langword="null"/>.</exception>
|
|
|
/// <exception cref="ArgumentOutOfRangeException">If the two matrices don't have the same dimensions.</exception>
|
|
|
/// <exception cref="ArgumentOutOfRangeException">If the two matrices don't have the same dimensions.</exception>
|
|
|
public override void Add(Matrix<Complex32> other, Matrix<Complex32> result) |
|
|
protected override void DoAdd(Matrix<Complex32> other, Matrix<Complex32> result) |
|
|
{ |
|
|
{ |
|
|
if (other == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new ArgumentNullException("other"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (result == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new ArgumentNullException("result"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (other.RowCount != RowCount || other.ColumnCount != ColumnCount) |
|
|
|
|
|
{ |
|
|
|
|
|
throw DimensionsDontMatch<ArgumentOutOfRangeException>(this, other, "other"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) |
|
|
|
|
|
{ |
|
|
|
|
|
throw DimensionsDontMatch<ArgumentOutOfRangeException>(this, other, "other"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var diagOther = other as DiagonalMatrix; |
|
|
var diagOther = other as DiagonalMatrix; |
|
|
var diagResult = result as DiagonalMatrix; |
|
|
var diagResult = result as DiagonalMatrix; |
|
|
|
|
|
|
|
|
if (diagOther == null || diagResult == null) |
|
|
if (diagOther == null || diagResult == null) |
|
|
{ |
|
|
{ |
|
|
base.Add(other, result); |
|
|
base.DoAdd(other, result); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
@ -303,34 +283,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 |
|
|
/// <param name="result">The matrix to store the result of the subtraction.</param>
|
|
|
/// <param name="result">The matrix to store the result of the subtraction.</param>
|
|
|
/// <exception cref="ArgumentNullException">If the other matrix is <see langword="null"/>.</exception>
|
|
|
/// <exception cref="ArgumentNullException">If the other matrix is <see langword="null"/>.</exception>
|
|
|
/// <exception cref="ArgumentOutOfRangeException">If the two matrices don't have the same dimensions.</exception>
|
|
|
/// <exception cref="ArgumentOutOfRangeException">If the two matrices don't have the same dimensions.</exception>
|
|
|
public override void Subtract(Matrix<Complex32> other, Matrix<Complex32> result) |
|
|
protected override void DoSubtract(Matrix<Complex32> other, Matrix<Complex32> result) |
|
|
{ |
|
|
{ |
|
|
if (other == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new ArgumentNullException("other"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (result == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new ArgumentNullException("result"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (other.RowCount != RowCount || other.ColumnCount != ColumnCount) |
|
|
|
|
|
{ |
|
|
|
|
|
throw DimensionsDontMatch<ArgumentOutOfRangeException>(this, other, "other"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) |
|
|
|
|
|
{ |
|
|
|
|
|
throw DimensionsDontMatch<ArgumentOutOfRangeException>(this, other, "result"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var diagOther = other as DiagonalMatrix; |
|
|
var diagOther = other as DiagonalMatrix; |
|
|
var diagResult = result as DiagonalMatrix; |
|
|
var diagResult = result as DiagonalMatrix; |
|
|
|
|
|
|
|
|
if (diagOther == null || diagResult == null) |
|
|
if (diagOther == null || diagResult == null) |
|
|
{ |
|
|
{ |
|
|
base.Subtract(other, result); |
|
|
base.DoSubtract(other, result); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|