Skip to content

lstsq

Module: strata.core • Kind: function
Source: strata/core/linalg.mojo

def lstsq[dtype: DType = DType.float64](
A: Matrix[dtype],
b: List[Scalar[dtype]],
rcond: Float64 = -1.0,
) -> List[Scalar[dtype]]
from strata.core import lstsq

Solve linear least-squares problem min⁡x∥Ax−b∥2\min_x \|A x - b\|_2 using SVD.

Uses LAPACK dgelss/sgelss to compute the minimum-norm least-squares solution.

Returns: List[Scalar[dtype]] — List[Scalar[dtype]]: Least-squares solution vector xx of length NN.