projects/nnum/decomposition/decomposition.py
def _qr_decomposition(a0, k):
    """Recursive call of :qr_decomposition function.

    :param a0: the matrix A (it's also the parameter :a in the :qr_decomposition).
    :param k: which level of reduction is the algorithm dealing. Resolves recursion.
    :return: Q and R matrix.
    """
    _q, ak_minus_1 = (
        np.identity(a0.shape[0]), a0) if k == 1 else _qr_decomposition(a0,
                                                                       k - 1)
    x = ak_minus_1[:, k - 1].reshape((a0.shape[0], 1))
    y = x + np.sign(x[k - 1]) * np.linalg.norm(x) * e(k - 1, a0.shape[0])
    h = np.identity(a0.shape[0]) - 2 * np.dot(y, y.T) / np.dot(y.T, y)
    del x, y

    return np.dot(_q, h.T), np.dot(h, ak_minus_1)
Recursive call of :qr_decomposition function.

    :param a0: the matrix A (it's also the parameter :a in the :qr_decomposition).
    :param k: which level of reduction is the algorithm dealing. Resolves recursion.
    :return: Q and R matrix.
    
Recursive call of :qr_decomposition function.
Recursive call of : qr_decomposition function .
def _qr_decomposition(a0, k):
    _q, ak_minus_1 = (
        np.identity(a0.shape[0]), a0) if k == 1 else _qr_decomposition(a0,
                                                                       k - 1)
    x = ak_minus_1[:, k - 1].reshape((a0.shape[0], 1))
    y = x + np.sign(x[k - 1]) * np.linalg.norm(x) * e(k - 1, a0.shape[0])
    h = np.identity(a0.shape[0]) - 2 * np.dot(y, y.T) / np.dot(y.T, y)
    del x, y
    return np.dot(_q, h.T), np.dot(h, ak_minus_1)
def _qr_decomposition ( a0 , k ) : _q , ak_minus_1 = ( np . identity ( a0 . shape [ 0 ] ) , a0 ) if k == 1 else _qr_decomposition ( a0 , k - 1 ) x = ak_minus_1 [ : , k - 1 ] . reshape ( ( a0 . shape [ 0 ] , 1 ) ) y = x + np . sign ( x [ k - 1 ] ) * np . linalg . norm ( x ) * e ( k - 1 , a0 . shape [ 0 ] ) h = np . identity ( a0 . shape [ 0 ] ) - 2 * np . dot ( y , y . T ) / np . dot ( y . T , y ) del x , y return np . dot ( _q , h . T ) , np . dot ( h , ak_minus_1 )
Recursive call of :qr_decomposition function.
Recursive call of : qr_decomposition function .
"""Recursive call of :qr_decomposition function.

    :param a0: the matrix A (it's also the parameter :a in the :qr_decomposition).
    :param k: which level of reduction is the algorithm dealing. Resolves recursion.
    :return: Q and R matrix.
    """
Q and R matrix.
Q and R matrix .
a0
the matrix A (it's also the parameter :a in the :qr_decomposition).
the matrix A ( it ' s also the parameter : a in the : qr_decomposition ) .
k
which level of reduction is the algorithm dealing. Resolves recursion.
which level of reduction is the algorithm dealing . Resolves recursion .