"""simple docstring"""


import importlib.metadata
from typing import Union

from packaging.version import Version, parse

from .constants import STR_OPERATION_TO_FUNC


lowerCAmelCase_:					List[Any]     =					parse(importlib.metadata.version("torch"))







def 					__a   (		A    ,				A    ,				A      ):






					'''simple docstring'''



					if operation not in STR_OPERATION_TO_FUNC.keys():
										raise ValueError(f'''`operation` must be one of {list(STR_OPERATION_TO_FUNC.keys()      )}, received {operation}'''      )
					lowercase__				 =							STR_OPERATION_TO_FUNC[operation]
					if isinstance(A    ,				A      ):
										lowercase__				 =							parse(importlib.metadata.version(A      )      )
					return operation(A    ,				parse(A      )      )







def 					__a   (		A    ,				A      ):






					'''simple docstring'''



					return compare_versions(A    ,				A    ,				A      )





"""simple docstring"""


from typing import Any

import numpy as np







def 					__a   (		A      ):






     '''simple docstring'''



     return np.array_equal(A    ,				matrix.conjugate().T      )







def 					__a   (		A    ,				A      ):






     '''simple docstring'''



     lowercase__				 =							v.conjugate().T
     lowercase__				 =							v_star.dot(A      )
     assert isinstance(A    ,				np.ndarray      )
     return (v_star_dot.dot(A      )) / (v_star.dot(A      ))







def 					__a   (		):






     '''simple docstring'''



     lowercase__				 =							np.array([[2, 2 + 1j, 4], [2 - 1j, 3, 1j], [4, -1j, 1]]      )
     lowercase__				 =							np.array([[1], [2], [3]]      )
     assert is_hermitian(A      ), f'''{a} is not hermitian.'''
     print(rayleigh_quotient(A    ,				A      )      )

     lowercase__				 =							np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]      )
     assert is_hermitian(A      ), f'''{a} is not hermitian.'''
     assert rayleigh_quotient(A    ,				A      ) == float(3      )


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 tests()




