o
    "ôjñ  ã                   @   sl   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	m
Z
 d dlmZ ddlmZ G d	d
„ d
e	ƒZdS )é    )Úcheck_assumptions)Ú	fuzzy_and)Ú_sympify)Ú
MatrixKind)ÚSetÚSetKind)Ú
NumberKindé   )Ú
MatrixExprc                   @   sP   e Zd ZdZdZdd„ Zedd„ ƒZedd„ ƒZd	d
„ Z	e
dd„ ƒZdd„ ZdS )Ú	MatrixSetaw  
    MatrixSet represents the set of matrices with ``shape = (n, m)`` over the
    given set.

    Examples
    ========

    >>> from sympy.matrices import MatrixSet
    >>> from sympy import S, I, Matrix
    >>> M = MatrixSet(2, 2, set=S.Reals)
    >>> X = Matrix([[1, 2], [3, 4]])
    >>> X in M
    True
    >>> X = Matrix([[1, 2], [I, 4]])
    >>> X in M
    False

    Fc                 C   sX   t |ƒt |ƒt |ƒ}}}|  |¡ |  |¡ t|tƒs$td |¡ƒ‚t | |||¡S )Nz {} should be an instance of Set.)r   Ú
_check_dimÚ
isinstancer   Ú	TypeErrorÚformatÚ__new__)ÚclsÚnÚmÚset© r   úr/var/www/html/academy/tools/voices/clone/cosy-venv/lib/python3.10/site-packages/sympy/matrices/expressions/sets.pyr      s   


zMatrixSet.__new__c                 C   s   | j d d… S ©Né   ©Úargs©Úselfr   r   r   Úshape'   s   zMatrixSet.shapec                 C   s
   | j d S r   r   r   r   r   r   r   +   s   
zMatrixSet.setc                    s`   t |tƒstd |¡ƒ‚|jˆ jkr%tdd„ |jˆ j D ƒƒ}|r#d S dS t‡ fdd„|D ƒƒS )Nz'{} should be an instance of MatrixExpr.c                 s   s   � | ]}t |ƒjV  qd S ©N)r   Ú	is_Symbol©Ú.0Úxr   r   r   Ú	<genexpr>3   s   € z&MatrixSet._contains.<locals>.<genexpr>Fc                 3   s   � | ]	}ˆ j  |¡V  qd S r   )r   Úcontainsr    r   r   r   r#   7   s   € )r   r
   r   r   r   Úanyr   )r   ÚotherZare_symbolicr   r   r   Ú	_contains/   s   
zMatrixSet._containsc                 C   s0   |j  o
t|ddd�}|du rtd |¡ƒ‚dS )z2Helper function to check invalid matrix dimensionsT)ÚintegerÚnonnegativeFz?The dimension specification {} should be a nonnegative integer.N)Úis_Floatr   Ú
ValueErrorr   )r   ÚdimÚokr   r   r   r   9   s   
ÿþÿzMatrixSet._check_dimc                 C   s   t ttƒƒS r   )r   r   r   r   r   r   r   Ú_kindC   s   zMatrixSet._kindN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úis_emptyr   Úpropertyr   r   r'   Úclassmethodr   r.   r   r   r   r   r   
   s    



	r   N)Zsympy.core.assumptionsr   Úsympy.core.logicr   Úsympy.core.sympifyr   Zsympy.matrices.kindr   Úsympy.sets.setsr   r   Zsympy.core.kindr   Úmatexprr
   r   r   r   r   r   Ú<module>   s    