Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@

"medium" level bindings to qulacs cppsim using cxxbridge.

## Usage

This library requires that QULACAS_PATH is set and points at the direction of a qulacs install.

Additionally you will need to include a `build.rs` in your project that provides the -fopenmp
flag to your linker.

```rust
fn main() {
println!("cargo:rustc-link-arg=-fopenmp");
}
```

## Sample Code

```rust
let state = new_quantum_state(3, false);
set_haar_random_state(&state);
// Not a random state here.

let circuit = new_quantum_circuit(3);
add_x_gate(&circuit, 0);
let merged_gate = merge(&new_cnot_gate(0, 1), &new_y_gate(1));
add_gate_copy(&circuit, &merged_gate);
add_r_x_gate(&circuit, 1, 0.5);
update_quantum_state(&circuit, &state, 1);

let observable = new_observable(3);
add_operator(&observable, 2.0.into(), "X 2 Y 1 Z 0");
add_operator(&observable, (-3.0).into(), "Z 2");
let value = get_expectation_value(&observable, &state);
```

## Development

The recommended way to develop is using [devenv.sh](https://devenv.sh/) and [direnv](https://direnv.net/).
Expand Down
9 changes: 5 additions & 4 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{ pkgs, lib, config, inputs, ... }:
let
qulacs = pkgs.callPackage ./nix/qulacs.nix {};
in {
qulacs = pkgs.callPackage ./nix/qulacs.nix { };
in
{
env = {
QULACS_PATH = qulacs;
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
};

packages = [
pkgs.boost
pkgs.eigen
pkgs.mpi
qulacs

pkgs.release-plz
pkgs.cargo-semver-checks
];
Expand Down