-
Notifications
You must be signed in to change notification settings - Fork 167
Add inverse to QFT implementation #705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Changes from all commits
6283c6e
7ec91b9
a0d7f94
7b1e285
3b07c0c
e939393
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,8 @@ | |
| #include "quest/include/matrices.h" | ||
| #include "quest/include/channels.h" | ||
|
|
||
| #include <stdbool.h> | ||
|
|
||
| #ifdef __cplusplus | ||
| #include <vector> | ||
| #endif | ||
|
|
@@ -2406,14 +2408,71 @@ extern "C" { | |
| #endif | ||
|
|
||
|
|
||
| /// @notyetdoced | ||
| /// @notyetvalidated | ||
| void applyQuantumFourierTransform(Qureg qureg, int* targets, int numTargets); | ||
| /** @notyetdoced | ||
| * @notyetvalidated | ||
| * | ||
| * Applies the Quantum Fourier Transform to the specified @p targets of @p qureg. | ||
| * Alternatively, applies the Inverse Quantum Fourier Transform according to @p inverse. | ||
| * | ||
| * @formulae | ||
| * | ||
| * Letting @f$ N @f$ = @p numTargets, the @f$ N @f$ qubit Quantum Fourier Transform maps each | ||
| * computational basis state of the targeted qubits, @f$ \ket{j} @f$, according to | ||
| * @f[ | ||
| \ket{j} \rightarrow \frac{1}{\sqrt{2^N}} \sum_{k=0}^{2^N-1} e^{2 \pi i j k / 2^N} \ket{k}. | ||
| * @f] | ||
| * Similarly the Inverse Quantum Fourier Transform maps each basis state like | ||
| * @f[ | ||
| \ket{j} \rightarrow \frac{1}{\sqrt{2^N}} \sum_{k=0}^{2^N-1} e^{-2 \pi i j k / 2^N} \ket{k}. | ||
| * @f] | ||
| * | ||
| * @param[in,out] qureg the state to modify. | ||
| * @param[in] targets the indices of the target qubits. | ||
| * @param[in] numTargets the length of list @p targets | ||
| * @param[in] inverse whether to apply the inverse QFT or forward QFT | ||
| * @throws @validationerror | ||
| * - if @p qureg is uninitialised. | ||
| * - if @p targets are invalid qubit indices. | ||
| * - if @p targets are not unique. | ||
| * - if @p numTargets < 1. | ||
| * @see | ||
| * - applyFullQuantumFourierTransform() | ||
| * @author Vasco Ferreira | ||
| */ | ||
| void applyQuantumFourierTransform(Qureg qureg, int* targets, int numTargets, bool inverse); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically, type
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy to update this, just a note that PR #702 also included a
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch @TysonRayJones! My thoughts are that:
So in my opinion we should include stdbool.h and use bool here. |
||
|
|
||
|
|
||
| /// @notyetdoced | ||
| /// @notyetvalidated | ||
| void applyFullQuantumFourierTransform(Qureg qureg); | ||
| /** @notyetdoced | ||
| * @notyetvalidated | ||
| * | ||
| * Applies the Quantum Fourier Transform to each qubit in @p qureg. Alternatively, | ||
| * applies the Inverse Quantum Fourier Transform according to @p inverse. | ||
| * | ||
| * @formulae | ||
| * | ||
| * The Quantum Fourier Transform maps each computational basis state @f$ \ket{j} @f$ | ||
| * in an @f$ N @f$ qubit @p qureg according to | ||
| * @f[ | ||
| \ket{j} \rightarrow \frac{1}{\sqrt{2^N}} \sum_{k=0}^{2^N-1} e^{2 \pi i j k / 2^N} \ket{k}. | ||
| * @f] | ||
| * Similarly the Inverse Quantum Fourier Transform maps each basis state like | ||
| * @f[ | ||
| \ket{j} \rightarrow \frac{1}{\sqrt{2^N}} \sum_{k=0}^{2^N-1} e^{-2 \pi i j k / 2^N} \ket{k}. | ||
| * @f] | ||
| * | ||
| * @equivalences | ||
| * | ||
| * - This function wraps applyQuantumFourierTransform() with all the qubits in the @p qureg as @p targets. | ||
| * | ||
| * @param[in,out] qureg the state to modify. | ||
| * @param[in] inverse whether to apply the inverse QFT or forward QFT | ||
| * @throws @validationerror | ||
| * - if @p qureg is uninitialised. | ||
| * @see | ||
| * - applyQuantumFourierTransform() | ||
| * @author Vasco Ferreira | ||
| */ | ||
| void applyFullQuantumFourierTransform(Qureg qureg, bool inverse); | ||
|
|
||
|
|
||
| // end de-mangler | ||
|
|
@@ -2429,7 +2488,7 @@ void applyFullQuantumFourierTransform(Qureg qureg); | |
| /// @notyetdoced | ||
| /// @cppvectoroverload | ||
| /// @see applyQuantumFourierTransform() | ||
| void applyQuantumFourierTransform(Qureg qureg, std::vector<int> targets); | ||
| void applyQuantumFourierTransform(Qureg qureg, std::vector<int> targets, bool inverse); | ||
|
|
||
|
|
||
| #endif // __cplusplus | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 3b07c0c.