+
    /i$                         ^ RI t ^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
HtHtHtHtHtHt  ! R R]4      tR tR tR tR	 t ! R
 R4      t ! R R4      tR# )    N)TestCaseassert_array_equal)BoundsLinearConstraintNonlinearConstraintPreparedConstraintnew_bounds_to_oldold_bound_to_newstrict_boundsc                   8   a  ] tR t^
t o R tR tR tR tRtV t	R# )TestStrictBoundsc                x   ^p^p^pRp\        W#VV4      w  rV\        V\        P                  ) \        P                  ) \        P                  ) .4       \        V\        P                  \        P                  \        P                  .4       Rp\        W#VV4      w  rV\        V. RO4       \        V. RO4       R# )   FTN)   r   r   )   r   r   r   r   npinfselfmlbubenforce_feasibility	strict_lb	strict_ubs   &      c/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/optimize/tests/test_constraints.py+test_scalarvalue_unique_enforce_feasibility<TestStrictBounds.test_scalarvalue_unique_enforce_feasibility   s    #,R-@-. 0	 	9w"&&&AB9rvvrvvrvv&>?",R-@-. 0	 	9i09i0    c                   ^p. ROp. ROpRp\        W#VV4      w  rV\        V\        P                  ) \        P                  ) \        P                  ) .4       \        V\        P                  \        P                  \        P                  .4       Rp\        W#VV4      w  rV\        V. RO4       \        V. RO4       R# )r   FTN   r   r   )r         r   r   s   &      r   +test_vectorvalue_unique_enforce_feasibility<TestStrictBounds.test_vectorvalue_unique_enforce_feasibility   s    #,R.A./ 1	 	9w"&&&AB9rvvrvvrvv&>?",R.A./ 1	 	9i09i0r    c                    ^p^p^p. ROp\        W#VV4      w  rV\        V\        P                  ) ^\        P                  ) .4       \        V\        P                  ^\        P                  .4       R# )r   N)FTFr   r   s   &      r   +test_scalarvalue_vector_enforce_feasibility<TestStrictBounds.test_scalarvalue_vector_enforce_feasibility/   sd    2,R-@-. 0	 	9wBFF7&;<9rvvq"&&&9:r    c                    ^p. ROp^^\         P                  .p. ROp\        W#VV4      w  rV\        V^\         P                  ) ^.4       \        V^\         P                  \         P                  .4       R# )r   Nr"   )TFT)r   r   r   r   r   s   &      r   +test_vectorvalue_vector_enforce_feasibility<TestStrictBounds.test_vectorvalue_vector_enforce_feasibility:   sg    BFF^1,R-@-. 0	 	9q266'1o69q"&&"&&&9:r     N)
__name__
__module____qualname____firstlineno__r   r&   r)   r,   __static_attributes____classdictcell____classdict__s   @r   r   r   
   s     1$1$	;	; 	;r    r   c                    a \         P                  ! . RO4      p \         P                  ! R\         P                  ^F.4      p\         P                  ! . RO4      p\         P                  ! . R	O\        R7      p\	        WV4      p\
        P                  ! \        \        WB4       \        \	        W4      . RO4      pVP                  . RO4      ^ 8  P                  4       '       g   Q hVP                  . R
O4      ^ 8H  P                  4       '       g   Q h\         P                  ! . RO4      p\         P                  ! . RO. RO. RO.4      o\         P                  ! . RO\        R7      p\        S\         P                  ) ^ V4      p\
        P                  ! \        \        Wb4       \        \        S\         P                  ) ^ 4      . RO4      pVP                  . RO4      ^ 8  P                  4       '       g   Q hVP                  . RO4      ^ 8H  P                  4       '       g   Q hV3R lpV3R lpR p	\        V\         P                  ) ^ WV4      p
\
        P                  ! \        \        W4       \        V
. RO4      pVP                  . RO4      ^ 8  P                  4       '       g   Q hVP                  . RO4      ^ 8H  P                  4       '       g   Q hR# )r         ?)dtypec                 &   < SP                  V 4      # N)dotxAs   &r   fun2test_prepare_constraint_infeasible_x0.<locals>.fun]   s    uuQxr    c                    < S# r;   r.   r=   s   &r   jac2test_prepare_constraint_infeasible_x0.<locals>.jac`   s    r    c                 .    \         P                  ! R4      # )r   )r   r   )sps	csr_array)r>   vs   &&r   hess3test_prepare_constraint_infeasible_x0.<locals>.hessc   s    }}V$$r    N)r         r"   )FTT)g      ?      )r#   r   r   r   )r$   r   r   r%   )   r      r   )TTT)r   rQ   r   )r   arrayr   boolr   pytestraises
ValueErrorr   	violationanyallr   r   )r   r   x0r   boundspclinearr@   rC   rI   	nonlinearr?   s              @r   %test_prepare_constraint_infeasible_x0r_   F   s   	+	B	3#	$B	)	B((#6dCB/0F
MM*0&=	F2NI	6BLL#a',,....LL(A-224444	,	B
,l;<A((#5TBa"&&!-@AF
MM*0&=	,Q;(
*BLL&*//1111LL)*a/446666% $C"&&!S$79I
MM*0)@	I'7	8BLL&*//1111LL)*a/446666r    c                      R  p \        V R
R.^^.4      p\        VR^.4      p\        VP                  R^.4      RR.4       \        P
                  P                  VP                  RR.4      RR.4       \        P
                  P                  VP                  RR.4      R^ .4       \        P
                  P                  VP                  RR.4      R^ .4       \        P
                  P                  VP                  R^.4      RR.4       R	# )c                     \         P                  ! V ^ ,          ^,          V ^,          ,           V ^ ,          ^,          V ^,          ,
          .4      # )r   )r   rR   )r>   s   &r   cons_ftest_violation.<locals>.cons_fp   s8    xx1QqT)1Q419qt+;<==r    r8           g333333?g?g{Gz?gRQ?g{Gz?g=
ףp=?Ng333333g333333)r   r   r   rW   r   testingassert_almost_equal)rb   nlcr\   s      r   test_violationri   o   s    > fr7maV
<C	C#q	*Br||S!H-Bx8JJ""2<<c
#;b#YGJJ""2<<c
#;dAYGJJ""2<<d#<tQiHJJ""2<<a#9D$<Hr    c                     \         P                  ! \         P                  ) ^^.4      p \         P                  ! ^\         P                  ^
.4      p. ROp\        \	        W^4      V4       . ROp\        \	        RV^4      V4       . ROp\        \	        \         P                  ) V^4      V4       . ROp\        \	        V ^^4      V4       . ROp\        \	        V \         P                  ^4      V4       . ROp\        \	        ^^^4      V4       . R	Op\        \	        \         P                  ) \         P                  ^4      V4       R# )
r   N)Nr   r   N)r   
   re   ))re   r   re   N)re   rm   )rk   NN)Nrm   ))NrK   )r   rK   )r   rK   )ro   rl   )r   N)r#   r   rp   rp   )ro   ro   ro   )r   rR   r   r   r	   )	r   r   r[   bounds_single_lbbounds_no_lbbounds_single_ubbounds_no_ubbounds_single_bothbounds_no_boths	            r   test_new_bounds_to_oldrw      s    	BFF7Aq/	"B	1bffb/	"B,F(3V<6(R35EF8L("&&"a8,G5(R35EF7L(RVVQ7F1(Aq13EF?N("&&"&&!<nMr    c                  "   ^^.RR3p \         P                  ! ^\         P                  ) R.4      p\         P                  ! ^^\         P                  .4      p\        V 4      w  r4\	        W14       \	        WB4       \         P                  ) \         P                  3\         P                  ! ^.4      \         P                  ! ^.4      3.p \        V 4      w  r4\	        V\         P                  ) ^.4       \	        V\         P                  ^.4       R# )r#   Nrk   re   rn   )r   rR   r   r
   r   )r[   lb_trueub_truer   r   s        r   test_old_bounds_to_newr{      s    !fi,FhhBFF7B'(Ghh1bff~&Gf%FBr#r#w"((A3-1#!?@Ff%FBrRVVGQ<(rBFFA;'r    c                   >   a  ] tR t^t o R tR tR tR tR tRt	V t
R# )
TestBoundsc           	        ^ RI HpHp RR\        P                  R3\        P                  ! R\        P                  ) .4      \        P                  ! R\        P                  .4      3\        P                  ! R\        P                  ) .4      \        P                  ! R\        P                  .4      \        P                  ! RR.4      33 F  p\	        V!  p\        \        \	        V!  4      4      p\        VP                  VP                  4       \        VP                  VP                  4       \        VP                  VP                  4       K  	  R# )	r   )rR   r         ?Tg       @FN      )r   g      @)numpyrR   r   r   r   evalreprr   r   r   keep_feasible)r   rR   r   argsr[   bounds2s   &     r   	test_reprTestBounds.test_repr   s    $2664 XXsRVVGn%rxxbff'>?XXsRVVGn%rxxbff'>XXtUm$&	
D T]F4./Gvyy'**5vyy'**5v33W5J5JK
r    c                    \        R R .RR.R7      p\        VP                  \        P                  4      '       g   Q h\        VP
                  \        P                  4      '       g   Q hR# )rd   r   )r   r   N)r   
isinstancer   r   ndarrayr   )r   bs   & r   
test_arrayTestBounds.test_array   sL    sCjc3Z0!$$

++++!$$

++++r    c                0   \        4       p\        \        P                  ! \        P                  ) 4      \        P                  ! \        P                  4      4      pVP                  VP                  8X  g   Q hVP
                  VP
                  8X  g   Q hR # r;   )r   r   asarrayr   r   r   )r   b1b2s   &  r   test_defaultsTestBounds.test_defaults   sY    XBJJw'BFF);<uu~~uu~~r    c           
        R p\         P                  ! \        VR7      ;_uu_ 4        \        \        P
                  ! ^^.4      ^^.4       RRR4       \         P                  ! \        VR7      ;_uu_ 4        \        ^^.\        P
                  ! ^^.4      4       RRR4       Rp\         P                  ! \        VR7      ;_uu_ 4        \        ^^.^^.\        P
                  ! RR.4      R7       RRR4       Rp\         P                  ! \        VR7      ;_uu_ 4        \        ^^.. RO4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lw; i  + '       g   i     R# ; i)z,Lower and upper bounds must be dense arrays.matchNz&`keep_feasible` must be a dense array.Tr   z6`lb`, `ub`, and `keep_feasible` must be broadcastable.r"   )rT   rU   rV   r   rF   	coo_array)r   messages   & r   test_input_validation TestBounds.test_input_validation   s    @]]:W553==!Q(1a&1 6]]:W55Aq63==!Q01 6 ;]]:W55Aq6Aq6d|1LM 6 K]]:W55Aq69% 65 6555 65 655s/   %D=8%E)E#"E6=E	E 	#E3	6F	c                    \        R^4      pR^.p\        P                  P                  VP	                  V4      ^^.^^.34       R# r   Nre   )r   r   rf   assert_allcloseresidual)r   r[   rZ   s   &  r   test_residualTestBounds.test_residual   s@    A!W


""6??2#6!Q!Q8HIr    r.   N)r/   r0   r1   r2   r   r   r   r   r   r3   r4   r5   s   @r   r}   r}      s&     L ,&J Jr    r}   c                   2   a  ] tR t^t o R tR tR tRtV tR# )TestLinearConstraintc                   \         P                  ! ^4      p\        V4      p\        V\         P                  ) \         P                  4      p\	        VP
                  VP
                  4       \	        VP                  VP                  4       R# )r   N)r   eyer   r   r   r   r   )r   r?   lclc2s   &   r   r   "TestLinearConstraint.test_defaults   sU    FF1Ia q266'2662255#&&)255#&&)r    c           
        \         P                  ! ^4      pRp\        P                  ! \        VR7      ;_uu_ 4        \        V^^.. R	O4       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  ! ^^.4      ^^.4       RRR4       \        P                  ! \        VR7      ;_uu_ 4        \        V^^.\        P                  ! ^^.4      4       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \        P                  ! RR.4      p\        V^^.^^.VR7       RRR4       \         P                  ! R
4      pRp\        P                  ! \        VR7      ;_uu_ 4        \        V4       RRR4       R#   + '       g   i     ELc; i  + '       g   i     EL#; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)r   z5`lb`, `ub`, and `keep_feasible` must be broadcastabler   Nz&Constraint limits must be dense arraysz%`keep_feasible` must be a dense arrayTr   z%`A` must have exactly two dimensions.r"   )r   r   r$   )	r   r   rT   rU   rV   r   rF   r   empty)r   r?   r   r   s   &   r   r   *TestLinearConstraint.test_input_validation   sV   FF1II]]:W55QA	2 6 ;]]:W55Qq!f 51v> 6]]:W55QAq!f(=> 6 :]]:W55MM4,7MQAAmL 6 HHY9]]:W55Q 65! 655 65555 65 655s;   F)=&F=&G#,G$G7)F:	=G	G!	$G4	7H	c                    \         P                  ! ^4      p\        VR^4      pR^.p\         P                  P	                  VP                  V4      ^^.^^.34       R# r   )r   r   r   rf   r   r   )r   r?   r   rZ   s   &   r   r   "TestLinearConstraint.test_residual   sO    FF1IaQ'!W


""2;;r?aVaV4DEr    r.   N)	r/   r0   r1   r2   r   r   r   r3   r4   r5   s   @r   r   r      s     * ,F Fr    r   )rT   r   r   numpy.testingr   r   scipy.sparsesparserF   scipy.optimize._constraintsr   r   r   r   r	   r
   r   r   r_   ri   rw   r{   r}   r   r.   r    r   <module>r      s]      6 8 8 8
9;x 9;x&7RI$N4( /J /Jd"F "Fr    