
    Џkh_                     ,   d dl mZmZ d dlZd dlZd dlmZmZ d dl	Z	d dl	m
Z d dlmZmZmZmZmZmZmZmZ  ej*                   e ee      d            Z ed      D  cg c]
  } ed|      c} Z ed      D  cg c]
  } ed	|      c} Z ej*                   e ee      d
            Z ej*                   e ee      d            Zed   Zd Zd Zd Z d Z!d Z"d Z#ddZ$ddZ%ddZ&ddZ' G d d      Z( G d d      Z) G d de)      Z* G d de)      Z+ G d d e)      Z, G d! d"e)      Z- G d# d$e*      Z. G d% d&e*      Z/ G d' d(e*      Z0 G d) d*e+      Z1 G d+ d,e+      Z2 G d- d.e+      Z3 G d/ d0e,      Z4 G d1 d2e,      Z5 G d3 d4e,      Z6 G d5 d6e-      Z7 G d7 d8e-      Z8 G d9 d:e-      Z9 G d; d<      Z: G d= d>e:      Z; G d? d@e:      Z< G dA dBe:      Z= G dC dDe:      Z> G dE dFe:      Z? G dG dHe:      Z@ G dI dJe:      ZA G dK dLe:      ZB G dM dNe:      ZC G dO dPe:      ZD G dQ dRe:      ZE G dS dTe:      ZF G dU dV      ZG G dW dXeG      ZH G dY dZeG      ZI G d[ d\eH      ZJ G d] d^eH      ZK G d_ d`eH      ZL G da dbeG      ZM G dc ddeG      ZN G de dfeG      ZO G dg dheG      ZP G di djeG      ZQ G dk dleG      ZR G dm dneI      ZS G do dpeI      ZT G dq dreI      ZU G ds dt      ZV G du dveV      ZW G dw dxeV      ZX G dy dzeV      ZY G d{ d|eV      ZZ G d} d~eV      Z[ G d deV      Z\ G d deV      Z] G d deV      Z^ G d deV      Z_ G d deV      Z` G d deV      Za G d deV      Zb G d d      Zc G d d      Zdyc c} w c c} w )    )joindirnameN)assert_array_almost_equalassert_equal)raises)dctidctdstidstdctnidctndstnidstnztest.npz   xyzfftw_double_ref.npzzfftw_single_ref.npzsizesc                 V   t        j                  d|dz
  |      j                  |      }t        j                  t         j                  |      }|t         j
                  k(  rt        }n$|t         j                  k(  rt        }n
t               |d|  d|    j                  |      }|||fS )Nr      dct__	nplinspaceastyperesult_typefloat32float64FFTWDATA_DOUBLEFFTWDATA_SINGLE
ValueErrortypesizedtr   datar   s         d/var/www/teggl/fontify/venv/lib/python3.12/site-packages/scipy/fftpack/tests/test_real_transforms.pyfftw_dct_refr(          
AtAvt$++B/A	

B	'B	RZZ	rzz	l	TF!D6"	#++B/Aa8O    c                 V   t        j                  d|dz
  |      j                  |      }t        j                  t         j                  |      }|t         j
                  k(  rt        }n$|t         j                  k(  rt        }n
t               |d|  d|    j                  |      }|||fS )Nr   r   dst_r   r   r"   s         r'   fftw_dst_refr-   (   r)   r*   c                    t        j                  | d      } t        | j                  d         D ]  }t	        | |ddf   fi || |ddf<    t        | j                  d         D ]  }t	        | dd|f   fi || dd|f<    | S )z,Calculate reference values for testing dct2.Tcopyr   Nr   )r   arrayrangeshaper   r   kwargsrowcols       r'   
dct_2d_refr8   5       
AQWWQZ  -#q&	,V,#q&	-QWWQZ  -!S&	,V,!S&	-Hr*   c                    t        j                  | d      } t        | j                  d         D ]  }t	        | |ddf   fi || |ddf<    t        | j                  d         D ]  }t	        | dd|f   fi || dd|f<    | S )z-Calculate reference values for testing idct2.Tr/   r   Nr   )r   r1   r2   r3   r	   r4   s       r'   idct_2d_refr;   ?       
AQWWQZ  .36-f-#q&	.QWWQZ  .1c6-f-!S&	.Hr*   c                    t        j                  | d      } t        | j                  d         D ]  }t	        | |ddf   fi || |ddf<    t        | j                  d         D ]  }t	        | dd|f   fi || dd|f<    | S )z,Calculate reference values for testing dst2.Tr/   r   Nr   )r   r1   r2   r3   r
   r4   s       r'   
dst_2d_refr>   I   r9   r*   c                    t        j                  | d      } t        | j                  d         D ]  }t	        | |ddf   fi || |ddf<    t        | j                  d         D ]  }t	        | dd|f   fi || dd|f<    | S )z-Calculate reference values for testing idst2.Tr/   r   Nr   )r   r1   r2   r3   r   r4   s       r'   idst_2d_refr@   S   r<   r*   c           
         t        j                  | d      } t        |       }|dz
  }t        j                  |      }d\  }}|dk(  r0t        j                  d|z        }t        j                  d|z        }t        |      D ]  }t        d|dz
        D ]B  }||xx   || |   z  t        j                  t         j                  |z  |z  |z        z  z  cc<   D ||xx   || d   z  z  cc<   ||xx   || |dz
     z  |d	z  dk(  rdnd
z  z  cc<    |dk(  rI|dxx   dt        j                  d	      z  z  cc<   ||dz
  xx   dt        j                  d	      z  z  cc<   |S )z/Calculate textbook definition version of DCT-I.Tr/   r   )r      ortho      ?       @r   rB   )r   r1   lenzerossqrtr2   cospi)	r   normNMr   m0mkns	            r'   
naive_dct1rS   ]   sJ   
AAA	!A
AEBwWWSU^GGCEN1X 8q!A# 	/AaDAadF266"%%'!)A+...D	/	!QqT		!QqsVAEQJqB77	8
 w	!"''!*	!A#!BGGAJ,Hr*   c                    t        j                  | d      } t        |       }|dz   }t        j                  |      }t	        |      D ]X  }t	        |      D ]H  }||xx   d| |   z  t        j
                  t         j                  |dz   z  |dz   z  |z        z  z  cc<   J Z |dk(  r|t        j                  d|z        z  }|S )z0Calculate textbook definition version  of DST-I.Tr/   r   rB   rD   rC         ?r   r1   rG   rH   r2   sinrK   rI   )r   rL   rM   rN   r   rQ   rR   s          r'   
naive_dst1rX   r   s    
AAA	!A
A1X ;q 	;AaDAadF266"%%3-3"7"9:::D	;; w	RWWSU^Hr*   c                    t        j                  | d      } t        |       }t        j                  |      }t	        |      D ]U  }t	        |      D ]E  }||xx   | |   t        j
                  t         j                  |dz   z  |dz   z  |z        z  z  cc<   G W |dk(  r|t        j                  d|z        z  }|S |dz  }|S )z0Calculate textbook definition version of DCT-IV.Tr/   rU   rC   rE   rB   )r   r1   rG   rH   r2   rJ   rK   rI   r   rL   rM   r   rQ   rR   s         r'   
naive_dct4r[          
AAA
A1X ;q 	;AaDAaDququ 5q 9:::D	;; w	RWWSU^ H 	
QHr*   c                    t        j                  | d      } t        |       }t        j                  |      }t	        |      D ]U  }t	        |      D ]E  }||xx   | |   t        j
                  t         j                  |dz   z  |dz   z  |z        z  z  cc<   G W |dk(  r|t        j                  d|z        z  }|S |dz  }|S )z0Calculate textbook definition version of DST-IV.Tr/   rU   rC   rE   rB   rV   rZ   s         r'   
naive_dst4r^      r\   r*   c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestComplexc                     t        dt        j                  dt        j                        z        }dt        t        j                  d            z  }t	        ||       y )N              ?   dtype)r   r   arange	complex64r   selfr   r   s      r'   test_dct_complex64zTestComplex.test_dct_complex64   sA    299Qbll334s299Q<  !!Q'r*   c                     t        t        j                  d      dz        }dt        t        j                  d            z  }t        ||       y Nrc   rb   )r   r   rf   r   rh   s      r'   test_dct_complexzTestComplex.test_dct_complex   9    		!R s299Q<  !!Q'r*   c                     t        t        j                  d      dz        }dt        t        j                  d            z  }t        ||       y rl   )r	   r   rf   r   rh   s      r'   test_idct_complexzTestComplex.test_idct_complex   9    1b!tBIIaL!!!!Q'r*   c                     t        t        j                  dt        j                        dz        }dt        t        j                  d            z  }t	        ||       y )Nrc   rd   rb   )r
   r   rf   rg   r   rh   s      r'   test_dst_complex64zTestComplex.test_dst_complex64   sA    		!2<<034s299Q<  !!Q'r*   c                     t        t        j                  d      dz        }dt        t        j                  d            z  }t        ||       y rl   )r
   r   rf   r   rh   s      r'   test_dst_complexzTestComplex.test_dst_complex   rn   r*   c                     t        t        j                  d      dz        }dt        t        j                  d            z  }t        ||       y rl   )r   r   rf   r   rh   s      r'   test_idst_complexzTestComplex.test_idst_complex   rq   r*   N)	__name__
__module____qualname__rj   rm   rp   rs   ru   rw    r*   r'   r`   r`      s     (
(
(
(
(
(r*   r`   c                   B    e Zd Zd Zej
                  d        Zd Zd Zy)_TestDCTBasec                 .    d | _         d| _        d | _        y N   rdtdecr#   ri   s    r'   setup_methodz_TestDCTBase.setup_method       	r*   c                 *    t        j                         S N	threadingLockr   s    r'   dct_lockz_TestDCTBase.dct_lock       ~~r*   c           	      ~   t         D ]  }|5  t        | j                  || j                        \  }}}d d d        t	        | j                        }t        |j                         t        |t        j                  |      z  t        j                  |      z  | j                  d| d        y # 1 sw Y   xY wNr#   Size  faileddecimalerr_msg)FFTWDATA_SIZESr(   r#   r   r   r   re   r   r   maxr   )ri   r   ir   yrr%   r   s          r'   test_definitionz_TestDCTBase.test_definition   s     
	0A A(Atxx@	2rAADII&A"%
 &a"&&)mR"&&)^TXX#A3g.0
	0A A   &B33B<	c           
      
   d}t         j                  j                  d      }dD ]  }|j                  ||      }t	        || j
                        }t        |      D ]5  }t        ||   t	        ||   | j
                        | j                         7 |j                  }t	        |d| j
                        }t        |      D ]=  }t        |d d |f   t	        |d d |f   | j
                        | j                         ?  y )NrB     )   r   	          @   r   r   r   )axisr#   )
r   randomRandomStaterandnr   r#   r2   r   r   T)ri   ntrngr   r   r   js          r'   	test_axisz_TestDCTBase.test_axis   s    ii##D)& 	*A		"a AADII&A2Y *)!A$AaDtyy0I $** AAADII.A2Y *)!AaC&#a!f4992M $**	*r*   N)	rx   ry   rz   r   pytestfixturer   r   r   r{   r*   r'   r}   r}      s)    
 ^^   0*r*   r}   c                       e Zd Zd Zy)_TestDCTIBasec                    t        j                  t         j                  | j                        }t        D ]  }t        j
                  || j                        }t        |dd      }t        |d      }t        |j                  |       t        |t        j                  |      z  |t        j                  |      z  | j                          y Nrd   rC   r   rL   r#   rL   r   )r   r   r   r   Xr1   r   rS   r   re   r   r   r   ri   r%   xrr   r   y2s         r'   test_definition_orthoz#_TestDCTIBase.test_definition_ortho       ^^BJJ1 	WB488,AAG!,AAG,B"%%a"&&)mR"&&)^TXXV	Wr*   Nrx   ry   rz   r   r{   r*   r'   r   r          Wr*   r   c                       e Zd Zd Zy)_TestDCTIIBasec                 >   t        j                  t         j                  | j                        }t	        t
        t              D ]X  \  }}t        j                  ||      }t        |dd      }t        |j                  |       t        ||| j                         Z y )Nrd   rC   rB   r   r   )r   r   r   r   zipr   Yr1   r   r   re   r   r   )ri   r%   r   r   r   r   s         r'   test_definition_matlabz%_TestDCTIIBase.test_definition_matlab   so    ^^BJJ1!Qi 	?FB2&AAG!,A"%%aTXX>		?r*   N)rx   ry   rz   r   r{   r*   r'   r   r      s    ?r*   r   c                       e Zd Zd Zy)_TestDCTIIIBasec                 L   t        j                  t         j                  | j                        }t        D ]m  }t        j
                  || j                        }t        |dd      }t        |dd      }t        |j                  |       t        ||| j                         o y )Nrd   rC   rB   r      r   )r   r   r   r   r   r1   r   r   re   r   r   )ri   r%   r   r   r   xis         r'   r   z%_TestDCTIIIBase.test_definition_ortho   sw    ^^BJJ1 	?B488,AAG!,AQW1-B2&%b!TXX>	?r*   Nr   r{   r*   r'   r   r          ?r*   r   c                       e Zd Zd Zy)_TestDCTIVBasec                    t        j                  t         j                  | j                        }t        D ]  }t        j
                  || j                        }t        |dd      }t        |d      }t        |j                  |       t        |t        j                  |      z  |t        j                  |      z  | j                          y Nrd   rC      r   r   r   )r   r   r   r   r   r1   r   r[   r   re   r   r   r   r   s         r'   r   z$_TestDCTIVBase.test_definition_ortho  r   r*   Nr   r{   r*   r'   r   r     r   r*   r   c                       e Zd Zd Zy)TestDCTIDoublec                 J    t         j                  | _        d| _        d| _        y N
   r   r   r   r   r   r#   r   s    r'   r   zTestDCTIDouble.setup_method      ::	r*   Nrx   ry   rz   r   r{   r*   r'   r   r         r*   r   c                       e Zd Zd Zy)TestDCTIFloatc                 J    t         j                  | _        d| _        d| _        y Nr   r   r   r   r   r   r#   r   s    r'   r   zTestDCTIFloat.setup_method      ::	r*   Nr   r{   r*   r'   r   r     r   r*   r   c                       e Zd Zd Zy)TestDCTIIntc                 6    t         | _        d| _        d| _        y Nrc   r   intr   r   r#   r   s    r'   r   zTestDCTIInt.setup_method"      	r*   Nr   r{   r*   r'   r   r   !  r   r*   r   c                       e Zd Zd Zy)TestDCTIIDoublec                 J    t         j                  | _        d| _        d| _        y Nr   rB   r   r   s    r'   r   zTestDCTIIDouble.setup_method)  r   r*   Nr   r{   r*   r'   r   r   (  r   r*   r   c                       e Zd Zd Zy)TestDCTIIFloatc                 J    t         j                  | _        d| _        d| _        y Nrc   rB   r   r   s    r'   r   zTestDCTIIFloat.setup_method0  r   r*   Nr   r{   r*   r'   r   r   /  r   r*   r   c                       e Zd Zd Zy)TestDCTIIIntc                 6    t         | _        d| _        d| _        y r   r   r   s    r'   r   zTestDCTIIInt.setup_method7  r   r*   Nr   r{   r*   r'   r   r   6  r   r*   r   c                       e Zd Zd Zy)TestDCTIIIDoublec                 J    t         j                  | _        d| _        d| _        y Nr   r   r   r   s    r'   r   zTestDCTIIIDouble.setup_method>  r   r*   Nr   r{   r*   r'   r   r   =  r   r*   r   c                       e Zd Zd Zy)TestDCTIIIFloatc                 J    t         j                  | _        d| _        d| _        y Nrc   r   r   r   s    r'   r   zTestDCTIIIFloat.setup_methodE  r   r*   Nr   r{   r*   r'   r   r   D  r   r*   r   c                       e Zd Zd Zy)TestDCTIIIIntc                 6    t         | _        d| _        d| _        y r   r   r   s    r'   r   zTestDCTIIIInt.setup_methodL  r   r*   Nr   r{   r*   r'   r   r   K  r   r*   r   c                       e Zd Zd Zy)TestDCTIVDoublec                 J    t         j                  | _        d| _        d| _        y )N   r   r   r   s    r'   r   zTestDCTIVDouble.setup_methodS  r   r*   Nr   r{   r*   r'   r   r   R  r   r*   r   c                       e Zd Zd Zy)TestDCTIVFloatc                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestDCTIVFloat.setup_methodZ  r   r*   Nr   r{   r*   r'   r   r   Y  r   r*   r   c                       e Zd Zd Zy)TestDCTIVIntc                 6    t         | _        d| _        d| _        y r   r   r   s    r'   r   zTestDCTIVInt.setup_methoda  r   r*   Nr   r{   r*   r'   r  r  `  r   r*   r  c                   <    e Zd Zd Zej
                  d        Zd Zy)_TestIDCTBasec                 .    d | _         d| _        d | _        y r   r   r   s    r'   r   z_TestIDCTBase.setup_methodh  r   r*   c                 *    t        j                         S r   r   r   s    r'   	idct_lockz_TestIDCTBase.idct_lockm  r   r*   c           	         t         D ]  }|5  t        | j                  || j                        \  }}}d d d        t	        | j                        }| j                  dk(  r|d|dz
  z  z  }n|d|z  z  }t        |j                         t        |t        j                  |      z  t        j                  |      z  | j                  d| d        y # 1 sw Y   xY wNr   r   rB   r   r   r   )r   r(   r#   r   r	   r   re   r   r   r   r   )ri   r  r   r   r   r%   r   s          r'   r   z_TestIDCTBase.test_definitionq       	0A B)$))QA
BBRdii(AyyA~Q!A#YQU
"%
 &a"&&)mR"&&)^TXX#A3g.0	0B B   &CC	N)rx   ry   rz   r   r   r   r  r   r{   r*   r'   r  r  g  $    
 ^^   0r*   r  c                       e Zd Zd Zy)TestIDCTIDoublec                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIDouble.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDCTIFloatc                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIFloat.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDCTIIntc                 6    t         | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIInt.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDCTIIDoublec                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIIDouble.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDCTIIFloatc                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIIFloat.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDCTIIIntc                 6    t         | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIIInt.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDCTIIIDoublec                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIIIDouble.setup_method  r   r*   Nr   r{   r*   r'   r!  r!    r   r*   r!  c                       e Zd Zd Zy)TestIDCTIIIFloatc                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIIIFloat.setup_method  r   r*   Nr   r{   r*   r'   r$  r$    r   r*   r$  c                       e Zd Zd Zy)TestIDCTIIIIntc                 6    t         | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDCTIIIInt.setup_method  r   r*   Nr   r{   r*   r'   r'  r'    r   r*   r'  c                       e Zd Zd Zy)TestIDCTIVDoublec                 J    t         j                  | _        d| _        d| _        y Nr   r   r   r   s    r'   r   zTestIDCTIVDouble.setup_method  r   r*   Nr   r{   r*   r'   r*  r*    r   r*   r*  c                       e Zd Zd Zy)TestIDCTIVFloatc                 J    t         j                  | _        d| _        d| _        y Nrc   r   r   r   s    r'   r   zTestIDCTIVFloat.setup_method  r   r*   Nr   r{   r*   r'   r.  r.    r   r*   r.  c                       e Zd Zd Zy)TestIDCTIVIntc                 6    t         | _        d| _        d| _        y r0  r   r   s    r'   r   zTestIDCTIVInt.setup_method  r   r*   Nr   r{   r*   r'   r2  r2    r   r*   r2  c                   <    e Zd Zd Zej
                  d        Zd Zy)_TestDSTBasec                 .    d | _         d | _        d | _        y r   r   r   s    r'   r   z_TestDSTBase.setup_method      	r*   c                 *    t        j                         S r   r   r   s    r'   dst_lockz_TestDSTBase.dst_lock  r   r*   c           	      ~   t         D ]  }|5  t        | j                  || j                        \  }}}d d d        t	        | j                        }t        |j                         t        |t        j                  |      z  t        j                  |      z  | j                  d| d        y # 1 sw Y   xY wr   )r   r-   r#   r   r
   r   re   r   r   r   r   )ri   r9  r   r   r   r%   r   s          r'   r   z_TestDSTBase.test_definition  s     
	0A B)$))QA
BBBTYY'A"%
 &a"&&)mR"&&)^TXX#A3g.0
	0B Br   N)rx   ry   rz   r   r   r   r9  r   r{   r*   r'   r5  r5    s$    
 ^^   0r*   r5  c                       e Zd Zd Zy)_TestDSTIBasec                    t        j                  t         j                  | j                        }t        D ]  }t        j
                  || j                        }t        |dd      }t        |d      }t        |j                  |       t        |t        j                  |      z  |t        j                  |      z  | j                          y r   )r   r   r   r   r   r1   r
   rX   r   re   r   r   r   r   s         r'   r   z#_TestDSTIBase.test_definition_ortho  r   r*   Nr   r{   r*   r'   r<  r<    r   r*   r<  c                       e Zd Zd Zy)_TestDSTIVBasec                 J   t        j                  t         j                  | j                        }t        D ]l  }t        j
                  || j                        }t        |dd      }t        |d      }t        |j                  |       t        ||| j                         n y r   )r   r   r   r   r   r1   r
   r^   r   re   r   r   r   s         r'   r   z$_TestDSTIVBase.test_definition_ortho  su    ^^BJJ1 	?B488,AAG!,AAG,B"%%aTXX>	?r*   Nr   r{   r*   r'   r?  r?    r   r*   r?  c                       e Zd Zd Zy)TestDSTIDoublec                 J    t         j                  | _        d| _        d| _        y Nr   r   r   r   s    r'   r   zTestDSTIDouble.setup_method  r   r*   Nr   r{   r*   r'   rB  rB    r   r*   rB  c                       e Zd Zd Zy)TestDSTIFloatc                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestDSTIFloat.setup_method
  r   r*   Nr   r{   r*   r'   rF  rF  	  r   r*   rF  c                       e Zd Zd Zy)TestDSTIIntc                 6    t         | _        d| _        d| _        y r   r   r   s    r'   r   zTestDSTIInt.setup_method  r   r*   Nr   r{   r*   r'   rI  rI    r   r*   rI  c                       e Zd Zd Zy)TestDSTIIDoublec                 J    t         j                  | _        d| _        d| _        y Nr   rB   r   r   s    r'   r   zTestDSTIIDouble.setup_method  r   r*   Nr   r{   r*   r'   rL  rL    r   r*   rL  c                       e Zd Zd Zy)TestDSTIIFloatc                 J    t         j                  | _        d| _        d| _        y N   rB   r   r   s    r'   r   zTestDSTIIFloat.setup_method  r   r*   Nr   r{   r*   r'   rP  rP    r   r*   rP  c                       e Zd Zd Zy)TestDSTIIIntc                 6    t         | _        d| _        d| _        y rR  r   r   s    r'   r   zTestDSTIIInt.setup_method&  r   r*   Nr   r{   r*   r'   rU  rU  %  r   r*   rU  c                       e Zd Zd Zy)TestDSTIIIDoublec                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestDSTIIIDouble.setup_method-  r   r*   Nr   r{   r*   r'   rX  rX  ,  r   r*   rX  c                       e Zd Zd Zy)TestDSTIIIFloatc                 J    t         j                  | _        d| _        d| _        y Nr   r   r   r   s    r'   r   zTestDSTIIIFloat.setup_method4  r   r*   Nr   r{   r*   r'   r[  r[  3  r   r*   r[  c                       e Zd Zd Zy)TestDSTIIIIntc                 6    t         | _        d| _        d| _        y r]  r   r   s    r'   r   zTestDSTIIIInt.setup_method;  r   r*   Nr   r{   r*   r'   r_  r_  :  r   r*   r_  c                       e Zd Zd Zy)TestDSTIVDoublec                 J    t         j                  | _        d| _        d| _        y r,  r   r   s    r'   r   zTestDSTIVDouble.setup_methodB  r   r*   Nr   r{   r*   r'   rb  rb  A  r   r*   rb  c                       e Zd Zd Zy)TestDSTIVFloatc                 J    t         j                  | _        d| _        d| _        y )Nr   r   r   s    r'   r   zTestDSTIVFloat.setup_methodI  r   r*   Nr   r{   r*   r'   re  re  H  r   r*   re  c                       e Zd Zd Zy)TestDSTIVIntc                 6    t         | _        d| _        d| _        y r0  r   r   s    r'   r   zTestDSTIVInt.setup_methodP  r   r*   Nr   r{   r*   r'   rh  rh  O  r   r*   rh  c                   <    e Zd Zd Zej
                  d        Zd Zy)_TestIDSTBasec                 .    d | _         d | _        d | _        y r   r   r   s    r'   r   z_TestIDSTBase.setup_methodW  r7  r*   c                 *    t        j                         S r   r   r   s    r'   	idst_lockz_TestIDSTBase.idst_lock\  r   r*   c           	         t         D ]  }|5  t        | j                  || j                        \  }}}d d d        t	        | j                        }| j                  dk(  r|d|dz   z  z  }n|d|z  z  }t        |j                         t        |t        j                  |      z  t        j                  |      z  | j                  d| d        y # 1 sw Y   xY wr
  )r   r-   r#   r   r   r   re   r   r   r   r   )ri   rn  r   r   r   r%   r   s          r'   r   z_TestIDSTBase.test_definition`  r  r  N)rx   ry   rz   r   r   r   rn  r   r{   r*   r'   rk  rk  V  r  r*   rk  c                       e Zd Zd Zy)TestIDSTIDoublec                 J    t         j                  | _        d| _        d| _        y rD  r   r   s    r'   r   zTestIDSTIDouble.setup_methods  r   r*   Nr   r{   r*   r'   rq  rq  r  r   r*   rq  c                       e Zd Zd Zy)TestIDSTIFloatc                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDSTIFloat.setup_methodz  r   r*   Nr   r{   r*   r'   rt  rt  y  r   r*   rt  c                       e Zd Zd Zy)TestIDSTIIntc                 6    t         | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDSTIInt.setup_method  r   r*   Nr   r{   r*   r'   rw  rw    r   r*   rw  c                       e Zd Zd Zy)TestIDSTIIDoublec                 J    t         j                  | _        d| _        d| _        y rN  r   r   s    r'   r   zTestIDSTIIDouble.setup_method  r   r*   Nr   r{   r*   r'   rz  rz    r   r*   rz  c                       e Zd Zd Zy)TestIDSTIIFloatc                 J    t         j                  | _        d| _        d| _        y rR  r   r   s    r'   r   zTestIDSTIIFloat.setup_method  r   r*   Nr   r{   r*   r'   r}  r}    r   r*   r}  c                       e Zd Zd Zy)TestIDSTIIIntc                 6    t         | _        d| _        d| _        y rR  r   r   s    r'   r   zTestIDSTIIInt.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDSTIIIDoublec                 J    t         j                  | _        d| _        d| _        y r   r   r   s    r'   r   zTestIDSTIIIDouble.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDSTIIIFloatc                 J    t         j                  | _        d| _        d| _        y NrS  r   r   r   s    r'   r   zTestIDSTIIIFloat.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDSTIIIIntc                 6    t         | _        d| _        d| _        y r  r   r   s    r'   r   zTestIDSTIIIInt.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDSTIVDoublec                 J    t         j                  | _        d| _        d| _        y r,  r   r   s    r'   r   zTestIDSTIVDouble.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDSTIVFloatc                 J    t         j                  | _        d| _        d| _        y NrS  r   r   r   s    r'   r   zTestIDSTIVFloat.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                       e Zd Zd Zy)TestIDSTIVntc                 6    t         | _        d| _        d| _        y r  r   r   s    r'   r   zTestIDSTIVnt.setup_method  r   r*   Nr   r{   r*   r'   r  r    r   r*   r  c                   d    e Zd ZdZej
                  ej                  gZd Zd Z	d Z
d Zd Zd Zy)	TestOverwritezCheck input overwrite behavior.c                     |j                         }	 ||	|||||       |j                   d|j                   |j                  d|d|d|d}
|st	        |	|d|
        y y )	N)overwrite_x(z, z, axis=z, overwrite_x=)zspurious overwrite in )r   )r0   rx   re   r3   r   )ri   r   routiner#   fftsizer   rL   r  kwx2sigs              r'   _checkzTestOverwrite._check  sy    VVXD'4;G""#1QWWIagg[7+ Fhn[O1>Q*@(FG r*   c                 h   t         j                  j                  d      }t        j                  |t         j                        r# |j
                  | d |j
                  | z  z   }n |j
                  | }|j                  |      }dD ]'  }dD ]   }dD ]  }	| j                  |||d ||	|        " ) y )Nr   rb   r   rB   r   r   )TF)NrC   )r   r   r   
issubdtypecomplexfloatingr   r   r  )
ri   r  re   r3   r   r   r&   r#   r  rL   s
             r'   	_check_1dzTestOverwrite._check_1d  s    ii##D)== 2 23399e$r)#))U*;';;D399e$D{{5!  	-D, -+ -DKKgtT4 +---	-r*   c                     | j                   D ]J  }| j                  t        |dd       | j                  t        |dd       | j                  t        |dd       L y N)r   rF   )r   rB   r   )rB   r   r   )real_dtypesr  r   ri   re   s     r'   test_dctzTestOverwrite.test_dct  M    %% 	3ENN3ub1NN3w2NN3w2	3r*   c                     | j                   D ]J  }| j                  t        |dd       | j                  t        |dd       | j                  t        |dd       L y r  )r  r  r	   r  s     r'   	test_idctzTestOverwrite.test_idct  M    %% 	4ENN4r2NN43NN43	4r*   c                     | j                   D ]J  }| j                  t        |dd       | j                  t        |dd       | j                  t        |dd       L y r  )r  r  r
   r  s     r'   test_dstzTestOverwrite.test_dst  r  r*   c                     | j                   D ]J  }| j                  t        |dd       | j                  t        |dd       | j                  t        |dd       L y r  )r  r  r   r  s     r'   	test_idstzTestOverwrite.test_idst  r  r*   N)rx   ry   rz   __doc__r   r   r   r  r  r  r  r  r  r  r{   r*   r'   r  r    s6    )::rzz*KH-3434r*   r  c                   x   e Zd ZdZg dZddgZej                  j                  d      Z	dZ
 e	j                  e
 Zej                  j                  deefeefg      ej                  j                  ddd	d
d	gdddgddd	gdddgg      ej                  j                  de      ej                  j                  ddg      d                             Zej                  j                  deefeefg      ej                  j                  de      ej                  j                  de      d                      Zej                  j                  deefeefg      ej                  j                  de      ej                  j                  dddg      d                      Zej                  j                  deefeefg      d        Zej                  j                  deeg      d        Zej                  j                  deefeefg      ej                  j                  dd	d
d	gdddgg      d               Zy)Test_DCTN_IDCTNr   r  NrC   r   )r   r   zfforward,finverseaxesr   )r   r   )r   r   r   )rF   r  rF   dct_typerL   c                 x     || j                   |||      } |||||      }t        | j                   |d       y )Nr#   r  rL   r   r   r&   r   )ri   fforwardfinverser  r  rL   tmps          r'   test_axes_round_tripz$Test_DCTN_IDCTN.test_axes_round_trip  s8     tyyxdFs4@!$))S"=r*   zfforward,fforward_refc                 v     || j                   |d |      } || j                   ||      }t        ||d       y )Nr  r#   rL      r   r  )ri   r  fforward_refr  rL   y1r   s          r'   test_dctn_vs_2d_referencez)Test_DCTN_IDCTN.test_dctn_vs_2d_reference  s6     diihTE$))(>!"b"5r*   zfinverse,finverse_refc                 |    t        | j                  ||      } ||||      } ||||      }t        ||d       y )Nr  r  r   )r   r&   r   )ri   r  finverse_refr  rL   fdatar  r   s           r'   test_idctn_vs_2d_referencez*Test_DCTN_IDCTN.test_idctn_vs_2d_reference  s>     TYYXD9e(6%hT:!"b"5r*   c                    t        t        d      5   || j                  | j                  j                  d   d       d d d        t        t        d      5   || j                  | j                  j                  d   d        d d d        t        t        d      5   || j                  | j                  j                  d       d d d        y # 1 sw Y   xY w# 1 sw Y   YxY w# 1 sw Y   y xY w)NzBwhen given, axes and shape arguments have to be of the same length)matchr   r  r3   r  )assert_raisesr!   r&   r3   )ri   r  r  s      r'   test_axes_and_shapez#Test_DCTN_IDCTN.test_axes_and_shape&  s     :"<= 	G TYYdiiooa&8vF	G
 :"<= 	E TYYdiiooa&8tD	E
 :"<= 	? TYYdiiooA>	? 	?	G 	G
	E 	E
	? 	?s#   -C-C*C)CC&)C2r  c                 Z     || j                   dd       }t        |j                  d       y )N)   r  r  )r&   r   r3   )ri   r  r  s      r'   
test_shapezTest_DCTN_IDCTN.test_shape8  s"    tyy
>SYY
+r*   c                      || j                   d |d      } ||d |d      }t        | j                   || j                         y )NrC   )r3   r  rL   r   )r&   r   r   )ri   r  r  r  r  s        r'   test_shape_is_none_with_axesz,Test_DCTN_IDCTN.test_shape_is_none_with_axes=  s<    
 tyy4gFs$T@!$))S$((Cr*   )rx   ry   rz   r   r  normsr   r   r   rstater3   r   r&   r   markparametrizer   r   r   r   r  r8   r>   r  r;   r@   r  r  r  r  r{   r*   r'   r  r    s   
CH7OEYY""4(FE6<<D[[0D%=48%=3B C[[Vd&'s&'s&,q!f&.R	&: ;
 [[Z2[[VgY/> 0 3;C>
 [[4j7I8<j7I7K L[[Z2[[VU+6 , 3L6 [[4{7K8={7K7M N[[Z2[[VdG_56 6 3N6 [[0D%=48%=3B C?C?  [[Z$6, 7, [[0D%=48%=3B C[[Vas&'s&4 5D5CDr*   r  r   )eos.pathr   r   r   numpyr   numpy.testingr   r   r   r   r  scipy.fftpack._realtransformsr   r	   r
   r   r   r   r   r   load__file__MDATAr2   r   r   r   r    r   r(   r-   r8   r;   r>   r@   rS   rX   r[   r^   r`   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r!  r$  r'  r*  r.  r2  r5  r<  r?  rB  rF  rI  rL  rP  rU  rX  r[  r_  rb  re  rh  rk  rq  rt  rw  rz  r}  r  r  r  r  r  r  r  r  r  )r   s   0r'   <module>r     s   !   A  *4 4 4 	WX&
34"1X&UQqc7^&"1X&UQqc7^& "''$wx02GHI"''$wx02GHI )

*( (@%* %*P	WL 	W?\ ?	?l 	?	W\ 	W] M - n ^ >  o O n ^ > 0 06m ] = } m M  } ] } m M 0 00	WL 	W	?\ 	?] M - l \ < | l L n ^ > 0 08m ] = } m M  } ] } m = 24 24jID ID[ '&s    N<N