Metadata-Version: 2.4
Name: stringebraic
Version: 0.2.1
Summary: String-based Pauli algebraic manipulations
Author-email: Ka Wa Yip <yipkawa@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Ka Wa Yip
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/kwyip/stringebraic
Project-URL: Issues, https://github.com/kwyip/stringebraic/issues
Keywords: Pauli,quantum,inner product
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.3.1
Requires-Dist: numpy; python_version >= "3.1.0"
Provides-Extra: build
Requires-Dist: build; extra == "build"
Requires-Dist: twine; extra == "build"
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: bumpver; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

  <figure>
    <img src="https://github.com/kwyip/stringebraic/blob/main/logo.png?raw=True" alt="logo" height="143" />
  </figure>

[![](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/kwyip/stringebraic/blob/main/LICENSE)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/stringebraic)](https://pypi.org/project/stringebraic/)
[![Static Badge](https://img.shields.io/badge/CalVer-2025.0416-ff5733)](https://pypi.org/project/stringebraic)
[![Static Badge](https://img.shields.io/badge/PyPI-wheels-d8d805)](https://pypi.org/project/stringebraic/#files)
[![](https://pepy.tech/badge/stringebraic/month)](https://pepy.tech/project/stringebraic)

[stringebraic](https://stringebraic.github.io/)
===============================================

Stringebraic is a library of methods for representing a Hamiltonian (i.e., a matrix) as a sum of Pauli *string*s and a quantum state (i.e., a vector) as a sum of *bitstring*s. This perspective allows for a variety of operations using these *string*s, such as matrix-vector multiplication, inner products, and other algebraic manipulations.  
🐦: Why take this approach?  
🐧: Because the computational complexity of these operations typically grows exponentially with the number of qubits—or, equivalently, with the size of the matrix.

In layman&#39;s terms, it automates Pauli algebra by:

1.  removing the concept of matrix and vector size,
2.  performing the matrix multiplication with string-based rules.

#### Input Files:

*   `input_string_list.pkl` – A [pickle](https://docs.python.org/3/library/pickle.html)
        file containing a list of bitstrings that compose the quantum state.</li>
*   `input_string_coeff_list.pkl` – A pickle file containing a list of coefficients that compose the quantum state.
*   `pauli_matrix_list.pkl` – A pickle file containing a list of Pauli strings that compose the Hamiltonian.
*   `pauli_coeff_list.pkl` – A pickle file containing a list of Pauli coefficients that compose the Hamiltonian. 

#### Output:

*   `The inner product value` – A scalar for what the inner product (e.g., expected energy) is.

* * *

Installation
------------

It can be installed with `pip`, ideally by using a [virtual environment](https://realpython.com/what-is-pip/#using-pip-in-a-python-virtual-environment). Open up a terminal and install the package and the dependencies with:  
  

    `pip install stringebraic`

_or_

    `python -m pip install stringebraic`

  
_🐍 This requires Python 3.8 or newer versions_

* * *

### Steps to fast compute the inner product energy using Pauli *string* algebra

1.  **Prepare the input files (i.e., converting the quantum Hamiltonian and quantum state into lists of strings and coefficients, as specified in the above [section](#input-files))**.
2.  **Run the command to generate a inner product (i.e., a scalar)**:  
      
    
           `stringebraic input_string_list.pkl input_string_coeff_list.pkl pauli_matrix_list.pkl pauli_coeff_list.pkl`


* * *

### Test

You may test the installation using the sample input files (`input_string_list.pkl` and
    `input_string_coeff_list.pkl`, `pauli_matrix_list.pkl` and `pauli_coeff_list.pkl`) located in the test folder.

---

♥ Lastly executed on Python `3.10` on 2025-06-05.
