You are here: Symbol Reference > RegModels Namespace > Functions > RegModels.MulLinEval Function
Stats Master VCL
ContentsIndex
PreviousUpNext
RegModels.MulLinEval Function

Evaluates b[0] + b[1]*x[0] + b[2]*x[1] + ... for given values in X vector, parameters in B array, and returns the results in XHat vector.

Pascal
procedure MulLinEval(Const B: Array of double; const X: TMtx; const YHat: TVec; Constant: boolean = false); overload;

Size and Complex properties of XHat vector are adjusted automatically.

Use this version if you want to evaluate multiple linear function for multiple values at the same time. This is a lot faster than calling single value version for each x value.

Evaluate multiple linear function for multiple values at the same time.

Uses MtxExpr, RegModels;
procedure Example;
var YHat: Vector;
    X: Matrix;
begin
  X.SetIt(3,3,false,[2, -3, 5,
                     1, 6, -4,
                     8, 7, 9]);
  MulLinEval([1, 0.5, -2],X,YHat,false); // no constant term !
  // YHat = (-9.5, 12, -6.5)
end;
#include "MtxExpr.hpp"
#include "Math387.hpp"
#include "RegModels.hpp"
#include "MtxVecTee.hpp"
void __fastcall Example();
{
  sMatrix X;
  sVector YHat;

  X.SetIt(3,3,false,OPENARRAY(double,(2, -3, 5,
                     1, 6, -4,
                     8, 7, 9)));
  MulLinEval(OPENARRAY(double,(1,0.5,-2)),X,YHat,false); // no constant term!
  // YHat = (-9.5, 12, -6.5)
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!