Skip to content

Type stability #9

Description

@nmheim

There are a few places with sub-optimal type definitions, like e.g.:

struct Shadow
    n_qubits::Int
    gate::Array{Yao.AbstractBlock}
    measure::Array{Int8}  # is this always a vector or can this be any dimensionality?
end

should really be

struct Shadow{G<:AbstractBlock}
  n_qubits::Int
  gate::G
  measure::Vector{Int8}
end

in order to make Shadow a proper concrete type that the julia compiler can work with optimally. without the parametric type G julia will always have to do dynamic dispatch (during runtime = slow) because the concrete type of the Shadow is not inferable (the gate can be any type of AbstractBlock)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions