Skip to content

Instantly share code, notes, and snippets.

@cgranade
Last active October 17, 2019 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgranade/6e1d177dc33f0bb34132319672c149bf to your computer and use it in GitHub Desktop.
Save cgranade/6e1d177dc33f0bb34132319672c149bf to your computer and use it in GitHub Desktop.
Passing parameters from Q# to Python
# Start from the IQ# base image. The definition for this image can be found at
# https://github.com/microsoft/iqsharp/blob/master/images/iqsharp-base/Dockerfile.
FROM mcr.microsoft.com/quantum/iqsharp-base:0.9.1909.3002
ENV IQSHARP_HOSTING_ENV="cgranade/python-parameters"
USER root
RUN pip install numpy matplotlib
# Make sure the contents of our repo are in ${HOME}.
# These steps are required for use on mybinder.org.
USER root
COPY . ${HOME}
RUN chown -R ${USER} ${HOME}
# Finish by dropping back to the notebook user.
USER ${USER}
namespace Sample {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Measurement;
operation SampleBiasedQrng(angle : Double) : Result {
using (q = Qubit()) {
Ry(angle, q);
return MResetZ(q);
}
}
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment