The Quipper System

Safe HaskellNone

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.

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.

class QFloating a where Source #

A type class for quantum floating-point numbers.

Minimal complete definition

q_sin, q_cos

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 Re on QDouble: a quantum complex is a pair of two QDoubles.

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

Quantum implementation of Im on QDouble: 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_mkPolar :: Circ (QDouble -> Circ (QDouble -> Circ (QDouble, QDouble))) Source #

Template version of mkPolar.

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

Template version of the constructor :+ of Complex.

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

Template version of magnitude.

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

Template version of realPart.

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

Template version of imagPart.

Orphan instances