Arcelyth/mqc/circuit does not have a README file

    Effect

    pub(open) trait Effect {
    fn measurement_key(Self) -> String? = _
    fn name(Self) -> String
    fn dimensions(Self) -> Array[UInt]
    fn arity(Self) -> Int = _
    fn try_unitary(Self) -> Gate? = _
    fn try_channel(Self) -> Channel? = _
    fn try_decompose(Self) -> Program? raise QuantumError = _
    fn try_adjoint(Self) -> &Effect? raise QuantumError = _
    fn parameters(Self) -> Array[String] = _
    }

    A quantum action on an ordered local wire shape such as Gate, Channel, and Program.

    An effect describes an operation independently of the physical wires it is applied to. Its local wire indices are mapped onto the enclosing operation's target wires when it is added to a program or circuit.

    Qid

    pub(open) trait Qid : Eq + Hash {
    fn dimension(Self) -> UInt
    }

    Identifies a quantum object. Equal IDs must have the same, fixed dimension. Dimensions must be at least two.

    UnitaryKernel

    pub(open) trait UnitaryKernel {
    fn dimension(Self) -> Int
    fn apply(Self, KernelArgs) -> Unit
    fn adjoint(Self) -> &UnitaryKernel
    }

    A pure, linear, unitary map on a local state vector.

    QuantumError

    pub(all) suberror QuantumError {
    InvalidDimension(UInt)
    SizeLimit(Int)
    InvalidGate(String)
    DuplicateQid(Int)
    TargetCount(Int, Int)
    DimensionMismatch(Int, UInt, UInt)
    RegisterMismatch
    InvalidBasis(Int)
    InvalidState(String)
    } derive(
    Debug
    )

    Channel

    type Channel

    Circuit

    type Circuit[Q]

    Represent a quantum circuit which shares the operation sequence.

    Circuit::append

    fn[Q : Qid + Eq + Hash] Circuit::append(self : Circuit[Q], operation : Operation[Q]) -> Unit raise QuantumError

    Append an operation in place.

    Circuit::compile

    fn[Q : Qid + Eq + Hash] Circuit::compile(self : Circuit[Q], name? : String) -> Program

    Compile circuit to program.

    Circuit::copy

    fn[Q] Circuit::copy(self : Circuit[Q]) -> Circuit[Q]

    Copy this circuit.

    Circuit::dimensions

    fn[Q] Circuit::dimensions(self : Circuit[Q]) -> Array[UInt]

    Return a copy of the ordered wire dimensions.

    Circuit::extend_ops

    fn[Q : Qid + Eq + Hash] Circuit::extend_ops(self : Circuit[Q], operations : Array[Operation[Q]]) -> Unit raise QuantumError

    Append a list of operations in place, in the supplied order.

    Circuit::from_op

    fn[Q : Qid + Eq + Hash] Circuit::from_op(operations : Array[Operation[Q]]) -> Circuit[Q] raise QuantumError

    Build a circuit from bound operations in execution order.

    Circuit::index_of

    fn[Q : Qid + Eq + Hash] Circuit::index_of(self : Circuit[Q], qid : Q) -> Int?

    Find a logical ID's position. Return None if absent.

    Circuit::length

    fn[Q] Circuit::length(self : Circuit[Q]) -> Int

    Return the stored operation count, counting a nested effect as one operation.

    Circuit::new

    fn[Q : Qid + Eq + Hash] Circuit::new(qids : Array[Q]) -> Circuit[Q] raise QuantumError

    Create an empty circuit over an ordered list of distinct logical IDs.

    Circuit::operations

    fn[Q] Circuit::operations(self : Circuit[Q]) -> Iter[Operation[Q]]

    Iterate over immutable operations in execution order.

    Circuit::qids

    fn[Q] Circuit::qids(self : Circuit[Q]) -> Array[Q]

    Return a copy of the logical IDs in order.

    Gate

    type Gate

    An immutable unitary effect.
    impl Effect for Gate

    Gate::arity

    fn Gate::arity(self : Gate) -> Int

    Gate::diagonal

    fn Gate::diagonal(name : String, dimensions : Array[UInt], phases : Array[
    Complex
    ], max_dimension? : Int) -> Gate raise QuantumError

    Create a diagonal unitary from one phase per basis state.

    Gate::dimension

    fn Gate::dimension(self : Gate) -> Int

    Gate::dimensions

    fn Gate::dimensions(self : Gate) -> Array[UInt]

    Gate::from_kernel

    fn Gate::from_kernel(name : String, dimensions : Array[UInt], kernel : &UnitaryKernel, max_dimension? : Int) -> Gate raise QuantumError

    Bind a custom unitary kernel to a shape.

    Gate::kernel

    fn Gate::kernel(self : Gate) -> &UnitaryKernel

    Return the immutable unitary kernel for this gate.

    Gate::measurement_key

    fn Gate::measurement_key(_self : Gate) -> String?

    Gate::monomial

    fn Gate::monomial(name : String, dimensions : Array[UInt], columns : Array[Int], phases : Array[
    Complex
    ], max_dimension? : Int) -> Gate raise QuantumError

    Constructs a monomial unitary gate from a column permutation and phase factors.

    Gate::name

    fn Gate::name(self : Gate) -> String

    Gate::parameters

    fn Gate::parameters(_self : Gate) -> Array[String]

    Gate::to_repr

    Gate::try_adjoint

    fn Gate::try_adjoint(_self : Gate) -> &Effect? raise QuantumError

    Gate::try_channel

    fn Gate::try_channel(_self : Gate) -> Channel?

    Gate::try_decompose

    fn Gate::try_decompose(_self : Gate) -> Program? raise QuantumError

    Gate::try_unitary

    fn Gate::try_unitary(self : Gate) -> Gate?

    Gate::unitary

    fn Gate::unitary(name : String, dimensions : Array[UInt], matrix : Array[
    Complex
    ], tolerance? : Double, max_dimension? : Int) -> Gate raise QuantumError

    Check shape, finite entries, and U†U before accepting a matrix. max_dimension bounds the cubic validation work and quadratic storage. Entries are in row order: row * dimension + column. Tolerance must be finite and in (0, 1e-6]; it bounds absolute errors in column inner products. Accepted entries are kept without normalization.

    Instruction

    type Instruction

    A checked binding to ordered local wire indices.

    Instruction::effect

    fn Instruction::effect(self : Instruction) -> &Effect

    Instruction::targets

    fn Instruction::targets(self : Instruction) -> Array[Int]

    KernelArgs

    pub(all) struct KernelArgs {
    input_re : ArrayView[Double]
    input_im : ArrayView[Double]
    output_re : MutArrayView[Double]
    output_im : MutArrayView[Double]
    }

    Operation

    type Operation[Q]

    An effect bound to distinct, ordered quantum IDs.

    Operation::effect

    fn[Q] Operation::effect(self : Operation[Q]) -> &Effect

    Return the immutable effect bound by this operation.

    Operation::gate

    fn[Q] Operation::gate(self : Operation[Q]) -> Gate?

    Return the effect's direct unitary capability, if present.

    Operation::new

    fn[Q : Qid + Eq + Hash] Operation::new(effect : &Effect, targets : Array[Q]) -> Operation[Q] raise QuantumError

    Operation::targets

    fn[Q] Operation::targets(self : Operation[Q]) -> Array[Q]

    Return a copy of the logical targets in effect wire order.

    Program

    type Program

    Program::dimensions

    fn Program::dimensions(self : Program) -> Array[UInt]

    Program::instructions

    fn Program::instructions(self : Program) -> Iter[Instruction]

    Program::length

    fn Program::length(self : Program) -> Int

    Program::name

    fn Program::name(self : Program) -> String

    QubitId

    pub(all) struct QubitId(UInt64) derive(Compare, Eq, Hash,
    Debug
    )

    A logical qubit ID with no device position.
    impl Qid for QubitId

    QubitId::compare

    fn QubitId::compare(QubitId, QubitId) -> Int

    QubitId::dimension

    fn QubitId::dimension(_self : QubitId) -> UInt

    QubitId::equal

    fn QubitId::equal(QubitId, QubitId) -> Bool

    QubitId::hash

    fn QubitId::hash(self : QubitId) -> Int

    QubitId::hash_combine

    fn QubitId::hash_combine(QubitId, Hasher) -> Unit

    QubitId::not_equal

    fn QubitId::not_equal(x : QubitId, y : QubitId) -> Bool

    QubitId::op_ge

    fn QubitId::op_ge(x : QubitId, y : QubitId) -> Bool

    QubitId::op_gt

    fn QubitId::op_gt(x : QubitId, y : QubitId) -> Bool

    QubitId::op_le

    fn QubitId::op_le(x : QubitId, y : QubitId) -> Bool

    QubitId::op_lt

    fn QubitId::op_lt(x : QubitId, y : QubitId) -> Bool

    QubitId::to_repr

    QuditId

    Identifies a qudit, a quantum system with a finite-dimensional state space. The levels field specifies the dimension of its local Hilbert space.
    impl Qid for QuditId

    QuditId::dimension

    fn QuditId::dimension(self : QuditId) -> UInt

    QuditId::equal

    fn QuditId::equal(QuditId, QuditId) -> Bool

    QuditId::hash

    fn QuditId::hash(self : QuditId) -> Int

    QuditId::hash_combine

    fn QuditId::hash_combine(QuditId, Hasher) -> Unit

    QuditId::new

    fn QuditId::new(id : UInt64, dimension : UInt) -> QuditId raise QuantumError

    QuditId::not_equal

    fn QuditId::not_equal(x : QuditId, y : QuditId) -> Bool

    QuditId::to_repr

    QuditId::value

    fn QuditId::value(self : QuditId) -> UInt64

    measure

    fn[Q : Qid + Eq + Hash] measure(targets : Array[Q], key? : String) -> Operation[Q] raise QuantumError

    space_size

    fn space_size(shape : Array[UInt], max_size? : Int) -> Int raise QuantumError

    Return the product of the dimensions, with a check before each multiply.