qml.data.DatasetSparseArray

class DatasetSparseArray(value=<UnsetType.UNSET: 'UNSET'>, info=None, *, bind=None, parent_and_key=None)[source]

Bases: Generic[pennylane.data.attributes.sparse_array.SparseT], pennylane.data.base.attribute.DatasetAttribute[collections.abc.MutableMapping, pennylane.data.attributes.sparse_array.SparseT, pennylane.data.attributes.sparse_array.SparseT]

Attribute type for Scipy sparse arrays. Can accept values of any type in scipy.sparse. Arrays are serialized using the CSR format.

bind

Returns the HDF5 object that contains this attribute’s data.

info

Returns the AttributeInfo for this attribute.

registry

Maps type_ids to their DatasetAttribute classes.

sparse_array_class

Returns the class of sparse array that will be returned by the get_value() method.

type_consumer_registry

Maps types to their default DatasetAttribute

type_id

bind

Returns the HDF5 object that contains this attribute’s data.

info

Returns the AttributeInfo for this attribute.

registry: Mapping[str, Type[DatasetAttribute]] = mappingproxy({'dataset': <class 'pennylane.data.base.dataset._DatasetAttributeType'>, 'array': <class 'pennylane.data.attributes.array.DatasetArray'>, 'dict': <class 'pennylane.data.attributes.dictionary.DatasetDict'>, 'json': <class 'pennylane.data.attributes.json.DatasetJSON'>, 'list': <class 'pennylane.data.attributes.list.DatasetList'>, 'molecule': <class 'pennylane.data.attributes.molecule.DatasetMolecule'>, 'none': <class 'pennylane.data.attributes.none.DatasetNone'>, 'operator': <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, 'scalar': <class 'pennylane.data.attributes.scalar.DatasetScalar'>, 'sparse_array': <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, 'string': <class 'pennylane.data.attributes.string.DatasetString'>, 'tuple': <class 'pennylane.data.attributes.tuple.DatasetTuple'>})

Maps type_ids to their DatasetAttribute classes.

sparse_array_class

Returns the class of sparse array that will be returned by the get_value() method.

type_consumer_registry: Mapping[type, Type[DatasetAttribute]] = mappingproxy({<class 'pennylane.qchem.molecule.Molecule'>: <class 'pennylane.data.attributes.molecule.DatasetMolecule'>, <class 'NoneType'>: <class 'pennylane.data.attributes.none.DatasetNone'>, <class 'pennylane.ops.channel.DepolarizingChannel'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.CNOT'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.Displacement'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.T'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.WireCut'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.observables.Projector'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.ControlledPhase'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qutrit.observables.THermitian'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.NumberOperator'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.GaussianState'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.operation.Tensor'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_controlled.CRY'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_single_qubit.Rot'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_multi_qubit.PSWAP'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.PauliY'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.channel.ThermalRelaxationError'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_single_qubit.PhaseShift'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_single_qubit.RX'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.Hadamard'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.FockState'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qutrit.matrix_ops.QutritUnitary'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_controlled.ControlledPhaseShift'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_multi_qubit.IsingXX'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.arithmetic_ops.QubitCarry'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.op_math.controlled_ops.CZ'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.Kerr'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.qchem_ops.OrbitalRotation'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.PauliX'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.TensorN'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.SISWAP'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.CH'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.QuadP'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.state_preparation.BasisState'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.InterferometerUnitary'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.qchem_ops.SingleExcitation'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_multi_qubit.MultiRZ'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.channel.BitFlip'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.PauliZ'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_multi_qubit.IsingYY'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.qchem_ops.DoubleExcitation'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.CrossKerr'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_single_qubit.U1'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qutrit.non_parametric_ops.TSWAP'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.qchem_ops.SingleExcitationMinus'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.matrix_ops.QubitUnitary'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.state_preparation.StatePrep'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_single_qubit.U3'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.FockStateVector'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.channel.GeneralizedAmplitudeDamping'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.QuadX'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.Beamsplitter'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.qchem_ops.DoubleExcitationPlus'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.channel.ResetError'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.op_math.controlled_ops.CY'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.SWAP'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_multi_qubit.IsingZZ'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_single_qubit.U2'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_controlled.CRot'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_controlled.CRZ'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.CSWAP'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.channel.PauliError'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.QuadOperator'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_controlled.CPhaseShift01'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.arithmetic_ops.QubitSum'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_multi_qubit.IsingXY'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.matrix_ops.DiagonalQubitUnitary'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.QuadraticPhase'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.state_preparation.QubitStateVector'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.CoherentState'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.qchem_ops.FermionicSWAP'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.identity.Identity'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.Rotation'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.ECR'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.SqueezedState'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_controlled.CPhaseShift10'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.TwoModeSqueezing'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qutrit.non_parametric_ops.TClock'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.observables.Hermitian'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.CCZ'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.PolyXP'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.state_preparation.QubitDensityMatrix'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.channel.AmplitudeDamping'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.hamiltonian.Hamiltonian'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.FockDensityMatrix'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.DisplacedSqueezedState'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.SX'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_controlled.CRX'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.ControlledAddition'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_controlled.CPhaseShift00'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_single_qubit.RZ'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.special_unitary.SpecialUnitary'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qutrit.non_parametric_ops.TShift'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qutrit.non_parametric_ops.TAdd'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.Squeezing'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.channel.PhaseDamping'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.channel.PhaseFlip'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.qchem_ops.SingleExcitationPlus'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.FockStateProjector'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.S'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.qchem_ops.DoubleExcitationMinus'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.CatState'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.non_parametric_ops.Toffoli'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.cv.ThermalState'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'pennylane.ops.qubit.parametric_ops_single_qubit.RY'>: <class 'pennylane.data.attributes.operator.operator.DatasetOperator'>, <class 'scipy.sparse._bsr.bsr_array'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._coo.coo_array'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._csc.csc_array'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._csr.csr_array'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._dia.dia_array'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._dok.dok_array'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._lil.lil_array'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._csc.csc_matrix'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._csr.csr_matrix'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._bsr.bsr_matrix'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._coo.coo_matrix'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._dia.dia_matrix'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._dok.dok_matrix'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'scipy.sparse._lil.lil_matrix'>: <class 'pennylane.data.attributes.sparse_array.DatasetSparseArray'>, <class 'str'>: <class 'pennylane.data.attributes.string.DatasetString'>, <class 'tuple'>: <class 'pennylane.data.attributes.tuple.DatasetTuple'>})

Maps types to their default DatasetAttribute

type_id: ClassVar[str] = 'sparse_array'

consumes_types()

Returns an iterable of types for which this should be the default codec.

copy_value()

Deserializes the mapped value from bind, and also perform a ‘deep-copy’ of any nested values contained in bind.

default_value()

Returns a valid default value for this type, or UNSET if this type must be initialized with a value.

get_value()

Deserializes the mapped value from bind.

hdf5_to_value(bind)

Parses bind into Python object.

py_type(value_type)

The module path of sparse array types is private, e.g scipy.sparse._csr.csr_array.

value_to_hdf5(bind_parent, key, value)

Converts value into a HDF5 Array or Group under bind_parent[key].

classmethod consumes_types()[source]

Returns an iterable of types for which this should be the default codec. If a value of one of these types is assigned to a Dataset without specifying a type_id, this type will be used.

copy_value()

Deserializes the mapped value from bind, and also perform a ‘deep-copy’ of any nested values contained in bind.

classmethod default_value()

Returns a valid default value for this type, or UNSET if this type must be initialized with a value.

get_value()

Deserializes the mapped value from bind.

hdf5_to_value(bind)[source]

Parses bind into Python object.

classmethod py_type(value_type)[source]

The module path of sparse array types is private, e.g scipy.sparse._csr.csr_array. This method returns the public path e.g scipy.sparse.csr_array instead.

value_to_hdf5(bind_parent, key, value)[source]

Converts value into a HDF5 Array or Group under bind_parent[key].