MIMIQ Cloud interaction
MimiqLink.Connection
— Typestruct Connection
Connection with the MIMIQ Services.
Attributes
uri
: the URI of the connected instancetokens_channel
: channel updated with the latest refreshed tokenrefresher
: task that refreshes the token on a configured interval
MimiqLink.Tokens
— Typestruct Tokens
Store access and refresh tokens
MimiqLink.Execution
— Typestruct Execution
Structure referring to an execution on the MIMIQ Services.
MimiqLink.connect
— Functionconnect([; url=https://mimiq.qperfect.io])
connect(token[; url=https://mimiq.qperfect.io])
connect(username, password[; url=https://mimiq.qperfect.io])
Establish a connection to the MIMIQ Services.
A refresh process will be spawned in the background to refresh the access credentials. An active connection can be closed by using the close(connection)
method. As an example:
connection = connect("john.doe@example.com", "johnspassword")
close(connection)
The first method will open a login page in the default browser and ask for your email and password. This method is encouraged, as it will avoid saving your password as plain text in your scripts or notebooks.
MimiqLink.savetoken
— Functionsavetoken([filename][; uri="https://mimiq.qperfect.io/api"])
Establish a connection to the MIMIQ Services and save the credentials in a JSON file.
Arguments
filename
: file where to save the credentials (default:qperfect.json
)
Keyword arguments
uri
: the uri of the MIMIQ Services (default:https://mimiq.qperfect.io/api
)
Example
julia> savetoken("myqperfectcredentials.json")
julia> connection = loadtoken("myqperfectcredentials.json")
MimiqLink.loadtoken
— Functionloadtoken([filename])
Establish a connection to the MIMIQ Services by loading the credentials from a JSON file.
Arguments
filename
: file where to load the credentials (default:qperfect.json
)
The credentials are usually valid only for a small amount of time, so you may need to regenerate them from time to time.
Example
julia> savetoken("myqperfectcredentials.json")
julia> connection = loadtoken("myqperfectcredentials.json")
MimiqCircuits.getresults
— Functiongetresults(connection, execution; kwargs...)
Block until the given execution is finished and return the results.
Keyword Arguments
interval
: time interval in seconds to check for job completion (default: 10)
MimiqCircuits.getinputs
— Functiongetinputs(connection, execution)
Returns the circuit and parameters for the given execution.
MimiqCircuits.execute
— Functionexecute(connection, circuit[; kwargs...])
Execute a quantum circuit on the MIMIQ remote services.
The circuit is applied to the zero state and the resulting state is measured via sampling. Optionally amplitudes corresponding to few selected bit states (or bitstrings) can be returned from the computation.
Keyword Arguments
label::String
: mnemonic name to give to the simulation, will be visible on the web interfacealgorithm
: algorithm to use by the compuation. By default"auto"
will select the fastest algorithm between"statevector"
or"mps"
.nsamples::Integer
: number of times to sample the circuit (default: 1000, maximum: 2^16)bitstates::Vector{BitState}
: list of bit states to compute the amplitudes for (default:BitState[]
)timelimit
: number of seconds before the computation is stopped (default: 300 seconds or 5 minutes)bonddim::Int64
: bond dimension for the MPS algorithm (default: 256, maximum: 4096)seed::Int64
: a seed for running the simulation (default: random seed)
MimiqCircuits.printreport
— Functionprintreport(res::MimiqCircuits.Results; kwargs...)
Print a report on the MIMIQ simulation results res
Keyword Arguments
max_outcomes
: the maximum number of unique measurement outcomes to display (default 8)