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.
-
GroupedProbExtension methodCheck value returned by
CircuitProbabilities.groupedProbabilities(byQubits:summarizedByQubits:roundingSummaryToDecimalPlaces:).Declaration
Swift
public typealias GroupedProb = (probability: Double, summary: [String : Double])
-
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: [Int], summarizedByQubits summaryQubits: [Int] = [], roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsList of qubits for which we want to know the probability of each combination.
summaryQubitsList of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: [Int], summarizedByQubits summaryQubits: Range<Int>, roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsList of qubits for which we want to know the probability of each combination.
summaryQubitsRange of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: [Int], summarizedByQubits summaryQubits: ClosedRange<Int>, roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsList of qubits for which we want to know the probability of each combination.
summaryQubitsRange of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: Range<Int>, summarizedByQubits summaryQubits: [Int] = [], roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsRange of qubits for which we want to know the probability of each combination.
summaryQubitsList of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: Range<Int>, summarizedByQubits summaryQubits: Range<Int>, roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsRange of qubits for which we want to know the probability of each combination.
summaryQubitsRange of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: Range<Int>, summarizedByQubits summaryQubits: ClosedRange<Int>, roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsRange of qubits for which we want to know the probability of each combination.
summaryQubitsRange of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: ClosedRange<Int>, summarizedByQubits summaryQubits: [Int] = [], roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsRange of qubits for which we want to know the probability of each combination.
summaryQubitsList of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: ClosedRange<Int>, summarizedByQubits summaryQubits: Range<Int>, roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsRange of qubits for which we want to know the probability of each combination.
summaryQubitsRange of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
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 insummaryQubitsconditioned to measure the aformentioned combination in the qubits ingroupQubits. This is equivalent to get the probability of each possible combination of qubits insummaryQubitsafter collapsing the qubits ingroupQubitswith a measurement.Declaration
Swift
public func groupedProbabilities(byQubits groupQubits: ClosedRange<Int>, summarizedByQubits summaryQubits: ClosedRange<Int>, roundingSummaryToDecimalPlaces places: Int? = nil) -> Result<[String: GroupedProb], GroupedProbabilitiesError>Parameters
groupQubitsRange of qubits for which we want to know the probability of each combination.
summaryQubitsRange of qubits for which we want to know the probability of each combination once the qubits in
groupQubitscollapse to a value. if an empty list is provided, an empty summary will be returned.placesIf 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
groupQubitsand its value the probability of such combination plus another dictionary where each key is a combination of qubits insummaryQubitsand its value the probability of such combination if qubits ingroupQubitscollapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesErrorerror. -
summarizedProbabilities()Extension methodReturns 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.
-
summarizedProbabilities(byQubits:Extension method) Returns the probability of each possible combination of qubits in
qubitsbigger than 0.Declaration
Swift
public func summarizedProbabilities(byQubits qubits: [Int]) -> Result<[String : Double], SummarizedProbabilitiesError>Parameters
qubitsList 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
SummarizedProbabilitiesErrorerror. -
summarizedProbabilities(byQubits:Extension method) Returns the probability of each possible combination of qubits in
qubitsbigger than 0.Declaration
Swift
public func summarizedProbabilities(byQubits qubits: Range<Int>) -> Result<[String : Double], SummarizedProbabilitiesError>Parameters
qubitsRange 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
SummarizedProbabilitiesErrorerror. -
summarizedProbabilities(byQubits:Extension method) Returns the probability of each possible combination of qubits in
qubitsbigger than 0.Declaration
Swift
public func summarizedProbabilities(byQubits qubits: ClosedRange<Int>) -> Result<[String : Double], SummarizedProbabilitiesError>Parameters
qubitsRange 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
SummarizedProbabilitiesErrorerror.
CircuitProbabilities Protocol Reference