+
    /i2                     "   ^ RI t^ RIHt ^ RIHt ^ RIt^ RIHt	 ^ RI
HtHtHtHtHt ^ RIH t ^ RIHtHt ^ RIHtHt ^ R	IHt ]P4                  P6                  tRR
 lt ! R R4      tRt]! ]4       ! R R4      4       t]! ]4      R 4       t R# )    N)product)raises)array_api_extra)xp_assert_closearray_namespace_xp_copy_to_numpyis_cupymake_xp_test_case)numpy)upfirdnfirwin)_output_len_upfirdn_modes)	_pad_testc                N   \         P                  ! V 4      p \         P                  ! V4      p\         P                  ! \        V 4      V,          V P                  4      pWRRV1&   \         P
                  ! W4      RRV1,          R\        \        V4      \        V 4      W#4       pV# )zhNaive upfirdn processing in Python.

Note: arg order (x, h) differs to facilitate apply_along_axis use.
N)npasarrayzeroslendtypeconvolver   )xhupdownouts   &&&& ]/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/signal/tests/test_upfirdn.pyupfirdn_naiver   7   sz    
 	

1A


1A
((3q6B;
(C"I
++a
ff
%&L{3q63q62'L
MCJ    c                   B   a  ] tR t^Dt o RtRR/R ltR tRR ltRtV t	R# )	UpFIRDnCasezTest _UpFIRDn objectxpNc                   Vf   \         pWn        W n        \        P                  ! V4      V n        W@n        \        P                  P                  ^4      V n	        WPn
        R # N)	np_compatr   r   r   
atleast_1dr   x_dtyperandomRandomStaterngr"   )selfr   r   r   r'   r"   s   &&&&&$r   __init__UpFIRDnCase.__init__F   sF    :B	q!99((,r   c                   V P                  \        P                  ! ^V P                  4      4       V P                  \        P                  ! ^
V P                  4      4       V P                  P                  ^
4      P                  V P                  4      pV P                  \        P                  \        P                  39   d*   VRV P                  P                  ^
4      ,          ,          pV P                  V4       V P                  \        P                  ! ^
4      P                  V P                  4      4       \        V P                  4      '       d   R# RpV P                  P
                  ! V!  P                  V P                  4      pV P                  \        P                  \        P                  39   d)   VRV P                  P
                  ! V!  ,          ,          p\        \        V4      4       F  pV P                  WR7       K  	  VR,          P                  p\        \        V4      4       F  pV P                  WR7       K  	  R# )                 ?Naxis)         ):NNN:NNr3   :r/   Nr4   )scrubr   onesr'   r*   randnastype	complex64
complex128aranger	   r"   ranger   T)r+   r   sizer2   s   &   r   __call__UpFIRDnCase.__call__P   sz   

2771dll+,

2772t||,-HHNN2%%dll3<<BLL"--88dhhnnR(((A

1

299R=''56477HHNND!((6<<BLL"--88dhhnnd+++A#d)$DJJqJ$ %lO#d)$DJJqJ$ %r   c                   V P                   p\        P                  ! \        W!V P                  V P
                  V P                  4      p\        \        V P                  4      VP                  V,          V P
                  V P                  4      pVP                  V,          V8X  g   Q h\        VP                  V P                  4      VP                  V4      V P
                  V P                  VR 7      pVP                  V,          V8X  g   Q hVP                  VP                  8X  g   Q hV P                  P                  VP                  3p\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d    VP                  VP                  8X  g   Q hEM\        P                  V9   d4   \        P                  V9   d   VP                  VP                  8X  g   Q hM\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   VP                  VP                  8X  g   Q hMe\        P                   V9   g   \        P                  V9   d   VP                  VP                   8X  g   Q hMVP                  VP"                  8X  g   Q hVP                  WFP                  R7      p\%        WF4       R# )r1   c              3   F   "   T F  q\         P                  8H  x  K  	  R # 5ir$   )r   r:   .0ds   & r   	<genexpr>$UpFIRDnCase.scrub.<locals>.<genexpr>u   s     1&QBLL &   !FTc              3   F   "   T F  q\         P                  8H  x  K  	  R # 5ir$   )r   float32rD   s   & r   rG   rH   y   s     1&Qbjj&rI   r   N)r"   r   apply_along_axisr   r   r   r   r   r   shaper   r   r   allr:   rK   r;   float64r   )r+   r   r2   r"   yrwant_lenydtypess   &&&     r   r6   UpFIRDnCase.scrubj   s   WW  !%$))=s466{AGGDM477DIINxx~)))BJJtvv&

1tww		wwt}(((ww"(("""&&,,(31&13331&11177bll***\\V#

f(<77bll***S1&1SSS1&11177bjj(((]]f$(>77bmm+++77bjj(((ZZ''Z*r   )r   r   r*   r   r'   r"   ))
__name__
__module____qualname____firstlineno____doc__r,   r@   r6   __static_attributes____classdictcell____classdict__s   @r   r!   r!   D   s#     4 %4 r   r!   c                   6  a  ] tR t^t o ]! RRR7      R 4       t]P                  P                  R. RO4      ]P                  P                  R. RO4      R 4       4       t	R t
]P                  P                  R	^^^^. RO3^^^^. RO3^^^^. RO3^^^^. R O3^^^^. R!O3.4      R
 4       t]P                  P                  R. R"O4      ]P                  P                  R. R#O4      R 4       4       t]P                  P                  R]4      ]P                  P                  RR$4      ]P                  P                  R. R%O4      R 4       4       4       t]P                  P                  R]4      ]P                  P                  R]4      ]P                  P                  R]! ]! R&R&4      4      4      R 4       4       4       tR t]P                  P                  R]4      R 4       t]P                  P                  R]! ^.. R'O]. R(O4      4      R 4       tRtV tR# ))TestUpfirdnTzenough to only test on numpy)np_onlyreasonc                    \        \        \        ^.^.^^ 4       \        \        \        . ^.^^4       \        \        \        ^..^.^^4       R# )r/   N)assert_raises
ValueErrorr   )r+   r"   s   &&r   test_valid_inputTestUpfirdn.test_valid_input   sD    j'A3Q:j'2sAq9j'QC51#q!<r   len_hlen_xc                @   VP                  V4      p\        P                  ! V4      V^,          ,          P                  R4      pVP	                  V4      p\        WE^^4      p\        P                  ! WQ^,          V^,
          ^,          3RVR7      p\        Wg4       R# )r3         ?constantr"   N)r   xpxatsetr7   r   padr   )r+   ri   rj   r"   r   r   rS   wants   &&&&    r   test_singletonTestUpfirdn.test_singleton   sy     HHUOFF1Ieqj!%%b)GGENA!QwwqA:	a'78*L r   c                d   \        VP                  ^^.4      VP                  R.4      ^^4      p\        W!P                  RR.VP                  R7      4       \        VP                  ^^.4      VP                  RR.4      ^^4      p\        W!P                  . ROVP                  R7      4       R# )r/   rl   rL           N)rw   rl   rl   )r   r   r   rP   )r+   r"   rS   s   && r   test_shift_xTestUpfirdn.test_shift_x   s    BJJ1v&

B4(8!Q?zz3*BJJz7	
 BJJ1v&

B8(<aC::oRZZ:HIr   z len_h, len_x, up, down, expectedc                   VP                  V4      p\        P                  ! V4      ^ ,          P                  R4      pVP	                  W&P
                  R7      p\        WxW44      p	VP                  WVP
                  R7      p\        W4       R# )r   rl   rL   N)	r   ro   rp   rq   r7   rP   r   r   r   )
r+   ri   rj   r   r   expectedr"   r   r   rS   s
   &&&&&&&   r   test_length_factorsTestUpfirdn.test_length_factors   si     HHUOFF1IaLR GGEG,A"#::hjj:9$r   r   zdown, want_lenc                   \         P                  P                  ^4      pRp\        \         V4      pVP	                  V4      P                  V4      pV\         P                  \         P                  39   d    VRVP	                  V4      ,          ,          p\        WC4      pVP                  WR7      pVP                  \        ^RV,          RR7      4      p	VP                  \        \        V4      \        V	4      ^V4      4      p
\        W^VR7      pVP                  V38X  g   Q hV
P                  ^ ,          VP                  ^ ,          8X  g   Q h\        WRRR	7       R
# )   i'  r0   rL   rl   hamming)window)r   r   gHz>atolrtolN)r   r(   r)   getattrr8   r9   r:   r;   r   r   r   r   r   rN   r   )r+   r   rR   r   r"   random_stater?   np_dtyper   r   ylrS   s   &&&&&       r   test_vs_convolveTestUpfirdn.test_vs_convolve   s    yy,,R02u%t$++H5bmm44l((...A"JJqJ&JJvb"t)I>?ZZ+A.0A!0DaN
 AQT*ww8+%%%xx{aggaj(((Dt4r   r'   r   zup, downc                ,    \        W4W!VR 7      ! 4        R# rn   N)r!   )r+   r'   r   r   r   r"   s   &&&&&&r   test_vs_naive_deltaTestUpfirdn.test_vs_naive_delta   s     	BaR02r   h_dtypezp_max, q_maxc                N    V P                  W4W!VR 7      pV F
  pV! 4        K  	  R# r   )_random_factors)r+   r'   r   p_maxq_maxr"   teststests   &&&&&&  r   test_vs_naiveTestUpfirdn.test_vs_naive   s*    
 $$U7$KDF r   c               $   ^p^p\         P                  P                  ^4      p. p	\        V4       F  p
W8  d   TM^pW!8  d   TM^pVP	                  V4      V,           pVP	                  V4      V,           pVP	                  V4      ^,           p\         P
                  ! VP	                  V4      4      pVP                  V4      pV\        J d    VRVP	                  V4      ,          ,          pV	P                  \        WVWER7      4       K  	  V	# )r4   r0   rn   )
r   r(   r)   r=   randintr&   r9   complexappendr!   )r+   r   r   r   r'   r"   n_rep	longest_hr   r   _p_addq_addpqri   r   s   &&&&&$           r   r   TestUpfirdn._random_factors   s    	yy,,R0uA"]EE"]EE$$U+e3A$$U+e3A !((3a7El2259:A!A'!R,..u555LLQ1g=>   r   modec                   \         P                  ! . R	O\         P                  R7      p^^rT\        W4WQR7      pVP                  V4      pVP                  V4      pVR8X  d   VP                  . RO4      pEM8VR8X  d   VP                  . RO4      pEMVR8X  d   VP                  . RO4      pEM VR8X  d   VR
,          V^ ,          ,
          VP                  ^ ,          ^,
          ,          pV^ ,          VP                  V) ^ ^VP                  R7      V,          ,           p	VR
,          VP                  ^V^,           VP                  R7      V,          ,           p
\        V	4      P                  pV! WV
34      pM4\         P                  ! \        V4      WE3VR7      pVP                  V4      pVP                  WrP                  R7      p\        Wg4       R# )z@Test vs. manually computed results for modes not in numpy's pad.rL   nprenpostr   antisymmetricantireflectsmoothliner   N)r/   r3   r4   r/   rV   )g      @r/   rV   rV   r/   r3   r4   r/   rV   r   r   rV   r/   r3   )rl   r3   r4   r/   rV   r   r/   r3   r4   r/   rV   r   r/   r3   r4   r/   )g      r   r   rV   r   r/   r3   r4   r/   rV   r   iii)r   r   rP   r   rN   r<   r   concatrr   r   r   )r+   r   r"   r   r   r   rS   
y_expected	lin_slopeleftrightr   s   &&&         r   test_extensionsTestUpfirdn.test_extensions   ss    JJ|2::6ea%;JJqMJJqM?"JLJ]"DFJXNPJV^21!''!*q.9IQ4"))TE1arzz)BYNNDbEBIIa"**IE	QQE$T*11F% 01J 1! 4tm$OJJ/JZZ
**Z=
&r   zsize, h_len, mode, dtypec                p   \        V4      '       d   VR 8w  d   \        P                  ! RR7       \        \        V4      p\        WT4      p\        P
                  P                  ^4      pVP                  V4      P                  V4      p	VR9   d    V	RVP                  V4      ,          ,          p	\        P                  ! ^^V,           V	P                  P                  R7      p
VP                  WR7      p	VP                  V
4      p
\        W^^VR7      pV^,
          pVR9   d   \        \        V	4      WVR7      pM!\        P                   ! \        V	4      WR7      pVP                  V4      p\        W^^R R7      pWV)  pVP#                  V4      P$                  R,          ;pp\'        WVVR	7       R
# )rm   z&only mode='constant' supported by CuPy)rc   r0   rL   )r   r   r   r   r   g      Y@r   N)r:   r;   )r   r   r   r   )r	   pytestskipr   r   r(   r)   r8   r9   r<   realr   r   r   r   r   rr   finfoepsr   )r+   r?   h_lenr   r   r"   dtype_npdtype_xpr   r   r   rS   npadxpadypadr   r   r   s   &&&&&&            r   
test_modesTestUpfirdn.test_modes  sd    2;;4:-KKGH2u%2%yy,,Q/t$++H5//l((...AIIaU!&&,,7JJqJ)JJqMAQQT2qyEE.q1tTD66+A.@Dzz$q11:>u%
hhx(,,s22tDt<r    N)r/   r3   r4      r5   )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/   int64rK   r:   rP   r;   ))r3   i  )   i  )O      )rl   r0   )r/   r/   )r3   r3   )r4   r3   )r3   r4   )
   d   )r   r5      )rK   rP   r:   r;   )rW   rX   rY   rZ   skip_xp_backendsrg   r   markparametrizert   rx   r|   r   _UPFIRDN_TYPESr   listr   r   r   r   r   r   r\   r]   r^   s   @r   ra   ra      sJ     d+IJ= K=
 [[Wo6[[Wo6! 7 7!J [[?	
Aq!\"	
Aq!_%	
Aq!_%	
Aq!_%	
B1+,B %% [[K [[- 0 
55, [[Y7[[S(+[[Z)IJ3 K , 83 [[Y7[[Y7[[^!')Y"?@BB 8 8
0 [[V^4' 5'< [["C=		
==r   ra   c                 @    R pRpRpRp\        WW44      pVR8X  g   Q hR# )i  i@  i  i6SNi )r   )r"   ri   in_lenr   r   out_lens   &     r   test_output_len_long_inputr   C  s4    
 EF	BD%2G hr   r   r   )!r   r   	itertoolsr   r   r   re   
scipy._libr   ro   scipy._lib._array_apir   r   r   r	   r
   scipy._lib.array_api_compatr%   scipy.signalr   r   scipy.signal._upfirdnr   r   scipy.signal._upfirdn_applyr   r   r   r   r!   r   ra   r   r   r   r   <module>r      s   F   *  -  ; ( = 1;;// 
< <~ L 7y= y= y=x 7 r   