
from typing import Any

import numpy as np




def        __UpperCamelCase					(    lowerCAmelCase__							:    np.ndarray  ):
 return np.array_equal(lowerCAmelCase__  ,       matrix.conjugate().T  )




def        __UpperCamelCase					(    lowerCAmelCase__							:    np.ndarray  ,       lowerCAmelCase__							:    np.ndarray  ):
 __a			:  Optional[int]		    =  v.conjugate().T
 __a			:  List[Any]		    =  v_star.dot(lowerCAmelCase__  )
 assert isinstance(lowerCAmelCase__  ,       np.ndarray  )
 return (v_star_dot.dot(lowerCAmelCase__  )) / (v_star.dot(lowerCAmelCase__  ))




def        __UpperCamelCase					(    ):
 __a			:  List[str]		    =  np.array([[2, 2 + 1j, 4], [2 - 1j, 3, 1j], [4, -1j, 1]]  )
 __a			:  Any		    =  np.array([[1], [2], [3]]  )
 assert is_hermitian(lowerCAmelCase__  ), f"{a} is not hermitian."
 print(rayleigh_quotient(lowerCAmelCase__  ,       lowerCAmelCase__  )  )

 __a			:  Tuple		    =  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()


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


lowercase__          ={
    'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LayoutLMv2Config'],
    'processing_layoutlmv2': ['LayoutLMv2Processor'],
    'tokenization_layoutlmv2': ['LayoutLMv2Tokenizer'],
}

try:
      if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase__          =['LayoutLMv2TokenizerFast']

try:
      if not is_vision_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase__          =['LayoutLMv2FeatureExtractor']
      lowercase__          =['LayoutLMv2ImageProcessor']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase__          =[
          'LAYOUTLMV2_PRETRAINED_MODEL_ARCHIVE_LIST',
          'LayoutLMv2ForQuestionAnswering',
          'LayoutLMv2ForSequenceClassification',
          'LayoutLMv2ForTokenClassification',
          'LayoutLMv2Layer',
          'LayoutLMv2Model',
          'LayoutLMv2PreTrainedModel',
      ]

if TYPE_CHECKING:
      from .configuration_layoutlmva import LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP, LayoutLMvaConfig
      from .processing_layoutlmva import LayoutLMvaProcessor
      from .tokenization_layoutlmva import LayoutLMvaTokenizer

      try:
            if not is_tokenizers_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_layoutlmva_fast import LayoutLMvaTokenizerFast

      try:
            if not is_vision_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_layoutlmva import LayoutLMvaFeatureExtractor, LayoutLMvaImageProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_layoutlmva import (
                LAYOUTLMV2_PRETRAINED_MODEL_ARCHIVE_LIST,
                LayoutLMvaForQuestionAnswering,
                LayoutLMvaForSequenceClassification,
                LayoutLMvaForTokenClassification,
                LayoutLMvaLayer,
                LayoutLMvaModel,
                LayoutLMvaPreTrainedModel,
            )
else:
      import sys

      lowercase__          =_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
