Skip to content

Commit

Permalink
Merge pull request #8 from qDNA-yonsei/refactoring
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
israelferrazaraujo authored Dec 29, 2023
2 parents c3b14db + 050eeb8 commit bb9cba5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 11 additions & 6 deletions qdna/compression/schmidt.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ def __init__(self, params, label=None, opt_params=None):
self.partition = self._default_partition(self.num_qubits)
self.svd = "auto"
else:
self.low_rank = 0 if opt_params.get("lr") is None else opt_params.get("lr")
self.partition = sorted(opt_params.get("partition"))
self.isometry_scheme = "ccd" if opt_params.get("iso_scheme") is None else opt_params.get("iso_scheme")
self.unitary_scheme = "qsd" if opt_params.get("unitary_scheme") is None else opt_params.get("unitary_scheme")
self.svd = "auto" if opt_params.get("svd") is None else opt_params.get("svd")
self.low_rank = 0 if opt_params.get("lr") is None else \
opt_params.get("lr")
self.partition = self._default_partition(self.num_qubits) if \
opt_params.get("partition") is None else sorted(opt_params.get("partition"))
self.isometry_scheme = "ccd" if opt_params.get("iso_scheme") is None else \
opt_params.get("iso_scheme")
self.unitary_scheme = "qsd" if opt_params.get("unitary_scheme") is None else \
opt_params.get("unitary_scheme")
self.svd = "auto" if opt_params.get("svd") is None else \
opt_params.get("svd")

# The trash and latent qubits must take into account that the qiskit qubits are reversed.
complement = sorted(
Expand Down Expand Up @@ -118,7 +123,7 @@ def _define_initialize(self):
circuit, reg_a, reg_b = self._create_quantum_circuit()

# Schmidt decomposition
rank, svd_u, singular_values, svd_v = schmidt_decomposition(
rank, svd_u, _, svd_v = schmidt_decomposition(
self.params, reg_a, rank=self.low_rank, svd=self.svd
)

Expand Down
1 change: 0 additions & 1 deletion qdna/embedding/util/state_tree_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""

from dataclasses import dataclass
import numpy as np
from qiskit.circuit import ParameterExpression
from qiskit.utils import optionals as _optionals
from sympy import sqrt as sp_sqrt
Expand Down

0 comments on commit bb9cba5

Please sign in to comment.