CircuitProbabilities

public protocol CircuitProbabilities

Probabilities of each possible combinations of qubits

  • Returns the probabilities of each possible combinations of qubits.

    Declaration

    Swift

    func probabilities() -> [Double]

    Return Value

    A list in which each position represents a qubit combination and the value in a position the probability of such combination.

Public types

Public methods

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: [Int],
                                     summarizedByQubits summaryQubits: [Int] = [],
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    List of qubits for which we want to know the probability of each combination.

    summaryQubits

    List of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: [Int],
                                     summarizedByQubits summaryQubits: Range<Int>,
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    List of qubits for which we want to know the probability of each combination.

    summaryQubits

    Range of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: [Int],
                                     summarizedByQubits summaryQubits: ClosedRange<Int>,
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    List of qubits for which we want to know the probability of each combination.

    summaryQubits

    Range of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: Range<Int>,
                                     summarizedByQubits summaryQubits: [Int] = [],
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    Range of qubits for which we want to know the probability of each combination.

    summaryQubits

    List of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: Range<Int>,
                                     summarizedByQubits summaryQubits: Range<Int>,
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    Range of qubits for which we want to know the probability of each combination.

    summaryQubits

    Range of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: Range<Int>,
                                     summarizedByQubits summaryQubits: ClosedRange<Int>,
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    Range of qubits for which we want to know the probability of each combination.

    summaryQubits

    Range of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: ClosedRange<Int>,
                                     summarizedByQubits summaryQubits: [Int] = [],
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    Range of qubits for which we want to know the probability of each combination.

    summaryQubits

    List of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: ClosedRange<Int>,
                                     summarizedByQubits summaryQubits: Range<Int>,
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    Range of qubits for which we want to know the probability of each combination.

    summaryQubits

    Range of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in groupQubits. For each of these combinations, it also lists the probability of each possible combination of qubits in summaryQubits conditioned to measure the aformentioned combination in the qubits in groupQubits. This is equivalent to get the probability of each possible combination of qubits in summaryQubits after collapsing the qubits in groupQubits with a measurement.

    Declaration

    Swift

    public func groupedProbabilities(byQubits groupQubits: ClosedRange<Int>,
                                     summarizedByQubits summaryQubits: ClosedRange<Int>,
                                     roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>

    Parameters

    groupQubits

    Range of qubits for which we want to know the probability of each combination.

    summaryQubits

    Range of qubits for which we want to know the probability of each combination once the qubits in groupQubits collapse to a value. if an empty list is provided, an empty summary will be returned.

    places

    If provided, probabilities in each summary are rounded to the given number of decimal places. Notice that if a probability ends up rounded to 0.0, it is removed from the summary.

    Return Value

    A dictionary where each key is a combination of qubits in groupQubits and its value the probability of such combination plus another dictionary where each key is a combination of qubits in summaryQubits and its value the probability of such combination if qubits in groupQubits collapse to the first key. Combinations with probability 0 are not included. Or GroupedProbabilitiesError error.

  • summarizedProbabilities() Extension method

    Returns the probability of each possible combination of qubits bigger than 0.

    Declaration

    Swift

    public func summarizedProbabilities() -> [String : Double]

    Return Value

    A dictionary where each key is a qubit combination and its value the probability of such combination. Combination with probability 0 are not included.

  • Returns the probability of each possible combination of qubits in qubits bigger than 0.

    Declaration

    Swift

    public func summarizedProbabilities(byQubits qubits: [Int]) -> Result<[String : Double], SummarizedProbabilitiesError>

    Parameters

    qubits

    List of qubits for which we want to know the probability of each combination.

    Return Value

    A dictionary where each key is a qubit combination and its value the probability of such combination. Combination with probability 0 are not included. Or SummarizedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in qubits bigger than 0.

    Declaration

    Swift

    public func summarizedProbabilities(byQubits qubits: Range<Int>) -> Result<[String : Double], SummarizedProbabilitiesError>

    Parameters

    qubits

    Range of qubits for which we want to know the probability of each combination.

    Return Value

    A dictionary where each key is a qubit combination and its value the probability of such combination. Combination with probability 0 are not included. Or SummarizedProbabilitiesError error.

  • Returns the probability of each possible combination of qubits in qubits bigger than 0.

    Declaration

    Swift

    public func summarizedProbabilities(byQubits qubits: ClosedRange<Int>) -> Result<[String : Double], SummarizedProbabilitiesError>

    Parameters

    qubits

    Range of qubits for which we want to know the probability of each combination.

    Return Value

    A dictionary where each key is a qubit combination and its value the probability of such combination. Combination with probability 0 are not included. Or SummarizedProbabilitiesError error.