Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small tuning of documentation #5

Merged
merged 4 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@
"github_version": "main",
"doc_path": "docs/source",
}

16 changes: 8 additions & 8 deletions qutree/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def nphi_psi(psi: np.array) -> Tuple[np.array, np.array]:

Returns:
r (np.array) : array of absolute values
phi (np.array) : array of angles from [0,2 pi]
phi (np.array) : array of angles from :math:`[0, 2\pi]`
"""

r = np.abs(psi)
Expand All @@ -33,15 +33,15 @@ def nthe_n0n1(n0: np.array, n1: np.array) -> Tuple[np.array, np.array]:
"""
Carthesian to Polar

Compute n and theta such that [n0,n1] = n*[cos(theta),sin(theta)]
Compute :math:`n` and :math:`\theta` such that :math:`[n0,n1] = n[cos(\\theta),sin(\\theta)]`

Args:
n0 (np.array): array of absolute values
n1 (np.array): array of absolute values

Returns:
n (np.array) : array of norm
the (np.array) : array of angles from [0,pi]
the (np.array) : array of angles from :math:`[0, \pi]`
"""

n = np.sqrt(n0**2 + n1**2)
Expand Down Expand Up @@ -72,8 +72,8 @@ def thephi_to_xyz(the: np.array, phi: np.array) -> Tuple[np.array, np.array, np.
spherical to carthesian

Args:
the (np.array): array of the angles [0,pi]
phi (np.array): array of phi angles [0,2 pi]
the (np.array): array of the angles :math:`[0,\pi]`
phi (np.array): array of :math:`\phi` angles :math:`[0,2 \pi]`

Returns:
x (np.array): array of the x axis coordinate
Expand All @@ -99,16 +99,16 @@ def fun_recursive(
recursive function going down the hilbert schmidt decomposition

Args:
psi (np.array): array representing the state in the current subspace (2**N,M)
psi (np.array): array representing the state in the current subspace :math:`(2^N,M)`
coord (str): string representing the current coordinate in the binary tree
tree_vals (list) : register storing the thetas and phis of the Bloch sphere at each coordinate
tree_vals (list) : register storing the :math:`\\theta` and :math:`\phi` of the Bloch sphere at each coordinate
tree_idxs (list) : register storing the coordinates
tol : tolerance to delete a subspace

Returns:
phip (np.array) : the global phases of the local subspace
n (np.array) : the amplitude of the local subspace
tree_vals (list) : register storing the thetas and phis of the Bloch sphere at each coordinate
tree_vals (list) : register storing the :math:`\\theta` and :math:`\phi` of the Bloch sphere at each coordinate
tree_idxs (list) : register storing the coordinates
"""

Expand Down
12 changes: 0 additions & 12 deletions tests/test_bbt.py

This file was deleted.

49 changes: 49 additions & 0 deletions tests/test_qutree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import numpy as np

import qutree


def test_nphi_psi() -> None:
r = np.random.random(10)
phi = np.random.random(10) * 2 * np.pi

r_test, phi_test = qutree.nphi_psi(r * np.exp(1j * phi))

assert np.allclose(r, r_test)
assert np.allclose(phi, phi_test)


def test_nthe_n0n1() -> None:
pass


def test_phimp_phi01() -> None:
pass


def test_thephi_to_xyz() -> None:
pass


def fun_recursive() -> None:
pass


def test_bloch_points() -> None:
pass


def test_BBT() -> None:
pass


def test_add_data() -> None:
pass


def test_fun_recursive() -> None:
pass


def test_plot_tree() -> None:
pass