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.
-
GroupedProb
Extension 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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
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 insummaryQubits
conditioned to measure the aformentioned combination in the qubits ingroupQubits
. This is equivalent to get the probability of each possible combination of qubits insummaryQubits
after collapsing the qubits ingroupQubits
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 insummaryQubits
and its value the probability of such combination if qubits ingroupQubits
collapse to the first key. Combinations with probability 0 are not included. OrGroupedProbabilitiesError
error. -
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
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. -
summarizedProbabilities(byQubits:
Extension method) 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. -
summarizedProbabilities(byQubits:
Extension method) 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.