|
|
|
@ -638,9 +638,9 @@ namespace MathNet.Numerics.LinearAlgebra.Generic |
|
|
|
/// Creates a matrix that contains the values from the requested sub-matrix.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="rowIndex">The row to start copying from.</param>
|
|
|
|
/// <param name="rowLength">The number of rows to copy. Must be positive.</param>
|
|
|
|
/// <param name="rowCount">The number of rows to copy. Must be positive.</param>
|
|
|
|
/// <param name="columnIndex">The column to start copying from.</param>
|
|
|
|
/// <param name="columnLength">The number of columns to copy. Must be positive.</param>
|
|
|
|
/// <param name="columnCount">The number of columns to copy. Must be positive.</param>
|
|
|
|
/// <returns>The requested sub-matrix.</returns>
|
|
|
|
/// <exception cref="ArgumentOutOfRangeException">If: <list><item><paramref name="rowIndex"/> is
|
|
|
|
/// negative, or greater than or equal to the number of rows.</item>
|
|
|
|
@ -648,9 +648,9 @@ namespace MathNet.Numerics.LinearAlgebra.Generic |
|
|
|
/// of columns.</item>
|
|
|
|
/// <item><c>(columnIndex + columnLength) >= Columns</c></item>
|
|
|
|
/// <item><c>(rowIndex + rowLength) >= Rows</c></item></list></exception>
|
|
|
|
/// <exception cref="ArgumentException">If <paramref name="rowLength"/> or <paramref name="columnLength"/>
|
|
|
|
/// <exception cref="ArgumentException">If <paramref name="rowCount"/> or <paramref name="columnCount"/>
|
|
|
|
/// is not positive.</exception>
|
|
|
|
public virtual Matrix<T> SubMatrix(int rowIndex, int rowLength, int columnIndex, int columnLength) |
|
|
|
public virtual Matrix<T> SubMatrix(int rowIndex, int rowCount, int columnIndex, int columnCount) |
|
|
|
{ |
|
|
|
if (rowIndex >= RowCount || rowIndex < 0) |
|
|
|
{ |
|
|
|
@ -662,30 +662,30 @@ namespace MathNet.Numerics.LinearAlgebra.Generic |
|
|
|
throw new ArgumentOutOfRangeException("columnIndex"); |
|
|
|
} |
|
|
|
|
|
|
|
if (rowLength < 1) |
|
|
|
if (rowCount < 1) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentMustBePositive, "rowLength"); |
|
|
|
throw new ArgumentException(Resources.ArgumentMustBePositive, "rowCount"); |
|
|
|
} |
|
|
|
|
|
|
|
if (columnLength < 1) |
|
|
|
if (columnCount < 1) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentMustBePositive, "columnLength"); |
|
|
|
throw new ArgumentException(Resources.ArgumentMustBePositive, "columnCount"); |
|
|
|
} |
|
|
|
|
|
|
|
var colMax = columnIndex + columnLength; |
|
|
|
var rowMax = rowIndex + rowLength; |
|
|
|
var colMax = columnIndex + columnCount; |
|
|
|
var rowMax = rowIndex + rowCount; |
|
|
|
|
|
|
|
if (rowMax > RowCount) |
|
|
|
{ |
|
|
|
throw new ArgumentOutOfRangeException("rowLength"); |
|
|
|
throw new ArgumentOutOfRangeException("rowCount"); |
|
|
|
} |
|
|
|
|
|
|
|
if (colMax > ColumnCount) |
|
|
|
{ |
|
|
|
throw new ArgumentOutOfRangeException("columnLength"); |
|
|
|
throw new ArgumentOutOfRangeException("columnCount"); |
|
|
|
} |
|
|
|
|
|
|
|
var result = CreateMatrix(rowLength, columnLength); |
|
|
|
var result = CreateMatrix(rowCount, columnCount); |
|
|
|
|
|
|
|
for (var j = columnIndex; j < colMax; j++) |
|
|
|
{ |
|
|
|
@ -1134,9 +1134,9 @@ namespace MathNet.Numerics.LinearAlgebra.Generic |
|
|
|
/// Copies the values of a given matrix into a region in this matrix.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="rowIndex">The row to start copying to.</param>
|
|
|
|
/// <param name="rowLength">The number of rows to copy. Must be positive.</param>
|
|
|
|
/// <param name="rowCount">The number of rows to copy. Must be positive.</param>
|
|
|
|
/// <param name="columnIndex">The column to start copying to.</param>
|
|
|
|
/// <param name="columnLength">The number of columns to copy. Must be positive.</param>
|
|
|
|
/// <param name="columnCount">The number of columns to copy. Must be positive.</param>
|
|
|
|
/// <param name="subMatrix">The sub-matrix to copy from.</param>
|
|
|
|
/// <exception cref="ArgumentOutOfRangeException">If: <list><item><paramref name="rowIndex"/> is
|
|
|
|
/// negative, or greater than or equal to the number of rows.</item>
|
|
|
|
@ -1145,10 +1145,10 @@ namespace MathNet.Numerics.LinearAlgebra.Generic |
|
|
|
/// <item><c>(columnIndex + columnLength) >= Columns</c></item>
|
|
|
|
/// <item><c>(rowIndex + rowLength) >= Rows</c></item></list></exception>
|
|
|
|
/// <exception cref="ArgumentNullException">If <paramref name="subMatrix"/> is <see langword="null" /></exception>
|
|
|
|
/// <item>the size of <paramref name="subMatrix"/> is not at least <paramref name="rowLength"/> x <paramref name="columnLength"/>.</item>
|
|
|
|
/// <exception cref="ArgumentException">If <paramref name="rowLength"/> or <paramref name="columnLength"/>
|
|
|
|
/// <item>the size of <paramref name="subMatrix"/> is not at least <paramref name="rowCount"/> x <paramref name="columnCount"/>.</item>
|
|
|
|
/// <exception cref="ArgumentException">If <paramref name="rowCount"/> or <paramref name="columnCount"/>
|
|
|
|
/// is not positive.</exception>
|
|
|
|
public virtual void SetSubMatrix(int rowIndex, int rowLength, int columnIndex, int columnLength, Matrix<T> subMatrix) |
|
|
|
public virtual void SetSubMatrix(int rowIndex, int rowCount, int columnIndex, int columnCount, Matrix<T> subMatrix) |
|
|
|
{ |
|
|
|
if (rowIndex >= RowCount || rowIndex < 0) |
|
|
|
{ |
|
|
|
@ -1160,14 +1160,14 @@ namespace MathNet.Numerics.LinearAlgebra.Generic |
|
|
|
throw new ArgumentOutOfRangeException("columnIndex"); |
|
|
|
} |
|
|
|
|
|
|
|
if (rowLength < 1) |
|
|
|
if (rowCount < 1) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentMustBePositive, "rowLength"); |
|
|
|
throw new ArgumentException(Resources.ArgumentMustBePositive, "rowCount"); |
|
|
|
} |
|
|
|
|
|
|
|
if (columnLength < 1) |
|
|
|
if (columnCount < 1) |
|
|
|
{ |
|
|
|
throw new ArgumentException(Resources.ArgumentMustBePositive, "columnLength"); |
|
|
|
throw new ArgumentException(Resources.ArgumentMustBePositive, "columnCount"); |
|
|
|
} |
|
|
|
|
|
|
|
if (subMatrix == null) |
|
|
|
@ -1175,27 +1175,27 @@ namespace MathNet.Numerics.LinearAlgebra.Generic |
|
|
|
throw new ArgumentNullException("subMatrix"); |
|
|
|
} |
|
|
|
|
|
|
|
if (columnLength > subMatrix.ColumnCount) |
|
|
|
if (columnCount > subMatrix.ColumnCount) |
|
|
|
{ |
|
|
|
throw new ArgumentOutOfRangeException("columnLength", @"columnLength can be at most the number of columns in subMatrix."); |
|
|
|
throw new ArgumentOutOfRangeException("columnCount", @"columnLength can be at most the number of columns in subMatrix."); |
|
|
|
} |
|
|
|
|
|
|
|
if (rowLength > subMatrix.RowCount) |
|
|
|
if (rowCount > subMatrix.RowCount) |
|
|
|
{ |
|
|
|
throw new ArgumentOutOfRangeException("rowLength", @"rowLength can be at most the number of rows in subMatrix."); |
|
|
|
throw new ArgumentOutOfRangeException("rowCount", @"rowLength can be at most the number of rows in subMatrix."); |
|
|
|
} |
|
|
|
|
|
|
|
var colMax = columnIndex + columnLength; |
|
|
|
var rowMax = rowIndex + rowLength; |
|
|
|
var colMax = columnIndex + columnCount; |
|
|
|
var rowMax = rowIndex + rowCount; |
|
|
|
|
|
|
|
if (rowMax > RowCount) |
|
|
|
{ |
|
|
|
throw new ArgumentOutOfRangeException("rowLength"); |
|
|
|
throw new ArgumentOutOfRangeException("rowCount"); |
|
|
|
} |
|
|
|
|
|
|
|
if (colMax > ColumnCount) |
|
|
|
{ |
|
|
|
throw new ArgumentOutOfRangeException("columnLength"); |
|
|
|
throw new ArgumentOutOfRangeException("columnCount"); |
|
|
|
} |
|
|
|
|
|
|
|
for (var j = columnIndex; j < colMax; j++) |
|
|
|
|