The Quipper System

Safe HaskellNone

Algorithms.CL.Main

Contents

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 the nearest integer, using a version of the the (quantum) HSP algorithm.
  2. Classically, refine the approximation from part 1 to higher accuracy.
  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; see also http://arxiv.org/abs/quant-ph/0302134
  • 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.

Option processing

data WhatToShow Source

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

data Subroutine Source

An enumeration type for selecting a subroutine.

Constructors

Rho 
RhoInv 
Normalize 
DotProd 
StarProd 
FN 

subroutine_enum :: [(String, Subroutine)]Source

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 

Fields

what :: WhatToShow

What kind of thing to output.

format :: Format

The output format.

gatebase :: GateBase

What kind of gates to decompose into.

sub :: Subroutine

Which subroutine to output (if what == Sub).

cl_delta :: CLIntP

The discriminant Δ, specifying the problem.

cl_i :: Int

i, log_2 of the estimated bound 2^i for the weak period S.

cl_r :: CLReal

The (good) approximation R of the period.

cl_q :: CLIntP

The parameter q for stage 4 of the algorithm.

cl_k :: CLIntP

The parameter k for stage 4 of the algorithm.

cl_n :: CLIntP

The parameter n for stage 4 of the algorithm.

cl_m :: CLIntP

The parameter m for stage 4 of the algorithm.

cl_generators :: [IdealRed]

A generating set for CL(K).

cl_seed :: Int

The seed for the random generator (0 for seed from time)

Instances

defaultOptions :: OptionsSource

The default options.

showDefault :: Show a => (Options -> a) -> StringSource

Show the default value of an option.

options :: [OptDescr (Options -> IO Options)]Source

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

dopts :: [String] -> IO OptionsSource

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

Main function: read options, then execute the appropriate task.

main_stage1 :: Options -> IO ()Source

Main function for outputting the circuit for stage 1 of Hallgren’s algorithm.

main_stage4 :: Options -> IO ()Source

Main function for outputting the circuit for stage 4 of Hallgren’s algorithm.

main_sub :: Options -> IO ()Source

Main function for outputting the circuits for specific subroutines.