K i:ddlmZd dZdefdZd dZddddZy) )_iszeroFcv|j|d\}}|Dcgc]}|j|c}Scc}w)aReturns 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 Tsimplify with_pivots) echelon_formcolMrreducedpivotsis ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/matrices/subspaces.py _columnspacers6:nnhDnIOGV$ %AEE!H %% %s6c|j||\}}t|jDcgc] }||vs| }}g}|D]a}|jg|jz} |j| |<t |D]\} } | | xx|| |fzcc<|j | c|D cgc]} |j|jd| !c} Scc}wcc} w)aReturns 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 ) iszerofuncrr)rrefrangecolszeroone enumerateappend_new) r rrr r r free_varsbasisfree_varvecpiv_rowpiv_colbs r _nullspacer"&s4ff XfFOGV!!&&M=qQf_=I=E 166)H )& 1 7 GW LGGX$56 6L 7  S +0 0QAFF1661a 00> 1s CC*$Cc|j|d\}}tt|Dcgc]}|j|c}Scc}w)aDReturns 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)rrlenrowr s r _rowspacer&Ss?"nnhDnIOGV$)#f+$6 7qGKKN 77 7sA) normalize rankcheckcddlm}|sgS|djdk(}|Dcgc]}|j}}|j|}|||\}} |r#|j t |kr tdg} t|j D]>} |r||dd| fj} n||dd| f} | j| @| Scc}w)aApply 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*rowsrhstackrr$ ValueErrorrTr) clsr'r(vecsr* all_row_vecsxr QRretrr s r_orthogonalizer8is`:  GLLA%L! "AEEG "D " DA $Q) r<s-&D!W*1Z8,*/%Er;