a
    RG5d                     @   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sHtd|t| |||S )Nz {} should be an instance of Set.)r   
_check_dim
isinstancer   	TypeErrorformat__new__)clsnmset r   [/var/www/html/django/DPS/env/lib/python3.9/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rJtdd |j j D }|rFd 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       z&MatrixSet._contains.<locals>.<genexpr>Fc                 3   s   | ]} j |V  qd S r   )r   containsr    r   r   r   r#   7   r$   )r   r
   r   r   r   anyr   )r   otherZare_symbolicr   r   r   	_contains/   s    
zMatrixSet._containsc                 C   s(   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)r   
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   _kindB   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   Zsympy.core.logicr   sympy.core.sympifyr   sympy.matrices.commonr   sympy.sets.setsr   r   Zsympy.core.kindr   matexprr
   r   r   r   r   r   <module>   s   