






'''simple docstring'''





from typing import Any

import numpy as np



def        __snake_case						(__UpperCAmelCase    ):





	"""simple docstring"""
	return np.array_equal(_lowerCamelCase       ,	matrix.conjugate().T    )



def        __snake_case						(__UpperCAmelCase       ,	__UpperCAmelCase    ):





	"""simple docstring"""
	lowerCamelCase_					:  List[str]						=    v.conjugate().T
	lowerCamelCase_					:  Dict						=    v_star.dot(_lowerCamelCase    )
	assert isinstance(_lowerCamelCase       ,	np.ndarray    )
	return (v_star_dot.dot(_lowerCamelCase    )) / (v_star.dot(_lowerCamelCase    ))



def        __snake_case						():





	"""simple docstring"""
	lowerCamelCase_					:  List[str]						=    np.array([[2, 2 + 1j, 4], [2 - 1j, 3, 1j], [4, -1j, 1]]    )
	lowerCamelCase_					:  Dict						=    np.array([[1], [2], [3]]    )
	assert is_hermitian(_lowerCamelCase    ), F"""{a} is not hermitian."""
	print(rayleigh_quotient(_lowerCamelCase       ,	_lowerCamelCase    )    )

	lowerCamelCase_					:  Dict						=    np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]    )
	assert is_hermitian(_lowerCamelCase    ), F"""{a} is not hermitian."""
	assert rayleigh_quotient(_lowerCamelCase       ,	_lowerCamelCase    ) == float(3    )


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			tests()













'''simple docstring'''

# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__lowerCAmelCase				:      Union[str, Any]						      ={"configuration_mra": ["MRA_PRETRAINED_CONFIG_ARCHIVE_MAP", "MraConfig"]}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __lowerCAmelCase				:      int						      =[
      "MRA_PRETRAINED_MODEL_ARCHIVE_LIST",
      "MraForMaskedLM",
      "MraForMultipleChoice",
      "MraForQuestionAnswering",
      "MraForSequenceClassification",
      "MraForTokenClassification",
      "MraLayer",
      "MraModel",
      "MraPreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_mra import MRA_PRETRAINED_CONFIG_ARCHIVE_MAP, MraConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_mra import (
        MRA_PRETRAINED_MODEL_ARCHIVE_LIST,
        MraForMaskedLM,
        MraForMultipleChoice,
        MraForQuestionAnswering,
        MraForSequenceClassification,
        MraForTokenClassification,
        MraLayer,
        MraModel,
        MraPreTrainedModel,
    )
else:
  import sys

  __lowerCAmelCase				:      Dict						      =_LazyModule(__name__, globals()["__file__"], _import_structure)



