-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copied qchem_300_Universality_Givens problem templates
- Loading branch information
xanadu-qubot
committed
Feb 14, 2022
1 parent
3a63f03
commit c9638aa
Showing
6 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-1.5707963267948963,-1.5707963267948966,-1.5707963267948966 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.5,0.5,0.5,0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0701416143903084,-0.39479111969976155,0.7124798514013161 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.8062,-0.5,-0.1,-0.3 |
Binary file not shown.
29 changes: 29 additions & 0 deletions
29
Coding_Challenges/qchem_300_Universality_Givens_template/universality_givens_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! /usr/bin/python3 | ||
|
||
import sys | ||
import numpy as np | ||
|
||
|
||
def givens_rotations(a, b, c, d): | ||
"""Calculates the angles needed for a Givens rotation to out put the state with amplitudes a,b,c and d | ||
Args: | ||
- a,b,c,d (float): real numbers which represent the amplitude of the relevant basis states (see problem statement). Assume they are normalized. | ||
Returns: | ||
- (list(float)): a list of real numbers ranging in the intervals provided in the challenge statement, which represent the angles in the Givens rotations, | ||
in order, that must be applied. | ||
""" | ||
|
||
# QHACK # | ||
|
||
# QHACK # | ||
|
||
|
||
if __name__ == "__main__": | ||
# DO NOT MODIFY anything in this code block | ||
inputs = sys.stdin.read().split(",") | ||
theta_1, theta_2, theta_3 = givens_rotations( | ||
float(inputs[0]), float(inputs[1]), float(inputs[2]), float(inputs[3]) | ||
) | ||
print(*[theta_1, theta_2, theta_3], sep=",") |