� ��g���<�ddlmZd d�Zdefd�Zd d�Zddd�d�ZdS) �)�_iszeroFc�T����|d���\}}�fd�|D��S)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_pivotsc�:��g|]}��|����S�)�col)�.0�i�Ms ��h/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/matrices/subspaces.py� <listcomp>z _columnspace.<locals>.<listcomp>#s#��� %� %� %��A�E�E�!�H�H� %� %� %�)� echelon_form)r r�reduced�pivotss` r� _columnspacers8���:�n�n�h�D�n�I�I�O�G�V� %� %� %� %�f� %� %� %�%rc�\�� ���||���\}� � fd�t�j��D��}g}|D]^}�jg�jz}�j||<t � ��D]\}} || xx|||fzcc<�|�|���_�fd�|D��S)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 )� iszerofuncrc���g|]}|�v�|�� Sr r )r r rs �rrz_nullspace.<locals>.<listcomp>Bs���=�=�=�q�Q�f�_�_��_�_�_rc�H��g|]}���jd|����S)r)�_new�cols)r �br s �rrz_nullspace.<locals>.<listcomp>Ps+��� 0� 0� 0�Q�A�F�F�1�6�1�a� � � 0� 0� 0r)�rref�ranger�zero�one� enumerate�append) r rrr� free_vars�basis�free_var�vec�piv_row�piv_colrs ` @r� _nullspacer(&s�����4�f�f� �X�f�F�F�O�G�V�=�=�=�=�E�!�&�M�M�=�=�=�I��E�� � �����1�6�)�����H� � )�&� 1� 1� 7� 7� �G�W� ��L�L�L�G�G�X�$5�6� 6�L�L�L�L� � � �S����� 0� 0� 0� 0�%� 0� 0� 0�0rc���|�|d���\�}�fd�tt|����D��S)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]])] Trc�:��g|]}��|����Sr )�row)r r rs �rrz_rowspace.<locals>.<listcomp>fs#��� 7� 7� 7�q�G�K�K��N�N� 7� 7� 7r)rr�len)r rrrs @r� _rowspacer-SsF���"�n�n�h�D�n�I�I�O�G�V� 7� 7� 7� 7�E�#�f�+�+�$6�$6� 7� 7� 7�7r)� normalize� rankcheckc��ddlm}|sgS|djdk}d�|D��}|j|�}|||���\}}|r'|jt |��krt d���g} t|j��D]I} |r||dd�| fj��} n||dd�| f��} | � | ���J| S)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�c�6�g|]}|�����Sr )r%)r �xs rrz"_orthogonalize.<locals>.<listcomp>�s �� "� "� "��A�E�E�G�G� "� "� "r)r.z0GramSchmidt: vector set not linearly independentN) �decompositionsr1�rows�hstackrr,� ValueErrorr�Tr!) �clsr.r/�vecsr1� all_row_vecsr �Q�R�retr r s r�_orthogonalizer@is��`:�9�9�9�9�9� ��� ���G�L�A�%�L� "� "�T� "� "� "�D��� �D��A� $� $�Q�)� <� <� <�D�A�q��M�Q�V�c�$�i�i�'�'��K�L�L�L� �C� �1�6�]�]���� � ��#�a����1��g�i�.�.�C�C��#�a����1��g�,�,�C� � � �3����� �JrN)F)� utilitiesrrr(r-r@r rr�<module>rBs���������&�&�&�&�D!�W�*1�*1�*1�*1�Z8�8�8�8�,*/�%�E�E�E�E�E�E�Er
Memory