Skip to content

Commit

Permalink
[Refact] Module reorganization (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmoutinho authored Aug 8, 2024
1 parent d990c40 commit a4b6e1a
Show file tree
Hide file tree
Showing 35 changed files with 1,116 additions and 977 deletions.
2 changes: 1 addition & 1 deletion docs/dropout.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from torch import manual_seed, optim, tensor

import pyqtorch as pyq
from pyqtorch.circuit import DropoutQuantumCircuit
from pyqtorch.parametric import Parametric
from pyqtorch.primitives import Parametric
from pyqtorch.utils import DropoutMode

seed = 70
Expand Down
4 changes: 2 additions & 2 deletions docs/fitting_a_function.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ from operator import add
from functools import reduce
import torch
import pyqtorch as pyq
from pyqtorch.circuit import hea
from pyqtorch.composite import hea
from pyqtorch.utils import DiffMode
from pyqtorch.parametric import Parametric
from pyqtorch.primitives import Parametric
import matplotlib.pyplot as plt

from torch.nn.functional import mse_loss
Expand Down
2 changes: 1 addition & 1 deletion docs/noise.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ import torch

from pyqtorch.circuit import QuantumCircuit
from pyqtorch.noise import BitFlip
from pyqtorch.primitive import X
from pyqtorch.primitives import X
from pyqtorch.utils import product_state


Expand Down
4 changes: 2 additions & 2 deletions docs/pde.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import numpy as np
import torch
from torch import Tensor, exp, linspace, ones_like, optim, rand, sin, tensor
from torch.autograd import grad
from pyqtorch.circuit import hea
from pyqtorch.composite import hea
from pyqtorch import CNOT, RX, RY, QuantumCircuit, Z, expectation, Sequence, Merge, Add, Observable
from pyqtorch.parametric import Parametric
from pyqtorch.primitives import Parametric
from pyqtorch.utils import DiffMode

DIFF_MODE = DiffMode.AD
Expand Down
35 changes: 17 additions & 18 deletions pyqtorch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@
logger.info(f"PyQTorch logger successfully setup with log level {LOG_LEVEL}")


from .analog import (
from .api import expectation, run, sample
from .apply import apply_operator
from .circuit import DropoutQuantumCircuit, QuantumCircuit
from .composite import (
Add,
HamiltonianEvolution,
Observable,
Merge,
Scale,
Sequence,
)
from .api import expectation, run, sample
from .apply import apply_operator
from .circuit import DropoutQuantumCircuit, Merge, QuantumCircuit, Sequence
from .embed import ConcretizedCallable, Embedding
from .hamiltonians import HamiltonianEvolution, Observable
from .noise import (
AmplitudeDamping,
BitFlip,
Expand All @@ -65,30 +66,27 @@
PhaseDamping,
PhaseFlip,
)
from .parametric import (
from .primitives import (
CNOT,
CPHASE,
CRX,
CRY,
CRZ,
OPS_PARAM,
OPS_PARAM_1Q,
OPS_PARAM_2Q,
PHASE,
RX,
RY,
RZ,
U,
)
from .primitive import (
CNOT,
CSWAP,
CY,
CZ,
OPS_1Q,
OPS_2Q,
OPS_3Q,
OPS_DIGITAL,
OPS_PARAM,
OPS_PARAM_1Q,
OPS_PARAM_2Q,
OPS_PAULI,
PHASE,
RX,
RY,
RZ,
SWAP,
H,
I,
Expand All @@ -98,6 +96,7 @@
SDagger,
T,
Toffoli,
U,
X,
Y,
Z,
Expand Down
2 changes: 1 addition & 1 deletion pyqtorch/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import torch
from torch import Tensor

from pyqtorch.analog import Observable
from pyqtorch.apply import apply_operator
from pyqtorch.circuit import QuantumCircuit
from pyqtorch.differentiation import (
Expand All @@ -16,6 +15,7 @@
check_support_psr,
)
from pyqtorch.embed import Embedding
from pyqtorch.hamiltonians import Observable
from pyqtorch.utils import DiffMode, sample_multinomial

logger = getLogger(__name__)
Expand Down
Loading

0 comments on commit a4b6e1a

Please sign in to comment.