piel.tools.qutip#

Submodules#

Package Contents#

Functions#

all_fock_states_from_photon_number(→ list)

For a specific amount of modes, we can generate all the possible Fock states for whatever amount of input photons we desire. This returns a list of all corresponding Fock states.

convert_qobj_to_jax(→ jax.numpy.ndarray)

fock_state_nonzero_indexes(→ tuple[int])

This function returns the indexes of the nonzero elements of a Fock state.

fock_state_to_photon_number_factorial(→ float)

This function converts a Fock state defined as:

fock_states_at_mode_index(→ list)

This function returns a list of valid Fock states that fulfill a condition of having a maximum photon number at a specific mode index.

fock_states_only_individual_modes(→ list)

This function returns a list of valid Fock states where each state has a maximum photon number, but only in one mode.

verify_matrix_is_unitary(→ bool)

Verify that the matrix is unitary.

subunitary_selection_on_range(unitary_matrix, stop_index)

This function returns a unitary between the indexes selected, and verifies the indexes are valid by checking that

subunitary_selection_on_index(unitary_matrix, ...)

This function returns a unitary between the indexes selected, and verifies the indexes are valid by checking that

Attributes#

convert_output_type

standard_s_parameters_to_qutip_qobj

all_fock_states_from_photon_number(mode_amount: int, photon_amount: int = 1, output_type: Literal[qutip, jax] = 'qutip') list[source]#

For a specific amount of modes, we can generate all the possible Fock states for whatever amount of input photons we desire. This returns a list of all corresponding Fock states.

Parameters:
  • mode_amount (int) – The amount of modes in the system.

  • photon_amount (int, optional) – The amount of photons in the system. Defaults to 1.

  • output_type (str, optional) – The type of output. Defaults to “qutip”.

Returns:

A list of all the Fock states.

Return type:

list

convert_qobj_to_jax(qobj: qutip.Qobj) jax.numpy.ndarray[source]#
convert_output_type#
fock_state_nonzero_indexes(fock_state: qutip.Qobj | jax.numpy.ndarray) tuple[int][source]#

This function returns the indexes of the nonzero elements of a Fock state.

Parameters:

fock_state (qutip.Qobj) – A QuTip QObj representation of the Fock state.

Returns:

The indexes of the nonzero elements of the Fock state.

Return type:

tuple

fock_state_to_photon_number_factorial(fock_state: qutip.Qobj | jax.numpy.ndarray) float[source]#

This function converts a Fock state defined as:

\[\]

ewcommand{ket}[1]{left|{#1} ight angle}

ket{f_1} = ket{j_1, j_2, … j_N}$

and returns:

\[j_1^{'}! j_2^{'}! ... j_N^{'}!\]
Args:

fock_state (qutip.Qobj): A QuTip QObj representation of the Fock state.

Returns:

float: The photon number factorial of the Fock state.

fock_states_at_mode_index(mode_amount: int, target_mode_index: int, maximum_photon_amount: int | None = 1, output_type: Literal[qutip, jax] = 'qutip') list[source]#

This function returns a list of valid Fock states that fulfill a condition of having a maximum photon number at a specific mode index.

Parameters:
  • mode_amount (int) – The amount of modes in the system.

  • target_mode_index (int) – The mode index to check the photon number at.

  • maximum_photon_amount (int, optional) – The amount of photons in the system. Defaults to 1.

  • output_type (str, optional) – The type of output. Defaults to “qutip”.

Returns:

A list of all the Fock states.

Return type:

list

fock_states_only_individual_modes(mode_amount: int, maximum_photon_amount: int | None = 1, output_type: Literal[qutip, jax, numpy, list, tuple] = 'qutip') list[source]#

This function returns a list of valid Fock states where each state has a maximum photon number, but only in one mode.

Parameters:
  • mode_amount (int) – The amount of modes in the system.

  • maximum_photon_amount (int) – The maximum amount of photons in a single mode.

  • output_type (str, optional) – The type of output. Defaults to “qutip”.

Returns:

A list of all the valid Fock states.

Return type:

list

standard_s_parameters_to_qutip_qobj#
verify_matrix_is_unitary(matrix: jax.numpy.ndarray) bool[source]#

Verify that the matrix is unitary.

Parameters:

matrix (jnp.ndarray) – The matrix to verify.

Returns:

True if the matrix is unitary, False otherwise.

Return type:

bool

subunitary_selection_on_range(unitary_matrix: jax.numpy.ndarray, stop_index: tuple, start_index: tuple | None = (0, 0))[source]#

This function returns a unitary between the indexes selected, and verifies the indexes are valid by checking that the output matrix is also a unitary.

TODO implement validation of a 2D matrix.

subunitary_selection_on_index(unitary_matrix: jax.numpy.ndarray, rows_index: jax.numpy.ndarray | tuple, columns_index: jax.numpy.ndarray | tuple)[source]#

This function returns a unitary between the indexes selected, and verifies the indexes are valid by checking that the output matrix is also a unitary.

TODO implement validation of a 2D matrix.