# Dirac-2

### Overview

Dirac-2 is a "qudit" entropy quantum computer. It minimizes quadratic Hamiltonian operators over a positive integer domain. It uses the same principles as Dirac-1 and all other EQC devices to perform computations.

### Our Qudit Programming model

Our qudit programming model, available on the Dirac-2 quantum computer, is

$H(z)=\sum_jh_jz_j+\sum_{ij}J_{ij}z_iz_j$

where the

*z’s*are*integer variables*which can have the values 0 − 63 and {h, J} are constants. Analogous to the QUBO and Ising model, the programmer’s job is to set the*h*values (linear terms) and*J*values (quadratic terms) in order to solve the problem, which has been expressed in integer decision variables. There is an additional built-in constraint as follows:$\sum_jz_j=100$

This constraint is specific to Dirac-2. Subsequent generations of EQC will have the flexibility to specify the sum total and eventually, no restriction. An implication of this constraint is that a model must have a natural constraint, which can have its variables scaled to the range 1-100 or the modeling done in a clever way to fit into the total. Another consequence is that interpretation of the model may lead to non-integer results. Again, this is a step in the development of Dirac and not a long-term restriction.

## Data format

To upload a Hamiltonian operator, we encode it in a sparse matrix format as shown below. We use Numpy array notation. The order-2 Hamiltonian supported by Dirac-2 has two parts. The first part is a single-dimension array for the linear terms. The second part is a two-dimension array for the quadratic terms. They will be called `h` and `J`, respectively.

1

`h = np.array([-1, -1, -1])`

1

`J = np.array([[0, -1.5, 0.5], [-1.5, 0, 0], [0.5, 0, 0]])`

We put these together into one matrix sized

`NxN+1`

. 1

`H = np.hstack([h, J])`

then the JSON will take the following list of dictionary sparse matrix format:

` {(i,j): value}`

123456789101112131415161718192021222324252627282930313233343536373839404142

```
hamiltonian_data = {
"data": [
{
"i": 0,
"j": 0,
"val": -1
},
{
"i": 1,
"j": 0,
"val": -1
},
{
"i": 2,
"j": 0,
"val": -1,
},
{
"i": 0,
"j": 2,
"val": -1.5
},
{
"i": 0,
"j": 3,
"val": 0.5
},
{
"i": 1,
"j": 1,
"val": -1.5
},
{
"i": 2,
"j": 1,
"val": 0.5
}
],
"file_name": "simple_hamiltonian.json", # can be any short string
"num_variables": 3, # number of rows
"file_type": "hamiltonian" # defines the data type as hamiltonian
}
```

## Uploading

To upload the matrix encoded above in

`hamiltonian_data`

, we use the the `qci_client`

imported previously. The following line 1

`response_json = qci.upload_file(qubo_data)`

The response contains a

`file_id`

for the uploaded file. This id is provided when a job is run, along a few other parameters (see #Running). Note: the same `file_id`

can be used multiple times to run a problem repeatedly. This enables an "upload once, run many times" scheme, which is especially useful for job types in which parameter searches may be involved.