Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Enhancements to Microsoft.Quantum.Preparation namespace #344

@msoeken

Description

@msoeken

Enhancements to Microsoft.Quantum.Preparation namespace

Proposal

Deprecated API

(full signatures for replacements are listed below)

  • function QuantumROM(targetError: Double, coefficients: Double[])PurifiedMixedState
  • function QuantumROMQubitCount(targetError: Double, nCoeffs: Int)PurifiedMixedStateRequirements
  • operation PrepareQubit(basis : Pauli, qubit : Qubit)PreparePauliEigenstate
  • operation PrepareArbitraryState(coefficients : ComplexPolar[], qubits : LittleEndian)PrepareArbitraryStateCP
  • function StatePreparationComplexCoefficients(coefficients : ComplexPolar[]) → only as operation PrepareArbitraryStateCP
  • function StatePreperationPositiveCoefficients(coefficients : Double[]) → only as operation PrepareArbitraryStateD

New UDTs

newtype MixedStatePreparation = (
    Requirements: MixedStatePreparationRequirements,
    Norm: Double,
    Prepare: ((LittleEndian, Qubit[], Qubit[]) => Unit is Adj + Ctl)
);

newtype MixedStatePreparationRequirements = (
    NTotalQubits: Int,
    (
        NIndexQubits: Int,
        NDataQubits: Int,
        NGarbageQubits: Int
    )
);

Note that Prepare takes as second parameter an additional Qubit register to prepare auxiliary data, e.g., the sign of a coefficient.

New or modified functions and operations

M.Q.Preparation namespace

  • function PurifiedMixedState(targetError : Double, coefficients : Double[]) : MixedStatePreparation
    (new name and signature for QuantumROM)
  • function PurifiedMixedStateWithData(targetError : Double, coefficients : (Double, Bool[])[]) : MixedStatePreparation
  • function PurifiedMixedStateRequirements(targetError : Double, nCoefficients : Int) : MixedStatePreparationRequirements
  • operation PreparePauliEigenstate(basis : Pauli, qubit : Qubit) : Unit
  • operation PrepareArbitraryStateCP(coefficients : ComplexPolar[], qubits : LittleEndian) : Unit is Adj + Ctl
  • operation PrepareArbitraryStateD(coefficients : Double[], qubits : LittleEndian) : Unit is Adj + Ctl
  • function BlochSphereCoordinates(a0 : ComplexPolar, a1 : ComplexPolar) : (ComplexPolar, Double, Double)

Update: As per API review discussions, the term "purified mixed state" is used in the context of this proposal to mean states of the form |ψ⟩ = Σᵢ √𝑝ᵢ |𝑖⟩ |garbageᵢ⟩ specified by a vector of coefficients {𝑝ᵢ}. States of this form can be reduced to mixed states ρ ≔ 𝑝ᵢ |𝑖⟩⟨𝑖| by tracing over the "garbage" register (that is, a mixed state that is diagonal in the computational basis). Similarly, a "purified mixed state with data" refers to a state of the form Σᵢ √𝑝ᵢ |𝑖⟩ |𝑥ᵢ⟩ |garbageᵢ⟩, where each 𝑥ᵢ is a bitstring encoding additional data associated with the register |𝑖⟩.

See https://arxiv.org/pdf/1805.03662.pdf?page=15 for further discussion.

M.Q.Convert namespace

  • function DoubleAsComplexPolar(input : Double) : ComplexPolar

Example use cases

Prepare purified mixed state and also output sign of coefficient

let coefficients = [3.14, -1.59, -2.65, -3.58];

// extract sign and wrap it into singleton Bool array
let data = Mapped(ConstantArray(1, _), Mapped(LessThanD(_, 0.0), coefficients));

let state = PurifiedMixedStateWithData(10e-2, Zipped(coefficients, data));
let reqs = state::Requirements;
using ((indexQubits, dataQubits, garbageQubits) = (reqs::NIndexQubits, reqs::NDataQubits, reqs::NGarbageQubits)) {
  state::Prepare(LittleEndian(indexQubits), dataQubits, garbageQubits);

  let signQubit = Head(dataQubits);
  // ...
}

Considerations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-APIIssue concerns the API design of a library, such as style guide or design principles adherence.Kind-EnhancementNew feature or requestPkg-StandardIssue relates to the Microsoft.Quantum.Standard package.Resolution-DoneIssue closed because work item completed.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions