MCPcopy Create free account
hub / github.com/dask/dask / qr

Function qr

dask/array/linalg.py:837–873  ·  view source on GitHub ↗

Compute the qr factorization of a matrix. Parameters ---------- a : Array Returns ------- q: Array, orthonormal r: Array, upper-triangular Examples -------- >>> q, r = da.linalg.qr(x) # doctest: +SKIP See Also -------- numpy.linalg.qr:

(a)

Source from the content-addressed store, hash-verified

835
836
837def qr(a):
838 """
839 Compute the qr factorization of a matrix.
840
841 Parameters
842 ----------
843 a : Array
844
845 Returns
846 -------
847 q: Array, orthonormal
848 r: Array, upper-triangular
849
850 Examples
851 --------
852 >>> q, r = da.linalg.qr(x) # doctest: +SKIP
853
854 See Also
855 --------
856 numpy.linalg.qr: Equivalent NumPy Operation
857 dask.array.linalg.tsqr: Implementation for tall-and-skinny arrays
858 dask.array.linalg.sfqr: Implementation for short-and-fat arrays
859 """
860
861 if len(a.chunks[1]) == 1 and len(a.chunks[0]) > 1:
862 return tsqr(a)
863 elif len(a.chunks[0]) == 1:
864 return sfqr(a)
865 else:
866 raise NotImplementedError(
867 "qr currently supports only tall-and-skinny (single column chunk/block; see tsqr)\n"
868 "and short-and-fat (single row chunk/block; see sfqr) matrices\n\n"
869 "Consider use of the rechunk method. For example,\n\n"
870 "x.rechunk({0: -1, 1: 'auto'}) or x.rechunk({0: 'auto', 1: -1})\n\n"
871 "which rechunk one shorter axis to a single chunk, while allowing\n"
872 "the other axis to automatically grow/shrink appropriately."
873 )
874
875
876def svd(a, coerce_signs=True):

Callers 3

test_qrFunction · 0.90
lstsqFunction · 0.85

Calls 2

tsqrFunction · 0.85
sfqrFunction · 0.85

Tested by 2

test_qrFunction · 0.72