Skip to content

tequilahub/pauliengine

Repository files navigation

PauliEngine: Fast Arithmetics for Quantum Operators

See more in arXiv:2601.02233

This project is currently in beta. Some features are incomplete or still under development.
The following items are planned or not yet fully implemented:

  • A detailed online Documentation of PauliEngines functionality.

  • Installation via pip.

  • A comprehensive test suite.

Examples

Operator Construction

import pauliengine as pe
# Example : Z on qubit 0 with coefficient 1.0
p1 = pe.PauliString ((1.0, {0: "Z"}))

# Example : X on qubit 1 with coefficient "a" ( symbolic )
p2 = pe.PauliString (("a", {1: "X"}))

# Example : OpenFermion style
p3 = pe.PauliString ((1.0, [("X", 0), ("Y", 2) ]))

Standard Operations

# Addition:
p4 = p2 + p3
# Multiplication
p5 = p4 * p1
# fast commutators
c = p1.commutator(p2)

Parametrized Operators

# create PauliString objects
p1 = pe.PauliString ((1.0 , {0: "Z"})) # not parametrized
p2 = pe.PauliString (("a", {1: "X"}))  # parametrized
# assemble operator
H = QubitHamiltonian([p1 , p2 ])

In beta version, mixed types need to be created like this (create atomic PauliStrings, then assemble operator)

Operations on Parametrized Operators

# Differentiate
dH = H.diff ("a")
# Substitute
H2 = H.subs ({"a": 2.0})

Installation and Build Guide

This guide explains how to install and build SymEngine and integrate it into a C++ project on Windows using Conan, CMake, and Visual Studio.

Note: When the project is built without SymEngine, runtime performance drops significantly!


Prerequisites

Before you begin, make sure you have the following installed:

  • Git (installed and accessible from the command line)

  • CMake (installed and added to your PATH)

  • Python

Step 1: Install Conan

Install Conan via pip:

pip  install  conan

conan  profile  detect

Step 2: Install SymEngine

MacOS only

conan install --build=symengine/0.14.0

Step 3 Clone Project

Clone the project into desired directory.


Step 4 Required packages

pip install nanobind

Step 5: Integrate SymEngine in Your Project

In the directory src

conan  install  .  --output-folder=build  --build=missing

Step 6: Install PauliEngine via pip

In the root directory

pip install .

PauliEngine file can now be used in any Python project, and its functionality can be accessed via:

 import pauliengine

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors