
    wg                     :    d dl mZ d	dZdefdZd	dZddddZy)
   )_iszeroFc                 v    | j                  |d      \  }}|D cg c]  }| j                  |       c}S c c}w )a  Returns a list of vectors (Matrix objects) that span columnspace of ``M``

    Examples
    ========

    >>> from sympy import Matrix
    >>> M = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
    >>> M
    Matrix([
    [ 1,  3, 0],
    [-2, -6, 0],
    [ 3,  9, 6]])
    >>> M.columnspace()
    [Matrix([
    [ 1],
    [-2],
    [ 3]]), Matrix([
    [0],
    [0],
    [6]])]

    See Also
    ========

    nullspace
    rowspace
    Tsimplifywith_pivots)echelon_formcolMr   reducedpivotsis        ]/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/matrices/subspaces.py_columnspacer      s6    : nnhDnIOGV$%AEE!H%%%s   6c                    | j                  ||      \  }}t        | j                        D cg c]	  }||vs| }}g }|D ]a  }| j                  g| j                  z  }	| j                  |	|<   t        |      D ]  \  }
}|	|xx   ||
|f   z  cc<    |j                  |	       c |D cg c]  }| j                  | j                  d|      ! c}S c c}w c c}w )a  Returns list of vectors (Matrix objects) that span nullspace of ``M``

    Examples
    ========

    >>> from sympy import Matrix
    >>> M = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
    >>> M
    Matrix([
    [ 1,  3, 0],
    [-2, -6, 0],
    [ 3,  9, 6]])
    >>> M.nullspace()
    [Matrix([
    [-3],
    [ 1],
    [ 0]])]

    See Also
    ========

    columnspace
    rowspace
    )
iszerofuncr   r   )rrefrangecolszeroone	enumerateappend_new)r   r   r   r   r   r   	free_varsbasisfree_varvecpiv_rowpiv_colbs                r   
_nullspacer"   &   s    4 ff
XfFOGV!!&&M=qQf_=I=E 	 166)H )& 1 	7GWLGGX$566L	7 	S	 +00QAFF1661a 00 > 1s   	CC*$Cc                     | j                  |d      \  }}t        t        |            D cg c]  }|j                  |       c}S c c}w )aD  Returns a list of vectors that span the row space of ``M``.

    Examples
    ========

    >>> from sympy import Matrix
    >>> M = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
    >>> M
    Matrix([
    [ 1,  3, 0],
    [-2, -6, 0],
    [ 3,  9, 6]])
    >>> M.rowspace()
    [Matrix([[1, 3, 0]]), Matrix([[0, 0, 6]])]
    Tr   )r   r   lenrowr
   s        r   	_rowspacer&   S   s?    " nnhDnIOGV$)#f+$67qGKKN777s   A)	normalize	rankcheckc                   ddl m} |sg S |d   j                  dk(  }|D cg c]  }|j                          }} | j                  | } |||      \  }}	|r#|j
                  t        |      k  rt        d      g }
t        |j
                        D ]>  }|r | |dd|f   j                        }n | |dd|f         }|
j                  |       @ |
S c c}w )a  Apply the Gram-Schmidt orthogonalization procedure
    to vectors supplied in ``vecs``.

    Parameters
    ==========

    vecs
        vectors to be made orthogonal

    normalize : bool
        If ``True``, return an orthonormal basis.

    rankcheck : bool
        If ``True``, the computation does not stop when encountering
        linearly dependent vectors.

        If ``False``, it will raise ``ValueError`` when any zero
        or linearly dependent vectors are found.

    Returns
    =======

    list
        List of orthogonal (or orthonormal) basis vectors.

    Examples
    ========

    >>> from sympy import I, Matrix
    >>> v = [Matrix([1, I]), Matrix([1, -I])]
    >>> Matrix.orthogonalize(*v)
    [Matrix([
    [1],
    [I]]), Matrix([
    [ 1],
    [-I]])]

    See Also
    ========

    MatrixBase.QRdecomposition

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process
    r   )_QRdecomposition_optional    )r'   z0GramSchmidt: vector set not linearly independentN)decompositionsr*   rowsr   hstackr   r$   
ValueErrorr   Tr   )clsr'   r(   vecsr*   all_row_vecsxr   QRretr   r	   s                r   _orthogonalizer8   i   s    ` :	GLLA%L!"AEEG"D"

DA$Q)<DAqQVVc$i'KLL
C166] a1gii.Ca1g,C

3 J #s   CN)F)	utilitiesr   r   r"   r&   r8        r   <module>r<      s-    &D !W *1Z8, */% Er;   