v2026.5.3
All Bundles
Bundle Machine learning library with linear regression, logistic regression, k-means clustering, and matrix operations. Designed for tabular data; supports training, prediction, and model evaluation. Compile with -lib ml.

LinearSolver

Solves a system of linear equations

m1 := [
  [1., 1., 2., 3.]
  [1., 4., 5., 6.]
  [1., 7., 8., 9.]];

m2 := [
  [6.]
  [16.]
  [23.]];

solver := System.ML.LinearSolver->New(m1, m2)->Calculate(1);
solver->GetRSquared()->PrintLine();

Operations

Calculate #

Calculates the equation coefficients

method : public : Calculate(offset:Int) ~ LinearResult

Parameters

NameTypeDescription
offsetIntoffset column for r-squared

Return

TypeDescription
LinearResultequation coefficients and r-squared

New # constructor

Constructor

New(m1:Float[,], m2:Float[,])

Parameters

NameTypeDescription
m1Floatfirst matrix
m2Floatsecond matrix