amplify.client.QulacsClient
- class QulacsClient
A class for using Qulacs client.
- __init__(self: amplify.client.QulacsClient) None
Methods
__init__
(self)solve
(*args, **kwargs)Overloaded function.
Attributes
The maximum number of available variables.
Get the parameter class of
QulacsClient
.Get the version string of the ampllify.qaoa library.
- property parameters
Get the parameter class of
QulacsClient
.- Type:
- solve(*args, **kwargs)
Overloaded function.
solve(self: amplify.client.QulacsClient, arg0: amplify.BinaryPoly) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(*args, **kwargs) Solves a given polynomial or matrix model.
Overloads:
- solve(poly)
- solve(matrix, constant)
- Parameters:
poly (
BinaryPoly
,BinaryIntPoly
,IsingPoly
orIsingIntPoly
) –Input polynomial model
matrix (
BinaryMatrix
,BinaryIntMatrix
,IsingMatrix
orIsingIntMatrix
) –Input matrix model
constant (
int
orfloat
, optional) –A constant value to be added to the above matrix. The type is set in accordance with the coefficients of the matrix.
- Returns:
A result class that provides information about execution.
- Return type:
Example
from amplify import BinaryPoly, BinarySymbolGenerator, Solver from amplify.client import QulacsClient gen = BinarySymbolGenerator() q = gen.array(3) f = -2 * q[0] * q[1] - q[0] - q[1] - q[2] + 1 client = QulacsClient() client.parameters.shots = 1024 client.parameters.reps = 10 result = client.solve(f)
>>> f - 2 q_0 q_1 - q_0 - q_1 - q_2 + 1 >>> [f"energy = {s.energy}, q = {q.decode(s.values)}, frequency={s.frequency}" for s in result] ['energy = -4.0, q = [1. 1. 1.], frequency=8', 'energy = -3.0, q = [1. 1. 0.], frequency=15', 'energy = -1.0, q = [1. 0. 1.], frequency=6', 'energy = -1.0, q = [0. 1. 1.], frequency=79', 'energy = 0.0, q = [0. 0. 1.], frequency=438', 'energy = 0.0, q = [0. 1. 0.], frequency=68', 'energy = 0.0, q = [1. 0. 0.], frequency=5', 'energy = 1.0, q = [0. 0. 0.], frequency=405']
solve(self: amplify.client.QulacsClient, arg0: amplify.BinaryIntPoly) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(self: amplify.client.QulacsClient, arg0: amplify.IsingPoly) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(self: amplify.client.QulacsClient, arg0: amplify.IsingIntPoly) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(self: amplify.client.QulacsClient, matrix: amplify.BinaryMatrix, constant: float = 0.0) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(self: amplify.client.QulacsClient, matrix: amplify.BinaryIntMatrix, constant: int = 0) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(self: amplify.client.QulacsClient, matrix: amplify.IsingMatrix, constant: float = 0.0) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(self: amplify.client.QulacsClient, matrix: amplify.IsingIntMatrix, constant: int = 0) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(self: amplify.client.QulacsClient, arg0: amplify.IsingPoly, arg1: amplify.IsingConstraints) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>
solve(self: amplify.client.QulacsClient, arg0: amplify.BinaryPoly, arg1: amplify.BinaryConstraints) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>