Thursday, October 31, 2024

Parity

COPILOT 

Qiskit; explain to me the notion of qubit parity.

In quantum computing, "qubit parity" refers to the concept of measuring whether the number of qubits in a particular state is even or odd. This is particularly useful in error detection and correction.

 Key Points about Qubit Parity:


1. Parity Measurement: This involves checking the equality of two or more qubits to determine if they are in the same state (even parity) or different states (odd parity). For example, if you measure two qubits and both are in the state |0> or both are in the state |1>, the parity is even. If one is in |0> and the other in |1>, the parity is odd.


2. Error Detection: Parity measurements are crucial in quantum error correction. By measuring the parity of qubits, you can detect errors without directly measuring the state of each qubit, which would collapse their quantum state.


3. Joint Measurement: Parity measurement is an example of a joint measurement, meaning it provides information about the collective state of multiple qubits rather than the state of individual qubits.


4. Implementation in Qiskit: In Qiskit, you can implement parity checks using controlled operations like CNOT gates. For instance, to check the parity of two qubits, you can use a CNOT gate with one qubit as the control and the other as the target¹.


Would you like to see an example of how to implement a parity check in Qiskit?

                                                 *     *     *

                                                            



Both collapsed to 0, the parity is even.

                                                                       

                                                               *     *     *

Checking parity with Sampler as a simulator. The result looks different, but means

the same thing. The two qubits are in even parity because I have a (app) 50% chance of

to zeros and a (app) 50% chance of two 1s.



*     *     *

A little post-punk tune, as befits the day. I'm off for my walk!!




Starburster LYRICS

[Verse 2]
I wanna talk with a gag if it's a bottle or bag
I wanna strike with the SAG, I need the friends from it
I want a shot in the dark, I wanna make the mark
I want to live the arcI call the ends on it
I wanna take the truth without a lens on it
My God given insanity, it depends on it
How I feel? How I feel? How I feel? I wanna keel

Over harder than a turned-up challenger
I wanna keep all of your charm in a canister
Do you inspire like the same did Salinger?
I'm the pig on the Chinese calendar
I got a shadow like a .58 Caliber
I wanna move like a new Salamander
I love the carrion who's a real Scavenger
It's moral tyranny keeping me from thee

[Instrumental Break]

[Interlude]
Hit me for the day
For the light
That you suffered
To come by
Take to my sky
Never wanting
Only wonder
To live out of reach
Sloping family
Short to tall

One to three
Swallow the key
In their footprints
I will follow

Wednesday, October 30, 2024

HappyH

                                                                          

HAPPY HALLOWEEN!




*     *     *
COPILOT:

Quantum computing with qiskit; what is a 'promise'?

In the context of quantum computing with Qiskit, a "promise" typically refers to a condition or constraint that is guaranteed to be true for a given problem. This concept is often used in the context of quantum algorithms, particularly in promise problems.

A promise problem is a type of computational problem where the input is guaranteed to satisfy a certain condition (the promise). This allows the algorithm to focus on solving the problem under the assumption that the input meets the specified criteria. For example, Grover's algorithm is designed to search an unsorted database, but it assumes that there is exactly one item that matches the search criteria. This assumption is the "promise" of the problem.

In summary, a promise in quantum computing is a predefined condition that the input to a problem must satisfy, allowing the algorithm to operate under specific constraints and potentially achieve better performance1

If you have any specific questions about how promises are used in quantum algorithms or need further clarification, feel free to ask!

                                                 *     *     *

Checked in with the Coding with Qiskit site and the Derek Wang series. I am up to

Episode 5, so will be working throught that in the next few days. It is what I was hoping

for: how to create dynamic circuits that use classical code to link quantum operations.

Below:

https://youtu.be/QDPtcwhpQkE?si=KF_GLsnG3SInavvA


The site also contains a number of John Watrous lectures which should keep me out of 

trouble.


Finally, would like to review all that I did with SharmaLearn, and see to what extent

I am now at ease with what was covered...


                                                       *     *     *

Totally enjoying this weather!


Tuesday, October 29, 2024

Security

 This is ridiculous. I am trying to solve one of these slide puzzles from the

Temu app (so that I can look at fleece-lined leggins) and I keep failing.

Copilot suggested to me the aim was to complete a missing part of the image,

and that I should work from the corners. No luck so far!!


                                         


Perplexity suggested I switch browsers; and that worked out for me. Ended up on the

French-language site, with a puzzle I understood:

                                                                  

Yeah!, I'm on the site:


Switched languages and those leggings are mine:

                                                                              


                                                                        

Monday, October 28, 2024

All_readings

 Ran the Grover code on an actual quantum machine overnight; ibm_brisbane,

The results were as expected from the code. There were readings on the not marked,

due to the probabilistic nature of the whole, or perhaps noise...


                                                      



*     *     *

To run yesterday's code on an actual quantum machine:

                                                                           
                                                         ...



Next day:                                                                                       









Sunday, October 27, 2024

Grover_Definitive

 Grover's algorithm from the IBM tutorial. The marked gates can be changed.

The Grover operator is imported...

                                                                  







*     *     *

qc.compose(MCMT(ZGate(), num_qubits - 1, 1), inplace=True)

COPILOT:

That line of code in Qiskit is performing a specific quantum operation using Grover's algorithm. Let's break it down:

qc.compose(...) is a method that combines or appends a quantum circuit or gate to the existing quantum circuit qc.

MCMT(ZGate(), num_qubits - 1, 1) is creating a multi-controlled multi-target (MCMT) gate. In this case, it's a multi-controlled Z gate. The ZGate() is the gate being controlled, num_qubits - 1 specifies the number of control qubits, and 1 specifies the number of target qubits.

inplace=True means that the operation is performed directly on the existing circuit qc without creating a new circuit.

So, this line is adding a multi-controlled Z gate to the quantum circuit qc, with num_qubits - 1 control qubits and 1 target qubit, modifying the circuit in place. This is part of the amplitude amplification step in Grover's algorithm, which helps to increase the probability of measuring the desired state.

Quantum computing can be quite the brain teaser, right? If you have more questions or need further clarification, feel free to ask!

StateV

 For qiskit Statevector and StatevectorSampler:

https://www.perplexity.ai/search/qiskit-what-is-the-current-cod-NuE8ykAgRpGRM4oGidRdFA


Altered the GeeksforGeeks Grover code to run on StatevectorSamplor (without noise

simulation). 

One creates the sampler at the very beginning...

                                                                            


The output needs to be queried!!

                                                                          








Saturday, October 26, 2024

Grover's_2

 Below, a version of Grover's algorithm from Gooks for Geeks:


                                  






COPILOT

Grover's algorithm: how does adding a phase to a qubit increase its amplitude??

Grover's algorithm is a fascinating quantum search algorithm that leverages the principles of quantum mechanics to achieve a quadratic speedup over classical algorithms for unstructured search problems. The key to understanding how adding a phase to a qubit increases its amplitude lies in the concept of amplitude amplification.

In Grover's algorithm, the process involves two main steps: phase inversion and amplitude amplification. Here's a simplified breakdown:

Phase Inversion: The algorithm first applies an oracle function that flips the phase of the desired state(s). This means that the amplitude of the desired state(s) is multiplied by -1, effectively inverting its phase.

Amplitude Amplification: After the phase inversion, the algorithm applies a series of operations that amplify the amplitude of the desired state(s) while suppressing the amplitudes of the other states. This is achieved through a process called the Grover diffusion operator, which inverts the amplitudes of all states about their average amplitude.

By iterating these steps, the amplitude of the desired state(s) increases, making it more likely to be measured when the quantum state is observed. Essentially, the phase inversion marks the desired state(s), and the amplitude amplification process boosts their probability of being found.

Grover's

 




Copilot

Sent by Copilot:

Grover’s algorithm is a quantum algorithm designed for searching an unsorted database or solving unstructured search problems more efficiently than classical algorithms. It provides a quadratic speedup, meaning it can find a specific item in a list of (N) elements in (O(\sqrt{N})) operations, compared to (O(N)) operations required by classical algorithms.

Key Concepts of Grover’s Algorithm:

  1. Oracle: A quantum subroutine that marks the correct solution by flipping its phase.
  2. Amplitude Amplification: Increases the probability amplitude of the correct solution while decreasing the amplitudes of incorrect ones.
  3. Grover Iteration: Consists of applying the oracle followed by the diffusion operator (inversion about the mean).

Implementation in Qiskit:

  1. Initialize Qubits: Start with a superposition of all possible states.
  2. Apply Oracle: Use a quantum circuit to mark the correct state.
  3. Apply Diffusion Operator: Amplify the probability of the correct state.
  4. Repeat: Perform the Grover iteration (\approx \sqrt{N}) times.
  5. Measure: Collapse the quantum state to the correct solution.

Here’s a simple example of implementing Grover’s algorithm in Qiskit:

Friday, October 25, 2024

Pondering

Trying to get a better intuitive grasp of what happens during phase estimation.

Two suggestions that have come forth from discussion with the Ai is outputting

a unitary matrix, or a statevector. Below, the unitary matrix approach.


Fro this to make sense, the circuit has to be in superposition and entangled. I have

altered my example code in this direction:

                                                            






( I checked, the result is the same for the two circuit definitions.)

                                                                     


Something to ponder...











E_College

 For US Presidential Elections, the outcome is not decided by popular vote.

https://news.westernu.ca/2024/10/how-the-electoral-college-works/