# Path: pyphysim/subspace/metrics.py
# def calc_principal_angles(matrix1: np.ndarray,
#                           matrix2: np.ndarray) -> np.ndarray:
# def calc_chordal_distance_from_principal_angles(
#         principalAngles: np.ndarray) -> float:
# def calc_chordal_distance(matrix1: np.ndarray, matrix2: np.ndarray) -> float:
# def calc_chordal_distance_2(matrix1: np.ndarray, matrix2: np.ndarray) -> float:
#     Q1 = np.linalg.qr(matrix1)[0]
#     Q2 = np.linalg.qr(matrix2)[0]
#     S = np.linalg.svd(Q1.conjugate().transpose().dot(Q2),
#                       full_matrices=False)[1]
#     S[S > 1] = 1  # Change values greater then 1 to 1
#     Q1 = np.linalg.qr(matrix1)[0]
#     Q2 = np.linalg.qr(matrix2)[0]
# 
# Path: pyphysim/subspace/projections.py
# class Projection:
#     def __init__(self, A: np.ndarray):
#     def project(self, M: np.ndarray) -> np.ndarray:
#     def oProject(self, M: np.ndarray) -> np.ndarray:
#     def reflect(self, M: np.ndarray) -> np.ndarray:
#     def calcProjectionMatrix(A: np.ndarray) -> np.ndarray:
#     def calcOrthogonalProjectionMatrix(A: np.ndarray) -> np.ndarray:
#         A_H = A.conjugate().transpose()
#         Q = Projection.calcProjectionMatrix(A)
# 
# Path: pyphysim/util/misc.py
# def randn_c(*args: int) -> np.ndarray:
#     """
#     Generates a random circularly complex gaussian matrix.
# 
#     Parameters
#     ----------
#     *args : any
#         Variable number of arguments (int values) specifying the
#         dimensions of the returned array. This is directly passed to the
#         numpy.random.randn function.
# 
#     Returns
#     -------
#     result : np.ndarray
#         A random N-dimensional numpy array (complex dtype) where the `N` is
#         equal to the number of parameters passed to `randn_c`.
# 
#     Examples
#     --------
#     >>> a = randn_c(4,3)
#     >>> a.shape
#     (4, 3)
#     >>> a.dtype
#     dtype('complex128')
# 
#     """
#     # noinspection PyArgumentList
#     return (1.0 / math.sqrt(2.0)) * (np.random.randn(*args) +
#                                      (1j * np.random.randn(*args)))


import doctest
import unittest
import numpy as np
from pyphysim.subspace import metrics, projections
from pyphysim.util.misc import randn_c
#!/usr/bin/env python

# pylint: disable=E1101
"""
Tests for the modules in the subspace package.

Each module has doctests for its functions and all we need to do is run all
of them them.
"""





# noinspection PyMethodMayBeStatic
class SubspaceDoctestsTestCase(unittest.TestCase):
    """
    Test case that run all the doctests in the modules of the subspace package.
    """
    def test_metrics(self) -> None:
        """Run metrics doctests"""
        doctest.testmod(metrics)

    def test_projections(self) -> None:
        """Run projections doctests"""

# Path: pyphysim/subspace/metrics.py
# def calc_principal_angles(matrix1: np.ndarray,
#                           matrix2: np.ndarray) -> np.ndarray:
# def calc_chordal_distance_from_principal_angles(
#         principalAngles: np.ndarray) -> float:
# def calc_chordal_distance(matrix1: np.ndarray, matrix2: np.ndarray) -> float:
# def calc_chordal_distance_2(matrix1: np.ndarray, matrix2: np.ndarray) -> float:
#     Q1 = np.linalg.qr(matrix1)[0]
#     Q2 = np.linalg.qr(matrix2)[0]
#     S = np.linalg.svd(Q1.conjugate().transpose().dot(Q2),
#                       full_matrices=False)[1]
#     S[S > 1] = 1  # Change values greater then 1 to 1
#     Q1 = np.linalg.qr(matrix1)[0]
#     Q2 = np.linalg.qr(matrix2)[0]
# 
# Path: pyphysim/subspace/projections.py
# class Projection:
#     def __init__(self, A: np.ndarray):
#     def project(self, M: np.ndarray) -> np.ndarray:
#     def oProject(self, M: np.ndarray) -> np.ndarray:
#     def reflect(self, M: np.ndarray) -> np.ndarray:
#     def calcProjectionMatrix(A: np.ndarray) -> np.ndarray:
#     def calcOrthogonalProjectionMatrix(A: np.ndarray) -> np.ndarray:
#         A_H = A.conjugate().transpose()
#         Q = Projection.calcProjectionMatrix(A)
# 
# Path: pyphysim/util/misc.py
# def randn_c(*args: int) -> np.ndarray:
#     """
#     Generates a random circularly complex gaussian matrix.
# 
#     Parameters
#     ----------
#     *args : any
#         Variable number of arguments (int values) specifying the
#         dimensions of the returned array. This is directly passed to the
#         numpy.random.randn function.
# 
#     Returns
#     -------
#     result : np.ndarray
#         A random N-dimensional numpy array (complex dtype) where the `N` is
#         equal to the number of parameters passed to `randn_c`.
# 
#     Examples
#     --------
#     >>> a = randn_c(4,3)
#     >>> a.shape
#     (4, 3)
#     >>> a.dtype
#     dtype('complex128')
# 
#     """
#     # noinspection PyArgumentList
#     return (1.0 / math.sqrt(2.0)) * (np.random.randn(*args) +
#                                      (1j * np.random.randn(*args)))


# Path: tests/subspace_package_test.py
import doctest
import unittest
import numpy as np
from pyphysim.subspace import metrics, projections
from pyphysim.util.misc import randn_c

#!/usr/bin/env python

# pylint: disable=E1101
"""
Tests for the modules in the subspace package.

Each module has doctests for its functions and all we need to do is run all
of them them.
"""





# noinspection PyMethodMayBeStatic
class SubspaceDoctestsTestCase(unittest.TestCase):
    """
    Test case that run all the doctests in the modules of the subspace package.
    """
    def test_metrics(self) -> None:
        """Run metrics doctests"""
        doctest.testmod(metrics)

    def test_projections(self) -> None:
        """Run projections doctests"""

        doctest.testmod(projections)