You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/API_specification/linear_algebra_functions.md
+29-3
Original file line number
Diff line number
Diff line change
@@ -313,10 +313,36 @@ Computes the (Moore-Penrose) pseudo-inverse of a matrix (or a stack of square ma
313
313
314
314
- an array containing the pseudo-inverses. The returned array must have a floating-point data type determined by {ref}`type-promotion` and must have shape `(..., N, M)` (i.e., must have the same shape as `x`, except the innermost two dimensions must be transposed).
315
315
316
-
(function-qr)=
317
-
### qr()
316
+
(function-linalg-qr)=
317
+
### linalg.qr(x, /, *, mode='reduced')
318
318
319
-
TODO
319
+
Computes the qr factorization of a matrix (or a stack of matrices), where `q` is an orthonormal matrix (or a stack of matrices) and `r` is an upper-triangular matrix (or a stack of matrices).
320
+
321
+
#### Parameters
322
+
323
+
-**x**: _<array>_
324
+
325
+
- input array having shape `(..., M, N)` and whose innermost two dimensions form `MxN` matrices. Should have a floating-point data type.
326
+
327
+
-**mode**: _str_
328
+
329
+
- factorization mode. Should be one of the following modes:
330
+
331
+
-`'reduced'`: compute only the leading `K` columns of `q`, such that `q` and `r` have dimensions `(..., M, K)` and `(..., K, N)`, respectively, and where `K = min(M, N)`.
332
+
-`'complete'`: compute `q` and `r` with dimensions `(..., M, M)` and `(..., M, N)`, respectively.
333
+
334
+
Default: `'reduced'`.
335
+
336
+
#### Returns
337
+
338
+
-**out**: _Tuple\[<array>, <array>]_
339
+
340
+
- a namedtuple `(q, r)` whose
341
+
342
+
- first element must be an array whose shape depends on the value of `mode` and contain orthonormal matrices. If `mode` is `'complete'`, the array must have shape `(..., M, M)`. If `mode` is `'reduced'`, the array must have shape `(..., M, K)`, where `K = min(M, N)`. The first `x.ndim-2` dimensions must have the same size as those of the input `x`.
343
+
- second element must be an array whose shape depends on the value of `mode` and contain upper-triangular matrices. If `mode` is `'complete'`, the array must have shape `(..., M, M)`. If `mode` is `'reduced'`, the array must have shape `(..., K, N)`, where `K = min(M, N)`. The first `x.ndim-2` dimensions must have the same size as those of the input `x`.
344
+
345
+
Each returned array must have a floating-point data type determined by {ref}`type-promotion`.
0 commit comments