amplify.client.QulacsClient

class QulacsClient

A class for using Qulacs client.

__init__(self: amplify.client.QulacsClient) None

Methods

__init__(self)

solve(*args, **kwargs)

Solves a given polynomial or matrix model.

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)

Solves a given polynomial or matrix model.

Overloads:

  • solve(poly)
  • solve(matrix, constant)
パラメータ
戻り値

A result class that provides information about execution.

戻り値の型

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']
property version

Get the version string of the ampllify.qaoa library.

Type

str