Skip to content

Commit

Permalink
fix inheritance issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyjmurray committed Nov 13, 2023
1 parent f91e433 commit 57379f6
Showing 1 changed file with 3 additions and 41 deletions.
44 changes: 3 additions & 41 deletions test/unit/modelmembers/test_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_hessian_wrt_params(self):
pass # ok if some classes don't implement this


class LinearOpTester(OpBase):
class LinearOpTester(OpBase, BaseCase):
n_params = 0

@staticmethod
Expand All @@ -104,6 +104,7 @@ def build_gate():
evotype = Evotype.cast('default')
state_space = statespace.default_space_for_dim(dim)
rep = evotype.create_dense_superop_rep(np.identity(dim, 'd'), state_space)
#rep = evotype.create_dense_superop_rep(None, np.identity(dim, 'd'), state_space)
return op.LinearOperator(rep, evotype)

def test_raise_on_invalid_method(self):
Expand Down Expand Up @@ -600,6 +601,7 @@ def test_include_off_diags_in_degen_blocks(self):
[(1j, (1, 0)), (-1j, (3, 2))]] # Im part of 1,0 and 3,2 els (lower triangle); (1,0) and (3,2) must be conjugates
)


class LindbladErrorgenTester(BaseCase):

def test_errgen_construction(self):
Expand Down Expand Up @@ -642,46 +644,6 @@ def test_errgen_construction_from_op(self):
errgen_copy.transform_inplace(T)
self.assertTrue(np.allclose(errgen_copy.to_dense(), eg.to_dense()))

#TODO - maybe update this to a test of ExpErrorgenOp, which can have dense/sparse versions?
#class LindbladOpBase(object):
# def test_has_nonzero_hessian(self):
# self.assertTrue(self.gate.has_nonzero_hessian())
#
#class LindbladErrorgenBase(LindbladOpBase, MutableDenseOpBase):
# def test_transform(self):
# gate_copy = self.gate.copy()
# T = UnitaryGaugeGroupElement(np.identity(4, 'd'))
# gate_copy.transform_inplace(T)
# self.assertArraysAlmostEqual(gate_copy, self.gate)
# # TODO test a non-trivial case
#
# def test_element_accessors(self):
# e1 = self.gate[1, 1]
# e2 = self.gate[1][1]
# self.assertAlmostEqual(e1, e2)
#
# s1 = self.gate[1, :]
# s2 = self.gate[1]
# s3 = self.gate[1][:]
# a1 = self.gate[:]
# self.assertArraysAlmostEqual(s1, s2)
# self.assertArraysAlmostEqual(s1, s3)
#
# s4 = self.gate[2:4, 1]
#
# result = len(self.gate)
# # TODO assert correctness
#
# def test_convert(self):
# g = op.convert(self.gate, "CPTP", Basis.cast("pp", 4))
# # TODO assert correctness
#
#
#class LindbladSparseOpBase(LindbladOpBase, OpBase):
# def assertArraysEqual(self, a, b):
# # Sparse LindbladOp does not support equality natively, so compare errorgen matrices
# self.assertEqual((a.errorgen.to_sparse() != b.errorgen.to_sparse()).nnz, 0)


class LindbladErrorgenBase(OpBase):
def test_has_nonzero_hessian(self):
Expand Down

0 comments on commit 57379f6

Please sign in to comment.