Skip to content

Commit

Permalink
Copied qchem_300_Universality_Givens problem templates
Browse files Browse the repository at this point in the history
  • Loading branch information
xanadu-qubot committed Feb 14, 2022
1 parent 3a63f03 commit c9638aa
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-1.5707963267948963,-1.5707963267948966,-1.5707963267948966
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.5,0.5,0.5,0.5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0701416143903084,-0.39479111969976155,0.7124798514013161
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.
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=",")

0 comments on commit c9638aa

Please sign in to comment.