Exemplo n.º 1
0
 public void testYIsConstant()
 {
     x         = new RootSpud <double>(values.manager);
     slope     = new RootSpud <double>(values.manager);
     indicator = new QRegressionForcedSlope(values, x, 3, slope);
     addPoint(2, 0, 0.5);
     hasNaN();
     addPoint(2, -1, 0.5);
     hasNaN();
     addPoint(2, 3, 0.7);
     checkOutputs(1.53333, 0.7);
 }
Exemplo n.º 2
0
 public void testSlopeHasInfinity()
 {
     x         = new RootSpud <double>(values.manager);
     slope     = new RootSpud <double>(values.manager);
     indicator = new QRegressionForcedSlope(values, x, 3, slope);
     addPoint(-5, -1, 0.5);
     hasNaN();
     addPoint(1, -2, 0);
     hasNaN();
     addPoint(-3, 0, 0.5);
     addPoint(-5, -1, double.NegativeInfinity);
     hasNaN();
     addPoint(8, 3, 0.7);
     checkOutputs(-0.46666, 0.7);
     addPoint(5, 1, 0);
     checkOutputs(2.66666, 0);
     addPoint(4, 0, -2);
     checkOutputs(8.33333, -2);
 }
Exemplo n.º 3
0
 public void testLongSeries()
 {
     x         = new RootSpud <double>(values.manager);
     slope     = new RootSpud <double>(values.manager);
     indicator = new QRegressionForcedSlope(values, x, 10, slope);
     addPoint(-5, -1, 0.5);
     hasNaN();
     addPoint(5, 3, 0.5);
     addPoint(1, 0.5, 2);
     addPoint(3, 1, 0.2);
     addPoint(2, 1.1, 0.6);
     addPoint(8, 1.3, 0.4);
     addPoint(-2, -1, 0.6);
     addPoint(-8, -5, 1.9);
     addPoint(1, 0.5, 2);
     addPoint(0, 0, 1.678);
     checkOutputs(0.43288, 1.678);
     addPoint(5, 1, 1.5);
     checkOutputs(1.14, 1.5);
     addPoint(4, 1, 0);
     checkOutputs(1.4, 0);
 }