
    3j                         S r SSKrSSKJr  S\R                  S\R                  4S jrS\R                  S\R                  4S jrg)	z4Module containing numerical functionalities for SfM.    N)_torch_inverse_castxreturnc                    U R                   S   S:X  d  [        U R                   5      eU S   nU S   nU S   n[        R                  " U5      n[        R                  " XC* X#XA* U* X/	SS9nU R                   SS S-   nUR
                  " U6 $ )	zReturn the cross_product_matrix symmetric matrix of a vector.

Args:
    x: The input vector to construct the matrix in the shape :math:`(*, 3)`.

Returns:
    The constructed cross_product_matrix symmetric matrix with shape :math:`(*, 3, 3)`.

   ).r   ).   ).   )dimN)r   r   )shapeAssertionErrortorch
zeros_likestackview)r   x0x1x2zeroscross_product_matrix_flatshape_s          Z/home/wildlama/miniconda3/lib/python3.13/site-packages/kornia/geometry/epipolar/numeric.pycross_product_matrixr      s     772;!QWW%%	
6B	
6B	
6B R E %UCbSRT,\bd eWWSb\F"F$))622    matrixc                    [         R                  " U 5      nUS:g  nUR                  5       S:w  aF  [        X   5      R	                  SS5      X   SS2SS4   -  n[         R
                  " U 5      nX4U'   U$ [        S5      e)znCofactor matrix, refer to the numpy doc.

Args:
    matrix: The input matrix in the shape :math:`(*, 3, 3)`.

r   r   Nzall singular matrices)r   detsumr   	transposer   	Exception)r   r   singular_maskcofactorreturned_cofactors        r   matrix_cofactor_tensorr%   1   s     ))F
C1HMa&v'<=GGBORURdefhlnrerRss!,,V4+3-(  /00r   )__doc__r   kornia.core.utilsr   Tensorr   r%    r   r   <module>r*      sF   $ ;  13ELL 3U\\ 3015<< 1ELL 1r   