Skip to content

Fast and simple computer algebra system (CAS) for spin-1/2- and spinless-fermion operators.

Notifications You must be signed in to change notification settings

heikoburau/QuantumExpression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuantumExpression

Evaluates arbitrary expressions of spin-1/2 (Pauli) operators and spinless fermions which are defined using a physicist-friendly syntax. Implemented with strong focus on high performance of operator manipulations, e.g. multiplication, by utilizing optimized hash tables. QuantumExpression is a C++ library with a Python interface.

Features

  • Natural syntax for composing arbitrary operators like Hamiltonians or observables.
  • Convertable to dense or sparse matrices.
  • Superior memory efficiency compared to sparse matrices for quasi-local operators.
  • Specific functions like unitrary rotation, hermitian conjugation, Jordan-Wigner transformation, partial trace, etc. included.

Installation

cd python-bindings
python setup.py install

Example

from QuantumExpression import (
    sigma_plus, sigma_minus, sigma_z,
    commutator, frobenius_norm
)
import numpy as np

L = 10

H_0 = -1 / 2 * sum(
    (sigma_plus(i) * sigma_minus(i + 1)) +
    (sigma_plus(i) * sigma_minus(i + 1)).dagger
    for i in range(L - 1)
) + sum(
    sigma_z(i) for i in range(L)
)

V = 0.1 * sum(
    sigma_z(i) * sigma_z(i + 1)
    for i in range(L - 1)
)

H = H_0 + V

print(frobenius_norm(commutator(H_0, H), L))

H_m = H.matrix(L)
print(np.trace(H_m @ H_m.T.conj()))

About

Fast and simple computer algebra system (CAS) for spin-1/2- and spinless-fermion operators.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published