Skip to content

Commit

Permalink
rename submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Dec 13, 2023
1 parent 42f8eca commit dd247cd
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Module defining the QuantumNetwork class and adjacent functions."""

# %%

from functools import reduce
from operator import mul
from typing import List, Optional, Tuple, Union
Expand Down Expand Up @@ -243,7 +241,6 @@ def is_positive_semidefinite(self, precision_tol: float = 0.0):

return all([eigenvalue >= precision_tol for eigenvalue in eigenvalues])

@property
def is_channel(
self,
order: Optional[Union[int, str]] = None,
Expand All @@ -270,3 +267,19 @@ def is_channel(
return self.is_causal(
order, precision_tol_causal
) and self.is_positive_semidefinite(precision_tol_psd)

def apply(self, state):
"""Apply the Choi operator :math:`\\mathcal{E}` to ``state`` :math:`\\varrho`.
It is assumed that ``state`` :math:`\\varrho` is a density matrix.
Args:
state (ndarray): density matrix of a ``state``.
Returns:
ndarray: Resulting state :math:`\\mathcal{E}(\\varrho)`.
"""
if self.is_pure():
return np.einsum("jk,lm,jl -> km", self.matrix, np.conj(self.matrix), state)

return np.einsum("jklm,kl -> jl", self.matrix, state)

0 comments on commit dd247cd

Please sign in to comment.