The Quipper System

Safe HaskellNone

Quipper.Algorithms.QLS.TemplateOracle

Description

This module contains an implementation of the oracle and its automatic lifting to quantum circuits using Template Haskell.

Synopsis

Documentation

local_any :: (a -> Bool) -> [a] -> Bool Source #

Lifted version of any (local version).

itoxy :: Int -> Int -> Int -> (Int, Int) Source #

Auxiliary function.

sinc :: Double -> Double Source #

The function sin x / x.

edgetoxy :: Int -> Int -> Int -> (Double, Double) Source #

Auxiliary function.

calcmatrixelement :: Int -> Int -> Int -> Int -> Double -> Double -> Double -> Complex Double Source #

Auxiliary function. The inputs are:

  • y1 :: Int - Global edge index of row index of desired matrix element;
  • y2 :: Int - Global edge index of column index of desired matrix element;
  • nx :: Int - Number of vertices left to right;
  • ny :: Int - Number of vertices top to bottom;
  • lx :: Double - Length of horizontal edges (distance between vertices in x direction);
  • ly :: Double - Length of vertical edges (distance between vertices in y direction);
  • k :: Double - Plane wave wavenumber.

The output is the matrix element A(y1, y2).

get_edges :: [a] -> [(a, a)] Source #

Auxiliary function.

template_get_edges :: Circ ([a] -> Circ [(a, a)]) Source #

checkedge :: Int -> [(Double, Double)] -> Int -> Int -> Bool Source #

Auxiliary function.

calcRweights :: Int -> Int -> Int -> Double -> Double -> Double -> Double -> Double -> Complex Double Source #

Oracle r.

convertband :: Int -> Int -> Int -> Int -> Int Source #

Auxiliary function for oracle A.

getNodeValuesMoreOutputs :: Int -> Int -> Int -> Int -> [(Double, Double)] -> Double -> Double -> Double -> BoolParam -> Int -> (Int, Double) Source #

Oracle A. It is equivalent to the Matlab function getBandNodeValues.

getNodeValuesMoreOutputs v b ... outputs the node of the edge connected to vertex v in band b, and a real number parameterized by the BoolParam parameter: the magnitude (PFalse) or the phase (PTrue) of the complex value at the corresponding place in the matrix A.

calcincidentfield :: Int -> Int -> Int -> Double -> Double -> Double -> Double -> Double -> Complex Double Source #

Auxiliary function for oracle b. The inputs are:

  • y :: Int - Global edge index. Note this is the unmarked y coordinate, i.e. the coordinate without scattering regions removed;
  • nx :: Int - Number of vertices left to right;
  • ny :: Int - Number of vertices top to bottom;
  • lx :: Double - Length of horizontal edges (distance between vertices in x direction);
  • ly :: Double - Length of vertical edges (distance between vertices in y direction);
  • k :: Double - Plane wave wavenumber;
  • θ :: Double - Direction of wave propagation;
  • E0 :: Double - Magnitude of incident plane wave.

The output is the magnitude of the electric field on edge y.

getconnection :: Int -> Int -> Int -> Int -> Int -> Int Source #

Auxiliary function for oracle b.

local_loop_with_index_aux :: Int -> Int -> t -> (Int -> t -> t) -> t Source #

Auxiliary function to template_paramZero.

template_local_loop_with_index_aux :: Circ (Int -> Circ (Int -> Circ (t -> Circ ((Int -> Circ (t -> Circ t)) -> Circ t)))) Source #

local_loop_with_index :: Int -> t -> (Int -> t -> t) -> t Source #

Local version of loop_with_index, for lifting.

template_local_loop_with_index :: Circ (Int -> Circ (y -> Circ ((Int -> Circ (y -> Circ y)) -> Circ y))) Source #

getKnownWeights :: Int -> Int -> Int -> [(Double, Double)] -> Double -> Double -> Double -> Double -> Double -> Int -> Complex Double Source #

Oracle b.