MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / lrbuildz

Function lrbuildz

src/linreg.cpp:358–389  ·  view source on GitHub ↗

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 *************************************************************************/

Source from the content-addressed store, hash-verified

356 Copyright 30.10.2008 by Bochkanov Sergey
357*************************************************************************/
358void 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/*************************************************************************

Callers 6

runEM_linearFunction · 0.85
runEMFunction · 0.85
runEMlogFunction · 0.85
calculateRatioUsingCGMethod · 0.85
calculateRatioMethod · 0.85

Calls 3

lrbuildzsFunction · 0.85
vmulFunction · 0.85
setboundsMethod · 0.45

Tested by

no test coverage detected