|
|
|
@ -6,7 +6,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
{ |
|
|
|
partial class MatrixStructureTheory<T> |
|
|
|
{ |
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetFieldsByIndex(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
Assert.That(() => matrix[0, 0], Throws.Nothing); |
|
|
|
@ -18,7 +18,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix[0, matrix.ColumnCount], Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetRow(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// First Row
|
|
|
|
@ -42,7 +42,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.Row(matrix.RowCount), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetRowIntoResult(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var row = CreateVectorZero(matrix.ColumnCount); |
|
|
|
@ -58,7 +58,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.Row(matrix.RowCount, row), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetRowWithRange(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// First Row, Columns 0..1
|
|
|
|
@ -93,7 +93,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.Row(0, 0, matrix.ColumnCount + 1), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetRowWithRangeIntoResult(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var row = CreateVectorZero(matrix.ColumnCount - 1); |
|
|
|
@ -110,7 +110,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.Row(0, 0, matrix.ColumnCount, row), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetColumn(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// First Column
|
|
|
|
@ -134,7 +134,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.Column(matrix.ColumnCount), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetColumnIntoResult(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var col = CreateVectorZero(matrix.RowCount); |
|
|
|
@ -150,7 +150,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.Column(matrix.ColumnCount, col), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetColumnWithRange(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// First Column, Rows 0..1
|
|
|
|
@ -185,7 +185,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.Column(0, 0, matrix.RowCount + 1), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetColumnWithRangeIntoResult(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var col = CreateVectorZero(matrix.RowCount - 1); |
|
|
|
@ -202,7 +202,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.Column(0, 0, matrix.RowCount, col), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanSetRow(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// First Row
|
|
|
|
@ -237,7 +237,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.SetRow(0, CreateVectorZero(matrix.ColumnCount + 1)), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanSetRowArray(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// First Row
|
|
|
|
@ -270,7 +270,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.SetRow(0, new T[matrix.ColumnCount + 1]), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanSetColumn(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// First Column
|
|
|
|
@ -305,7 +305,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.SetColumn(0, CreateVectorZero(matrix.RowCount + 1)), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanSetColumnArray(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// First Column
|
|
|
|
@ -338,7 +338,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.SetColumn(0, new T[matrix.RowCount + 1]), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetUpperTriangle(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var upper = matrix.UpperTriangle(); |
|
|
|
@ -351,7 +351,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetUpperTriangleIntoResult(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var dense = CreateDenseZero(matrix.RowCount, matrix.ColumnCount); |
|
|
|
@ -379,7 +379,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.UpperTriangle(CreateDenseZero(matrix.RowCount, matrix.ColumnCount + 1)), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetLowerTriangle(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var upper = matrix.LowerTriangle(); |
|
|
|
@ -392,7 +392,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetLowerTriangleIntoResult(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var dense = CreateDenseZero(matrix.RowCount, matrix.ColumnCount); |
|
|
|
@ -420,7 +420,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.LowerTriangle(CreateDenseZero(matrix.RowCount, matrix.ColumnCount + 1)), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetStrictlyUpperTriangle(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var upper = matrix.StrictlyUpperTriangle(); |
|
|
|
@ -433,7 +433,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetStrictlyUpperTriangleIntoResult(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var dense = CreateDenseZero(matrix.RowCount, matrix.ColumnCount); |
|
|
|
@ -461,7 +461,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.StrictlyUpperTriangle(CreateDenseZero(matrix.RowCount, matrix.ColumnCount + 1)), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetStrictlyLowerTriangle(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var upper = matrix.StrictlyLowerTriangle(); |
|
|
|
@ -474,7 +474,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetStrictlyLowerTriangleIntoResult(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var dense = CreateDenseZero(matrix.RowCount, matrix.ColumnCount); |
|
|
|
@ -502,7 +502,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.StrictlyLowerTriangle(CreateDenseZero(matrix.RowCount, matrix.ColumnCount + 1)), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetDiagonal(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var diag = matrix.Diagonal(); |
|
|
|
@ -513,7 +513,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanSetDiagonal(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var m = matrix.Clone(); |
|
|
|
@ -533,7 +533,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.SetDiagonal(CreateVectorZero(Math.Min(matrix.RowCount, matrix.ColumnCount) + 1)), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanSetDiagonalArray(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
var m = matrix.Clone(); |
|
|
|
@ -552,7 +552,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.SetDiagonal(new T[Math.Min(matrix.RowCount, matrix.ColumnCount) + 1]), Throws.ArgumentException); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanGetSubmatrix(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// Top Left Corner 2x2
|
|
|
|
@ -594,7 +594,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests |
|
|
|
Assert.That(() => matrix.SubMatrix(0, 1, 0, 0), Throws.InstanceOf<ArgumentOutOfRangeException>()); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, Timeout(200)] |
|
|
|
[Theory, Timeout(500)] |
|
|
|
public void CanSetSubmatrix(Matrix<T> matrix) |
|
|
|
{ |
|
|
|
// Top Left Corner 2x2
|
|
|
|
|