forked from tsai/mathnet-numerics
1 changed files with 50 additions and 0 deletions
@ -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); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue