Skip to content

Commit

Permalink
Merge branch 'develop' into improved-matrixtools
Browse files Browse the repository at this point in the history
Forgot to pull latest develop before attempting the previous merge.
  • Loading branch information
rileyjmurray committed Jun 13, 2024
2 parents 071fa29 + 14f2859 commit fde0dfa
Show file tree
Hide file tree
Showing 21 changed files with 761 additions and 934 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/autodeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
name: Deploy new version on pypi.org

on:
push:
branches: [ "master" ]
release:
types:
- published

# Dont allow running manually from Actions tab -- use manualdeploy for this
#workflow_dispatch:
workflow_dispatch:

jobs:
build_wheels:
Expand All @@ -20,7 +16,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -37,6 +33,7 @@ jobs:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-*
CIBW_BUILD_VERBOSITY: 1
CIBW_BEFORE_ALL_LINUX: ./.github/ci-scripts/before_install.sh
CIBW_BEFORE_ALL_MACOS: ./.github/ci-scripts/before_install_macos.sh

- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/beta-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
use-cython: ${{ matrix.use-cython }}
run-unit-tests: 'true'
run-extra-tests: 'true'
run-notebook-tests: 'true'
run-notebook-tests: 'false' # TODO: Turn off failing notebook tests for runner failures starting end of May 2024



Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## [0.9.12.3] - 2024-06-03
## [0.9.12.3] - 2024-06-11

### Added
* Deterministic Clifford compilation and native gate count statistics for `CliffordRBDesign` (#314, #315, #443)
Expand Down
9 changes: 7 additions & 2 deletions pygsti/evotypes/densitymx_slow/effectreps.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
import numpy as _np

# import functools as _functools
from .. import basereps as _basereps
from pygsti.baseobjs.statespace import StateSpace as _StateSpace
from ...tools import matrixtools as _mt


class EffectRep(_basereps.EffectRep):
class EffectRep:
"""Any representation of an "effect" in the sense of a POVM."""

def __init__(self, state_space):
self.state_space = _StateSpace.cast(state_space)

Expand All @@ -27,6 +28,10 @@ def probability(self, state):


class EffectRepConjugatedState(EffectRep):
"""
A real superket representation of an "effect" in the sense of a POVM.
Internally uses a StateRepDense object to hold the real superket.
"""

def __init__(self, state_rep):
self.state_rep = state_rep
Expand Down
17 changes: 15 additions & 2 deletions pygsti/evotypes/densitymx_slow/opreps.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from scipy.sparse.linalg import LinearOperator

from .statereps import StateRepDense as _StateRepDense
from .. import basereps as _basereps
from pygsti.baseobjs.statespace import StateSpace as _StateSpace
from ...tools import basistools as _bt
from ...tools import internalgates as _itgs
Expand All @@ -26,7 +25,11 @@
from ...tools import optools as _ot


class OpRep(_basereps.OpRep):
class OpRep:
"""
A real superoperator on Hilbert-Schmidt space.
"""

def __init__(self, state_space):
self.state_space = state_space

Expand All @@ -41,6 +44,10 @@ def adjoint_acton(self, state):
raise NotImplementedError()

def aslinearoperator(self):
"""
Return a SciPy LinearOperator that accepts superket representations of vectors
in Hilbert-Schmidt space and returns a vector of that same representation.
"""
def mv(v):
if v.ndim == 2 and v.shape[1] == 1: v = v[:, 0]
in_state = _StateRepDense(_np.ascontiguousarray(v, 'd'), self.state_space, None)
Expand All @@ -54,6 +61,12 @@ def rmv(v):


class OpRepDenseSuperop(OpRep):
"""
A real superoperator on Hilbert-Schmidt space.
The operator's action (and adjoint action) work with Hermitian matrices
stored as *vectors* in their real superket representations.
"""

def __init__(self, mx, basis, state_space):
state_space = _StateSpace.cast(state_space)
if mx is None:
Expand Down
13 changes: 10 additions & 3 deletions pygsti/evotypes/densitymx_slow/statereps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import numpy as _np

from .. import basereps as _basereps
from pygsti.baseobjs.statespace import StateSpace as _StateSpace
from ...tools import basistools as _bt
from ...tools import optools as _ot
Expand All @@ -25,13 +24,17 @@
_fastcalc = None


class StateRep(_basereps.StateRep):
class StateRep:
"""A real superket representation of an element in Hilbert-Schmidt space."""

def __init__(self, data, state_space):
#vec = _np.asarray(vec, dtype='d')
assert(data.dtype == _np.dtype('d'))
self.data = _np.require(data.copy(), requirements=['OWNDATA', 'C_CONTIGUOUS'])
self.state_space = _StateSpace.cast(state_space)
assert(len(self.data) == self.state_space.dim)
ds0 = self.data.shape[0]
assert(ds0 == self.state_space.dim)
assert(ds0 == self.data.size)

def __reduce__(self):
return (StateRep, (self.data, self.state_space), (self.data.flags.writeable,))
Expand Down Expand Up @@ -62,6 +65,10 @@ def __str__(self):


class StateRepDense(StateRep):
"""
An almost-trivial wrapper around StateRep.
Implements the "base" property and defines a trivial "base_has_changed" function.
"""

def __init__(self, data, state_space, basis):
#ignore basis for now (self.basis = basis in future?)
Expand Down
1 change: 1 addition & 0 deletions pygsti/forwardsims/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from .forwardsim import ForwardSimulator
from .mapforwardsim import SimpleMapForwardSimulator, MapForwardSimulator
from .torchfwdsim import TorchForwardSimulator
from .matrixforwardsim import SimpleMatrixForwardSimulator, MatrixForwardSimulator
from .termforwardsim import TermForwardSimulator
from .weakforwardsim import WeakForwardSimulator
Loading

0 comments on commit fde0dfa

Please sign in to comment.