Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
meandmytram committed Apr 15, 2024
1 parent b48b3d5 commit ac2ee58
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions examples/random_circuit/mps-rand-circ.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
from scipy.stats import unitary_group

# Setup logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logging.basicConfig(
level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s"
)

# Append paths using environment variables or hardcoded fallbacks
project_root = os.getenv(
'MDOPT_PATH', '/home/bereza/projects/def-ko1/bereza/project-mdopt/mdopt'
)
"MDOPT_PATH", "/home/bereza/projects/def-ko1/bereza/project-mdopt/mdopt"
)
examples_path = os.getenv(
'MDOPT_EXAMPLES_PATH', '/home/bereza/projects/def-ko1/bereza/project-mdopt/mdopt/examples'
)
"MDOPT_EXAMPLES_PATH",
"/home/bereza/projects/def-ko1/bereza/project-mdopt/mdopt/examples",
)

sys.path.append(project_root)
sys.path.append(examples_path)
Expand All @@ -25,7 +28,9 @@
from mdopt.contractor.contractor import mps_mpo_contract
from examples.random_circuit.random_circuit import create_mpo_from_layer
except ImportError as e:
logging.error("Failed to import required modules. Ensure paths are correct.", exc_info=True)
logging.error(
"Failed to import required modules. Ensure paths are correct.", exc_info=True
)
sys.exit(1)

PHYS_DIM = 2
Expand All @@ -47,7 +52,9 @@
)

for k in range(NUM_LAYERS_CIRC):
layer = unitary_group.rvs(PHYS_DIM**2, size=NUM_QUBITS // PHYS_DIM - k % 2)
layer = unitary_group.rvs(
PHYS_DIM**2, size=NUM_QUBITS // PHYS_DIM - k % 2
)
mpo = create_mpo_from_layer(layer)
state = mps_mpo_contract(
mps=state,
Expand Down

0 comments on commit ac2ee58

Please sign in to comment.