dask.array.linalg.lstsq

dask.array.linalg.lstsq

dask.array.linalg.lstsq(a, b)[source]

Return the least-squares solution to a linear matrix equation using QR decomposition.

Solves the equation a x = b by computing a vector x that minimizes the Euclidean 2-norm || b - a x ||^2. The equation may be under-, well-, or over- determined (i.e., the number of linearly independent rows of a can be less than, equal to, or greater than its number of linearly independent columns). If a is square and of full rank, then x (but for round-off error) is the “exact” solution of the equation.

Parameters
a(M, N) array_like

“Coefficient” matrix.

b{(M,), (M, K)} array_like

Ordinate or “dependent variable” values. If b is two-dimensional, the least-squares solution is calculated for each of the K columns of b.

Returns
x{(N,), (N, K)} Array

Least-squares solution. If b is two-dimensional, the solutions are in the K columns of x.

residuals{(1,), (K,)} Array

Sums of residuals; squared Euclidean 2-norm for each column in b - a*x. If b is 1-dimensional, this is a (1,) shape array. Otherwise the shape is (K,).

rankArray

Rank of matrix a.

s(min(M, N),) Array

Singular values of a.