Safe Haskell | None |
---|
This module provides some automated tests for the algebraic optimization procedure. The main function are:
testArith5
: runs the optimization on a reversible adder generated with Template Haskell and exhaustively tests all the values.testCircSimpl
andtestCircSwap
: using the Test.QuickCheck library, perform optimization on randomly generated circuits and test validity for some random input.
Synopsis
- myAdder :: ([Qubit], [Qubit]) -> Circ [Qubit]
- myArith :: ([Qubit], [Qubit]) -> Circ [Qubit]
- myCircArith :: Int -> (CircState, [Wire])
- bCircArith :: Int -> BCircuit
- wire_of_endpoint :: B_Endpoint t t -> t
- runArithDry :: Int -> Int -> Int -> Int
- runArith :: Int -> Int -> Int -> Int
- testArith5 :: Bool
- choose :: [b] -> Int -> [[b]]
- genCirc :: Int -> Int -> Gen ([Gate], [Wire])
- printSampleCirc :: Int -> Int -> IO ()
- restrict :: Ord k => [k] -> Map k a -> Map k a
- testCircSimpl :: Property
- testCircSwap :: Property
- myQuickTest :: Property -> IO Result
Testing an adder
wire_of_endpoint :: B_Endpoint t t -> t Source #
Extract the underlying Wire
from a B_Endpoint
.
testArith5 :: Bool Source #
Exhaustively test all the inputs of the optimized adder.
Randomized tests
The following functions use the Test.QuickCheck library. They generate random circuits, and run them classically before and after optimization.
genCirc :: Int -> Int -> Gen ([Gate], [Wire]) Source #
Generate a random circuit with the given number of inputs and ancillas.
testCircSimpl :: Property Source #
Test of simplRec
.
testCircSwap :: Property Source #
Test of alg_swap
.