Skip to content

Package for expressing, composing, and costing quantum algorithm subroutines

License

Notifications You must be signed in to change notification settings

zapatacomputing/qsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qsub Package

Overview

The qsub package is a Python framework designed for expressing complex quantum algorithms and predicting their costs. At the heart of qsub is the SubroutineModel class, which facilitates the hierarchical construction of algorithms. Users can build algorithms by linking together various subroutines and profiling their overall cost.

Installation

  1. Clone the Repository:

    git clone [email protected]:zapatacomputing/qsub.git
    
  2. Navigate to the Cloned Directory:

    cd qsub
    
  3. Install the Package:

    pip install .
    

    Alternatively, if you're actively developing the package and want to install it in editable mode:

    pip install -e .
    
  4. Verify Installation: You can verify that the package has been installed correctly by importing it in a Python interpreter or script:

    python
    >>> import qsub
    

These steps assume that you have Python and pip installed on your system. If not, please install Python from python.org and follow the instructions to install pip.

Usage

Basic Example

Here's a quick example to get you started:

from qsub.quantum_algorithms.general_quantum_algorithms.amplitude_estimation import (
    QuantumAmplitudeEstimation,
)

# Initialize your algorithm
amp_est = QuantumAmplitudeEstimation()


# Set requirements
estimation_error = 0.001
failure_tolerance = 0.01

amp_est.set_requirements(
    estimation_error=estimation_error,
    failure_tolerance=failure_tolerance,
)

# Run the profile for this subroutine
amp_est.run_profile()
amp_est.print_profile()

print("qubits =", amp_est.count_qubits())

print(amp_est.count_subroutines())

Advanced Usage

For more complex scenarios, see the examples directory.

Features

  • SubroutineModel: Core class for creating and managing subroutines.
  • Cost Analysis Tools: Tools for profiling the cost and resource requirements of algorithms.
  • Flexible Subroutine Integration: Easily swap and integrate different subroutines.

Contributing

We welcome contributions! If you're interested in adding more subroutines or enhancing the framework, please follow these steps:

  1. Fork the repository.
  2. Create your feature branch (git checkout -b feature/AmazingFeature).
  3. Add file(s) with your chages (git add path/to/file_1 path/to/file_2).
  4. Commit your changes (git commit -m 'commit message').
  5. Push to the branch (git push origin feature/AmazingFeature).
  6. Open a Pull Request.

Running tests

First, install development dependencies with

pip install -e '.[dev]'

Then, to run tests, execute the commmand:

pytest tests

About

Package for expressing, composing, and costing quantum algorithm subroutines

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages