haojin2 commented on a change in pull request #17851: [WIP] [Numpy] 
np.linalg.qr forward implementation
URL: https://github.com/apache/incubator-mxnet/pull/17851#discussion_r393969808
 
 

 ##########
 File path: python/mxnet/numpy/linalg.py
 ##########
 @@ -291,6 +291,78 @@ def cholesky(a):
     return _mx_nd_np.linalg.cholesky(a)
 
 
+def qr(a, mode='reduced'):
+    r"""
+    Compute the qr factorization of a matrix a.
+    Factor the matrix a as qr, where q is orthonormal and r is 
upper-triangular.
+
+    Parameters
+    ----------
+    a : (..., M, N) ndarray
+        Matrix or stack of matrices to be qr factored.
+    mode: {‘reduced’, ‘complete’, ‘r’, ‘raw’, ‘full’, ‘economic’}, optional
+        Only default mode, 'reduced', is implemented. If K = min(M, N), then
+        * 'reduced’ : returns q, r with dimensions (M, K), (K, N) (default)
+
+    Returns
+    -------
+    q : (..., M, K) ndarray
+        A matrix or stack of matrices with K orthonormal columns, with K = 
min(M, N).
+    r : (..., K, N) ndarray
+        A matrix or stack of upper triangular matrices.
+
+    Raises
+    ------
+    MXNetError
+        If factoring fails.
+
+    Examples
+    --------
+    >>> from mxnet import np
+    >>> a = np.random.uniform(-10, 10, (3, 3))
+    >>> a
+    array([[ 0.9762707 ,  1.8568916 ,  4.303787  ],
+       [ 6.885315  ,  2.0552673 ,  7.1589127 ],
 
 Review comment:
   would you please fix the alignment of the examples here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to