MCPcopy
hub / github.com/dask/dask / qr

Function qr

dask/array/linalg.py:835–871  ·  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

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

Callers 3

test_qrFunction · 0.90
lstsqFunction · 0.85

Calls 2

tsqrFunction · 0.85
sfqrFunction · 0.85

Tested by 2

test_qrFunction · 0.72