Shaped#

qualtran.symbolics.Shaped

Symbolic value for an object that has a shape.

A Shaped object can be used as a symbolic replacement for any object that has an attribute shape, for example numpy NDArrays. Each dimension can be either a positive integer value or a sympy expression.

For the symbolic variant of a tuple or sequence of values, see HasLength.

This is useful to do symbolic analysis of Bloqs whose call graph only depends on the shape of the input, but not on the actual values. For example, T-cost of the QROM Bloq depends only on the iteration length (shape) and not on actual data values. In this case, for the bloq attribute data, we can use the type:

data: Union[NDArray, Shaped]
shape

 

Methods#

is_symbolic

View source

__ne__

Check equality and either forward a NotImplemented or return the result negated.

__eq__

Method generated by attrs for class Shaped.