From f51ac6a14dff7230afcba73ea866bff425050566 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 26 Jul 2021 09:34:34 -0700 Subject: [PATCH] Replace lstsq with lstsq_solve --- spec/extensions/linear_algebra_functions.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/spec/extensions/linear_algebra_functions.md b/spec/extensions/linear_algebra_functions.md index 00e05ab86..f623b9db0 100644 --- a/spec/extensions/linear_algebra_functions.md +++ b/spec/extensions/linear_algebra_functions.md @@ -267,8 +267,8 @@ Computes the multiplicative inverse of a square matrix (or a stack of square mat - an array containing the multiplicative inverses. The returned array must have a floating-point data type determined by {ref}`type-promotion` and must have the same shape as `x`. -(function-linalg-lstsq)= -### linalg.lstsq(x1, x2, /, *, rtol=None) +(function-linalg-lstsq-solve)= +### linalg.lstsq_solve(x1, x2, /, *, rtol=None) Returns the least-squares solution to a linear matrix equation `Ax = b`. @@ -288,14 +288,9 @@ Returns the least-squares solution to a linear matrix equation `Ax = b`. #### Returns -- **out**: _Tuple\[ <array>, <array>, <array>, <array> ]_ - - - a namedtuple `(x, residuals, rank, s)` whose +- **out**: _<array>_ - - first element must have the field name `x` and must be an array containing the least-squares solution for each `MxN` matrix in `x1`. The array containing the solutions must have shape `(N, K)` and must have a floating-point data type determined by {ref}`type-promotion`. - - second element must have the field name `residuals` and must be an array containing the sum of squares residuals (i.e., the squared Euclidean 2-norm for each column in `b - Ax`). The array containing the residuals must have shape `(K,)` and must have a floating-point data type determined by {ref}`type-promotion`. - - third element must have the field name `rank` and must be an array containing the effective rank of each `MxN` matrix. The array containing the ranks must have shape `shape(x1)[:-2]` and must have an integer data type. - - fourth element must have the field name `s` and must be an array containing the singular values for each `MxN` matrix in `x1`. The array containing the singular values must have shape `(..., min(M, N))` and must have a floating-point data type determined by {ref}`type-promotion`. + - an array containing the least-squares solution for each `MxN` matrix in `x1`. The array containing the solutions must have shape `(N, K)` and must have a floating-point data type determined by {ref}`type-promotion`. (function-linalg-matmul)= ### linalg.matmul(x1, x2, /)