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

num_bits

The maximum number of available variables.

parameters

Get the parameter class of QulacsClient.

version

Get the version string of the ampllify.qaoa library.

property num_bits

The maximum number of available variables.

Type:

int

property parameters

Get the parameter class of QulacsClient.

Type:

QulacsClientParameters

solve(*args, **kwargs)

Overloaded function.

  1. 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:
Returns:

A result class that provides information about execution.

Return type:

QulacsClientResult

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']
  1. solve(self: amplify.client.QulacsClient, arg0: amplify.BinaryIntPoly) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

  2. solve(self: amplify.client.QulacsClient, arg0: amplify.IsingPoly) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

  3. solve(self: amplify.client.QulacsClient, arg0: amplify.IsingIntPoly) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

  4. solve(self: amplify.client.QulacsClient, matrix: amplify.BinaryMatrix, constant: float = 0.0) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

  5. solve(self: amplify.client.QulacsClient, matrix: amplify.BinaryIntMatrix, constant: int = 0) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

  6. solve(self: amplify.client.QulacsClient, matrix: amplify.IsingMatrix, constant: float = 0.0) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

  7. solve(self: amplify.client.QulacsClient, matrix: amplify.IsingIntMatrix, constant: int = 0) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

  8. solve(self: amplify.client.QulacsClient, arg0: amplify.IsingPoly, arg1: amplify.IsingConstraints) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

  9. solve(self: amplify.client.QulacsClient, arg0: amplify.BinaryPoly, arg1: amplify.BinaryConstraints) -> libqam::client::ClientResult<libqam::client::QulacsClient, decltype(nullptr)>

property version

Get the version string of the ampllify.qaoa library.

Type:

str