public void ExceptionTest()
{
double[,] X =
{
{ 2.5, 2.4, 0 },
{ 0.5, 0.7, 0 },
{ 2.2, 2.9, 0 },
{ 1.9, 2.2, 0 },
{ 3.1, 3.0, 0 },
{ 2.3, 2.7, 0 },
{ 2.0, 1.6, 0 },
{ 1.0, 1.1, 0 },
{ 1.5, 1.6, 0 },
{ 1.1, 0.9, 0 },
};
double[,] Y =
{
{ 1 },
{ 0 },
{ 1 },
{ 0 },
{ 1 },
{ 1 },
{ 0 },
{ 0 },
{ 0 },
{ 0 },
};
var pls = new PartialLeastSquaresAnalysis(X, Y, AnalysisMethod.Standardize,
PartialLeastSquaresAlgorithm.NIPALS);
bool thrown = false;
try
{
pls.Compute();
}
catch (ArithmeticException ex)
{
ex.ToString();
thrown = true;
}
// Assert that an appropriate exception has been
// thrown in the case of a constant variable.
Assert.IsTrue(thrown);
}