Safe Haskell | None |
---|
Algorithms.QLS.TemplateOracle
Description
This module contains an implementation of the oracle and its automatic lifting to quantum circuits using Template Haskell.
- local_any :: (a -> Bool) -> [a] -> Bool
- itoxy :: Int -> Int -> Int -> (Int, Int)
- sinc :: Double -> Double
- edgetoxy :: Int -> Int -> Int -> (Double, Double)
- calcmatrixelement :: Int -> Int -> Int -> Int -> Double -> Double -> Double -> Complex Double
- checkedge :: Int -> [(Double, Double)] -> Int -> Int -> Bool
- calcRweights :: Int -> Int -> Int -> Double -> Double -> Double -> Double -> Double -> Complex Double
- convertband :: Int -> Int -> Int -> Int -> Int
- getNodeValuesMoreOutputs :: Int -> Int -> Int -> Int -> [(Double, Double)] -> Double -> Double -> Double -> BoolParam -> Int -> (Int, Double)
- calcincidentfield :: Int -> Int -> Int -> Double -> Double -> Double -> Double -> Double -> Complex Double
- getconnection :: Int -> Int -> Int -> Int -> Int -> Int
- local_loop_with_index_aux :: Int -> Int -> t -> (Int -> t -> t) -> t
- local_loop_with_index :: Int -> t -> (Int -> t -> t) -> t
- getKnownWeights :: Int -> Int -> Int -> [(Double, Double)] -> Double -> Double -> Double -> Double -> Double -> Int -> Complex Double
Documentation
calcmatrixelement :: Int -> Int -> Int -> Int -> Double -> Double -> Double -> Complex DoubleSource
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).
calcRweights :: Int -> Int -> Int -> Double -> Double -> Double -> Double -> Double -> Complex DoubleSource
Oracle r.
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 DoubleSource
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.
local_loop_with_index_aux :: Int -> Int -> t -> (Int -> t -> t) -> tSource
Auxiliary function to
.
template_paramZero
local_loop_with_index :: Int -> t -> (Int -> t -> t) -> tSource
Local version of
, for lifting.
loop_with_index