Skip to content

Commit

Permalink
Merge pull request #9 from modios/tests-1
Browse files Browse the repository at this point in the history
Enable all tests
  • Loading branch information
modios authored May 5, 2021
2 parents a7fbff0 + 0b3ff06 commit 84220ae
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 60 deletions.
60 changes: 30 additions & 30 deletions test/EigenCore.Test/Core/Dense/MatrixXDTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void ConstructorMutyDim_ShouldSucceed()
Assert.Equal(new double[] { 1, 0, 3, 2, 2, 1 }, A.GetValues().ToArray());
}

[Fact(Skip = "need to update .so")]
[Fact]
public void Minus_ShouldSucceed()
{

Expand Down Expand Up @@ -56,15 +56,15 @@ public void Mult_ShouldSucceed()
Assert.Equal(new double[] { 11, 35, 0, 20 }, result.GetValues().ToArray());
}

[Fact(Skip = "need to update .so")]
[Fact]
public void Transpose_ShouldSucceed()
{
MatrixXD A = new MatrixXD("1 2 4; 3 5 7");
MatrixXD B = A.Transpose();
Assert.Equal(new double[] { 1, 2, 4, 3, 5, 7 }, B.GetValues().ToArray());
}

[Fact(Skip = "need to update .so")]
[Fact]
public void MultT_ShouldSucceed()
{
MatrixXD A = new MatrixXD("1 2 1; 2 5 2");
Expand Down Expand Up @@ -188,7 +188,7 @@ public void Mean_ShouldSucceed()

[InlineData("2 2 1; 1 2 -3; 1 0 1", 5)]
[InlineData("1 0 0 ; 0 0 0; 0 0 0", 1)]
[Theory(Skip = "need to update .so")]
[Theory]
public void Norm_ShouldSucceed(string valuesString, double expected)
{
MatrixXD A = new MatrixXD(valuesString);
Expand All @@ -197,7 +197,7 @@ public void Norm_ShouldSucceed(string valuesString, double expected)

[InlineData("2 2 1; 1 2 -3; 1 0 1", 25)]
[InlineData("1 0 0 ; 0 0 0; 0 0 0", 1)]
[Theory(Skip = "need to update .so")]
[Theory]
public void SquaredNorm_ShouldSucceed(string valuesString, double expected)
{
MatrixXD A = new MatrixXD(valuesString);
Expand All @@ -206,7 +206,7 @@ public void SquaredNorm_ShouldSucceed(string valuesString, double expected)

[InlineData("2 2 1; 1 2 -3; 1 0 1", 13)]
[InlineData("1 0 0 ; 0 0 0; 0 0 0", 1)]
[Theory(Skip = "need to update .so")]
[Theory]
public void Lp1Norm_ShouldSucceed(string valuesString, double expected)
{
MatrixXD A = new MatrixXD(valuesString);
Expand All @@ -215,7 +215,7 @@ public void Lp1Norm_ShouldSucceed(string valuesString, double expected)

[InlineData("2 2 1; 1 2 -3; 1 0 1", 3)]
[InlineData("1 0 0 ; 0 0 0; 0 0 0", 1)]
[Theory(Skip = "need to update .so")]
[Theory]
public void LpInfNorm_ShouldSucceed(string valuesString, double expected)
{
MatrixXD A = new MatrixXD(valuesString);
Expand Down Expand Up @@ -388,7 +388,7 @@ public void ConcatVertical_ShouldSucceed(string matrixString, double[] diag, str
}


[Fact(Skip = "need to update .so")]
[Fact]
public void MultV_ShouldSucceed()
{
MatrixXD A = MatrixXD.Diag(new[] { 3.5, 2, 4.5 });
Expand All @@ -408,15 +408,15 @@ public void MultV_ShouldSucceed()
Assert.Equal(new double[] { 17.0, -29.0, 26.0 }, result.GetValues().ToArray());
}

[Fact(Skip = "need to update .so")]
[Fact]
public void Trace_ShouldSucceed()
{
MatrixXD A = MatrixXD.Diag(new[] { 3.5, 2, 4.5 });
var result = A.Trace();
Assert.Equal(10.0, result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void Eigen_ShouldSucceed()
{
MatrixXD A = MatrixXD.Diag(new[] { 3.5, 2, 4.5 });
Expand All @@ -440,15 +440,15 @@ public void Eigen_ShouldSucceed()
-0.447213595499958, 0.8944271909999157 }, v2.GetValues().ToArray());
}

[Fact(Skip = "need to update .so")]
[Fact]
public void PlusT_ShouldSucceed()
{
MatrixXD A = new MatrixXD("2 2; 1 1");
var result = A.PlusT();
Assert.Equal(new double[] { 4, 3, 3, 2 }, result.GetValues().ToArray());
}

[Fact(Skip = "need to update .so")]
[Fact]
public void MultT_WithSelf_ShouldSucceed()
{
MatrixXD A = new MatrixXD("2 2; 1 1");
Expand All @@ -460,7 +460,7 @@ public void MultT_WithSelf_ShouldSucceed()
Assert.Equal(new MatrixXD("8 4 12; 4 2 6; 12 6 18"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void TMult_WithSelf_ShouldSucceed()
{
MatrixXD A = new MatrixXD("2 2; 1 1");
Expand All @@ -472,7 +472,7 @@ public void TMult_WithSelf_ShouldSucceed()
Assert.Equal(new MatrixXD("14 14; 14 14"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void SymmetricEigen_ShouldSucceed()
{
MatrixXD A = new MatrixXD("4 3; 3 2");
Expand All @@ -488,7 +488,7 @@ public void SymmetricEigen_ShouldSucceed()
0.7071067811865475, 0.7071067811865475 }, eigen.Eigenvectors.GetValues().ToArray());
}

[Fact(Skip = "need to update .so")]
[Fact]
public void Plus_ShouldSucceed()
{
MatrixXD A = new MatrixXD("4 3; 3 2");
Expand All @@ -497,7 +497,7 @@ public void Plus_ShouldSucceed()
Assert.Equal(new MatrixXD("5 3; 3 3"), result);
}

[Theory(Skip = "need to update .so")]
[Theory]
[InlineData(SVDType.Jacobi)]
[InlineData(SVDType.BdcSvd)]
public void SVD_ShouldSucceed(SVDType sdvType)
Expand All @@ -516,7 +516,7 @@ public void SVD_ShouldSucceed(SVDType sdvType)
result.V);
}

[Theory(Skip = "need to update .so")]
[Theory]
[InlineData(SVDType.Jacobi)]
[InlineData(SVDType.BdcSvd)]
public void LeastSquaresSVD_ShouldSucceed(SVDType sdvType)
Expand All @@ -527,7 +527,7 @@ public void LeastSquaresSVD_ShouldSucceed(SVDType sdvType)
Assert.Equal(new VectorXD("0.46347421844577846 0.04209165616389611"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void LeastSquaresNE_ShouldSucceed()
{
var A = new MatrixXD("-1 -0.0827; -0.737 0.0655; 0.511 -0.562 ");
Expand All @@ -536,7 +536,7 @@ public void LeastSquaresNE_ShouldSucceed()
Assert.Equal(new VectorXD("0.46347421844577846 0.04209165616389611"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void SolveColPivHouseholderQr_ShouldSucceed()
{
var A = new MatrixXD("1 2 3; 4 5 6; 7 8 10");
Expand All @@ -545,7 +545,7 @@ public void SolveColPivHouseholderQr_ShouldSucceed()
Assert.Equal(new VectorXD("-2 1 1"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void SolveLDLT_ShouldSucceed()
{
var A = new MatrixXD("2 4 0;4 2 1;0 1 4");
Expand All @@ -554,7 +554,7 @@ public void SolveLDLT_ShouldSucceed()
Assert.Equal(new VectorXD("0.22 0.64 0.84"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void SolveLLT_ShouldSucceed()
{
var A = new MatrixXD("6 4 0;4 4 1;0 1 8");
Expand All @@ -563,7 +563,7 @@ public void SolveLLT_ShouldSucceed()
Assert.Equal(new VectorXD("0.22413793103448287 0.41379310344827569 0.44827586206896558"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void SolveFullPivLU_ShouldSucceed()
{
var A = new MatrixXD("1 2 1; 2 1 0 ; -1 1 2");
Expand All @@ -572,7 +572,7 @@ public void SolveFullPivLU_ShouldSucceed()
Assert.Equal(new VectorXD("2.3333333333333321 -1.6666666666666643 3.9999999999999978"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void SolvePartialPivLU_ShouldSucceed()
{
var A = new MatrixXD("1 2 1; 2 1 0 ; -1 1 2");
Expand All @@ -581,15 +581,15 @@ public void SolvePartialPivLU_ShouldSucceed()
Assert.Equal(new VectorXD("2.3333333333333321 -1.6666666666666643 3.9999999999999978"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void Determinant_ShouldSucceed()
{
var A = new MatrixXD("1 2 3; 4 5 6; 7 8 10");
double result = A.Determinant();
Assert.Equal(-3, result, DoublePrecision);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void AbsoluteError_ShouldSucceed()
{
var A = new MatrixXD("1 2 3; 4 5 6; 7 8 10");
Expand All @@ -598,7 +598,7 @@ public void AbsoluteError_ShouldSucceed()
Assert.Equal(0.0, A.AbsoluteError(rhs, x), DoublePrecision);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void RelativeError_ShouldSucceed()
{
var A = new MatrixXD("1 2 3; 4 5 6; 7 8 10");
Expand All @@ -607,7 +607,7 @@ public void RelativeError_ShouldSucceed()
Assert.Equal(0.0, A.RelativeError(rhs, x), DoublePrecision);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void Inverse_ShouldSucceed()
{
var A = new MatrixXD("1 2 1; 2 1 0 ; -1 1 2");
Expand All @@ -617,7 +617,7 @@ public void Inverse_ShouldSucceed()
"-1 1 1"), result);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void HouseholderQR_ShouldSucceed()
{
var A = new MatrixXD("1 -2 4; 1 -1 1;1 0 0");
Expand All @@ -632,7 +632,7 @@ public void HouseholderQR_ShouldSucceed()
"0 0 0.8164965809277254"), result.R);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void ColPivHouseholderQR_ShouldSucceed()
{
var A = new MatrixXD("1 -2 4 -8; 1 -1 1 -1; 1 0 0 0;1 1 1 1; 1 2 4 8");
Expand All @@ -655,7 +655,7 @@ public void ColPivHouseholderQR_ShouldSucceed()
Assert.Equal(new MatrixXD("0 0 1 0;0 0 0 1;0 1 0 0;1 0 0 0"), result.P);
}

[Fact(Skip = "need to update .so")]
[Fact]
public void FullPivLU_ShouldSucceed()
{
var A = new MatrixXD("-1 -0.562 -0.233;-0.737 -0.906 0.0388; 0.511 0.358 0.662; -0.0827 0.359 -0.931; 0.0655 0.869 -0.893");
Expand Down
8 changes: 4 additions & 4 deletions test/EigenCore.Test/Core/Dense/VectorXDTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void Dot_ShouldSucceed()

[InlineData("2 2 1", 3)]
[InlineData("1 0 0 0", 1)]
[Theory(Skip = "need to update .so")]
[Theory]
public void Norm_ShouldSucceed(string valuesString, double expected)
{
VectorXD v = new VectorXD(valuesString);
Expand All @@ -84,7 +84,7 @@ public void Norm_ShouldSucceed(string valuesString, double expected)

[InlineData("2 2 1", 9)]
[InlineData("1 0 0 0", 1)]
[Theory(Skip = "need to update .so")]
[Theory]
public void SquaredNorm_ShouldSucceed(string valuesString, double expected)
{
VectorXD v = new VectorXD(valuesString);
Expand All @@ -94,7 +94,7 @@ public void SquaredNorm_ShouldSucceed(string valuesString, double expected)
[InlineData("2 2 1", 5)]
[InlineData("2 2 -1", 5)]
[InlineData("1 0 0 0", 1)]
[Theory(Skip = "need to update .so")]
[Theory]
public void Lp1Norm_ShouldSucceed(string valuesString, double expected)
{
VectorXD v = new VectorXD(valuesString);
Expand All @@ -104,7 +104,7 @@ public void Lp1Norm_ShouldSucceed(string valuesString, double expected)
[InlineData("2 2 1", 2)]
[InlineData("2 2 -3", 3)]
[InlineData("1 0 0 0", 1)]
[Theory(Skip = "need to update .so")]
[Theory]
public void LpInfNorm_ShouldSucceed(string valuesString, double expected)
{
VectorXD v = new VectorXD(valuesString);
Expand Down
5 changes: 0 additions & 5 deletions test/EigenCore.Test/Core/Sparse/MatrixSparseBaseTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using EigenCore.Core.Dense;
using EigenCore.Core.Sparse;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace EigenCore.Test.Core.Sparse
Expand Down
Loading

0 comments on commit 84220ae

Please sign in to comment.