Ë
    þÍ:j¨
  ã                   ór   — d dl mZ d dlZd dlmZmZ d dlmZ d dlmZ 	 ddedede	d	eee
eeef   f   fd
„Zy)é    )ÚUnionN)ÚTensorÚlinalg)Ú_check_same_shape)Úrank_zero_warnÚpoint_cloud1Úpoint_cloud2Ú
return_allÚreturnc                 óè  — t        | |«       | j                  dk7  rt        d| j                  › d�«      ‚| | j                  dd¬«      z
  } ||j                  dd¬«      z
  }| t	        j
                  | ddgd¬«      z  } |t	        j
                  |ddgd¬«      z  }	 t	        j                  t        j                  |j                  dd«      | «      j                  dd«      d¬	«      \  }}}t        j                  ||«      }|j#                  dd¬«      }|dd…df   t        j                  ||j                  dd«      «      z  }| |z
  j%                  «       j#                  ddg¬«      }	|r|	||fS |	S # t        $ rv}t        d
|› d�t        «       t        j                  d«      t        j                  | j                  d   «      t        j                   | j                  d   «      fcY d}~S d}~ww xY w)aZ  Runs procrustrus analysis on a batch of data points.

    Works similar ``scipy.spatial.procrustes`` but for batches of data points.

    Args:
        point_cloud1: The first set of data points
        point_cloud2: The second set of data points
        return_all: If True, returns the scale and rotation matrices along with the disparity

    é   z®Expected both datasets to be 3D tensors of shape (N, M, D), where N is the batch size, M is the number of data points and D is the dimensionality of the data points, but got z dimensions.é   T)ÚdimÚkeepdimé   F)Úfull_matricesz>SVD calculation in procrustes_disparity failed with exception z4. Returning 0 disparity and identity scale/rotation.g        r   N)r   )r   )r   ÚndimÚ
ValueErrorÚmeanr   ÚnormÚsvdÚtorchÚmatmulÚ	transposeÚ	Exceptionr   ÚUserWarningÚtensorÚonesÚshapeÚeyeÚsumÚsquare)
r   r	   r
   ÚuÚwÚvÚexÚrotationÚscaleÚ	disparitys
             ú}/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/torchmetrics/functional/shape/procrustes.pyÚprocrustes_disparityr+      só  € ô �l LÔ1Ø×Ñ˜AÒÜðTØT`×TeÑTeÐSfÐfrðtó
ð 	
ð
   ,×"3Ñ"3¸À4Ð"3Ó"HÑH€LØ ,×"3Ñ"3¸À4Ð"3Ó"HÑH€LØ”F—K‘K °1°a°&À$ÔGÑG€LØ”F—K‘K °1°a°&À$ÔGÑG€Lð
fÜ—*‘*Ü�L‰L˜×/Ñ/°°1Ó5°|ÓD×NÑNÈqÐRSÓTÐdiô
‰ˆˆ1ˆaô �|‰|˜A˜qÓ!€HØ�E‰E�!˜TˆEÓ"€EØš˜D˜‘>¤E§L¡L°¸x×?QÑ?QÐRSÐUVÓ?WÓ$XÑX€LØ Ñ,×4Ñ4Ó6×:Ñ:ÀÀ1¸vÐ:ÓF€IÙØ˜% Ð)Ð)ØÐøô ò fÜØLÈRÈDð Qð äô	
ô
 �|‰|˜CÓ ¤%§*¡*¨\×-?Ñ-?ÀÑ-BÓ"CÄUÇYÁYÈ|×OaÑOaÐbcÑOdÓEeÐeÕeûðfús    ÂAE2 Å2	G1Å;A+G,Ç&G1Ç,G1)F)Útypingr   r   r   r   Útorchmetrics.utilities.checksr   Útorchmetrics.utilities.printsr   ÚboolÚtupler+   © ó    r*   ú<module>r3      sX   ðõ ã ß  å ;Ý 8ð DIñ+Øð+Ø(.ð+Ø<@ð+à
ˆ6�5˜ ¨Ð/Ñ0Ð0Ñ1ô+r2   