+
    Y°³j�  ã                   ó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‰\        W‰4      '       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   &&&&        Úf/home/luca/screen-checking/.venv/lib/python3.14/site-packages/scipy/_external/pyprima/common/powalg.pyÚqradd_Rdiagr"      s®  € ð( 	
�‰��
€AØ€Eô 
�‹€BÜ
”#�a“&œ#˜a›&Ó
!€Cô 
�ŠÄSÈÄ\ÔRÁ\¹	¸œ ×*Ò*‘1°Ò3Á\ÒRÓ	S€Bô
 �1�Q•3˜˜!�˜RÖ ˆÜˆr�A•#�w‹<˜!Öô ˜˜a �c˜Ó#ˆAÜ$ Q q¨1°­c¨( {¥^°Q·S±SÓ9ˆAˆa�!�q•S�ˆk‰NÜ˜2  !¥˜9Ñ%ˆB‹Eñ !ð 	„uäˆr�u‹:œ˜Q�Ô¤w¨r­u°cµf×'=Ò'=Ø��FˆAð 	ˆ1…u�„z�a˜!•e˜a”iØ˜a�%•yˆ�!�e‰çƒyØÖ.œS ¨¥¨AÓ.Ô.Ð.Ñ.Ð.Ð.Ø”C˜“JÖ# !Ô#Ð#Ñ#Ð#Ð#Ø�w‰w˜1˜&Ô Ð Ð à�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  € ð �7‰7�D€Að �Œ6�a”fÐÐØ�Œ6�a”eÐÐÜˆu‹:˜Œ?Ðˆ?Ø�7‰7�1�:˜Œ?˜qŸw™w q�z¨Qœ°1·7±7¸1µ:À´?ÐBÐBð
 	ˆ1„u�”Øˆxˆô �1˜•cŽ]ˆÜ�e˜a�C•j¤&¨¨1¨a¨4­°!°A°q¸µs°Fµ)Ó"<Ð=Ó>ˆÜ   1 q¨¥s¨A h ;¥°!·#±#Ó7ˆˆ!ˆa�1•ˆXˆ+‹ñ ô 9>¸aÀ1Å¼ÓF¹°1”F˜1˜Q ˜T�7 A a¨¨1­ f¥IÖ.¹ÑF€EˆAˆa�C€LÜ˜˜!˜Q˜q�S˜&�	 1 Q¨ T¥7Ó+€EˆA�#�Jàˆ8€Oùò Gs   Ä8.F#)Ú__doc__Únumpyr   Úlinalgr   r   r   r   r   Úconstsr   r   r"   r&   © ó    r!   Ú<module>r-      s#   ðñó ß =Õ =ß "ò9ôx7r,   