public void covariance_success()
{
double[] mean = Measures.Mean(data, dimension: 0);
double[,] cov = Measures.Covariance(data);
var target = PrincipalComponentAnalysis.FromCovarianceMatrix(mean, cov);
// Compute
target.Compute();
// Transform
double[,] actual = target.Transform(data);
double[,] expected = new double[,]
{
{ 0.827970186, -0.175115307 },
{ -1.77758033, 0.142857227 },
{ 0.992197494, 0.384374989 },
{ 0.274210416, 0.130417207 },
{ 1.67580142, -0.209498461 },
{ 0.912949103, 0.175282444 },
{ -0.099109437, -0.349824698 },
{ -1.14457216, 0.046417258 },
{ -0.438046137, 0.017764629 },
{ -1.22382056, -0.162675287 },
};
// Verify both are equal with 0.01 tolerance value
Assert.IsTrue(Matrix.IsEqual(actual, expected, 0.01));
// Transform
double[,] image = target.Transform(data);
// Reverse
double[,] reverse = target.Revert(image);
// Verify both are equal with 0.01 tolerance value
Assert.IsTrue(Matrix.IsEqual(reverse, data, 0.01));
}