o
    0Gf                     @   s   d dl ZdddZdS )    Nc                 C   s   t | tjr| jdkr| j} t| }t| d }|s"t| d j}tj||f|d}d}d}g }g }	g }
t	| |D ]'\}}||dd|f< tj
|}||kr\|| |}|d7 }q:|	| q:|ddd|f |fS )z
    construct array with independent columns

    x is either iterable (list, tuple) or instance of ndarray or a subclass
    of it.  If x is an ndarray, then each column is assumed to represent a
    variable with observations in rows.
       r   )dtypeN   )
isinstancenpZndarrayndimTlenZasarrayr   ZzeroszipZlinalgZmatrix_rankappend)xvarnamesr   Z
nvars_origZnobsZxoutcountZrank_oldZvarnames_newZvarnames_droppedZkeepindxZxiZniZrank_new r   8lib/python3.10/site-packages/statsmodels/tools/catadd.py	add_indep   s*   


r   )N)Znumpyr   r   r   r   r   r   <module>   s    