Like LRBuild but builds model Y = A(0)*X[0] + ... + A(N-1)*X[N-1] i.e. with zero constant term. -- ALGLIB -- Copyright 30.10.2008 by Bochkanov Sergey *************************************************************************/
| 356 | Copyright 30.10.2008 by Bochkanov Sergey |
| 357 | *************************************************************************/ |
| 358 | void lrbuildz(const ap::real_2d_array& xy, |
| 359 | int npoints, |
| 360 | int nvars, |
| 361 | int& info, |
| 362 | linearmodel& lm, |
| 363 | lrreport& ar) |
| 364 | { |
| 365 | ap::real_1d_array s; |
| 366 | int i; |
| 367 | double sigma2; |
| 368 | |
| 369 | if( npoints<=nvars+1||nvars<1 ) |
| 370 | { |
| 371 | info = -1; |
| 372 | return; |
| 373 | } |
| 374 | s.setbounds(0, npoints-1); |
| 375 | for(i = 0; i <= npoints-1; i++) |
| 376 | { |
| 377 | s(i) = 1; |
| 378 | } |
| 379 | lrbuildzs(xy, s, npoints, nvars, info, lm, ar); |
| 380 | if( info<0 ) |
| 381 | { |
| 382 | return; |
| 383 | } |
| 384 | sigma2 = ap::sqr(ar.rmserror)*npoints/(npoints-nvars-1); |
| 385 | for(i = 0; i <= nvars; i++) |
| 386 | { |
| 387 | ap::vmul(&ar.c(i, 0), 1, ap::vlen(0,nvars), sigma2); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | |
| 392 | /************************************************************************* |
no test coverage detected