Skip to content

Extend Base.zero to easily initialize empty Qobj #342

@labay11

Description

@labay11

Problem Description

The zero_ket function already exists, but this is more general and allows the initialization of an empty object of the same type and dims of other objects. Useful, for instance, for reduce or other Julia functions.

Proposed Solution

Base.zero(x::AbstractQuantumObject) = QuantumObject(zero(x.data), dims=x.dims, type=x.type)

Alternate Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions