Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 0c99b1003662bd784e6c4d9d5053874918cc5ade authored by EPiQC on 08 July 2019, 21:28:06 UTC, committed by GitHub on 08 July 2019, 21:28:06 UTC
Merge pull request #38 from AndrewLitteken/master
Segmentation Faults and Fixes to Run main branch on macOS
2 parent s 98275a9 + 5ea8679
  • Files
  • Changes
  • 5e79c08
  • /
  • scripts
  • /
  • gen_rotations
  • /
  • README.md
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:0c99b1003662bd784e6c4d9d5053874918cc5ade
directory badge
swh:1:dir:1408a35b70b1bbe12b313101d88ff7b526e17071
content badge
swh:1:cnt:85dea788769d15bb4e2273f4fad80dc1232a90d5

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
README.md
# Rotation Library Generator

This is a C++ implemetation of the *library construction* method for generating *Rz* rotations. The main features of this generator include:
  - Powered by [gridsynth](http://www.mathstat.dal.ca/~selinger/newsynth/), the package can generate rotation sequences that approximate arbitray *Rz* angles, up to given precision.
  - Generate libraries of rotation sequences given use-defined precision and storage requirements, trading storage for execution time.
  - Dynamically concatenate rotation sequences at run time using generated libraries.

### Library Construction Method

The library construction method stems from optimizations for dynamic code generation. Specifically, many quantum algorithms, like Ground State Estimation, require arbitrary rotation angles (either known or unknown at compile time), which is typically realized/approximated by a sequence of operations, such as the Cifford+T gates. Rather than calling core generator for all rotations at run time, the library construction method uses a pre-compiled library (of some basis angles), and rapidly assembles the library rotations to construct the desired angle. 

### Example

We have provided an example code to help you getting started with the tool. To compile the example code, run
```sh
$ make
$./example 2 2 3 110 1
```
which will produce a library with precision up to 3 binrary floating point digits. It will not exceed 110 bytes in size.

More concretely, when generating a rotation library for the first time, you would need to specify the following parameters as input:
- The library will then consist of angles: {pi, pi/b, pi/b<sup>2</sup>, pi/b<sup>3</sup>, ... }, until the required precision can be achieved.
  - *b*: basis of the angles. 
- The guaranteed precision will be *k* base-*n* places. E.g. if *n=10, k=10*, then the angles generated is guaranteed to have precision up to 10 decimal places.
  - *n*: base of precision (can be 2 or 10).
  - *k*: number of places in base-*n* precision
- For storage, you would need to provide the size and the unit, such as 100 KB. 
- You may also specify whether to have the rotations decomposed up to global phase or not.

Some important functions from RotLib class you may take advantage of are:
- RotLib::generate() - which envokes the core rotation generator and decompresses rotation sequences with Huffman encoding.
- RotLib::save(filename) - which writes the encoded library into output file.
- RotLib::load(filename) - which loads previously saved library from file.
- RotLib::concatenate(angle[, factor]) - which automatically assembles library angles for the desired angle, optionally with factor = "pi". Note that angle is in RotLib::Rz type, whose members include:
  - angle -> theta: rotation angle in radian
  - angle -> gates: the decomposed rotation sequence
  - angle -> length: number of operations in sequence

Yongshan (yongshan@uchicago.edu)
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API