本文整理汇总了C++中LinearRegression::getYIntercept方法的典型用法代码示例。如果您正苦于以下问题:C++ LinearRegression::getYIntercept方法的具体用法?C++ LinearRegression::getYIntercept怎么用?C++ LinearRegression::getYIntercept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinearRegression
的用法示例。
在下文中一共展示了LinearRegression::getYIntercept方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEUCHOS_UNIT_TEST( Rythmos_ConvergenceTestHelpers, trivialData ) {
LinearRegression<double> lr;
Array<double> x,y;
x.push_back(0.0);
x.push_back(1.0);
y.push_back(0.0);
y.push_back(1.0);
lr.setData(x,y);
TEST_EQUALITY_CONST( lr.getSlope(), 1.0 );
TEST_EQUALITY_CONST( lr.getYIntercept(), 0.0 );
}
示例2: cos
TEUCHOS_UNIT_TEST( Rythmos_ConvergenceTestHelpers, CoSineData ) {
LinearRegression<double> lr;
Array<double> x,y;
int N = 11;
double dt = 0.1;
for (int i=0 ; i<N ; ++i) {
double xval = dt*i;
x.push_back( xval );
y.push_back( cos(xval) );
}
lr.setData(x,y);
// 1.0e-14 works on rancilio but not on gabriel, exetazo, or s858352
double tol = 1.0e-13;
TEST_FLOATING_EQUALITY( lr.getSlope(), -4.653508042678562e-01, tol ); // These came from matlab
TEST_FLOATING_EQUALITY( lr.getYIntercept(), 1.067025181571952, tol );
}
示例3: sin
TEUCHOS_UNIT_TEST( Rythmos_ConvergenceTestHelpers, SineData ) {
LinearRegression<double> lr;
Array<double> x,y;
int N = 11;
double dt = 0.1;
for (int i=0 ; i<N ; ++i) {
double xval = dt*i;
x.push_back( xval );
y.push_back( sin(xval) );
}
lr.setData(x,y);
// 1.0e-14 works on rancilio but not on gabriel, exetazo, or s858352
double tol = 1.0e-13;
TEST_FLOATING_EQUALITY( lr.getSlope(), 8.518189335013251e-01, tol ); // These came from matlab
TEST_FLOATING_EQUALITY( lr.getYIntercept(), 2.989789515694744e-02, tol );
}