diff --git a/src/UnitTests/LinearAlgebraTests/Double/UserDefinedMatrixTests.cs b/src/UnitTests/LinearAlgebraTests/Double/UserDefinedMatrixTests.cs new file mode 100644 index 00000000..14a6054e --- /dev/null +++ b/src/UnitTests/LinearAlgebraTests/Double/UserDefinedMatrixTests.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using MbUnit.Framework; + +namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double +{ + using LinearAlgebra.Double; + + internal class UserDefinedMatrix : Matrix + { + private readonly double[,] _data; + + public UserDefinedMatrix(int rows, int columns) : base(rows, columns) + { + _data = new double[rows, columns]; + } + + public UserDefinedMatrix(double[,] data) : base(data.GetLength(0), data.GetLength(1)) + { + _data = data; + } + + public override double At(int row, int column) + { + return _data[row, column]; + } + + public override void At(int row, int column, double value) + { + _data[row, column] = value; + } + + public override Matrix CreateMatrix(int numberOfRows, int numberOfColumns) + { + return new UserDefinedMatrix(numberOfRows, numberOfColumns); + } + } + + public class UserDefinedMatrixTests : MatrixTests + { + protected override Matrix CreateMatrix(int rows, int columns) + { + return new UserDefinedMatrix(rows, columns); + } + + protected override Matrix CreateMatrix(double[,] data) + { + return new UserDefinedMatrix(data); + } + } +}