The Quipper System

Safe HaskellNone

Quipper.Algorithms.QLS.RealFunc

Contents

Description

Define various analytic functions for FDouble and QDouble.

Synopsis

Some analytic functions on FDouble.

approx_sin :: FDouble -> FDouble Source #

Approximation of the sine function using Taylor series.

local_sin :: FDouble -> FDouble Source #

Implementation of the sine function valid on the whole domain of FDouble.

local_cos :: FDouble -> FDouble Source #

Implementation of the cosine function valid on the whole domain of FDouble.

approx_sqrt :: Int -> FDouble -> FDouble Source #

Auxiliary function for local_sqrt.

local_sqrt :: FDouble -> FDouble Source #

Approximation of the square root using iterative means.

local_mag :: FDouble -> FDouble -> FDouble Source #

The function magnitude defined for FDouble. Calculate the non-negative magnitude of a complex number.

rotate :: FDouble -> FDouble -> FDouble -> FDouble -> FDouble -> FDouble -> (FDouble, FDouble) Source #

Apply the matrix

 ( a b )
 ( c d )

to the column vector (x,y).

approx_atan2 :: FDouble -> FDouble -> FDouble Source #

Definition of atan2 using a CORDIC method. Assume (x,y) is in first quadrant and that x > y.

local_atan2 :: FDouble -> FDouble -> FDouble Source #

Definition of atan2 using a CORDIC method. x and y can be any FDouble.

local_mkPolar :: FDouble -> FDouble -> (FDouble, FDouble) Source #

The function mkPolar defined for FDouble. Form a complex number from polar components of magnitude and phase.

class QFloating a where Source #

A type class for quantum floating-point numbers.

Methods

q_sin :: a -> Circ a Source #

Quantum implementation of the sine function.

q_cos :: a -> Circ a Source #

Quantum implementation of the cosine function.

q_atan2 :: QDouble -> QDouble -> Circ QDouble Source #

Quantum implementation of atan2 on QDouble.

q_magnitude :: (QDouble, QDouble) -> Circ QDouble Source #

Quantum implementation of magnitude on QDouble.

q_mkPolar :: QDouble -> QDouble -> Circ (QDouble, QDouble) Source #

Quantum implementation of mkPolar on QDouble.

q_Re :: (QDouble, QDouble) -> Circ QDouble Source #

Quantum implementation of realPart on QDouble: return the real part of a complex number. A quantum complex is a pair of two QDoubles.

q_Im :: (QDouble, QDouble) -> Circ QDouble Source #

Quantum implementation of imagPart on QDouble: return the imaginary part of a copmlex number. A quantum complex is a pair of two QDoubles.

Template subroutines of analytic functions.

template_sin :: Circ (QDouble -> Circ QDouble) Source #

Template version of sin.

template_cos :: Circ (QDouble -> Circ QDouble) Source #

Template version of cos.

template_atan2 :: Circ (QDouble -> Circ (QDouble -> Circ QDouble)) Source #

Template version of atan2.

Template subroutines for dealing with quantum complex number encoded as pairs of QDouble.

template_symb_colon_symb_plus_ :: Circ (QDouble -> Circ (QDouble -> Circ (QDouble, QDouble))) Source #

Template version of the constructor :+ of Complex.

Orphan instances