The Quipper System

Algorithms.CL.Main

Description

Authors: Keith Kim, Peter LeFanu Lumsdaine, Alexandr Virodov

An implementation of Hallgren’s Class Number algorithm. This algorithm computes various invariants of a real quadratic number field K = ℚ(√Δ), notably the class number and the structure of the class group CL(K). The field K is specified by its discriminant Δ, the main input to the algorithm.

The algorithm may also be adapted to other problems from algebraic number theory, including Pell's equation (finding integer solutions to x 2dy 2 = 1, for non-square d) and the principal ideal problem (determining whether an ideal of a number field is principal, and finding a generator if so).

The present implementation falls into five stages, which we will refer to throughout the documentation:

1. Approximate the regulator of K, to low precision, using a version of the the (quantum) HSP algorithm.
2. Classically, refine the approximation from part 1 to higher precision.
3. Classically compute a small generating set for the class group, using the value of the regulator from part 2.
4. Compute relations for these generators, again using a version of the HSP algorithm.
5. Classically compute from these the structure of the class group, and hence the class number.

Further details are given in the documentation of individual modules.

The algorithm and its mathematical background are described in:

• Sean Hallgren, "Polynomial-time quantum algorithms for Pell’s equation and the principal ideal problem", in STOC ’02: Proceedings of the thirty-fourth annual ACM symposium on Theory of computing, pp. 653–658, 2002. (Also published in J. ACM, 54(1), 2007.)
• Richard Jozsa, "Quantum computation in algebraic number theory: Hallgren’s efficient quantum algorithm for solving Pell’s equation." Annals of Physics, 306:241–279, February 2003; also available as http://arxiv.org/abs/quant-ph/0302134. All references in documentation refer to arXiv version.
• Daniel Haase and Helmut Maier, "Quantum algorithms for number fields." Fortschr. Phys., 54(8):866–881, 2006.

The present implementation is based on a detailed algorithm specification that was provided to us by the IARPA QCS program and written by Brian J. Matt, Durward McDonell, and David Zaret.

Modules:

Synopsis

# Command line interface

This module provides a command line interface for Hallgren’s Class Number algorithm. This allows the user, for example, to print or simulate the circuits used in quantum portions of the algorithm, or to run small instances of the algorithm in a classical implementation.

Sample invocations:

>>> ./cl -R


Compute, classically, the regulator of ℚ[√Δ], with Δ = 28 (default value).

>>> ./cl -P -d 17


Compute, classically, the fundamental solution of Pell’s equation x2dy2 = 1 with d = Δ = 17.

>>> ./cl -S fn -d 5 -f eps > cl_fn_d5.eps


Produce an .eps file of the quantum circuit implementing the pseudo-periodic function fN used for regulator estimation, for Δ = 5

>>> ./cl -S starprod -d 60 -f gatecount


Give gate-count for the quantum circuit implementing the star-product on ideals, for Δ = 17

>>> ./cl --help


Print detailed usage information.

# Option processing

An enumeration type for determining what the main function should do.

Constructors

 Stage1 Show the circuit for stage 1 of the algorithm Stage4 Show the circuit for stage 4 of the algorithm Sub Show the circuit for a specific quantum subroutine Regulator Classically, find the regulator FundamentalUnit Classically, find the fundamental unit PellSolution Classically, find the fundamental solution of Pell’s equation

Instances

 # MethodsshowList :: [WhatToShow] -> ShowS #

An enumeration type for selecting a subroutine.

Constructors

 Rho RhoInv Normalize DotProd StarProd FN

Instances

 # Methods # Methods # MethodsshowList :: [Subroutine] -> ShowS #

An enumeration of available subroutines. (Compare format_enum, gatebase_enum.)

data Options Source #

A data type to hold values set by command line options.

Constructors

 Options Fieldswhat :: WhatToShowWhat kind of thing to output.format :: FormatThe output format.gatebase :: GateBaseWhat kind of gates to decompose into.sub :: SubroutineWhich subroutine to output (if what == Sub).cl_delta :: CLIntPThe discriminant Δ, specifying the problem.cl_i :: Inti, log_2 of the estimated bound 2^i for the weak period S.cl_r :: CLRealThe (good) approximation R of the period.cl_q :: CLIntPThe parameter q for stage 4 of the algorithm.cl_k :: CLIntPThe parameter k for stage 4 of the algorithm.cl_n :: CLIntPThe parameter n for stage 4 of the algorithm.cl_m :: CLIntPThe parameter m for stage 4 of the algorithm.cl_generators :: [IdealRed]A generating set for CL(K).cl_seed :: IntThe seed for the random generator (0 for seed from time)

Instances

 # MethodsshowList :: [Options] -> ShowS #

The default options.

show_default :: Show a => (Options -> a) -> String Source #

Show the default value of an option.

The list of command line options, in the format required by getOpt.

dopts :: [String] -> IO Options Source #

Process argv-style command line options into an Options structure.

usage :: IO () Source #

Print usage message to stdout.

# The CL circuit generation main function

main :: IO () Source #