Skip to content

Commit d3b91e6

Browse files
committed
remove unused OuterProdBasis class
1 parent 1fdde66 commit d3b91e6

File tree

1 file changed

+0
-73
lines changed

1 file changed

+0
-73
lines changed

pygsti/baseobjs/basis.py

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,76 +1788,3 @@ def create_simple_equivalent(self, builtin_basis_name=None):
17881788
if all([c.name == first_comp_name for c in self._component_bases]):
17891789
builtin_basis_name = first_comp_name # if all components have the same name
17901790
return BuiltinBasis(builtin_basis_name, self.elsize, sparse=self.sparse)
1791-
1792-
1793-
class OuterProdBasis(TensorProdBasis):
1794-
1795-
def __init__(self, component_bases, name=None, longname=None, squeeze=True):
1796-
"""
1797-
Let ⨂ denote an infix operator where (a ⨂ b) := numpy.tensordot(a, b, axes=0).
1798-
1799-
Suppose component_bases has length k. Under the default setting of squeeze=True,
1800-
the elements of this OuterProdBasis are all arrays of the form
1801-
1802-
v1.squeeze() ⨂ v2.squeeze() ⨂ ... ⨂ vk.squeeze(),
1803-
1804-
where vi belongs to component_bases[i].elements. The definition is changed in the
1805-
natural way if squeeze=False.
1806-
"""
1807-
TensorProdBasis.__init__(self, component_bases, name, longname)
1808-
if self.sparse:
1809-
raise NotImplementedError()
1810-
cnames = [c.name for c in self.component_bases]
1811-
if name is None:
1812-
self.name = "⨂".join(cnames)
1813-
if longname is None:
1814-
self.longname = "Outer-product basis with components " + ", ".join(cnames)
1815-
self._squeeze = squeeze
1816-
return
1817-
1818-
@property
1819-
def elshape(self):
1820-
shape = []
1821-
if self._squeeze:
1822-
for c in self.component_bases:
1823-
shape.extend(d for d in c.elshape if d > 1)
1824-
else:
1825-
for c in self.component_bases:
1826-
shape.extend(c.elshape)
1827-
return tuple(shape)
1828-
1829-
def _lazy_build_elements(self):
1830-
compMxs = _np.zeros((self.size,) + self.elshape, 'complex')
1831-
comp_els = [c.elements for c in self.component_bases]
1832-
for i, factors in enumerate(_itertools.product(*comp_els)):
1833-
M = factors[0].squeeze() if self._squeeze else factors[0]
1834-
for f in factors[1:]:
1835-
if self._squeeze:
1836-
f = f.squeeze()
1837-
M = _np.tensordot(M, f, axes=0)
1838-
compMxs[i] = M
1839-
self._elements = compMxs
1840-
1841-
def _lazy_build_labels(self):
1842-
self._labels = []
1843-
comp_lbls = [c.labels for c in self.component_bases]
1844-
for i, factor_lbls in enumerate(_itertools.product(*comp_lbls)):
1845-
self._labels.append('⨂'.join(factor_lbls))
1846-
1847-
def is_equivalent(self, other, sparseness_must_match=True):
1848-
if not sparseness_must_match:
1849-
raise NotImplementedError()
1850-
otherIsBasis = isinstance(other, OuterProdBasis)
1851-
if not otherIsBasis: return False # can't be equal to a non-DirectSumBasis
1852-
return all([c1.is_equivalent(c2, True)
1853-
for (c1, c2) in zip(self.component_bases, other.component_bases)])
1854-
1855-
def _copy_with_toggled_sparsity(self):
1856-
raise NotImplementedError()
1857-
1858-
def create_equivalent(self, builtin_basis_name):
1859-
raise NotImplementedError()
1860-
1861-
def create_simple_equivalent(self, builtin_basis_name=None):
1862-
raise NotImplementedError()
1863-

0 commit comments

Comments
 (0)