+
    /i                     J    R t ^ RIt^RIHtHtHtHtHt ^RI	H
t
Ht R tR tR# )a   
This module provides some Powell-style linear algebra procedures.

Translated from Zaikun Zhang's modern-Fortran reference implementation in PRIMA.

Dedicated to late Professor M. J. D. Powell FRS (1936--2015).

Python translation by Nickolai Belakovski.
N)isminorplanerotmatprodinprodhypot)	DEBUGGINGEPSc           
        VP                   ^,          pTp\        W4      p\        \        V 4      \        V4      4      p\        P                  ! \        Wg4       UU	u. uF  w  r\        W4      '       d   ^ MTNK  	  up	p4      p\        V^,
          V^,
          R4       F~  p
\        Wj^,           ,          4      ^ 8  g   K"  \        WjV
^,            4      p\        VRW^,           .3,          VP                  4      VRW^,           .3&   \        WjV
^,            !  Wj&   K  	  W48  dI   \        Wc,          4      \        ^,          8  d(   \        Wc,          Ws,          4      '       g
   V^,          pV^,
          ^ 8  d'   V^,
          V8  d   Wc^,
          ,          W#^,
          &   \        '       dV   YSu;8:  d   \        V^,           V4      8:  g   Q h Q hV\        V4      u;8:  d	   V8:  g   Q h Q hVP                   WD38X  g   Q hWV3# u up	pi )aH  
This function updates the QR factorization of an MxN matrix A of full column rank, attempting to
add a new column C to this matrix as the LAST column while maintaining the full-rankness.
Case 1. If C is not in range(A) (theoretically, it implies N < M), then the new matrix is np.hstack([A, C])
Case 2. If C is in range(A), then the new matrix is np.hstack([A[:, :n-1], C])
N.B.:
0. Instead of R, this subroutine updates Rdiag, which is np.diag(R), with a size at most M and at
least min(m, n+1). The number is min(m, n+1) rather than min(m, n) as n may be augmented by 1 in
the function.
1. With the two cases specified as above, this function does not need A as an input.
2. The function changes only Q[:, nsave:m] (nsave is the original value of n) and
R[:, n-1] (n takes the updated value)
3. Indeed, when C is in range(A), Powell wrote in comments that "set iOUT to the index of the
constraint (here, column of A --- Zaikun) to be deleted, but branch if no suitable index can be
found". The idea is to replace a column of A by C so that the new matrix still has full rank
(such a column must exist unless C = 0). But his code essentially sets iout=n always. Maybe he
found this worked well enough in practice. Meanwhile, Powell's code includes a snippet that can
never be reached, which was probably intended to deal with the case that IOUT != n
NNN)shaper   absnparrayzipr   ranger   Tr   r   r   minlen)cQRdiagnmnsavecqcqacqicqaikGs   &&&&        ^/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/_lib/pyprima/common/powalg.pyqradd_Rdiagr"      s   ( 	

AE 
B
#a&#a&
!C 
S\R\	**13\R	SB
 1Q3!R rA#w<! ac#A$Qq1c({^QSS9Aa!qSkN2!9%BE ! 	uru:Qwrucf'='=FA 	1uza!eaia%y!ey.SA......CJ#!#####ww1&   Q;9 Ss    H	
c                P   V P                   w  rEV^8  d   WT8:  g   Q hV^ 8  d   W58  g   Q h\        V4      V8X  g   Q hVP                   ^ ,          V8X  d1   VP                   ^,          V8  d   VP                   ^,          V8:  g   Q hV^ 8  g   W58  d   W3# \        W5^,
          4       Fu  p\        W&^,           ,          \	        VRV3,          V RV^,           3,          4      .4      p\        VRV^,           V.3,          VP                  4      VRWf^,           .3&   Kw  	  \        W5^,
          4       Uu. uF(  p\	        VRV3,          V RV^,           3,          4      NK*  	  upW#V^,
          % \	        VRV^,
          3,          V RV3,          4      W%^,
          &   W3# u upi )a/  
This function updates the QR factorization for an MxN matrix A=Q@R so that the updated Q and
R form a QR factorization of [A_0, ..., A_{I-1}, A_{I+1}, ..., A_{N-1}, A_I] which is the matrix
obtained by rearranging columns [I, I+1, ... N-1] of A to [I+1, ..., N-1, I]. Here A is ASSUMED TO
BE OF FULL COLUMN RANK, Q is a matrix whose columns are orthogonal, and R, which is not present,
is an upper triangular matrix whose diagonal entries are nonzero. Q and R need not be square.
N.B.:
0. Instead of R, this function updates Rdiag, which is np.diag(R), the size being n.
1. With L = Q.shape[1] = R.shape[0], we have M >= L >= N. Most often L = M or N.
2. This function changes only Q[:, i:] and Rdiag[i:]
3. (NDB 20230919) In Python, i is either icon or nact - 2, whereas in FORTRAN it is either icon or nact - 1.
r
   )r   r   r   r   r   r   r   )Ar   r   ir   r   r   r    s   &&&&    r!   qrexc_Rdiagr&   L   sn    77DA 6af6aeu:??771:?qwwqzQ1771:?BB
 	1ux 1c]eaCj&1a4!AqsF)"<=> 1qsAh;!##7!a1X+  9>a1F1F1QT7Aa1fI.FEAaCL!QqS&	1QT7+EA#J8O Gs   8.F#)__doc__numpyr   linalgr   r   r   r   r   constsr   r   r"   r&        r!   <module>r-      s#     = = "9x7r,   