quipper 0.7 → 0.8
raw patch · 29 files changed
+72/−65 lines, 29 filesdep +primesdep ~basedep ~mtldep ~process
Dependencies added: primes
Dependency ranges changed: base, mtl, process, template-haskell, unix
Files
- COPYRIGHT +1/−1
- README +18/−12
- quipper.cabal +2/−2
- src/Libraries/Auxiliary.hs +2/−2
- src/Libraries/CommandLine.hs +1/−1
- src/Libraries/PortableSignals.hs +1/−1
- src/Libraries/RandomSource.hs +1/−1
- src/Libraries/Sampling.hs +1/−1
- src/Libraries/ShowAll.hs +2/−2
- src/Libraries/Template.hs +1/−1
- src/Libraries/Template/Auxiliary.hs +1/−1
- src/Libraries/Template/ErrorMsgQ.hs +1/−1
- src/Libraries/Template/LiftQ.hs +1/−1
- src/Libraries/Template/Lifting.hs +5/−5
- src/Libraries/Tuple.hs +1/−1
- src/Libraries/Typeable.hs +1/−1
- src/Quipper.hs +1/−1
- src/Quipper/CircLifting.hs +5/−5
- src/Quipper/Circuit.hs +1/−1
- src/Quipper/Classical.hs +1/−1
- src/Quipper/Control.hs +1/−1
- src/Quipper/Generic.hs +2/−2
- src/Quipper/Internal.hs +1/−1
- src/Quipper/Labels.hs +2/−1
- src/Quipper/Monad.hs +1/−1
- src/Quipper/Printing.hs +12/−12
- src/Quipper/QClasses.hs +1/−1
- src/Quipper/QData.hs +2/−2
- src/Quipper/Transformer.hs +2/−2
COPYRIGHT view
@@ -4,7 +4,7 @@ name is marked (ACS), the copyright rests with Applied Communication Sciences. -Copyright (C) 2011-2014. All rights reserved.+Copyright (C) 2011-2016. All rights reserved. Copyright (C) 2012-2013 Applied Communication Sciences. All rights reserved.
README view
@@ -1,4 +1,4 @@-This file is part of Quipper. Copyright (C) 2011-2014. Please see the+This file is part of Quipper. Copyright (C) 2011-2016. Please see the file COPYRIGHT for a list of authors, copyright holders, licensing, and other details. All rights reserved. @@ -26,17 +26,17 @@ Before you can compile Quipper, you have to install some Haskell libraries: - * random v.1.0.1.1- * mtl v.2.1.2- * primes v.0.2.1.0- * Lattices v.0.0.1 (note: "Lattices" must be capitalized)- * zlib v.0.5.4.1- * easyrender v.0.1.0.0- * fixedprec v.0.2.1.0- * newsynth v.0.1.0.0- * containers v.0.5.2.1- * set-monad v.0.1.0.0- * QuickCheck v.2.6+ * random >= 1.0.1.1+ * mtl >= 2.1.2+ * primes >= 0.2.1.0+ * Lattices >= 0.0.1 (note: "Lattices" must be capitalized)+ * zlib >= 0.5.4.1+ * easyrender >= 0.1.0.0+ * fixedprec >= 0.2.1.0+ * newsynth >= 0.3.0.1+ * containers >= 0.5.2.1+ * set-monad >= 0.1.0.0+ * QuickCheck >= 2.6 This can be done using Cabal. On the command line, use the following commands:@@ -85,6 +85,12 @@ # also install template-haskell-2.7.0.0: cabal install QuickCheck++Special note for GHC 7.10.*:+============================++Quipper will not work with ghc 7.10. Please use ghc 7.8 or earlier, or+ghc 8.0 or later. Browsing the documentation and source code ==========================================
quipper.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: quipper-version: 0.7+version: 0.8 synopsis: Quipper is an embedded, scalable functional programming language for quantum computing. -- description: homepage: http://www.mathstat.dal.ca/~selinger/quipper/@@ -20,6 +20,6 @@ exposed-modules: Quipper, Quipper.Generic, Quipper.CircLifting, Quipper.Printing, Quipper.Classical, Quipper.QData, Quipper.Internal, Quipper.Monad, Quipper.Control, Quipper.Circuit, Quipper.QClasses, Quipper.Labels, Quipper.Transformer other-modules: Libraries.Template, Libraries.RandomSource, Libraries.CommandLine, Libraries.ShowAll, Libraries.Auxiliary, Libraries.Typeable, Libraries.PortableSignals, Libraries.Sampling, Libraries.Tuple, Libraries.Template.LiftQ, Libraries.Template.Auxiliary, Libraries.Template.ErrorMsgQ, Libraries.Template.Lifting other-extensions: GADTs, RankNTypes, FlexibleInstances, OverlappingInstances, MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances, CPP, StandaloneDeriving, DeriveDataTypeable, ScopedTypeVariables, TypeSynonymInstances, TemplateHaskell, BangPatterns, FlexibleContexts, TypeFamilies, Rank2Types, ExistentialQuantification- build-depends: base >=4.6 && <4.7, random >=1.0 && <1.1, containers >=0.5 && <0.6, unix >=2.6 && <2.7, template-haskell >=2.8 && <2.9, mtl >=2.1 && <2.2, easyrender >=0.1 && <0.2, process >=1.1 && <1.2, directory >=1.2 && <1.3+ build-depends: base >=4.6 && <4.10, random >=1.0 && <1.1, containers >=0.5 && <0.6, unix >=2.6 && <2.8, template-haskell >=2.8 && <2.12, mtl >=2.1 && <2.3, easyrender >=0.1 && <0.2, process >=1.1 && <1.5, directory >=1.2 && <1.3, primes >=0.2 && <0.3 hs-source-dirs: src default-language: Haskell2010
src/Libraries/Auxiliary.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- @@ -731,7 +731,7 @@ blist_concat l = foldr (+++) blist_empty l instance (Show a) => Show (BList a) where- show bl = show (list_of_blist bl) + show bl = show (list_of_blist bl) -- ---------------------------------------------------------------------- -- * Strings optimized for fast concatenation
src/Libraries/CommandLine.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/PortableSignals.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/RandomSource.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/Sampling.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/ShowAll.hs view
@@ -1,11 +1,11 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- -- ====================================================================== {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE OverlappingInstances #-}+ -- | This module extends the 'show' function to be able to convert any -- term to a string, even if its type is not an instance of the 'Show'
src/Libraries/Template.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/Template/Auxiliary.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/Template/ErrorMsgQ.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/Template/LiftQ.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/Template/Lifting.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- @@ -145,7 +145,7 @@ litTHtoExpAST :: TH.Lit -> LiftQ Exp litTHtoExpAST (TH.CharL c) = return $ LitE $ CharL c litTHtoExpAST (TH.StringL s) = return $ ListE $ map (LitE . CharL) s-litTHtoExpAST (TH.IntegerL i) = return $ LitE $ IntegerL i +litTHtoExpAST (TH.IntegerL i) = return $ LitE $ IntegerL i litTHtoExpAST (TH.RationalL r) = return $ LitE $ RationalL r litTHtoExpAST x = errorMsg ("lifting not handled for " ++ (show x)) @@ -153,7 +153,7 @@ litTHtoPatAST :: TH.Lit -> LiftQ Pat litTHtoPatAST (TH.CharL c) = return $ LitP $ CharL c litTHtoPatAST (TH.StringL s) = return $ ListP $ map (LitP . CharL) s-litTHtoPatAST (TH.IntegerL i) = return $ LitP $ IntegerL i +litTHtoPatAST (TH.IntegerL i) = return $ LitP $ IntegerL i litTHtoPatAST (TH.RationalL r) = return $ LitP $ RationalL r litTHtoPatAST x = errorMsg ("lifting not handled for " ++ (show x)) @@ -558,13 +558,13 @@ liftExpAST (CaseE exp matches) = do exp' <- liftExpAST exp matches' <- mapM liftMatchAST matches- fresh_name <- newName "case"+ fresh_name <- newName "varfromcase" return $ doE [BindS fresh_name exp'] $ CaseE (VarE fresh_name) matches' liftExpAST (ListE exps) = do exps' <- mapM liftExpAST exps- fresh_names <- mapM newName $ replicate (length exps) "liste"+ fresh_names <- mapM newName $ replicate (length exps) "varfromlist" return $ doE (map (uncurry BindS) $ zip fresh_names exps') $ AppE ReturnE $ ListE $ map VarE fresh_names
src/Libraries/Tuple.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Libraries/Typeable.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Quipper.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Quipper/CircLifting.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- @@ -359,9 +359,9 @@ -- > 1 |--N------- output: not a. template_not :: Circ (Qubit -> Circ Qubit) template_not = return $ \b -> do- r <- qinit_qubit True;+ r <- qinit_qubit True; qnot_at r `controlled` b- return r+ return r ----------------------------------------------------------------------@@ -400,7 +400,7 @@ template_symb_vbar_symb_vbar_ = return $ \b1 -> return $ \b2 -> do r <- qinit_qubit True; qnot_at r `controlled` b1 .==. 0 .&&. b2 .==. 0;- return r+ return r -- | Lifted version of 'bool_xor':@@ -417,7 +417,7 @@ template_bool_xor :: Circ (Qubit -> Circ (Qubit -> Circ Qubit)) template_bool_xor = return $ \b1 -> return $ \b2 -> do r <- qinit_qubit False- qnot_at r `controlled` b1+ qnot_at r `controlled` b1 qnot_at r `controlled` b2 return r
src/Quipper/Circuit.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Quipper/Classical.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Quipper/Control.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Quipper/Generic.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- @@ -361,7 +361,7 @@ do_bit :: Bit -> Circ Bit do_bit = return --- | Heterogeneous version of 'measure'. Given a heterogeneous data+-- | Heterogeneous version of 'prepare'. Given a heterogeneous data -- structure, prepare qubits from all classical bits, and leave any -- qubits unchanged. qc_prepare :: (QCData qc) => qc -> Circ (QCType Qubit Qubit qc)
src/Quipper/Internal.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Quipper/Labels.hs view
@@ -1,9 +1,10 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- -- ====================================================================== +{-# LANGUAGE Unsafe #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-}
src/Quipper/Monad.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Quipper/Printing.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- @@ -499,25 +499,25 @@ assign_x_coordinates :: FormatStyle -> [Gate] -> X -> (X, [(Gate, X)]) assign_x_coordinates fs gs x0 = let ((x,ws), xgs) = mapAccumL (\ (x, ws) g ->- -- count the wires attached to the gate. If there is precisely- -- one (unary gate), merge it with adjacent unary gates. Do- -- not merge comments.+ -- count the wires attached to the gate. If there is precisely+ -- one (unary gate), merge it with adjacent unary gates. Do+ -- not merge comments. let merge = case (g, wirelist_of_gate g) of (Comment _ _ _, _) -> Nothing (_, [w]) -> Just w (_, _) -> Nothing in- case merge of+ case merge of Just w -> if not (w `elem` ws) then- ((x, w:ws), (g, x))- else- ((x + (xoff fs), [w]), (g, x + (xoff fs)))+ ((x, w:ws), (g, x))+ else+ ((x + (xoff fs), [w]), (g, x + (xoff fs))) _ ->- if ws == [] then- ((x + (xoff fs), []), (g, x))- else- ((x + 2.0 * (xoff fs), []), (g, x + (xoff fs)))+ if ws == [] then+ ((x + (xoff fs), []), (g, x))+ else+ ((x + 2.0 * (xoff fs), []), (g, x + (xoff fs))) ) (x0, []) gs in if ws == [] then
src/Quipper/QClasses.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. --
src/Quipper/QData.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- @@ -1012,7 +1012,7 @@ -- initialized from a 'Bool'; a 'Qubit' can be measured, resulting in -- a 'Bit', etc. For this reason, the type class 'QShape' establishes a -- relation between three types:--- +-- -- [@qa@] A data structure having 'Qubit' at the leaves. -- -- [@ca@] A data structure of the same shape as @qa@, having 'Bit' at
src/Quipper/Transformer.hs view
@@ -1,4 +1,4 @@--- This file is part of Quipper. Copyright (C) 2011-2014. Please see the+-- This file is part of Quipper. Copyright (C) 2011-2016. Please see the -- file COPYRIGHT for a list of authors, copyright holders, licensing, -- and other details. All rights reserved. -- @@ -593,7 +593,7 @@ transformer :: Transformer m a b, define_subroutine :: BoxId -> TypedSubroutine -> m (), lifting_function :: b -> m Bool- } + } -- | Like 'transform_bcircuit_rec', but for dynamic-boxed circuits. --