+
    åûj± ã                   óø  € R t ^ RIHtHtHtHt ^ RIt^ RIHtH	t	H
t
 ^ RIHtHt ^ RIHt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HtHtHt ^R	I H!t!H"t" ^R
I#H$t$H%t% ^RI&H't' . RLOt(RMR R llt)R R lt*R R lt+RNR R llt, ! R R]PZ                  P\                  4      t/R R lt0R R lt1R R lt2]Pf                  ! ^^^
4      t4]Pf                  ! ^
^^4      t5R R lt6R R lt7ROR  R! llt8. RPOt9R" R# lt:R$ R% lt;R& R' lt<R( R) lt=R* R+ lt>R, R- lt?R. R/ lt@R0 R1 ltAR2 R3 ltBR4 R5 ltCR6 R7 ltDR8 R9 ltER: R; ltFR< R= ltGR> R? ltHR@ RA ltIRB RC ltJRMRD RE lltKRF RG ltLRMRH RI lltMRJ RK ltNR# )QzVEssential matrices: estimate them, convert from and to other models, recover the pose.)ÚAnyÚOptionalÚTupleÚUnionN)ÚKORNIA_CHECKÚKORNIA_CHECK_SAME_SHAPEÚKORNIA_CHECK_SHAPE)Úeye_likeÚvec_like)Ú_at_least_float32Ú_autocast_disabledÚ_needs_derivativesÚ_right_singular_vectorÚ_torch_svd_castÚ_torch_svd_in_work_dtype)Ú_null_space_householder)ÚT_deg1ÚT_deg2)Ú_epipolar_design_rowsÚ
_hat_basisÚ_sampson_costÚ_sampson_normal_equationsÚ_solve_dtype)Úcross_product_matrixÚmatrix_cofactor_tensor)Údepth_from_pointÚprojection_from_KRt)Útriangulate_pointsc                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  ,          R\         P                  /# ©é   Úpoints1Úpoints2ÚweightsÚreturn©ÚtorchÚTensorr   )Úformats   "Ú^C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\geometry\epipolar\essential.pyÚ__annotate__r*   7   s@   € ÷ ñ œŸ™ð ¬u¯|©|ð ÄhÌuÏ|É|ÕF\ð Ôhm×htÑhtñ ó    c                óò   € \        V . RO4       \        W4       \        V P                  ^,          ^8¬  R4       \	        W4      pVP                  ^,          ^8X  d   \        V4      w  rEV# \        V4      pV# )añ  Compute the essential matrix using the 5-point algorithm from Nister.

The linear system is solved by Nister's 5-point algorithm [@nister2004efficient],
and the solver implemented referred to [@barath2020magsac++][@wei2023generalized][@wang2023vggsfm].

Args:
    points1: A set of calibrated points in the first image with a tensor shape ``(B, N, 2)``, ``N >= 5``.
    points2: A set of points in the second image with a tensor shape ``(B, N, 2)``, ``N >= 5``.
    weights: Not used, kept for compatibility, including for :math:`N > 5`. Positive weights leave the null
      space of an exact five-point sample unchanged; for larger sets they can affect the least-squares fit.

Returns:
    the computed essential matrix with shape ``(B, 10, 3, 3)``.

zNumber of points should be >=5)ÚBÚNÚ2)r   r   r   Úshaper   Ú_five_point_candidatesÚ_least_squares_candidates)r!   r"   r#   ÚdesignÚ
candidatesÚ_s   &&&   r)   Ú
run_5pointr6   7   so   € ô  �w¢Ô0Ü˜GÔ-Ü�—‘˜qÕ! QÑ&Ð(HÔIä" 7Ó4€Fà‡|�|�A…˜!ÔÜ.¨vÓ6‰ˆ
ð Ðô /¨vÓ6ˆ
ØÐr+   c          
      ó�   € V ^8„  d   QhR\         R\         R\        P                  R\        P                  R\        P                  /# )r    ÚmÚnÚdtypeÚdevicer$   )Úintr&   r:   r;   r'   )r(   s   "r)   r*   r*   T   s>   € ÷ ñ ¤ð ¬ð ´U·[±[ð Ì%Ï,É,ð Ô[`×[gÑ[gñ r+   c                óö   € \         P                  ! \         P                  ! WR7      \         P                  ! WR7      RR7      w  rE\         P                  ! WW,           ^,
          W#R7      pRWdWTV,           3&   V# )zg``T[i, j, i + j] = 1``: the coefficients of a product of polynomials with ``m`` and ``n`` coefficients.©r;   Úij)Úindexing©r:   r;   ç      ð?)r&   ÚmeshgridÚarangeÚzeros)r8   r9   r:   r;   ÚiÚjÚtables   &&&&   r)   Ú_polynomial_product_tablerI   T   sV   € ä�>Š>œ%Ÿ,š, qÔ8¼%¿,º,ÀqÔ:XÐcgÔh�D€AÜ�KŠK˜˜a�e a�i¨uÔD€EØ€EˆQ�A•ˆ+ÑØ€Lr+   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r    ÚAr$   ©r&   r'   )r(   s   "r)   r*   r*   \   s&   € ÷ lñ l¤e§l¡lð l´u·|±|ñ lr+   c                óÔ  € V P                   V P                  r!\        P                  ! ^^^W!R7      pR F  w  w  rErgWsWEV3&   K  	  V R,          P	                  R4      V R,          P	                  R4      V R	,          P	                  R4      r©p\        P
                  ! RW‰\        ^^W!4      4      p\        P
                  ! RW³4      p\        P
                  ! RWÊ\        ^^W!4      4      # )
a  Coefficients ``(B, 11)``, of ``z^0`` first, of the determinant of Nister's hidden-variable matrix ``(B, 3, 13)``.

Each row of ``A`` holds three polynomials in ``z``, highest degree first: two cubics (columns 0-3 and 4-7) and a
quartic (8-12). The determinant is the sum over the six permutations of the rows of signed products of one
polynomial of each kind, expanded with polynomial product tables: a few matrix products, deterministic on every
backend, where the explicit expansion into 486 triple products cost five times as much.
rA   zxai,xbj,ijm->xabmzxabm,abc->xcmzxcm,xck,mkn->xn)))é    é   r    rB   ))rO   r    rN   rB   ))r    rN   rO   rB   ))rN   r    rO   ç      ð¿))r    rO   rN   rP   ))rO   rN   r    rP   ).:rN   é   Néÿÿÿÿ).:rQ   é   N).:rS   é   N)r;   r:   r&   rE   ÚflipÚeinsumrI   )rK   r;   r:   Úlevi_civitaÚaÚbÚcÚsignÚcubic1Úcubic2ÚquarticÚsexticsÚsigneds   &            r)   Ú_determinant_to_polynomial_jitra   \   sÓ   € ð —H‘H˜aŸg™gˆEÜ—+’+˜a  A¨UÔB€Kó‰‰	ˆˆqð  $�A˜!�GÓñð   �k×.Ñ.¨rÓ2°A°hµK×4DÑ4DÀRÓ4HÈ!ÈIÍ,×J[ÑJ[Ð\^ÓJ_�G€FÜ�lŠlÐ.°Ô@YÐZ[Ð]^Ð`eÓ@nÓo€GÜ�\Š\˜/¨7Ó@€FÜ�<Š<Ð)¨6Ô<UÐVWÐYZÐ\aÓ<jÓkÐkr+   c          
      óº   € V ^8„  d   QhR\         P                  R\         P                  R\        R\        \         P                  \         P                  3,          /# )r    rK   rY   Úepsr$   )r&   r'   Úfloatr   )r(   s   "r)   r*   r*   u   sO   € ÷ Gñ G¤§¡ð G´·±ð GÄEð GÔV[Ô\a×\hÑ\hÔjo×jvÑjvÐ\vÕVwñ Gr+   c                óŽ  € V R,          pV R,          pV R,          pV R,          pW6,          WE,          ,
          pVP                  4       pW‚8*  \        P                  ! V4      ,          \        P                  ! V4      ,          p	\        P                  ! W‚8„  V\        P
                  ! V4      V,          4      p
RV
,          pWk,          pV) V,          pV) V,          pW;,          pWÁR,          ,          WÑR,          ,          ,           pWáR,          ,          WñR,          ,          ,           p\        P                  ! VV3RR7      P                  R4      pW3,          WU,          ,           pW4,          WV,          ,           pWD,          Wf,          ,           pW1R,          ,          WQR,          ,          ,           pWAR,          ,          WaR,          ,          ,           pVV,           pVR,          P                  V4      pVV,           pTpTpVV,           pVV,          VV,          ,
          pVP                  4       P                  V4      pRV,          p VV ,          p!V) V ,          p"V) V ,          p#VV ,          p$V!V,          V"V,          ,           p%V#V,          V$V,          ,           p&\        P                  ! V%V&3RR7      P                  R4      p'\        P                  ! V	P                  R4      P                  R4      V'V4      p(\        P                  ! V(4      P                  R	4      P                  R4      \        P                  ! V(4      P                  R	4      P                  R4      ,          p)V	V),          p	\        P                  ! V	P                  R4      P                  R4      \        P                  ! V(4      V(4      p(V(V	3# )
u  Solve (A)x=b for A (...,2,2), b (...,2,1) using Tikhonov regularization.

Uses the following methods:
  - direct inverse when det is OK
  - otherwise solve normal equations (A^T A + Î»I)x = A^T b  (Î» from trace scale)
Never throws. Returns (x, bad) where bad marks ill-conditioned A.
rB   ©Údimg:Œ0âŽyE>©.rN   rN   ).rN   rO   ©.rO   rN   ).rO   rO   rR   éþÿÿÿ)Úabsr&   ÚisnanÚisinfÚwhereÚ	ones_likeÚstackÚ	unsqueezeÚ	clamp_minÚflattenÚanyÚ
zeros_like)*rK   rY   rc   rX   ÚbbrZ   ÚdÚdetÚdet_absÚbadÚdet_safeÚinv_detÚinv00Úinv01Úinv10Úinv11Úx0_dirÚx1_dirÚx_dirÚata00Úata01Úata11Úatb0Úatb1ÚtrÚlamÚm00Úm01Úm10Úm11Údet_mÚ
det_m_safeÚ	inv_det_mÚinvm00Úinvm01Úinvm10Úinvm11Úx0_fbÚx1_fbÚx_fbÚxÚ	nonfinites*   &&&                                       r)   Ú_solve_2x2_tikhonov_safer›   u   së  € ð 	
ˆ)�€AØ	
ˆ9�€BØ	ˆ)�€AØ	ˆ)�€Aà
�%�"•&�.€CØ�g‰g‹i€GØ‰>œUŸ[š[¨Ó1Õ
1´E·K²KÀÓ4HÕ
H€Cô �{Š{˜7™=¨#¬u¯ª¸sÓ/CÀcÕ/IÓJ€HØ�H�n€Gà�K€EØˆS�G�O€EØˆR�7�N€EØ�K€Eà�y•\Õ! E¨i­LÕ$8Õ8€FØ�y•\Õ! E¨i­LÕ$8Õ8€FÜ�KŠK˜ Ð(¨bÔ1×;Ñ;¸BÓ?€Eð �E�A•E�M€EØ�F�Q•U�N€EØ�G�a•e�O€Eà��|Õ˜a I¥,Õ.Õ.€DØ�)•Õ˜q Y¥<Õ/Õ/€Dð 
��€BØ��9×
Ñ
 Ó
$€Cà
�#�+€CØ
€CØ
€CØ
�#�+€Cà�#�I˜˜c�	Õ!€EØ—‘“×&Ñ& sÓ+€JØ�jÕ €Ià�9�_€FØˆd�iÕ€FØˆd�iÕ€FØ�9�_€Fà�T�M˜F T�MÕ)€EØ�T�M˜F T�MÕ)€EÜ�;Š;˜˜u�~¨2Ô.×8Ñ8¸Ó<€Dô 	�Š�C—M‘M "Ó%×/Ñ/°Ó3°T¸5ÓA€Aô —’˜A“×&Ñ& rÓ*×.Ñ.¨rÓ2´U·[²[À³^×5KÑ5KÈBÓ5O×5SÑ5SÐTVÓ5WÕW€IØ
�	�/€CÜ�Š�C—M‘M "Ó%×/Ñ/°Ó3´U×5EÒ5EÀaÓ5HÈ!ÓL€Aàˆcˆ6€Mr+   c                   óx   a € ] tR t^¿t o Rt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       tRt	V t
R	# )
Ú_NullSpaceBasisa  The four right singular vectors of ``X`` with the smallest singular values, differentiably.

``torch.linalg.svd`` leaves the right singular vectors past ``min(N, 9)`` without a gradient, and
for fewer than 9 points some or all of the four the 5-point solver uses are exactly those, so the
backward pass silently dropped their gradient (all of it for ``N = 5``). This is used for
``N < 9`` only.

The candidates depend only on the subspace the four vectors span, not on the basis chosen within
it, so the backward differentiates the subspace. With
:math:`X^\top X = \sum_j \lambda_j v_j v_j^\top`, each basis vector :math:`v_i` moves only out of
the subspace :math:`S`, by
:math:`dv_i = \sum_{j \notin S} v_j \, v_j^\top d(X^\top X) \, v_i / (\lambda_i - \lambda_j)`.
That needs a gap between the fourth and fifth smallest singular values. Without one the subspace
itself is not unique, and a nonzero incoming gradient gives no usable gradient, as for
``torch.linalg.svd``: one that is not finite where the SVD returns the missing gap as exactly zero,
as LAPACK does, and a finite one many orders of magnitude past ``1 / eps`` where it leaves the gap at
rounding level, as cuSOLVER's Jacobi SVD, torch's default on CUDA, does. A zero incoming gradient, as
from a sample whose candidates were discarded, gives zero. The forward pass is the same
``_torch_svd_cast`` call as before, so its result is unchanged.
c                ó�   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  S[ P                  S[ P                  3,          /# )r    ÚXr$   ©r&   r'   r   )r(   Ú__classdict__s   "€r)   r*   Ú_NullSpaceBasis.__annotate__×   s7   ø€ ÷ /ñ /‘5—<‘<ð /¡E©%¯,©,¹¿¹ÁeÇlÁlÐ*RÕ$Sñ /r+   c                óZ   € \        V 4      w  rpVR R RR13,          P                  4       W#3# )ºNNNNéüÿÿÿ)r   Ú
contiguous)rŸ   r5   ÚSÚVs   &   r)   ÚforwardÚ_NullSpaceBasis.forwardÖ   s0   € ä! !Ó$‰ˆˆaØ��A�r‘s��|×&Ñ&Ó(¨!Ð.Ð.r+   c                ó|   <€ V ^8„  d   QhRS[ RS[S[P                  ,          RS[S[P                  R3,          RR/# )r    ÚctxÚinputsÚoutput.r$   N)r   r   r&   r'   )r(   r¡   s   "€r)   r*   r¢   Ü   sB   ø€ ÷ 'ñ '™3ð '©©e¯l©lÕ(;ð 'ÁUÉ5Ï<É<ÐY\ÐK\ÕE]ð 'Ðbfñ 'r+   c                ó^   € Vw  pVw  rEpV P                  WV4       V P                  W5V4       R # ©N)Úmark_non_differentiableÚsave_for_backward)r¬   r­   r®   rŸ   r5   r§   r¨   s   &&&    r)   Úsetup_contextÚ_NullSpaceBasis.setup_contextÛ   s0   € à‰ˆØ‰ˆˆaØ×#Ñ# AÔ)Ø×Ñ˜a AÖ&r+   c          
      ó`   <€ V ^8„  d   QhRS[ RS[P                  RS[ RS[ RS[P                  /# )r    r¬   Ú
grad_basisÚ_grad_SÚ_grad_Vr$   )r   r&   r'   )r(   r¡   s   "€r)   r*   r¢   ã   s;   ø€ ÷ <ñ <‘cð <¡u§|¡|ð <¹cð <ÉCð <ÑTY×T`ÑT`ñ <r+   c           	     ó*  € V P                   w  rEpVP                  \        P                  8X  d,   VP                  P
                  R 8w  d   \        P                  MVP                  pVP                  V4      VP                  V4      VP                  V4      VP                  V4      3w  r‰r«\        P                  ! W™,          V	P                  V	P                  ^ ,          V
P                  R,          V	P                  R,          ,
          4      3RR7      pV
RRRR13,          V
RRRR13,          ríVRRR13,          P                  R4      VRRR13,          P                  R4      ,
          pVP                  RR4      V,          p\        P                  ! V^ 8H  \        P                  ! V4      VV,          4      pVV,          VP                  RR4      ,          pVVVP                  RR4      ,           ,          P                  VP                  4      # )Úmpsrf   r¤   NrR   r¥   rj   )Úsaved_tensorsr:   r&   Úfloat32r;   ÚtypeÚfloat64ÚtoÚcatÚ	new_zerosr0   rq   Ú	transposern   ru   )r¬   r¶   r·   r¸   rŸ   r§   r¨   ÚworkÚX_ÚS_ÚV_ÚgrŠ   ÚV_outÚV_inÚgapÚnumÚKÚMs   &&&&               r)   ÚbackwardÚ_NullSpaceBasis.backwardâ   s‹  € à×#Ñ#‰ˆˆaØ !§¡¬5¯=©=Ô 8¸Q¿X¹X¿]¹]ÈeÔ=SŒu�}Š}ÐYZ×Y`ÑY`ˆØŸ™˜T›
 A§D¡D¨£J°·±°T³
¸J¿M¹MÈ$Ó<OÐO‰ˆ�ä�iŠi˜� "§,¡,¨r¯x©x¸­{¸B¿H¹HÀR½LÈ2Ï8É8ÐTVÍ<Õ<WÓ"XÐYÐ_aÔbˆØ˜˜A˜s ˜s˜•m R¨¨1¨b©c¨	¥]ˆtØ�!�R‘S�&�k×#Ñ# BÓ'¨#¨a°°"°¨f­+×*?Ñ*?ÀÓ*CÕCˆØ�o‰o˜b "Ó%¨Õ)ˆô �KŠK˜˜q™¤%×"2Ò"2°3Ó"7¸¸s½ÓCˆØ�A�I˜Ÿ™ r¨2Ó.Õ.ˆØ�a˜!Ÿ+™+ b¨"Ó-Õ-Õ.×2Ñ2°1·7±7Ó;Ð;r+   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ústaticmethodr©   r³   rÎ   Ú__static_attributes__Ú__classdictcell__)r¡   s   @r)   r�   r�   ¿   sF   ø‡ € ñð, ÷/ó ð/ð ÷'ó ð'ð ÷<ó ö<r+   r�   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# ©r    r3   r$   rL   )r(   s   "r)   r*   r*   ó   s"   € ÷ ñ ¤§¡ð ´%·,±,ñ r+   c                óî   € V P                  \        V P                  4      4      p V P                  R,          ^	8  d   \        P                  V 4      ^ ,          # \        V RR7      w   rVRRRR13,          # )z×Least-squares null space ``(B, 9, 4)`` of design rows ``(B, N, 9)`` with ``N > 5``.

The four right singular vectors with the smallest singular values, in
:func:`~kornia.geometry.epipolar.fundamental._solve_dtype`.
F)Úfull_matricesr¤   Nrj   r¥   )r¿   r   r;   r0   r�   Úapplyr   )r3   r5   r¨   s   &  r)   Ú_least_squares_basisrÞ   ó   sf   € ð �Y‰Y”| F§M¡MÓ2Ó3€FØ‡|�|�BÕ˜!ÔÜ×$Ñ$ VÓ,¨QÕ/Ð/ô ˜f°EÔ:�G€A€qØˆQ��2‘3ˆY�<Ðr+   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# rÚ   rL   )r(   s   "r)   r*   r*     s&   € ÷ Mñ M¤e§l¡lð M´u·|±|ñ Mr+   c                óè   € V P                   P                  R8X  d3   \        V P                  4       4      P	                  V P                   4      # \        \        V 4      V P                  4      ^ ,          # )zµNister's candidates ``(B, 10, 3, 3)`` of design rows ``(B, N, 9)`` with ``N > 5``, on the design's device.

MPS inputs are solved on the host, as in :func:`_five_point_candidates`.
rº   )r;   r½   r2   Úcpur¿   Ú_nister_candidatesrÞ   r:   )r3   s   &r)   r2   r2     sR   € ð
 ‡}�}×Ñ˜UÔ"Ü(¨¯©«Ó6×9Ñ9¸&¿-¹-ÓHÐHÜÔ2°6Ó:¸F¿L¹LÓIÈ!ÕLÐLr+   c                óŽ   € V ^8„  d   QhR\         P                  R\        \         P                  \         P                  3,          /# rÚ   r    )r(   s   "r)   r*   r*     s4   € ÷ $mñ $m¤5§<¡<ð $m´E¼%¿,¹,ÌÏÉÐ:TÕ4Uñ $mr+   c           
     ó  € V P                   P                  R8X  dR   \        V P                  4       4      w  rVP	                  V P                   4      VP	                  V P                   4      3# V P	                  \        V P                   4      4      p\        P                  P                  VP                  4       P                  4      w  rEpVP                  RRR7      P                  4       pV^ 8„  VP                  R4      R\        P                  ! VP                  4      P                   ,          VP#                  R4      ,          8*  ,          p\        P$                  ! VR,          \        P&                  ! ^^	VP                   VP                  R7      V4      p\)        \+        V4      V P                  4      w  rW(R	,          ( ,          p\        P$                  ! VR
,          V\        P,                  ! V\/        R4      4      4      V3# )aÿ  Nister's five-point solver on the epipolar design rows ``(B, 5, 9)`` of minimal samples.

The four-dimensional null space comes from batched Householder reflections,
:func:`~kornia.geometry.solvers.homogeneous._null_space_householder`, and everything up to the roots is computed
in float64, so a float32 sample does not lose its true solution to rounding.

A sample whose design rows are rank deficient, such as one with a repeated correspondence or points collinear in
both images, has a null space of more than four dimensions and no unique solution: all ten of its slots are NaN.
It is found by a partial-pivoted LU factorization of the detached rows. Rounding rarely leaves an exactly zero
pivot, so rank deficiency is a pivot below ``1e3`` epsilons of the largest one: repeated correspondences measure
at most about 1e-16 relative, regular samples above 1e-8 even with all five points in a patch 1e-4 wide.
Collinear points rounded to float32 are no longer collinear, and are solved like any other sample. A rank-deficient
sample is swapped for a constant full-rank design before the null space is taken, whose normalizations would
otherwise divide by a vanishing norm, so that its gradient is zero.

Note:
    MPS has no float64, so an MPS sample is solved on the host and its candidates are copied back; autograd
    follows both copies. Solved in float32 on the device instead, an exact sample could miss its true solution
    by more than 1e-3, and on an Apple M1 (torch 2.14) the host solve was also faster: 8 ms against 37 ms for 256
    samples, 45 ms against 75 ms for 2048, and about the same at 8192.

Returns:
    Candidates ``(B, 10, 3, 3)`` of unit Frobenius norm in the design's dtype, NaN where the slot holds no
    real root, and the ``(B, 10)`` mask of the real ones.
rº   ©Údim1Údim2g     @�@©r;   r:   Únanrj   rR   ©r¤   NN©r¤   N©.NN)r;   r½   r1   rá   r¿   r   r&   ÚlinalgÚlu_factor_exÚdetachÚmTÚdiagonalrk   ÚaminÚfinfor:   rc   Úamaxrn   Úeyerâ   r   Ú	full_likerd   )	r3   r4   ÚvalidrK   Úlur5   ÚinfoÚpivotsÚrank_deficients	   &        r)   r1   r1     sr  € ð4 ‡}�}×Ñ˜UÔ"Ü2°6·:±:³<Ó@Ñˆ
Ø�}‰}˜VŸ]™]Ó+¨U¯X©X°f·m±mÓ-DÐDÐDØ�	‰	”,˜vŸ}™}Ó-Ó.€AÜ—,‘,×+Ñ+¨A¯H©H«J¯M©MÓ:�K€Bˆ4Ø�[‰[˜b rˆ[Ó*×.Ñ.Ó0€FØ˜Q‘h 6§;¡;¨r£?°c¼E¿KºKÈÏÉÓ<P×<TÑ<TÕ6TÐW]×WbÑWbÐceÓWfÕ6fÑ#fÕg€NÜ�Š�N =Õ1´5·9²9¸QÀÈ!Ï(É(ÐZ[×ZaÑZaÔ3bÐdeÓf€AÜ*Ô+BÀ1Ó+EÀvÇ|Á|ÓTÑ€JØ GÕ,Ð,Õ,€EÜ�;Š;�u˜_Õ-¨z¼5¿?º?È:ÔW\Ð]bÓWcÓ;dÓeÐglÐlÐlr+   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r    Úrootsr$   rL   )r(   s   "r)   r*   r*   9  s&   € ÷ Bñ B¤U§\¡\ð B´e·l±lñ Br+   c                óÌ  € V P                  4       R8„  p\        P                  ! V\        P                  ! WR4      P                  4       V 4      pVR,          P                  ! . VP
                  O^
N5!  P                  R4      p\        P                  ! \        P                  ! VR,          4      V3R4      p\        P                  ! VR,          VP                  R4      V4      # )ac  Return ``z**d / max(1, abs(z))**10`` for ``d = 0, ..., 10`` without large powers.

For ``abs(z) > 1`` these are the powers of ``1/z`` in reverse order (the degree ten is even).
Every multiplication therefore has magnitude at most one. Cumulative products avoid the two general
tensor exponentiations in the Newton correction, which dominate its CPU cost.
rB   ©.NrR   )
rk   r&   rn   Ú
reciprocalÚexpandr0   ÚcumprodrÀ   ro   rU   )rý   ÚlargeÚboundedÚpowerss   &   r)   Ú_scaled_polynomial_powersr  9  s©   € ð �I‰I‹K˜#Ñ€EÜ�kŠk˜%¤§¢¨U¸3Ó!?×!JÑ!JÓ!LÈeÓT€GØ�YÕ×&Ò&Ð:¨¯©Ð:°rÓ:×BÑBÀ2ÓF€FÜ�YŠYœŸš¨°	Õ(:Ó;¸VÐDÀbÓI€FÜ�;Š;�u˜YÕ'¨¯©°R«¸&ÓAÐAr+   c                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  \         P                  3,          /# )r    ÚbasisÚ	out_dtyper$   )r&   r'   r:   r   )r(   s   "r)   r*   r*   G  sC   € ÷ {#ñ {#œeŸl™lð {#´u·{±{ð {#ÄuÌUÏ\É\Ô[`×[gÑ[gÐMgÕGhñ {#r+   c           
     ó�  € V P                   ^ ,          pV P                  V P                  rC\        P	                  W44      p\
        P	                  W44      pV P                  V^^^4      p\        P                  ! RVR,          VR,          V4      p\        P                  ! VR,          VR,          ,
          VR,          VR,          ,
          VR,          VR,          ,
          .^4      p	\        P                  ! RW—R,          V4      p
\        P                  ! RWwV4      pRVP                  ^^R7      P                  R4      ,          pV\        P                  ! ^W4R7      R,          VR,          ,          ,
          p\        P                  ! RW·V4      P                  V^	^4      p\        P                  ! WÚR ,          .^4      pVR!,          VR",          pp\        P                  ! ^
W4R7      p\        P                  P                  VP                   '       d   VP#                  4       MT4      w  pppV^ 8„  pVP                   '       dB   \        P                  P                  \        P$                  ! VR#,          VV4      4      w  pppM`\        P$                  ! VR#,          VV4      p\        P$                  ! VR ,          \        P&                  ! ^^VVP                  R7      V4      p\        P                  P)                  VVV4      pVR. R$O3,          VR. R%O3,          pp\        P*                  ! V^^W4R7      pVR&,          VR'&   VR(,          VR&,          ,
          VR(&   VR),          VR*&   VR+,          VR),          ,
          VR+&   VR,,          VR-&   VR.,          VR,,          ,
          VR.&   \-        V4      pVR/,          pV( \        P.                  ! V4      P1                  ^4      ,          V^ 8g  ,          pVP#                  4       P3                  4       P5                  4       p\        P*                  ! V^
^
\        P6                  R	7      p\        P                  ! ^	\        P6                  R	7      VR0&   VR1,          ) \        P$                  ! VR2,          ^ 8H  RVR2,          4      ,          VR3&   VP3                  4       \        P.                  ! V4      P9                  ^4      P1                  ^4      ,          p \        P$                  ! V R#,          V\        P                  ! ^
\        P6                  R	7      4      p\        P                  P;                  V4      p!V!P<                  P?                  4       RV!P?                  4       PA                  RR7      ,          8*  p"V!PB                  P?                  4       \        PD                  ! V4      PF                  R,          8  p#V"V#,          V R ,          ,          P	                  V4      p$\        P$                  ! V"V#,          V!PB                  R4      P	                  W44      p%\        P&                  ! ^W4R7      p&\I        V%4      p'V'VR ,          ,          P                  R4      p(V'R!,          V&R
,          VR4,          ,          R ,          ,          p)V)P                  R4      p*V$V*P?                  4       ^\        PD                  ! V4      PJ                  ,          V)P?                  4       P                  R4      ,          8„  ,          p+V+\        P.                  ! V(4      ,          \        P.                  ! V*4      ,          p+V(\        P$                  ! V+V*\        PL                  ! V*4      4      ,          p,V%\        P$                  ! V+V,\        PN                  ! V,4      4      ,
          p-V-R ,          p.\        P                  ! VR5,          V.^,          ,          VR6,          V.PQ                  4       ,          ,           VR7,          V.,          ,           VR8,          ,           VR9,          V.^,          ,          VR:,          V.PQ                  4       ,          ,           VR;,          V.,          ,           VR<,          ,           3^R7      PS                  ^R4      p/VR=,          V.^,          ,          VR>,          V.^,          ,          ,           VR?,          V.PQ                  4       ,          ,           VR@,          V.,          ,           VRA,          ,           PS                  ^^4      RB,          p0\        P                  ! V/RC,          P9                  ^4      V0RD,          .R4      p1V1P#                  4       P?                  4       PU                  R4      PA                  \        PD                  ! V4      PV                  R7      RE,          p2\Y        V/RC,          V2,          V0RF,          V2,          R4      w  p3p4\        P                  ! V3RG,          ) V3RH,          ) V-\        PL                  ! V-4      .R4      p5\        P                  ! RVV54      p6V6P9                  ^4      P[                  RR7      RE,          p7V6\        P$                  ! V7^ 8„  V7\        PL                  ! V74      4      ,          p6V$V4( ,          \        P.                  ! V64      P9                  ^4      P1                  R4      ,          p$\        P$                  ! V$RE,          V6\        P\                  ! V6\_        R4      4      4      p6V6P	                  V4      V$3# )Ia™  Essential matrices ``E = x X + y Y + z Z + W`` in the span of ``basis`` ``(B, 9, 4)`` (columns X, Y, Z, W).

Nister's method: the cubic constraints ``det E = 0`` and ``2 E E^T E - tr(E E^T) E = 0`` as a ``(10, 20)``
coefficient matrix, Gauss-Jordan elimination of its first ten monomials, a degree-ten polynomial in ``z`` from
the determinant of the ``(3, 13)`` hidden-variable matrix, its real roots, and ``x``, ``y`` by
back-substitution.

The roots are the eigenvalues of the polynomial's companion matrix, from LAPACK on the host in float64 for every
device: ``torch.linalg.eigvals`` has no batched CUDA kernel and none at all on MPS, and it is faster in
float64 than in float32. They carry no gradient themselves: one Newton step on the differentiable polynomial
polishes each root and supplies its derivative by the implicit function theorem, and is skipped at a multiple
root, where the derivative does not exist.
zbja,bkc,acm->bjkmr¤   zbjm,bjc,mcn->bnzbika,bjkc,acm->bijmç      à?rå   rè   zbikm,bkjc,mcn->bijn)r:   ºrO   NNrB   g»½×Ùß|Û=)Úmingš™™™™™É?ç        rf   çê-�™—q=zbijk,brk->brijré   ©r¤   rN   ©r¤   rO   ©r¤   rO   r    ©r¤   r    rO   ©r¤   r    rN   ©r¤   rN   r    ©r¤   rN   rO   ©r¤   rO   rN   ©r¤   r    rR   )Nr¤   r¤   N)r¤   NNr¤   rë   ).ºNé
   N).ºr  NNrê   )rQ   é   rS   )é   é   é	   ).ºrN   é   N)r¤   r¤   :rO   rQ   N)r¤   r¤   r   ).:r!  r  N)r¤   r¤   :r  rS   N)r¤   r¤   :rQ   r  N).:r  r  N)r¤   r¤   :r  rT   N)r¤   r¤   :rS   é   N)r¤   rR   )r¤   :Nr  Nr  )r¤   r  )r¤   r  )r¤   r  )r¤   r  )r¤   ºNr!  N:NrO   N)r¤   r#  :rO   r    N)r¤   r#  :r    r!  N)r¤   r#  :r!  rQ   N)r¤   r#  :rQ   r  N)r¤   r#  :r  r  N)r¤   r#  :r  r  N)r¤   r#  :r  rS   N)r¤   r#  :rS   r  N)r¤   r#  :r  r  N)r¤   r#  :r  é   N)r¤   r#  :r$  r"  N)r¤   r#  :r"  rT   Nrÿ   )r¤   r¤   ºNr    Nr%  )r¤   r¤   r%  rN   rì   )r¤   r¤   r%  rh   ri   )0r0   r;   r:   Ú_LINEAR_PRODUCTSr¿   Ú_CUBIC_PRODUCTSÚreshaper&   rV   rp   rñ   Úsumrõ   rÀ   rí   rî   Úrequires_gradrï   rn   rD   Úlu_solverE   ra   ÚisfiniteÚallrá   Údoubler¾   rs   ÚeigvalsÚimagrk   ÚclampÚrealró   Úmaxr  rc   ro   ru   ÚsquarerÂ   rô   Útinyr›   Únormrö   rd   )8r  r	  r-   r;   r:   ÚlinearÚcubicr.   Úrows01Ú	cofactorsÚdeterminantÚEEtÚ
half_traceÚtrace_constraintsÚcoeffsÚA10Úb10Úeye10rø   rú   rù   Úsingularr5   Ú
eliminatedÚtopÚbottomrK   ÚcsÚleadÚusableÚdetachedÚ	companionÚhost_usableÚeigenvaluesr2  Úin_ranger÷   Úroot0Údegreesr  ÚvalueÚslope_termsÚslopeÚsimpleÚstepÚzÚzzÚBsÚbsÚsystemÚsystem_scaleÚxyÚbad2ÚcoefficientsÚEsr6  s8   &&                                                      r)   râ   râ   G  sz  € ð 	�‰�A�€AØ—L‘L %§+¡+ˆEÜ× Ñ  Ó/€FÜ×Ñ˜vÓ-€EØ�‰�a˜˜A˜qÓ!€Aô �\Š\Ð-¨q°­w¸¸$½ÀÓH€FÜ—’Ø	��˜6 '�?Õ	*¨F°7­O¸fÀW½oÕ,MÈvÐV]ÍÐagÐhoÕapÕOpÐqÐstó€Iô —,’,Ð0°)¸t½WÀeÓL€Kä
�,Š,Ð,¨a°FÓ
;€CØ�s—|‘|¨°�|Ó3×7Ñ7¸Ó;Õ;€JØ
”—	’	˜! FÔ8Ð9IÕJÈZÐXhÕMiÕiÕ
i€CÜŸšÐ%:¸CÀEÓJ×RÑRÐSTÐVWÐY[Ó\ÐÜ�YŠYÐ)°wÕ+?Ð@À!ÓD€Fð �hÕ ¨Õ!1ˆ€CÜ�IŠI�b Ô5€EÜ—|‘|×0Ñ0À×AR×ARÐAR°·±´ÐX[Ó\Ñ€Bˆ�Ø�a‰x€HØ
××Ðô Ÿ™×1Ñ1´%·+²+¸hÀ}Õ>UÐW\Ð^aÓ2bÓc‰ˆˆF‘Aô �[Š[˜ -Õ0°%¸Ó<ˆÜ—’˜X gÕ.´·²¸QÀÈ6ÐY_×YeÑYeÔ0fÐhnÓoˆÜ—‘×&Ñ& r¨6°3Ó7€Jð ˜Q¢	˜\Õ*¨J°qº)°|Õ,Dˆ€CÜ�Š�A�q˜" VÔ9€AØ�x•=€A€i�LØ�Y•< &¨Õ"2Õ2€A€i�LØ�x•=€A€i�LØ�Y•< &¨Õ"2Õ2€A€i�LØ˜	•N€A€j�MØ�j•M F¨9Õ$5Õ5€A€j�MÜ	'¨Ó	*€Bð
 ˆe�9€DØˆYœŸš¨Ó+×/Ñ/°Ó2Õ2°d¸a±iÕ@€FØ�y‰y‹{�‰Ó ×'Ñ'Ó)€HÜ—’˜A˜r 2¬U¯]©]Ô;€IÜ Ÿ9š9 Q¬e¯m©mÔ<€IˆiÑØ Õ'Ð'¬%¯+ª+°h¸vÕ6FÈ!Ñ6KÈSÐRZÐ[aÕRbÓ*cÕc€Iˆd�OØ—*‘*“,¤§¢°	Ó!:×!BÑ!BÀ1Ó!E×!IÑ!IÈ!Ó!LÕL€KÜ—’˜K¨Õ6¸	Ä5Ç9Â9ÈRÔW\×WdÑWdÔCeÓf€IÜ—,‘,×&Ñ& yÓ1€KØ×Ñ×ÑÓ! U¨[¯_©_Ó->×-DÑ-DÈÐ-DÓ-MÕ%MÑM€Dð ×Ñ×#Ñ#Ó%¬¯ª°EÓ(:×(>Ñ(>À#Õ(EÑE€HØ�H�_˜{¨7Õ3Õ3×7Ñ7¸Ó?€EÜ�KŠK˜˜x�¨×)9Ñ)9¸3Ó?×BÑBÀ6ÓQ€Eô
 �lŠl˜2 fÔ:€GÜ& uÓ-€FØ�b˜•kÕ!×&Ñ& rÓ*€EØ˜Õ" g¨b¥k°B°uµIÕ&=¸wÕ%GÕG€KØ�O‰O˜BÓ€Eà�e—i‘i“k A¬¯ª°EÓ(:×(>Ñ(>Õ$>ÀÇÁÓAR×AVÑAVÐWYÓAZÕ$ZÑZÕ[€FØ”e—n’n UÓ+Õ+¬e¯nªn¸UÓ.CÕC€FØ”5—;’;˜v u¬e¯oªo¸eÓ.DÓEÕE€DØ”—’˜F D¬%×*:Ò*:¸4Ó*@ÓAÕA€Að 
ˆ7�€BÜ	�Šàˆi�L˜2˜q�5Õ  1 Z¥=°2·9±9³;Õ#>Õ>ÀÀ:ÅÐQSÕASÕSÐVWÐXbÕVcÕcØˆj�M˜B �EÕ! A j¥M°B·I±I³KÕ$?Õ?À!ÀJÅ-ÐRTÕBTÕTÐWXÐYcÕWdÕdð	
ð ô
÷ �i��2Óð ð 
ˆ:�˜˜Q�Õ	  ;¥°"°aµ%Õ!7Õ	7¸!¸L½/ÈBÏIÉIËKÕ:WÕ	WÐZ[Ð\hÕZiÐlnÕZnÕ	nØ
ˆL�/õ	ç�i��1ƒo�iõ
!€Bô �YŠY˜˜<Õ(×0Ñ0°Ó3°R¸µ_ÐEÀrÓJ€FØ—=‘=“?×&Ñ&Ó(×-Ñ-¨bÓ1×7Ñ7¼E¿KºKÈÓ<N×<SÑ<SÐ7ÓTÐUdÕe€LÜ'¨¨<Õ(8¸<Õ(GÈÈHÍÐXdÕIdÐfkÓl�H€BˆÜ—;’;  I¥ °°Iµ°ÀÄ5Ç?Â?ÐSTÓCUÐVÐXZÓ[€LÜ	�ŠÐ&¨¨<Ó	8€BØ�:‰:�a‹=×Ñ "ÐÓ% oÕ6€DØ	Œe�kŠk˜$ ™( D¬%¯/ª/¸$Ó*?Ó@Õ	@€BØ�T�E�MœEŸNšN¨2Ó.×6Ñ6°qÓ9×=Ñ=¸bÓAÕA€EÜ	�Š�U˜?Õ+¨R´·²ÀÄUÈ5Ã\Ó1RÓ	S€BØ�5‰5�Ó˜UÐ"Ð"r+   c          
      ó|   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  /# )r    Únull_matrF   rG   Úratior$   ©r&   r'   r<   )r(   s   "r)   r*   r*   Å  s7   € ÷ &ñ &œŸ™ð &¬#ð &´#ð &¼cð &Ì%Ï,É,ñ &r+   c                 ó2   € V R W2,          V,           3,          # )r¤   rÐ   )ra  rF   rG   rb  s   &&&&r)   Ú
fun_selectre  Å  s   € Ø�A�u•y 1•}Ð$Õ%Ð%r+   c                ód   € V ^8„  d   QhR\         P                  R\        R\         P                  /# )r    rŸ   Ú
batch_sizer$   rc  )r(   s   "r)   r*   r*   Í  s)   € ÷ -ñ -œuŸ|™|ð -¼ð -ÄÇÁñ -r+   c                óŠ   € V R\         3,          pVP                  ^,          ^8X  d   \        V4      ^ ,          # \        V4      # )zeCandidates ``(B, 10, 3, 3)`` of design rows ``X`` ``(B, N, 9)`` in the column order ``vec(x1 x2^T)``..)Ú_TRANSPOSED_ROWSr0   r1   r2   )rŸ   rg  r3   s   && r)   Únull_to_Nister_solutionrj  Í  s=   € àˆsÔ$Ð$Õ%€FØ‡|�|�A…˜!ÔÜ% fÓ-¨aÕ0Ð0Ü$ VÓ,Ð,r+   c                ó˜   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  /# )r    ÚF_matÚK1ÚK2r$   rL   )r(   s   "r)   r*   r*   Õ  sA   € ÷ $^ñ $^¤e§l¡lð $^¼¿¹ð $^Ì%Ï,É,ð $^Ô[`×[gÑ[gñ $^r+   c                ód  € \        V . RO4       \        V. RO4       \        V. RO4       \        V4      P                  RR4      \        V 4      ,          \        V4      ,          pV P                  \        P
                  \        P                  39   d   VP                  V P                  4      # T# )a?  Convert a fundamental matrix and the intrinsics of its two cameras to their essential matrix.

``E = essential_from_fundamental(F_mat, K1, K2)`` takes a fundamental matrix ``(*, 3, 3)`` in the
:math:`x_2^\top F x_1 = 0` order of :func:`find_fundamental` and the pixel intrinsics ``(*, 3, 3)`` of the
first and the second camera, and returns :math:`E = K_2^\top F K_1`, ``(*, 3, 3)`` with the leading dimensions
broadcast, for which :math:`x_2^\top E x_1 = 0` in normalized camera coordinates (Hartley and Zisserman, 9.6,
p. 257, eq. 9.12). It keeps the scale of ``F_mat`` and does not enforce the constraints of an essential matrix:
pass an estimated one through :func:`project_to_essential` before decomposing it with
:func:`decompose_essential_matrix_no_svd`; :func:`decompose_essential_matrix` does not need it. For the reverse, use
:func:`fundamental_from_essential`.

Convention:
    - ``K1`` is the camera of the first image, so ``E`` follows the :math:`x_2^\top E x_1 = 0` order of
      :func:`find_essential`.

Args:
    F_mat: The fundamental matrix with shape of ``(*, 3, 3)``.
    K1: The camera matrix from first camera with shape ``(*, 3, 3)``.
    K2: The camera matrix from second camera with shape ``(*, 3, 3)``.

Returns:
    The essential matrix with shape ``(*, 3, 3)``.

See Also:
    - :func:`fundamental_from_essential`: the reverse conversion, :math:`F = K_2^{-\top} E K_1^{-1}`.
    - :func:`project_to_essential`: the nearest matrix that satisfies the essential constraints.
    - :func:`find_essential`: an essential matrix fitted to calibrated correspondences directly.

©Ú*Ú3rr  rj   rR   )r   r   rÂ   r:   r&   Úfloat16Úbfloat16r¿   )rl  rm  rn  ÚE_mats   &&& r)   Úessential_from_fundamentalrv  Õ  sƒ   € ô< �ušoÔ.Ü�rš?Ô+Ü�rš?Ô+ô ˜bÓ!×+Ñ+¨B°Ó3Ô6GÈÓ6NÕNÔQbÐceÓQfÕf€EØ$)§K¡K´E·M±MÄ5Ç>Á>Ð3RÔ$Rˆ5�8‰8�E—K‘KÓ Ð]ÐX]Ð]r+   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# ©r    ru  r$   rL   )r(   s   "r)   r*   r*   ü  s"   € ÷ 4,ñ 4,¤§¡ð 4,´·±ñ 4,r+   c                ój  € \        V . RO4       \        P                  P                  4       '       d   \	        V 4      # \        V P                  P                  4      ;_uu_ 4        \        V 4      '       d   \        V 4      uuRRR4       # \	        V 4      uuRRR4       #   + '       g   i     R# ; i)ak
  Project 3x3 matrices onto the nearest essential matrices in Frobenius norm.

``E = project_to_essential(E_mat)`` takes matrices ``(*, 3, 3)`` and returns the closest matrices ``(*, 3, 3)``
of the essential form :math:`U \text{diag}(s, s, 0) V^T`: the two largest singular values of ``E_mat`` averaged
and the smallest one set to zero. Matrices estimated by other means, such as an 8-point fit of
:func:`find_fundamental` on normalized camera coordinates or :func:`essential_from_fundamental` of an estimated
``F``, generally violate this constraint. :func:`decompose_essential_matrix_no_svd` then returns matrices that are
not rotations, while :func:`decompose_essential_matrix` and :func:`motion_from_essential` return the same
candidates for a matrix and for its projection, because the projection keeps its singular vectors. Their order can
differ, though: on about half of noisy inputs the projection swaps the two rotations and flips the translation,
so pick a candidate by its triangulated points, as :func:`motion_from_essential_choose_solution` does, not by its
index. The candidates of :func:`find_essential` have this form only up to rounding, which on unlucky samples
leaves a relative gap of order ``1e-4`` between their two largest singular values;
:class:`~kornia.geometry.ransac.RANSAC` projects its essential matrix for that reason
(`#3874 <https://github.com/kornia/kornia/issues/3874>`_).

Convention:
    - The result is not normalised to unit Frobenius norm, unlike the candidates of :func:`find_essential`.
    - A caller's autocast region does not change the result, outside TorchScript.
    - First and second derivatives at an exact essential matrix are finite and correct, also where its two largest
      singular values are equal and the backward of :func:`torch.linalg.svd` divides by zero; a third derivative
      is not correct. They need the smallest singular value to differ from the other two; without that, as for a
      matrix of rank 1, there is no derivative and the gradient is finite but not meaningful. A scripted call
      differentiates through the SVD instead.

Args:
    E_mat: The matrices to project with shape ``(*, 3, 3)``.

Returns:
    The closest matrices (in Frobenius norm) satisfying the essential-matrix constraint,
    with shape ``(*, 3, 3)``.

See Also:
    - :func:`decompose_essential_matrix_no_svd`: the closed-form decomposition, which needs this projection of
      an estimate.
    - :func:`decompose_essential_matrix`: the SVD decomposition, which gives the same candidates with or without
      it.
    - :func:`essential_from_fundamental`: an essential matrix that usually needs this projection.

Nrp  )
r   r&   ÚjitÚis_scriptingÚ_project_to_essentialr   r;   r½   r   Ú$_project_to_essential_differentiable©ru  s   &r)   Úproject_to_essentialr  ü  sz   € ôR �ušoÔ.ô ‡y�y×Ñ×ÒÜ$ UÓ+Ð+Ü	˜EŸL™L×-Ñ-×	.Õ	.ô ˜e×$Ò$Ü7¸Ó>÷ 
/Ò	.ô % UÓ+÷ 
/×	.×	.Ó	.ús   Á%B!Â
B!Â!B2	c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# rx  rL   )r(   s   "r)   r*   r*   3  s"   € ÷ )ñ )¤§¡ð )´%·,±,ñ )r+   c                 ó6   € \        V 4      w  rp\        WV4      # r°   )r   Ú_projection_from_svd)ru  ÚUr§   r¨   s   &   r)   r|  r|  3  s   € Ü˜eÓ$�G€Aˆ!Ü  aÓ(Ð(r+   c                ó˜   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  /# )r    rƒ  r§   r¨   r$   rL   )r(   s   "r)   r*   r*   8  s8   € ÷ .ñ .œEŸL™Lð .¬U¯\©\ð .¼e¿l¹lð .ÌuÏ|É|ñ .r+   c                 óÖ   € \         P                  ! V4      pR VR,          VR,          ,           ,          pWCR&   WCR&   V \         P                  ! V4      ,          VP                  ,          # )r  ©.rN   ©.rO   )r&   ru   Ú
diag_embedÚmH)rƒ  r§   r¨   ÚS_newÚmean_svs   &&&  r)   r‚  r‚  8  sV   € Ü×Ò˜QÓ€EØ�Q�v•Y  6¥Õ*Õ+€GØˆ&�MØˆ&�MØŒu×Ò Ó&Õ&¨¯©Õ-Ð-r+   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# rx  rL   )r(   s   "r)   r*   r*   @  s"   € ÷ 3ñ 3´·±ð 3ÄÇÁñ 3r+   c                ó  € \        V P                  4       4      w  rp\        VP                  V P                  4      VP                  V P                  4      VP                  V P                  4      4      p\        WW#4      w   rV\        WF4      # )zbThe value of :func:`_project_to_essential`, with the derivatives of :func:`_pair_invariant_terms`.)r   rï   r‚  r¿   r:   Ú_pair_invariant_termsÚ_with_derivatives_of)ru  rƒ  r§   r¨   rQ  r5   Ú
projections   &      r)   r}  r}  @  sg   € ä& u§|¡|£~Ó6�G€Aˆ!Ü  §¡ e§k¡kÓ!2°A·D±D¸¿¹Ó4EÀqÇtÁtÈEÏKÉKÓGXÓY€EÜ,¨U°qÓ<Ñ€A€qÜ Ó2Ð2r+   c                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# )r    rQ  Úsmoothr$   rL   )r(   s   "r)   r*   r*   H  s-   € ÷ >ñ >¤§¡ð >´e·l±lð >ÄuÇ|Á|ñ >r+   c                ón   € WP                  4       V,
          P                  V P                  4      ,
          # )aJ  Return ``value`` with the derivatives of ``smooth``, another expression of the same quantity.

This is the detached-value pattern of #4229. For a finite ``smooth``, ``smooth.detach() - smooth`` is ``+0.0``;
subtracting it, unlike adding it, also leaves a ``-0.0`` of ``value`` as it is, so that ``value`` stays bitwise
unchanged.
)rï   r¿   r:   )rQ  r’  s   &&r)   r�  r�  H  s'   € ð —M‘M“O fÕ,×0Ñ0°·±Ó=Õ=Ð=r+   c                ó  € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\        \         P                  \         P                  \         P                  3,          /# )r    ru  rƒ  r§   r¨   r$   r    )r(   s   "r)   r*   r*   R  s\   € ÷ (ñ (Ü�<‰<ð(Ü!ŸL™Lð(Ü-2¯\©\ð(Ü>C¿l¹lð(ä
Œ5�<‰<œŸ™¤u§|¡|Ð3Õ4ñ(r+   c                ó¢  € V P                  VP                  4      p\        VP                  W!^4      \	        V4      ,          p\        WBV^4      \	        V4      ,          pVR,          VR,          ,          pRV,          pVVW‡V,          P                  RRR7      V,          ,
          \        V4      V,          \        V4      ,          ,
          3# )aR  Express the SVD decompositions without the basis chosen for the two largest singular values.

Take :math:`E = \sum_i s_i u_i v_i^\top` with right-handed singular vectors, so that
:math:`[u_3]_\times (u_1, u_2) = (u_2, -u_1)`, and likewise for :math:`v`. Then

.. math::
    M = E - (u_3^\top E v_3)\, u_3 v_3^\top - [u_3]_\times E [v_3]_\times
      = (s_1 + s_2)(u_1 v_1^\top + u_2 v_2^\top).

The projection onto essential matrices is :math:`P = M / 2`, the rotations are
:math:`u_3 v_3^\top \pm [u_3]_\times P / m` with :math:`m = (s_1 + s_2) / 2 = \|P\|_F / \sqrt{2}`, and the
translation is :math:`u_3`. :math:`P` is built from :math:`E / 2`, so it stays in range while the singular values
of :math:`E` do, where :math:`M` can overflow. All of this holds for any :math:`E`, so these expressions have the
derivatives of the SVD wherever the backward of :func:`torch.linalg.svd` is correct, but they never divide by the
difference of the two largest singular values, which that backward does. Only the derivatives of :math:`u_3` and
:math:`v_3` divide, by the gaps to :math:`s_3`: :func:`~kornia.core.utils._symmetric_eigenvector` gives them to
second order, and leaves out a gap that is exactly zero.

Args:
    E_mat: the matrices ``(*, 3, 3)``.
    U: the left singular vectors ``(*, 3, 3)`` of the detached ``E_mat``, in its work dtype.
    S: the singular values ``(*, 3)``, in that dtype.
    V: the right singular vectors ``(*, 3, 3)``, in that dtype.

Returns:
    :math:`u_3` and :math:`v_3`, ``(*, 3)``, right-handed whatever the signs of ``U`` and ``V``, and :math:`P`,
    ``(*, 3, 3)``, in that dtype.
r  T©Úkeepdim©.r¤   N©.Nr¤   ©rj   rR   )r¿   r:   r   rð   Ú_handednessr)  r   )	ru  rƒ  r§   r¨   ÚEÚuÚvÚuvÚhalfs	   &&&&     r)   rŽ  rŽ  R  s­   € ð> 	�‰�—‘Ó€AÜ˜qŸt™t Q¨1Ó-´¸A³Õ>€AÜ˜q Q¨Ó*¬[¸«^Õ;€AØ	
ˆ<�˜1˜\�?Õ	*€BØ��7€Dà	Ø	Ø�T•	�‰˜x°ˆÓ6¸Õ;Õ;Ô>RÐSTÓ>UÐX\Õ>\Ô_sÐtuÓ_vÕ>vÕvðð r+   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r    Úframer$   rL   )r(   s   "r)   r*   r*   }  s&   € ÷ sñ s”u—|‘|ð s¬¯©ñ sr+   c                ó¼   € \         P                  P                  V R,          V R,          RR7      V R,          ,          P                  RRR7      P	                  4       # )zeThe sign ``(*, 1)`` of the determinant of orthogonal matrices ``(*, 3, 3)``, without a factorization.rf   Tr–  r†  r‡  rR   ©.r    )r&   rí   Úcrossr)  r[   )r¢  s   &r)   r›  r›  }  sJ   € ä�L‰L×Ñ˜u V�}¨e°F­mÀÐÓDÀuÈVÅ}ÕT×YÑYÐZ\ÐfjÐYÓk×pÑpÓrÐrr+   c                ó¬   € V ^8„  d   QhR\         P                  R\        \         P                  \         P                  \         P                  3,          /# rx  r    )r(   s   "r)   r*   r*   ‚  s9   € ÷ >3ñ >3¤e§l¡lð >3´u¼U¿\¹\Ì5Ï<É<ÔY^×YeÑYeÐ=eÕ7fñ >3r+   c                óø  € \        V . RO4       V P                  p\        V 4      p\        P                  P                  4       '       d   \        V4      w  r4pM^\        V P                  P                  4      ;_uu_ 4        \        V4      '       d   \        V4      w  r4pM\        V4      w  r4pRRR4       XP                  V4      XP                  V4      XP                  V4      3#   + '       g   i     LB; i)a»
  Decompose an essential matrix into its two candidate rotations and its translation direction by SVD.

``R1, R2, t = decompose_essential_matrix(E_mat)`` takes essential matrices ``(*, 3, 3)`` and returns the two
rotations ``(*, 3, 3)`` and the unit translation ``(*, 3, 1)`` of their SVD factorization (Hartley and
Zisserman, section 9.6.2): the relative motion of camera 2 to camera 1, :math:`X_2 = R X_1 + t` as in
:func:`relative_camera_motion`, is one of :math:`(R_1, \pm t)` and :math:`(R_2, \pm t)`, with the translation
known only up to scale. It does not tell which; :func:`motion_from_essential` stacks the four candidates and
:func:`motion_from_essential_choose_solution` picks the one that puts the points in front of both cameras. For
the same candidates in closed form, without an SVD, use :func:`decompose_essential_matrix_no_svd`.

Convention:
    - :math:`(R_1, -t)` and :math:`(R_2, t)` give :math:`[t]_\times R` with the sign
      of ``E_mat``, :math:`(R_1, t)` and :math:`(R_2, -t)` the opposite sign. Which of the four is the true
      pose is not fixed: it can change when ``E_mat`` is negated or rescaled. Select by cheirality with
      :func:`motion_from_essential_choose_solution`; :ref:`two-view geometry <two-view-conventions>`
      compares OpenCV's labels.
    - A caller's autocast region does not change the result, outside TorchScript: a float32 ``E_mat`` gives
      float32 rotations.
    - A float16 or bfloat16 ``E_mat`` is decomposed in float32, and the rotations and the translation are
      returned in its dtype.
    - First and second derivatives at an exact essential matrix are finite and correct, also where its two largest
      singular values are equal and the backward of :func:`torch.linalg.svd` divides by zero; a third derivative
      is not correct. They are those of the labeling the call returned. They need the smallest singular value to
      differ from the other two; without that, as for a matrix of rank 1, there is no derivative and the gradient
      is finite but not meaningful. A scripted call differentiates through the SVD instead.

Args:
   E_mat: The essential matrix in the form of ``(*, 3, 3)``.

Returns:
   A tuple containing the first and second possible rotation matrices and the translation vector,
   with shapes ``(*, 3, 3)``, ``(*, 3, 3)`` and ``(*, 3, 1)``: the same leading dims as the input.

See Also:
    - :func:`decompose_essential_matrix_no_svd`: the same candidates in closed form, exact essential
      matrices only, with the leading dims flattened.
    - :func:`motion_from_essential`: the four candidate poses stacked on one axis.
    - :func:`motion_from_essential_choose_solution`: the one candidate with the points in front of both
      cameras.

Nrp  )r   r:   r   r&   rz  r{  Ú_decompose_essential_matrixr   r;   r½   r   Ú*_decompose_essential_matrix_differentiabler¿   )ru  r:   ÚE_workÚR1ÚR2Úts   &     r)   Údecompose_essential_matrixr®  ‚  sº   € ôT �ušoÔ.ð �K‰K€EÜ˜uÓ%€Fô ‡y�y×Ñ×ÒÜ/°Ó7‰	ˆ‘ä §¡× 1Ñ 1×2Õ2ô
 " &×)Ò)ÜFÀvÓN‘	�™ä7¸Ó?‘	�˜÷ 3ð �5‰5�‹<˜Ÿ™˜u› q§t¡t¨E£{Ð2Ð2÷ 3×2ús   Â /C)Ã)C9	c                ó¬   € V ^8„  d   QhR\         P                  R\        \         P                  \         P                  \         P                  3,          /# rx  r    )r(   s   "r)   r*   r*   Ã  s9   € ÷ &ñ &¤u§|¡|ð &¼¼e¿l¹lÌEÏLÉLÔZ_×ZfÑZfÐ>fÕ8gñ &r+   c                 ó4   € \        V 4      w  rp\        W4      # r°   )r   Ú_candidates_from_svd)ru  rƒ  r5   r¨   s   &   r)   r¨  r¨  Ã  s   € ä˜eÓ$�G€Aˆ!Ü Ó%Ð%r+   c                ó¬   € V ^8„  d   QhR\         P                  R\        \         P                  \         P                  \         P                  3,          /# rx  r    )r(   s   "r)   r*   r*   É  s<   € ÷ ñ ´e·l±lð ÄuÌUÏ\É\Ô[`×[gÑ[gÔin×iuÑiuÐMuÕGvñ r+   c                ó&  € \        V P                  4       4      w  rp\        VP                  V P                  4      VP                  V P                  4      4      w  rEp\        WW#4      w  rxp	V	P                  4       P                  4       P                  RRR7      p
V	\        P                  ! V
^ 8„  V
\        P                  ! V
4      4      ,          p	RW™,          P                  RRR7      ,          p\        P                  ! V^ 8„  V\        P                  ! V4      4      P                  4       p\        V4      Wœ,          ,          pVR,          VR,          ,          p\        WNV,           4      \        W^V,
          4      \        WgR,          4      3# )	zhThe value of :func:`_decompose_essential_matrix`, with the derivatives of :func:`_pair_invariant_terms`.T©rg   r—  r  r–  rš  r˜  r™  rÿ   )r   rï   r±  r¿   r:   rŽ  rk   rô   r&   rn   ro   r)  Úsqrtr   r�  )ru  rƒ  r§   r¨   r«  r¬  ÚTr�  rž  r�  ÚscaleÚnorm_squaredr6  ÚrotatedrŸ  s   &              r)   r©  r©  É  s6  € ä& u§|¡|£~Ó6�G€Aˆ!Ü$ Q§T¡T¨%¯+©+Ó%6¸¿¹¸U¿[¹[Ó8IÓJ�I€BˆAÜ,¨U°qÓ<Ñ€Aˆ*ð ×ÑÓ×#Ñ#Ó%×*Ñ*¨xÀÐ*ÓF€EØœeŸkšk¨%°!©)°U¼E¿OºOÈEÓ<RÓSÕS€JØ˜*Õ1×6Ñ6°xÈÐ6ÓNÕN€LÜ�;Š;�| aÑ'¨´u·²À|Ó7TÓU×ZÑZÓ\€DÜ" 1Ó%¨Õ):Õ;€GØ	
ˆ<�˜1˜\�?Õ	*€Bä˜R g¥Ó.Ü˜R g¥Ó.Ü˜Q )¥Ó-ðð r+   c          	      óÌ   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  \         P                  \         P                  3,          /# ©r    rƒ  r¨   r$   r    )r(   s   "r)   r*   r*   Ý  sG   € ÷ ñ œEŸL™Lð ¬U¯\©\ð ¼eÄEÇLÁLÔRW×R^ÑR^Ô`e×`lÑ`lÐDlÕ>mñ r+   c                 óŠ  € VP                  RR4      p\        P                  ! V 4      pVRRR13;;,          R,          uu&   VP                  RR4      p\        P                  ! \        P                  ! V 4      R8  R,          W,          V 4      p \        P                  ! \        P                  ! V4      R8  R,          W$,          V4      p\        P
                  ! . R	O. R
O. RO.V P                  V P                  R7      pW,          V,          pWP                  RR4      ,          V,          pTpTp	V RRR13,          p
W‰V
3# )r    .Nr  rè   rj   rR   rP   rì   )r  rP   r  )rB   r  r  )r  r  rB   )rÂ   r&   ro   rn   rx   Útensorr;   r:   )rƒ  r¨   ÚVtÚmaskÚmasktÚWÚU_W_VtÚU_Wt_Vtr«  r¬  r¶  s   &&         r)   r±  r±  Ý  s  € Ø	
�‰�R˜Ó	€Bä�?Š?˜1Ó€DØˆˆb‰cˆ‡N�dÕƒNà�N‰N˜2˜rÓ"€Eô 	�Š”U—Y’Y˜q“\ CÑ'¨Õ9¸1½8ÀQÓG€AÜ	�Š”e—i’i “m cÑ)¨?Õ;¸R½ZÈÓ	L€Bô 	�ŠÒ&ªºÐIÐRS×RZÑRZÐbc×biÑbiÔj€Að �U�R�Z€FØ—+‘+˜b "Ó%Õ%¨Õ*€Gð 
€BØ	€BØ	ˆ#ˆr‰sˆ(�€AØ�Aˆ;Ðr+   c                ó¬   € V ^8„  d   QhR\         P                  R\        \         P                  \         P                  \         P                  3,          /# rx  r    )r(   s   "r)   r*   r*   ÷  s<   € ÷ $9ñ $9¬U¯\©\ð $9¼eÄEÇLÁLÔRW×R^ÑR^Ô`e×`lÑ`lÐDlÕ>mñ $9r+   c                ó  € \        V . RO4       \        P                  P                  4       '       d   \	        V 4      # \        V P                  P                  4      ;_uu_ 4        \	        V 4      uuRRR4       #   + '       g   i     R# ; i)a¿  Decompose an essential matrix into candidate rotations and translation in closed form.

``R1, R2, t = decompose_essential_matrix_no_svd(E_mat)`` takes essential matrices ``(*, 3, 3)`` and returns the
candidates of :func:`decompose_essential_matrix`, two rotations and a unit translation, from cross products of
the columns of ``E_mat`` and its cofactor matrix (Horn, Recovering baseline and orientation from essential
matrix, J. Opt. Soc. Am., 1990). Every leading dimension is flattened into one batch dimension ``B``, so a
``(3, 3)`` input returns a batch of one. The closed form holds only for an exact essential matrix: for one off
the essential manifold, such as an estimate, the returned matrices are in general not rotations, so pass it
through :func:`project_to_essential` first or use :func:`decompose_essential_matrix`, whose rotations are
orthogonal for any input.

Convention:
    - For an exact essential matrix, the same candidate set as :func:`decompose_essential_matrix`, with ``t``
      of unit norm.
    - A caller's autocast region does not change the result, outside TorchScript.

Args:
   E_mat: The essential matrix in the form of ``(*, 3, 3)``.

Returns:
   A tuple containing the first and second possible rotation matrices and the translation vector, with
   shapes ``(B, 3, 3)``, ``(B, 3, 3)`` and ``(B, 3, 1)``: all leading dims are flattened into one batch dim.

See Also:
    - :func:`decompose_essential_matrix`: the same candidates by SVD, with orthogonal rotations for any input
      and the leading dims kept.
    - :func:`motion_from_essential`: the four candidate poses stacked on one axis.
    - :func:`project_to_essential`: the nearest exact essential matrix, to decompose an estimate.

Nrp  )r   r&   rz  r{  Ú"_decompose_essential_matrix_no_svdr   r;   r½   r~  s   &r)   Ú!decompose_essential_matrix_no_svdrÇ  ÷  sX   € ô> �ušoÔ.ä‡y�y×Ñ×ÒÜ1°%Ó8Ð8Ü	˜EŸL™L×-Ñ-×	.Õ	.Ü1°%Ó8÷ 
/×	.×	.Ó	.ús   Á%A;Á;B	c                ó¬   € V ^8„  d   QhR\         P                  R\        \         P                  \         P                  \         P                  3,          /# rx  r    )r(   s   "r)   r*   r*     s<   € ÷ 2'ñ 2'¬e¯l©lð 2'¼uÄUÇ\Á\ÔSX×S_ÑS_Ôaf×amÑamÐEmÕ?nñ 2'r+   c           
      óF  € \        V P                  4      ^8w  d   V P                  R^^4      p V P                  ^ ,          pV R	,          V R
,          V R,          rCp\        P                  ! R\        P
                  ! W P                  RR4      ,          RRR7      P                  R4      ,          4      p\        P                  ! \        P                  P                  W#RR7      \        P                  P                  W4RR7      \        P                  P                  WBRR7      .^R7      p\        P                  ! VRRR7      p\        P                  ! VRR7      pVP                  R4      P                  RRVP                  R4      4      p	\        P                   ! V^V	R7      P#                  ^4      p
\        P                   ! V^VP                  R4      R7      P#                  ^4      pVR,          V
,          V,          p
V
\        P                  ! V
RRR7      ,          p\        P$                  ! V^^3V P&                  V P(                  R7      pV
R,          V
R,          V
R,          prþV) VuVR&   VR&   Wÿ) uVR&   VR&   V) VuVR&   VR&   V) pV
) p\+        V 4      WÐ,          ,
          Wª,          P                  R4      R,          ,          p\+        V 4      VV ,          ,
          VV,          P                  R4      R,          ,          pVVVP                  R4      3# )r!  r  rå   rf   Tr´  )rg   Úindexrè   rR   r†  r‡  r¤  rj   rë   r  r  r  r  r  r  r  r  r  rê   )Úlenr0   Úviewr&   rµ  rñ   rÂ   r)  rp   rí   r¥  r6  Úargmaxrq   r  ÚsizeÚgatherÚsqueezerE   r;   r:   r   )ru  r-   Úe1Úe2Úe3Úscale_factorÚcross_productsÚnormsÚlargestÚindex_expandedÚb1Úselected_normÚb1_ÚB1Út0Út1Út2ÚB2Úb2r«  r¬  s   &                    r)   rÆ  rÆ    s�  € Ü
ˆ5�;‰;Ó˜1ÔØ—
‘
˜2˜q !Ó$ˆà�‰�A�€Að �v•  f¥¨u°V­}ˆB€Bô —:’:˜c¤E§N¢N°5¿?¹?È2ÈrÓ;RÕ3RÐY[ÐbdÔ$e×$iÑ$iÐjlÓ$mÕmÓn€Lô —[’[Ü	�‰×	Ñ	˜B¨Ð	Ó	+¬U¯\©\×-?Ñ-?ÀÈBÐ-?Ó-OÔQV×Q]ÑQ]×QcÑQcÐdfÐprÐQcÓQsÐtØô€Nô �JŠJ�~¨2°tÔ<€Eô �lŠl˜5 bÔ)€Gð ×&Ñ& rÓ*×1Ñ1°"°b¸.×:MÑ:MÈbÓ:QÓR€Nô 
�Š�n¨!°>Ô	B×	JÑ	JÈ1Ó	M€BÜ—L’L ¨A°W×5FÑ5FÀrÓ5JÔK×SÑSÐTUÓV€MØ	�gÕ	 Õ	# mÕ	3€Bà
Œu�zŠz˜" "¨dÔ3Õ
3€Cô 
�Š�a˜˜A�Y u§|¡|¸5¿;¹;Ô	G€BØ�D•˜2˜d�8 R¨¥XˆBˆØ "˜s BÐ€B€w�K��G‘Ø! 3Ð€B€w�K��G‘Ø "˜s BÐ€B€w�K��G‘ð ˆ€BØ
ˆ€Bô ! Ó
'¨"­*Õ
4¸½¿¹ÀbÓ8IÈ-Õ8XÕ	X€BÜ
  Ó
'¨"¨u­*Õ
4¸¸b½¿¹ÀbÓ8IÈ-Õ8XÕ	X€Bà��C—M‘M "Ó%Ð&Ð&r+   c          
      ó¸   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\         P                  /# ©r    r«  rÞ  r¬  rß  r$   rL   )r(   s   "r)   r*   r*   S  sI   € ÷ %ñ %œ%Ÿ,™,ð %¬E¯L©Lð %¼e¿l¹lð %ÔPU×P\ÑP\ð %Ôaf×amÑamñ %r+   c                óÂ   € \        V . RO4       \        V. RO4       \        V. RO4       \        V. RO4       \        WW#4      w  rE\        VR,          4      pWd,          # )a†  Build the essential matrix of two cameras from their world-to-camera rotations and translations.

``E = essential_from_Rt(R1, t1, R2, t2)`` takes the world-to-camera extrinsics of the first and the second
camera, :math:`X_{cam} = R X + t`, as rotations ``(*, 3, 3)`` and translations ``(*, 3, 1)``, and returns
:math:`E = [t]_\times R`, ``(*, 3, 3)``, for their relative motion ``(R, t)`` from :func:`relative_camera_motion`,
so that :math:`x_2^\top E x_1 = 0` in normalized camera coordinates (Hartley and Zisserman, 9.6, p. 257,
eq. 9.12). It is not normalized: :math:`\|E\|_F = \sqrt{2} \|t\|`, unlike the unit-norm candidates of
:func:`find_essential`. For the fundamental matrix of two projection matrices, use
:func:`fundamental_from_projections`.

Args:
    R1: The first camera rotation matrix with shape ``(*, 3, 3)``.
    t1: The first camera translation vector with shape ``(*, 3, 1)``.
    R2: The second camera rotation matrix with shape ``(*, 3, 3)``.
    t2: The second camera translation vector with shape ``(*, 3, 1)``.

Returns:
    The Essential matrix with the shape ``(*, 3, 3)``.

See Also:
    - :func:`relative_camera_motion`: the relative motion ``(R, t)`` that this matrix encodes.
    - :func:`fundamental_from_projections`: the uncalibrated counterpart, from two projection matrices.
    - :func:`decompose_essential_matrix`: the reverse, the motion candidates of an essential matrix.

rp  ©rq  rr  Ú1r†  )r   Úrelative_camera_motionr   )r«  rÞ  r¬  rß  ÚRr­  ÚTxs   &&&&   r)   Úessential_from_Rtrê  S  sS   € ô4 �rš?Ô+Ü�rš?Ô+Ü�rš?Ô+Ü�rš?Ô+ô " "¨"Ó1�D€Aô 
˜a �iÓ	(€Bà�6€Mr+   c                óŽ   € V ^8„  d   QhR\         P                  R\        \         P                  \         P                  3,          /# rx  r    )r(   s   "r)   r*   r*   {  s0   € ÷ %ñ %¤§¡ð %´%¼¿¹ÄeÇlÁlÐ8RÕ2Sñ %r+   c                ó¬   € \        V . RO4       \        V 4      w  rp\        P                  ! WW".RR7      p\        P                  ! W3) W3) .RR7      pWE3# )a  List the four candidate relative poses of an essential matrix, stacked on one axis.

``Rs, ts = motion_from_essential(E_mat)`` takes essential matrices ``(*, 3, 3)`` and returns the four candidate
motions of camera 2 relative to camera 1 that the matrix allows, rotations ``(*, 4, 3, 3)`` and unit translations
``(*, 4, 3, 1)``, in the order :math:`(R_1, t), (R_1, -t), (R_2, t), (R_2, -t)` of the candidates of
:func:`decompose_essential_matrix`. Only one of them puts the scene in front of both cameras; to select it from
point correspondences, use :func:`motion_from_essential_choose_solution`.

Convention:
    - The candidates are stacked on dim ``-3``; which index is the true pose is not fixed.
    - A caller's autocast region does not change the result, and the derivatives at an exact essential matrix are
      finite and correct, as for :func:`decompose_essential_matrix`.
    - A float16 or bfloat16 ``E_mat`` is decomposed in float32, and the candidates are returned in its dtype.

Args:
    E_mat: The essential matrix in the form of ``(*, 3, 3)``.

Returns:
    The rotation and translation containing the four possible combination for the retrieved motion,
    with shapes ``(*, 4, 3, 3)`` and ``(*, 4, 3, 1)``.

See Also:
    - :func:`motion_from_essential_choose_solution`: the one candidate that passes the cheirality test.
    - :func:`decompose_essential_matrix`: the two rotations and the translation the candidates combine.
    - :func:`decompose_essential_matrix_no_svd`: the same rotations and translation without an SVD.

rf   rp  éýÿÿÿ)r   r®  r&   rp   )ru  r«  r¬  r­  ÚRsÚTss   &     r)   Úmotion_from_essentialrð  {  sT   € ô8 �ušoÔ.ô +¨5Ó1�I€BˆAô 
�Š�b˜bÐ%¨2Ô	.€BÜ	�Š�a˜˜Q �^¨Ô	,€Bàˆ6€Mr+   c                ó€  € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\        \         P                  ,          R\        \         P                  \         P                  \         P                  \         P                  3,          /# )r    ru  rm  rn  Úx1Úx2r¿  r$   )r&   r'   r   r   )r(   s   "r)   r*   r*   £  s’   € ÷ M3ñ M3Ü�<‰<ðM3ä�‰ðM3ô 	�‰ðM3ô 	�‰ð	M3ô
 	�‰ðM3ô ”5—<‘<Õ
 ðM3ô Œ5�<‰<œŸ™¤u§|¡|´U·\±\ÐAÕBñM3r+   c                ó  € \        V . RO4       \        V. RO4       \        V. RO4       \        V. RO4       \        V. RO4       \        \        V P                  RR	 4      \        VP                  RR	 4      u;8H  ;'       d    \        VP                  RR	 4      8H  Mu 4       Ve4   \        VRR.4       \        VP                  VP                  RR
 8H  4       \        V P                  4      ^8H  pV'       d;   V R,          p VR,          pVR,          pVR,          pVR,          pVe
   VR,          pVP	                  V P
                  4      VP	                  V P
                  4      r!V P
                  p\        V 4      \        V4      \        V4      r!p \        V4      \        V4      rC\        V P                  P                  4      ;_uu_ 4        \        V 4      w  r‰\        ^V 4      p
\        ^V 4      pV
R,          P                  R
^R
R
4      p
VR,          P                  R
^R
R
4      pVR,          P                  R
^R
R
4      p\        WV4      pTpT	pVR,          P                  R
^R
R
4      p\        W-V4      pVR,          P                  R
^R
R
4      pVR,          P                  R
^R
R
4      p\        WÏW44      p\!        W«V4      p\!        WÞV4      pVR8„  VR8„  ,          pVe   VVP#                  ^4      ,          p\$        P&                  ! VP)                  R
4      R
R7      w  pp\$        P*                  ! VP                  ^ ,          VP                  R7      pVVV3,          P	                  V4      pV	VV3,          P	                  V4      pVVV3,          P	                  V4      pRRR4       V'       d%   X^ ,          pX^ ,          pX^ ,          pX^ ,          pXXXX3#   + '       g   i     LB; i)a$  Pick the relative pose of an essential matrix that puts the points in front of both cameras.

``R, t, points3d, count = motion_from_essential_choose_solution(E_mat, K1, K2, x1, x2)`` takes essential matrices
``(B, 3, 3)`` with :math:`x_2^\top E x_1 = 0` in normalized camera coordinates, the pixel intrinsics
``(B, 3, 3)`` of the first and the second camera, and pixel correspondences ``(B, N, 2)`` of the first and the
second image. Of the four candidates of :func:`motion_from_essential` it keeps the one that puts the most points
at positive depth in both cameras. It returns that candidate's rotation ``(B, 3, 3)`` and unit translation
``(B, 3, 1)`` of camera 2 relative to camera 1, :math:`X_2 = R X_1 + t` as in :func:`relative_camera_motion`. It
also returns the points triangulated by :func:`triangulate_points` in the frame of camera 1 at the scale
:math:`\|t\| = 1`, ``(B, N, 3)``, and the number of points that passed, ``(B,)``, the count that
``cv2.recoverPose`` also returns. For all four candidates, use :func:`motion_from_essential`.

Convention:
    - ``K1`` and ``K2`` are applied inside, so ``x1`` and ``x2`` are pixel coordinates.
    - The count is the number of points at positive depth in both cameras for the returned
      candidate. A count of ``0`` means no point passed, and the returned pose is then candidate 0 of
      :func:`motion_from_essential`, not a recovered motion.
    - A caller's autocast region does not change the result. ``K1`` and ``K2`` are cast to the dtype of
      ``E_mat``. A float16 or bfloat16 ``E_mat`` is decomposed, triangulated and tested in float32, and the
      rotation, translation and points are returned in its dtype.
    - The first and second derivatives with respect to ``E_mat`` are finite and correct as for
      :func:`motion_from_essential`, while the selected candidate stays the same and the points triangulate to
      finite positions, which a point at infinity does not; a third derivative is not correct.

Args:
    E_mat: The essential matrix in the form of ``(B, 3, 3)``, or ``(3, 3)`` with every other input
        unbatched too.
    K1: The camera matrix from first camera with shape ``(B, 3, 3)``.
    K2: The camera matrix from second camera with shape ``(B, 3, 3)``.
    x1: The set of points in the first image with shape ``(B, N, 2)``.
    x2: The set of points in the second image with shape ``(B, N, 2)``.
    mask: A boolean mask which can be used to exclude some points from choosing
      the best solution. This is useful for using this function with sets of points of
      different cardinality (for instance after filtering with RANSAC) while keeping batch
      semantics. Mask is of shape ``(B, N)``.

Returns:
    The rotation, translation, 3d triangulated points, and the number of points
    with positive depth in both cameras for the selected candidate.
    The tuple is as following ``(B, 3, 3)``, ``(B, 3, 1)``, ``(B, N, 3)`` and ``(B,)``,
    without ``B`` for unbatched inputs.

See Also:
    - :func:`motion_from_essential`: all four candidate poses, without a cheirality test.
    - :func:`decompose_essential_matrix`: the rotations and translation the candidates combine.
    - :func:`triangulate_points`: the triangulation it tests the candidates with.
    - :func:`find_essential`: the essential matrices to pass, from normalized camera coordinates.

rq  r.   Nr  rf   r>   rp  )rq  r.   r/   rj   rR   rë   )r   r   rË  r0   r¿   r:   r   r   r;   r½   rð  r	   r
   r  r   r   r   rq   r&   r3  r)  rD   )ru  rm  rn  rò  ró  r¿  Ú	unbatchedr:   rî  Útsr«  rÞ  ÚP1r¬  rß  ÚP2rŸ   Úd1Úd2Ú
depth_maskÚvalid_countÚmask_indicesÚ	batch_idxÚR_outÚt_outÚpoints3d_outs   &&&&&&                    r)   Ú%motion_from_essential_choose_solutionr  £  s†  € ôr �ušoÔ.Ü�rš?Ô+Ü�rš?Ô+Ü�rš?Ô+Ü�rš?Ô+Ü”�U—[‘[  "Ð%Ó&¬#¨b¯h©h°s¸¨mÓ*<×RÔRÄÀBÇHÁHÈSÈbÀMÓ@RÔRÔSàÒÜ˜4 # s Ô,Ü�T—Z‘Z 2§8¡8¨C¨R =Ñ0Ô1ä�E—K‘KÓ  AÑ%€Içð �d•ˆØ��XˆØ��XˆØ��XˆØ��XˆØÒØ˜•:ˆDð �U‰U�5—;‘;Ó §¡ u§{¡{Ó!3ˆð �K‰K€EÜ% eÓ,Ô.?ÀÓ.CÔEVÐWYÓEZˆr€EÜ˜rÓ"Ô$5°bÓ$9ˆô 
˜EŸL™L×-Ñ-×	.Õ	.ä& uÓ-‰ˆô �a˜ÓˆÜ�a˜Óˆð ��[×Ñ  A r¨2Ó.ˆØ��[×Ñ  A r¨2Ó.ˆØ��[×Ñ  A r¨2Ó.ˆÜ  ¨Ó,ˆð ˆØˆØ��[×Ñ  A r¨2Ó.ˆÜ  ¨Ó,ˆð ��[×Ñ  A r¨2Ó.ˆØ��[×Ñ  A r¨2Ó.ˆÜ˜r rÓ.ˆô ˜b aÓ(ˆÜ˜b aÓ(ˆð ˜3‘h 2¨¡8Õ,ˆ
ØÒØ˜$Ÿ.™.¨Ó+Õ+ˆJä$)§I¢I¨j¯n©n¸RÓ.@ÀbÔ$IÑ!ˆ�\ô —L’L ×!3Ñ!3°AÕ!6¸|×?RÑ?RÔSˆ	Ø�9˜lÐ*Õ+×.Ñ.¨uÓ5ˆØ�9˜lÐ*Õ+×.Ñ.¨uÓ5ˆØ˜ LÐ0Õ1×4Ñ4°UÓ;ˆ÷Q 
/÷T Ø�a•ˆØ�a•ˆØ# A•ˆØ! !•nˆà�%˜ {Ð2Ð2÷a 
/×	.ús   ÇGO.Ï.O>	c                óî   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\        \         P                  \         P                  3,          /# rã  r    )r(   s   "r)   r*   r*   3  sV   € ÷ 0ñ 0Ü�‰ð0ÜŸ,™,ð0Ü,1¯L©Lð0Ü>C¿l¹lð0ä
Œ5�<‰<œŸ™Ð%Õ&ñ0r+   c                óÆ   € \        V . RO4       \        V. RO4       \        V. RO4       \        V. RO4       W P                  RR4      ,          pW4V,          ,
          pWE3# )a  Compute the motion from camera 1 to camera 2 from their world-to-camera rotations and translations.

``R, t = relative_camera_motion(R1, t1, R2, t2)`` takes the world-to-camera extrinsics of two cameras,
rotations ``(*, 3, 3)`` and translations ``(*, 3, 1)``, and returns the rotation ``(*, 3, 3)`` and translation
``(*, 3, 1)`` that take camera-1 coordinates to camera-2 coordinates, :math:`X_2 = R X_1 + t`: the pose of the
second camera when the first one is at the origin. This is the motion that :func:`essential_from_Rt` encodes and
:func:`motion_from_essential_choose_solution` recovers. For the same motion from ``4 x 4`` extrinsics, compute
``E2 @ inverse_transformation(E1)`` with :func:`~kornia.geometry.linalg.inverse_transformation`;
:func:`~kornia.geometry.linalg.relative_transformation` composes in the other order.

Convention:
    - Inputs are world-to-camera extrinsics, :math:`x_{cam} = R X + t` (see :doc:`camera and world
      conventions </get-started/camera-conventions>`); the result is :math:`R = R_2 R_1^\top` and
      :math:`t = t_2 - R_2 R_1^\top t_1`, the motion from camera 1 to camera 2. As 4x4 matrices this is
      :math:`E_2 E_1^{-1}`, whereas :func:`~kornia.geometry.linalg.relative_transformation` of :math:`E_1` and
      :math:`E_2` returns :math:`E_1^{-1} E_2`.

Args:
    R1: The first camera rotation matrix with shape ``(*, 3, 3)``.
    t1: The first camera translation vector with shape ``(*, 3, 1)``.
    R2: The second camera rotation matrix with shape ``(*, 3, 3)``.
    t2: The second camera translation vector with shape ``(*, 3, 1)``.

Returns:
    A tuple with the relative rotation matrix and
    translation vector with the shapes ``(*, 3, 3)`` and ``(*, 3, 1)``.

See Also:
    - :func:`essential_from_Rt`: the essential matrix of this motion.
    - :func:`~kornia.geometry.linalg.relative_transformation`: the relative pose of two 4x4 matrices,
      :math:`E_1^{-1} E_2` rather than :math:`E_2 E_1^{-1}`.
    - :func:`motion_from_essential_choose_solution`: the same motion, up to scale, from an essential matrix.

rp  rå  rj   rR   )r   rÂ   )r«  rÞ  r¬  rß  rè  r­  s   &&&&  r)   rç  rç  3  sV   € ôJ �rš?Ô+Ü�rš?Ô+Ü�rš?Ô+Ü�rš?Ô+ð 	�\‰\˜"˜bÓ!Õ!€Að 	��V�€Aàˆ4€Kr+   c                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  ,          R\         P                  /# r   r%   )r(   s   "r)   r*   r*   f  sG   € ÷ /Cñ /CÜ�\‰\ð/CÜ$)§L¡Lð/CÜ;CÄEÇLÁLÕ;Qð/Cä
‡\�\ñ/Cr+   c                óL   € \        WV4      P                  V P                  4      # )aË  Estimate up to ten essential matrices from calibrated points with Nister's five-point solver.

``Es = find_essential(points1, points2)`` takes correspondences ``(B, N, 2)``, ``N >= 5``, of the first and the
second image in normalized camera coordinates :math:`K^{-1} [u, v, 1]^\top`, not pixels (see
:func:`~kornia.geometry.conversions.normalize_points_with_intrinsics`), and returns ``(B, 10, 3, 3)``: one slot
per root of Nister's degree-ten polynomial, a candidate of unit Frobenius norm for each real root and ``NaN`` for
each complex one. Five points satisfy :math:`x_2^\top E x_1 = 0` exactly for every candidate; with more, the null
space of the epipolar constraints is fitted by least squares first, so the candidates satisfy it only
approximately. Pick a candidate by its :func:`sampson_epipolar_distance` on other
correspondences, ignoring the ``NaN`` slots. For one essential matrix from correspondences with outliers, use
:class:`~kornia.geometry.ransac.RANSAC` with ``model_type="essential"``; for pixel correspondences of unknown
cameras, :func:`find_fundamental`.

Convention:
    - :ref:`Two-view geometry <two-view-conventions>` maps the argument order and the candidate layout onto
      OpenCV.
    - All ten slots are always returned, so a sample with no real solution returns ten ``NaN`` slots.
    - The solve runs in float64 whatever the input dtype, and the degree-ten polynomial's roots come from LAPACK
      on the host for every device. MPS has no float64, so MPS inputs are solved on the host and the candidates
      copied back, which on an Apple M1 was also faster than a float32 solve on the device. A sample whose five
      design rows are rank deficient, such as one with a repeated correspondence, has no unique solution: ten
      ``NaN`` slots and a zero gradient.

Args:
     points1: A set of points in the first image with a tensor shape ``(B, N, 2)``, ``N >= 5``.
     points2: A set of points in the second image with a tensor shape ``(B, N, 2)``, ``N >= 5``.
     weights: Accepted with a shape of ``(B, N)`` and ignored for compatibility, including for :math:`N > 5`.
       Positive weights leave the null space of an exact five-point sample unchanged; for larger sets they can
       affect the least-squares fit.

Returns:
     the computed essential matrices with shape ``(B, 10, 3, 3)``.
     To choose the best one out of 10, try to check the one with the lowest Sampson distance, ignoring the
     ``NaN`` slots.

See Also:
    - :func:`find_fundamental`: the model of uncalibrated cameras, from pixel correspondences.
    - :func:`~kornia.geometry.homography.find_homography_dlt`: a homography instead, for a planar scene or a
      camera that only rotates.
    - :class:`~kornia.geometry.ransac.RANSAC`: one essential matrix, robust to wrong correspondences.
    - :func:`motion_from_essential_choose_solution`: the relative pose of a chosen candidate.
    - :func:`essential_from_fundamental`: an essential matrix from a fundamental matrix and both intrinsics.

)r6   r¿   r:   )r!   r"   r#   s   &&&r)   Úfind_essentialr  f  s!   € ô^ �g¨Ó0×3Ñ3°G·M±MÓBÐBr+   c                ó(  € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        \         P                  ,          R\        R\        \
        \         P                  3,          R\        R\         P                  /# )	r    rœ  rò  ró  r¿  ÚlossÚscale2Úitersr$   )r&   r'   r   Ústrr   rd   r<   )r(   s   "r)   r*   r*   ˜  s‰   € ÷ Dñ DÜ‡|�|ðDä�‰ðDô 	�‰ðDô ”5—<‘<Õ
 ð	Dô
 ðDô ”%œŸ™Ð%Õ&ðDô ðDô ‡\�\ñDr+   c           	     ó~  aaaaaa a!a"€ V P                   ^ ,          oV P                  V P                  r‡S^ 8„  ;'       d2    VP                  R8H  ;'       d    \        P
                  ! 4       '       * p	V	'       dM   S^8X  dF   SeB   SP                  \        P                  8X  d#   VS^ ,          ,          VS^ ,          ,          Ruro\        Wx4      o\        P                  ! ^WxR7      o!\        P                  ! ^WxR7      p
\        W4      P                  o \        P                  ! \        W4      \        W"4      .^4      P                  o"\        P                  P                  V 4      w  r¼pVP                  p\        P                  ! VR,          VR,          \        P                  P                  V4      P!                  4       R,          ,          .R4      p\        P                  ! VR,          VR,          \        P                  P                  V4      P!                  4       R,          ,          .R4      p\        P"                  ! S^^3RWxR7      pR R lpR VVV VVV"V3R llpR	 VV!3R
 llpV! W¾4      p V! W4      w  pp\%        V4       EF§  p\        P                  P'                  VR,          Wú,          ,           VR,          4      ^ ,          R,          ) pV! RVR,          ,          4      V,          pV! RVR,          VR,          ,          R,          ,          4      V,          pV! VV4      pV	'       dE   V^,           V8X  d7   \)        VS S"SSS4      pVV8  p\        P*                  ! VR,          VV 4      u # V! VV4      w  ppVV8  R,          p\        P*                  ! VVV4      \        P*                  ! VVV4      rë\        P*                  ! VVV 4      \        P*                  ! VVV4      pp \        P*                  ! VR,          VV4      pV\        P*                  ! VRR4      ,          pEKª  	  V # )aU  Levenberg-Marquardt on the Sampson distance, batched over essential matrices ``(K, 3, 3)``.

``E = U diag(1, 1, 0) V^T / sqrt(2)`` with ``U`` and ``V`` in SO(3): the factorization of
:func:`~kornia.geometry.epipolar.fundamental._refine_fundamental_lm` with its singular-value ratio fixed to one.
Five parameters, as many as the rotation and translation direction of PoseLib's ``refine_relpose``: Cayley
rotations of ``U`` about the three axes and of ``V`` about ``V e_1`` and ``V e_2``. Rotating both about their third
axes by the same angle leaves ``E`` unchanged, so that direction is left out and the normal equations stay regular.
Residuals, losses, masks and step acceptance as for the fundamental matrix; ``x1`` and ``x2`` are homogeneous
``(N, 3)`` calibrated points. Returns matrices of unit Frobenius norm. For RANSAC, under ``torch.no_grad``.
rá   NrA   gü©ñÒMbP?c                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# r»  rL   )r(   s   "r)   r*   Ú*_refine_essential_lm.<locals>.__annotate__¼  s-   € ÷ 7ñ 7”5—<‘<ð 7¤E§L¡Lð 7´U·\±\ñ 7r+   c                 óR   € V R,          VR,          P                   ,          R,          # ).©.r%  gÍ;fž æ?)rð   )rƒ  r¨   s   &&r)   ÚcomposeÚ%_refine_essential_lm.<locals>.compose¼  s   € Ø�'•
˜Q˜w�ZŸ]™]Õ*¨hÕ6Ð6r+   c                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  \         P                  3,          /# )r    rœ  r¨   r$   r    )r(   s   "r)   r*   r  ¿  sC   € ÷ _ñ _œEŸL™Lð _¬U¯\©\ð _¼eÄEÇLÁLÔRW×R^ÑR^ÐD^Õ>_ñ _r+   c           	      óP  <€ VR,          P                   P                  S^,          ^4      SP                  ^^	4      ,          P                  S^^^4      p\        P                  ! SV R,          ,          V R,          V,          P	                  4       .^4      p\        WSS	SSS
4      # ).r  rë   )rð   r(  r&   rÀ   Únegr   )rœ  r¨   ÚaxesÚtangentÚHrÌ   Ú	algebraicr	  r¿  Ú	quadraticr
  s   &&  €€€€€€€r)   Únormal_equationsÚ._refine_essential_lm.<locals>.normal_equations¿  s‰   ø€ à�'•
—‘×%Ñ% a¨!¥e¨QÓ/°!·)±)¸A¸q³/ÕA×JÑJÈ1ÈaÐQRÐTUÓVˆÜ—)’)˜Q  7¥�^¨a°­j¸4Õ.?×-DÑ-DÓ-FÐGÈÓKˆÜ(¨°YÀ	È4ÐQUÐW]Ó^Ð^r+   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r    r   r$   rL   )r(   s   "r)   r*   r  Å  s"   € ÷ 4ñ 4”U—\‘\ð 4¤e§l¡lñ 4r+   c                 óø   <€ V SP                  ^^	4      ,          P                  R^^4      pRRV P                  4       P                  ^4      ,           ,          R,          pSW!W,          ,           ,          ,           # )r!  g       @rB   rR   rê   )r(  r4  r)  )r   ÚskewÚfactorr  Úeye3s   &  €€r)   ÚcayleyÚ$_refine_essential_lm.<locals>.cayleyÅ  s`   ø€ à�q—y‘y  A“Õ&×/Ñ/°°A°qÓ9ˆØ˜˜tŸ{™{›}×0Ñ0°Ó3Õ3Õ4°mÕDˆØ�f t¥{Õ 2Õ3Õ3Ð3r+   r  gš™™™™™¹?g      $@r  ).:r    NNrê   rR   ).:Nr  N).:r  NNr†  )r¤   r#  )r¤   :r!  NNN)r¤   rN   rN   )r0   r:   r;   r½   r&   Úis_grad_enabledÚboolr   rõ   r   r¶  rÀ   rí   Úsvdrð   rx   r[   ÚfullÚrangeÚsolve_exr   rn   )#rœ  rò  ró  r¿  r	  r
  r  r:   r;   rá   Úeye5rƒ  r5   ÚVhr¨   Údampingr  r  r#  rZ  ÚcostÚ	iterationÚdeltaÚU_newÚV_newÚE_newÚcost_newÚacceptedÚ
system_newÚacceptr  rÌ   r  r"  r  s#   &&&fff&                       @@@@@r)   Ú_refine_essential_lmr8  ˜  sB  ÿ€ ð& 	
�‰��
€AØ—G‘G˜QŸX™Xˆ6Ø
ˆa‰%×
HÐ
H�F—K‘K 5Ñ(×
HÐ
H´×1FÒ1FÓ1HÔ-H€Cß
ˆq�AŒv˜$Ò*¨t¯z©z¼U¿Z¹ZÔ/GØ˜$˜q�'•{ B t¨A¥w¥K°ˆˆ�Ü�5Ó!€AÜ�9Š9�Q˜eÔ3€DÜ�9Š9�Q˜eÔ3€DÜ% bÓ-×/Ñ/€IÜ—	’	Ô0°Ó8Ô:OÐPRÓ:WÐXÐZ[Ó\×^Ñ^€IÜ�|‰|×Ñ Ó"�H€Aˆ"Ø
�‰€Aä�	Š	�1�W•:˜q �z¬E¯L©L×,<Ñ,<¸QÓ,?×,DÑ,DÓ,FÀ}Õ,UÕUÐVÐXZÓ[€AÜ�	Š	�1�W•:˜q �z¬E¯L©L×,<Ñ,<¸QÓ,?×,DÑ,DÓ,FÀ}Õ,UÕUÐVÐXZÓ[€AÜ�jŠj˜!˜Q ˜ D°ÔE€Gõ7÷_ö _÷4ñ 4ñ 	�‹€AÙ# AÓ)�L€FˆDÜ˜5—\ˆ	Ü—‘×&Ñ& v¨g¥¸½Õ'GÈÐPWÍÓYÐZ[Õ\Ð]cÕdÐdˆÙ�s˜U 5�\Õ)Ó*¨QÕ.ˆÙ�s˜a �j¨5°Õ+=Õ=¸vÕFÕFÓGÈ!ÕKˆÙ˜˜uÓ%ˆß�9˜q•= EÔ)Ü$ U¨I°yÀ$ÈÈfÓUˆHØ $‘ˆHÜ—;’;˜x¨Õ6¸¸qÓAÒAÙ/°°uÓ=Ñˆ
�HØ˜T‘/ =Õ1ˆÜ�{Š{˜6 5¨!Ó,¬e¯kªk¸&À%ÈÓ.Kˆ1Ü—K’K ¨¨qÓ1´5·;²;¸vÀzÐSYÓ3Zˆ6ˆÜ�{Š{˜6 '�?¨H°dÓ;ˆØœEŸKšK¨°°TÓ:Õ:‹ñ "ð €Hr+   )	r®  rÇ  rê  rv  r  rð  r  r  rç  r°   )r  )r!  )	rN   r!  r  rO   rQ   r  r    r  rS   )OrÕ   Útypingr   r   r   r   r&   Úkornia.core.checkr   r   r   Úkornia.core.opsr	   r
   Úkornia.core.utilsr   r   r   r   r   r   Ú#kornia.geometry.solvers.homogeneousr   Ú)kornia.geometry.solvers.polynomial_solverr   r   Úfundamentalr   r   r   r   r   Únumericr   r   r�  r   r   Útriangulationr   Ú__all__r6   rI   ra   r›   ÚautogradÚFunctionr�   rÞ   r2   r1   rÌ  r&  r'  r  râ   re  ri  rj  rv  r  r|  r‚  r}  r�  rŽ  r›  r®  r¨  r©  r±  rÇ  rÆ  rê  rð  r  rç  r  r8  rÐ   r+   r)   Ú<module>rE     s@  ðñ$ ]ç .Ó .ã ç WÑ Wß .÷÷ õ Hß Dç rÕ rß Aß =Ý -ò
€÷õ:õl÷2GôT1<�e—n‘n×-Ñ-ô 1<õhõMõ$mðR —;’;˜q ! RÓ(Ð Ø—+’+˜b ! RÓ(€õBõ{#÷|&ò
 /Ð õ-õ$^õN4,õn)õ
.õ3õ>õ(õVsõ
>3õB&õõ(õ4$9õN2'õj%õP%÷PM3õ`0÷f/C÷dDr+   