,      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij k l m n o p q r s t u v w x y z { | } ~                NoneA axis is either I, H, or SH. ;A type class for things that can be exactly converted to a 7 Clifford operator. One particular instance of this is , so / that Clifford operators can be denoted, e.g.,   to_clifford "-iX" 5The valid characters for such string conversions are " XYZHSEIWi-". 3Convert any suitable thing to a Clifford operator. 5A type representing single-qubit Clifford operators.  The Pauli X-gate as a Clifford operator.  The Pauli Y-gate as a Clifford operator.  The Pauli Z-gate as a Clifford operator. *The Hadamard gate as a Clifford operator. The Clifford operator S. The Clifford operator SH. The Clifford operator E = HS[sup 3]uni__969__[sup 3]. This operator is ' uniquely determined by the properties E uni__179__ = I,  EXE==|*~!%|==uni__185__ = Y, EYE==|*~!%|==uni__185__ = Z, and EZE==|*~!%|==uni__185__ = X. [ image E.png] (The Clifford operator uni__969__ = [exp i uni__960__/4]. Given a Clifford operator U , return (a, b, c, d ) such that  U = E[sup a]X[sup b]S[sup c]uni__969__[sup d],  a ==|*+!?|== {0, 1, 2}, b ==|*+!?|== {0, 1}, c$ ==|*+!?|== {0, ==|*?~.|==, 3}, and d ==|*+!?|== {0, ==|*?~.|==,  7}. Here, E = HS[sup 3]uni__969__[sup 3] . Note that E, X, S, and uni__969__ have order D 3, 2, 4, and 8, respectively. Moreover, each Clifford operator can # be uniquely represented as above. Given a Clifford operator U , return (K, b, c, d ) such that  U = KX[sup b]S[sup c]uni__969__[sup d],  K ==|*+!?|== {I, H, SH}, b ==|*+!?|== {0, 1}, c$ ==|*+!?|== {0, ==|*?~.|==, 3}, and d ==|*+!?|== {0, ==|*?~.|==,  7}.  The identity Clifford operator. Clifford multiplication. Clifford inverse. Given a Clifford gate C, return an axis K ==|*+!?|== {I, H, SH}  and a Clifford gate C' such that  CT = KTC'.  c b returns (c', d' ) such that  S[sup c]X[sup b] = X[sup b]S[sup c']uni__969__[sup d'].  b c a returns (a', b', c', d' ) such that  X[sup b]S[sup c]E[sup a] = E[sup a']X[sup b']S[sup c']uni__969__[sup d'].  a b c returns (a', b', c', d' ) such that  (E[sup a]X[sup b]S[sup c])==|*~!%|==uni__185__ = E[sup a']X[sup b']S[sup c']uni__969__[sup d']. tconj2 a b returns (K, c, d ) such that  E[sup a]X[sup b]T = KTX[sup b]S[sup c]uni__969__[sup d].      Safe-Inferred$We provide a replacement for Haskell's , because the  latter depends on the  class, which limits its  applicability.  Safe-Inferred7BA type class for things that can be converted to a real number at  arbitrary precision. ;A type to represent symbolic expressions for real numbers. Caution: equality + at this type denotes symbolic equality of 8 expressions, not equality of the defined real numbers. arctan2 x y. acosh x. atanh x. asinh x. cosh x. tanh x. sinh x. !acos x. "atan x. #asin x. $cos x. %cos x. &sin x. 'x[sup y]. (log x. ) ==|*+~.|==x. *[exp x]. +e. , uni__960__. -1/x. .signum(x). /|x|. 0= =|*+??|==x. 1x / y. 2x * y. 3x  ==|*+??|== y. 4x + y. 5KA decimal constant. This has a rational value and a string representation. 6An integer constant. 7@It would be useful to have a function for converting a symbolic < real number to a fixed-precision real number with a chosen $ precision, such that the precision e depends on a parameter d:  ; to_fixedprec :: (ToReal r) => Integer -> r -> FixedPrec e  to_fixedprec d x = ... However, since e is a type, d is a term, and Haskell is not 2 dependently typed, this cannot be done directly.  The function 7# is the closest thing we have to a  workaround. The call dynamic_fixedprec d f x calls  f(x' ), where x' is the value x converted to d digits of % precision. In other words, we have  1 dynamic_fixedprec d f x = f (to_fixedprec d x), (with the restriction that the precision e cannot occur freely in  the result type of f. 8Like 7), but take two real number arguments. In " terms of the fictitious function  to_fixedprec , we have: G dynamic_fixedprec2 d f x y = f (to_fixedprec d x) (to_fixedprec d y). 9integer ::= digit digit*. :float ::= digit* "." digit*. LThere must be at least one digit, either before or after the decimal point. ;const_pi ::= "pi". <const_e ::= "e". =negative ::= " ==|*+??|==". >positive ::= "+". ? plus_term ::= "+" exp7. @ minus_term ::= " ==|*+??|==" exp7. A times_term ::= "*" exp8. Bdiv_term ::= "/" exp8. C power_term ::= exp10 "**" | exp10 "^". D unary_fun ::= unary_op exp10. Eunary_op ::= "abs" | "signum" | ... F binary_fun ::=  binary_op exp10 exp10. G binary_op ::= "abs" | "signum" | ... Hexp6 ::= (negative | positive)? exp7 (  plus_term |  minus_term )*. ;An expression whose top-level operator has precedence 6 or * above. The operators of precedence 6 are "+" and " ==|*+??|==". Iexp7 ::= exp8 (  times_term | div_term )*. ;An expression whose top-level operator has precedence 7 or * above. The operators of precedence 6 are "*" and "/". Jexp8 ::= (  power_term )* exp10 ;An expression whose top-level operator has precedence 8 or * above. The operators of precedence 6 are "**" and "^". Kexp10 ::=  parenthesized | const_pi | const_e | integer | float |  unary_fun |  binary_fun. <An expression whose top-level operator has precedence 10 or > above. Such expressions are constants, applications of unary  operators (except unary " ==|*+??|==" and "+"), and parenthesized  expressions. L parenthesized ::= "(" exp6 ")". M expression ::= exp6  end-of-line.  This is a top-level expression. NBParse a symbolic real number expression. Typical strings that can  be parsed are "1.0", "pi/128", " (1+sin(pi/3))^2" , etc. If ) the expression cannot be parsed, return . E !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN8 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN86543210/.-,+*)('&%$#"! 789:;<=>?@ABCDEFGHIJKLMN'6543210/.-,+*)('&%$#"! 789:;<=>?@ABCDEFGHIJKLMNNoneLO*A type class for things that have parity. P Return the parity of something. QOA type class for things that can be exactly converted to UNI__8474__[uni__969__]. RConversion to ]. S6A type class for things from which a common power of 1/==|*+~.|==2 (a D least denominator exponent) can be factored out. Typical instances  are l, e), as well as tuples, lists, vectors, and  matrices thereof. T)Calculate the least denominator exponent k of a . Returns  the smallest k==|**.%|==0 such that a = b/==|*+~.|==2[sup k] for some  integral b. U Factor out a k th power of 1/==|*+~.|==2 from a. In other words,  calculate a==|*+~.|==2[sup k]. V9A type class for rings that have a distinguished subring "of  integers". A typical instance is a = l , which has b =  m as its ring of integers. W<The embedding of the ring of integers into the larger ring. XThe inverse of W. Throws an error if the given 1 element is not actually an integer in the ring. Y#A type class for rings that have a "real" component. A typical  instance is a = e with b = l. ZTake the real part. [A type class relating "rational" types to their dyadic  counterparts. \ Convert a "rational" value to a "dyadic" value, if the 0 denominator is a power of 2. Otherwise, return . ] The field UNI__8474__[uni__969__] of cyclotomic rationals of degree 8. ^The ring [bold D] [uni__969__]. Here [bold D]=UNI__8484__[uni__189__] is the ring of dyadic  fractions. In fact, [bold D] [uni__969__]" is isomorphic to the ring [bold D][==|*+~.|==2,  i], but they have different  instances. _The ring UNI__8484__[uni__969__] of cyclotomic integers of degree 8. Such rings D were first studied by Kummer around 1840, and used in his proof of  special cases of Fermat's Last Theorem. See also:   Rhttp://fermatslasttheorem.blogspot.com/2006/05/basic-properties-of-cyclotomic.html   Ghttp://fermatslasttheorem.blogspot.com/2006/02/cyclotomic-integers.html  Harold M. Edwards, "Fermat's Last Theorem: A Genetic ( Introduction to Algebraic Number Theory". ` The ring R [uni__969__], where R/ is any ring, and uni__969__ = [exp iuni__960__/4] is an  8th root of unity. The value ` a b c d represents  auni__969__[sup 3]+buni__969__[sup 2]+c uni__969__+d. b1Single precision complex floating point numbers. c1Double precision complex floating point numbers. d#The field UNI__8474__[==|*+~.|==2, i]. eThe ring [bold D][==|*+~.|==2, i] = UNI__8484__[1/ ==|*+~.|==2, i]. fThe ring UNI__8474__[i] of Gaussian rationals. gThe ring [bold D][i] = UNI__8484__[uni__189__, i] of Gaussian dyadic fractions. hThe ring UNI__8484__[i] of Gaussian integers. i The ring R[i], where R# is any ring. The reason we do not  use the  a- type from the standard Haskell libraries is 3 that it assumes too much, for example, it assumes a is a member  of the . class. Also, this allows us to define a more  sensible  instance. k!The field UNI__8474__[==|*+~.|==2]. lThe ring [bold D] [==|*+~.|==2] = UNI__8484__[1/ ==|*+~.|==2]. m The ring UNI__8484__[==|*+~.|==2]. n The ring R [==|*+~.|==2], where R is any ring. The value n a  b represents a + b ==|*+~.|==2. p?We define our own variant of the rational numbers, which is an  identical copy of the type  from the standard Haskell - library, except that it has a more sensible  instance. s>A dyadic fraction is a rational number whose denominator is a 6 power of 2. We denote the dyadic fractions by [bold D] = UNI__8484__[uni__189__]. *We internally represent a dyadic fraction a/2[sup n] as a pair  (a,n;). Note that this representation is not unique. When it is E necessary to choose a canonical representative, we choose the least  possible n ==|**.%|==0. u7The ring UNI__8484__uni__8322__ of integers modulo 2. xThe  and $ functions provided by the standard C Haskell libraries are predicated on many unnecessary assumptions. * This type class provides an alternative. Minimal complete definition: y or z. yCompute the floor of x, i.e., the greatest integer n such  that n ==|**.$|== x. zCompute the ceiling of x, i.e., the least integer n such  that x ==|**.$|== n. {A (number-theoretic) norm on a ring R is a function N : R " ==|*%-$|== UNI__8484__ such that N(rs) = N(r)N(s ), for all r, s ==|*+!?|== R.  The norm also satisfies N(r ) = 0 iff r = 0, and N(r) = ==|!++|==1  iff r is a unit of the ring. }@A type class for rings with a ==|*+~.|==2-conjugation, i.e., an = automorphism mapping ==|*+~.|==2 to ==|*+??|====|*+~.|==2. ?When instances of this type class are vectors or matrices, the  ==|*+~.|==2-conjugation does not) exchange the roles of rows and columns. MFor rings that have no ==|*+~.|==2, the conjugation can be defined to be the  identity function. ~Compute the adjoint, mapping a + b==|*+~.|==2 to a ==|*+??|==b ==|*+~.|==2. :A type class for rings with complex conjugation, i.e., an  automorphism mapping i to ==|*+??|==i. ?When instances of this type class are vectors or matrices, the D conjugation also exchanges the roles of rows and columns (in other  words, it is the adjoint). BFor rings that are not complex, the conjugation can be defined to  be the identity function. 3Compute the adjoint (complex conjugate transpose). 5A type class for rings that contain a square root of i, or - equivalently, a fourth root of ==|*+??|==1. The square root of i. 9A type class for rings that contain a square root of -1. The complex unit. %A type class for rings that contain 1/ ==|*+~.|==2. The square root of uni__189__. 1A type class for rings that contain ==|*+~.|==2. The square root of 2. 0A type class for rings that contain uni__189__. The value uni__189__. &A type class to denote rings. We make  a synonym of  Haskell's 3 type class, so that we can use the usual notation  , , 6 for the ring operations. This is not a perfect fit,  because Haskell's - class also contains two non-ring operations   and 0. By convention, for rings where these notions  don'5t make sense (or are inconvenient to define), we set  x  = x and  x = 1. Given a dyadic fraction r , return (a,n ) such that r =  a/2[sup n], where n,==|**.%|==0 is chosen as small as possible. Given a dyadic fraction r and an integer k==|**.%|==0, such that a =  r2[sup k] is an integer, return a. If a is not an integer,  the behavior is undefined. 8The unique ring homomorphism from UNI__8484__[uni__189__] to any ring containing 7 uni__189__. This exists because UNI__8484__[uni__189__] is the free such ring. ;An auxiliary function for printing rational numbers, using 6 correct precedences, and omitting denominators of 1. Conversion from p to any  type. 9The unique ring homomorphism from UNI__8484__[==|*+~.|==2] to any ring containing 9 ==|*+~.|==2. This exists because UNI__8484__[==|*+~.|==2] is the free such ring. )The unique ring homomorphism from [bold D] [==|*+~.|==2] to any ring containing  1/(==|*+~.|==2. This exists because [bold D] [==|*+~.|==2] = UNI__8484__[1/ ==|*+~.|==2] is the free such ring. 9The unique ring homomorphism from UNI__8474__[==|*+~.|==2] to any ring containing R the rational numbers and ==|*+~.|==2. This exists because UNI__8474__[==|*+~.|==2] is the free  such ring. .The unique ring homomorphism from UNI__8484__[i] to any ring containing  i". This exists because UNI__8484__[i] is the free such ring. )The unique ring homomorphism from [bold D][i] to any ring containing  uni__189__ and i. This exists because [bold D][i] is the free such ring. .The unique ring homomorphism from UNI__8474__[i] to any ring containing  the rational numbers and i". This exists because UNI__8474__[i] is the  free such ring. )The unique ring homomorphism from [bold D][==|*+~.|==2, i] to any ring  containing 1/==|*+~.|==2 and i. This exists because [bold D][==|*+~.|==2, i] =  UNI__8484__[1/ ==|*+~.|==2, i] is the free such ring. ;The unique ring homomorphism from UNI__8474__[==|*+~.|==2, i] to any ring 3 containing the rational numbers, ==|*+~.|==2, and i. This exists because  UNI__8474__[==|*+~.|==2, i] is the free such ring. An inverse to the embedding R ==|*^!$|== R [uni__969__] : return the "real  rational" part.  In other words, map auni__969__[sup 3]+buni__969__[sup 2]+c uni__969__+d to d. 8The unique ring homomorphism from UNI__8484__[uni__969__] to any ring containing 7 uni__969__. This exists because UNI__8484__[uni__969__] is the free such ring. 0Inverse of the embedding UNI__8484__[==|*+~.|==2]" ==|*%-$|== UNI__8484__[uni__969__]#. Note that UNI__8484__[==|*+~.|==2] = UNI__8484__[uni__969__] ==|*+$%|== F UNI__8477__. This function takes an element of UNI__8484__[uni__969__] that is real, and 5 converts it to an element of UNI__8484__[==|*+~.|==2]". It throws an error if the input  is not real. )The unique ring homomorphism from [bold D] [uni__969__] to any ring containing  1/==|*+~.|==2 and i. This exists because [bold D] [uni__969__] is the free such ring. 8The unique ring homomorphism from UNI__8474__[uni__969__] to any ring containing the $ rational numbers, ==|*+~.|==2, and i,. This exists because UNI__8474__[uni__969__] is the free  such ring.  Convert a "rational" value to a "dyadic" value, if the 9 denominator is a power of 2. Otherwise, throw an error. 8Calculate and factor out the least denominator exponent k of  a . Return (b,k ), where a = b/(==|*+~.|==2)[sup k] and k ==|**.%|==0. Generic 3-like method that factors out a common denominator  exponent. If n==|**..|==0, return (a,k ) such that a is odd and n =  a==|*-.!|==2[sup k]. If n =0, return (0,0). If n is of the form 2[sup k] , return k. Otherwise, return  . For n6 ==|**.%|== 0, return the floor of the square root of n . This is A done using integer arithmetic, so there are no rounding errors. OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"UOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~U}~{|xyzuwvstpqrnomlkijhgfedcb`a_^][\YZVWXSTUQROPOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuwvxyz{|}~      !" None#$%&'(#$%&'(NoneR@A convenient abbreviation for the type of 3==|?!%|==3-matrices. @A convenient abbreviation for the type of 2==|?!%|==2-matrices. An m ==|?!%|==n-matrix is a list of n columns, each of which is a  list of m4 scalars. The type of square matrices of any fixed ! dimension is an instance of the  class, and therefore the  usual symbols, such as "" and "" can be used on 5 them. However, the non-square matrices, the symbols "" and  "" must be used. Vector n a is the type of lists of length n with elements  from a. We call this a "vector"! rather than a tuple or list for A two reasons: the vectors are homogeneous (all elements have the E same type), and they are strict: if any one component is undefined,  the whole vector is undefined. .Multiplication of type-level natural numbers. (Addition of type-level natural numbers. BA type class for the natural numbers. The members are exactly the  type-level natural numbers. 9Return a term-level natural number corresponding to this  type-level natural number. =Return a term-level integer corresponding to this type-level B natural number. The argument is just a dummy argument and is not  evaluated. 6A data type for the natural numbers. Specifically, if n is a ! type-level natural number, then   NNat n 7is a singleton type containing only the natural number n. >The 10th successor of a natural number type. For example, the  natural number 18 as a type is  Ten_and Eight !The natural number 10 as a type.  The natural number 9 as a type.  The natural number 8 as a type.  The natural number 7 as a type.  The natural number 6 as a type.  The natural number 5 as a type.  The natural number 4 as a type.  The natural number 3 as a type.  The natural number 2 as a type.  The natural number 1 as a type. (Type-level representation of successor. #Type-level representation of zero.  Convert an  to an ).  Construct a vector of length 1. 9Return the length of a vector. Since this information is C contained in the type, the vector argument is never evaluated and & can be a dummy (undefined) argument. 1Convert a fixed-length list to an ordinary list. Zip two equal length lists. )Map a function over a fixed-length list. %Create the vector (0, 1, ==|*?~.|==, n-1). Create the vector (f(0), f(1), ==|*?~.|==, f(n-1)). >Construct a vector from a list. Note: since the length of the @ vector is a type-level integer, it cannot be inferred from the D length of the input list; instead, it must be specified explicitly A in the type. It is an error to apply this function to a list of  the wrong length.  Return the i2th element of the vector. Counting starts from 0. / Throws an error if the index is out of range. =Return a fixed-length list consisting of a repetition of the  given element. Unlike *#, no count is needed, because this A information is already contained in the type. However, the type / must of course be inferable from the context. ,Turn a list of columns into a list of rows. +Left strict fold over a fixed-length list. %Right fold over a fixed-length list. BReturn the tail of a fixed-length list. Note that the type system  ensures that this never fails. BReturn the head of a fixed-length list. Note that the type system  ensures that this never fails. Append two fixed-length lists.  Version of + for fixed-length lists. +Decompose a matrix into a list of columns. Return the size (m, n) of a matrix, where m is the number  of rows, and n2 is the number of columns. Since this information D is contained in the type, the matrix argument is not evaluated and & can be a dummy (undefined) argument.  Addition of m ==|?!%|==n+-matrices. We use a special symbol because  m ==|?!%|==n#-matrices do not form a ring; only n ==|?!%|==n-matrices form a ' ring (in which case the normal symbol "" also works). Subtraction of m ==|?!%|==n+-matrices. We use a special symbol because  m ==|?!%|==n#-matrices do not form a ring; only n ==|?!%|==n-matrices form a ' ring (in which case the normal symbol "" also works). 2Map some function over every element of a matrix. Create the matrix whose i,j -entry is (i,j). Here i and  j1 are 0-based, i.e., the top left entry is (0,0). Create the matrix whose i,j -entry is f i j. Here i and  j* are 0-based, i.e., the top left entry is f 0 0. "Multiplication of a scalar and an m ==|?!%|==n -matrix. Multiplication of m ==|?!%|==n#-matrices. We use a special symbol  because m ==|?!%|==n#-matrices do not form a ring; only n ==|?!%|==n -matrices . form a ring (in which case the normal symbol "" also works). ,Return the 0 matrix of the given dimension. Take the transpose of an m ==|?!%|==n -matrix. Take the adjoint of an m ==|?!%|==n-matrix. Unlike , this can be ! applied to non-square matrices. Return the element in the i th row and jth column of the E matrix. Counting of rows and columns starts from 0. Throws an error  if the index is out of range. @Return a list of all the entries of a matrix, in some fixed but  unspecified order.  Version of + for matrices. %Return the trace of a square matrix. 4Return the square of the Hilbert-Schmidt norm of an  m ==|?!%|==n-matrix, defined by ==|*?!$|==M==|*?!$|==uni__178__ = tr M[sup ==|*??$|==]M. Stack matrices vertically. Stack matrices horizontally. ARepeat a matrix vertically, according to some vector of scalars. -Vertically concatenate a vector of matrices. CRepeat a matrix horizontally, according to some vector of scalars. /Horizontally concatenate a vector of matrices. "Kronecker tensor of two matrices. Form a diagonal block matrix. Form a controlled gate. ?A convenience constructor for matrices: turn a list of columns  into a matrix. BNote: since the dimensions of the matrix are type-level integers, D they cannot be inferred from the dimensions of the input; instead, B they must be specified explicitly in the type. It is an error to 7 apply this function to a list of the wrong dimension. AA convenience constructor for matrices: turn a list of rows into  a matrix. BNote: since the dimensions of the matrix are type-level integers, D they cannot be inferred from the dimensions of the input; instead, B they must be specified explicitly in the type. It is an error to 7 apply this function to a list of the wrong dimension. A synonym for . &Turn a matrix into a list of columns. #Turn a matrix into a list of rows. IA convenience constructor for 2==|?!%|==2-matrices. The arguments are by  rows. JA convenience destructor for 2==|?!%|==2-matrices. The result is by rows. IA convenience constructor for 3==|?!%|==3-matrices. The arguments are by  rows. IA convenience constructor for 4==|?!%|==4-matrices. The arguments are by  rows. <A convenience constructor for 3-dimensional column vectors. @A convenience destructor for 3-dimensional column vectors. This  is the inverse of . EA convenience constructor for turning a vector into a column matrix. Controlled-not gate.  Swap gate. A z-rotation gate, R[sub z](uni__952__) = [exp ==|*+??|==i uni__952__Z/2]. m,-./0123456789:;<=>?@AWWf,-./0123456789:;<=>?@ANone AA type class for Euclidean domains. A Euclidean domain is a ring : with a Euclidean function and a division with remainder. ;The Euclidean function for the Euclidean domain. This is a  function rank : R\&{0} ==|*%-$|== UNI__8469__ such that:  for all nonzero a, b ==|*+!?|== R, rank(a ) ==|**.$|== rank(ab);  if b ==|**..|== 0 and (q,r) = a  b, then either r =  0 or rank(r) < rank(b). Given a and b1==|**..|==0, return a quotient and remainder for  division of a by b. Specifically, return (q,r ) such that  a = qb + r, and such that r = 0 or rank(r) < rank(b). ,Calculate the remainder for the division of x by y. +Calculate the quotient for the division of x by y , ignoring C the remainder, if any. This is typically, but not always, used in @ situations where the remainder is known to be 0 ahead of time. ?Calculate the greatest common divisor in any Euclidean domain. 4Perform the extended Euclidean algorithm. On inputs x and  y, this returns (a,b,s,t,d ) such that:  d = gcd(x,y),  ax + by = d,  sx + ty = 0,  at - bs = 1. ?Find the inverse of a unit in a Euclidean domain. If the given  element is not a unit, return . >Determine whether an element of a Euclidean domain is a unit. Compute the inverse of a in R/ (p), where R is a Euclidean # domain. Note: this works whenever a and p are relatively  prime. If a and p" are not relatively prime, return . For y ==|**..|== 0, find the integer q closest to x / y. This  works regardless of whether x and/or y are positive or  negative. The distance q ==|*+??|== x / y is guaranteed to be in  (-1/2, 1/2]. BCDE   BCDENone,ASymbolic representation of one- and two-level operators, with an  alternate set of generators. Note: when we use a list of  operators to express a > sequence of operators, the operators are meant to be applied A right-to-left, i.e., as in the mathematical notation for matrix = multiplication. This is the opposite of the quantum circuit  notation. (uni__969__[sub i])[super m]. W[super m][sub i,j].  (T[super ==|*+??|==m] (iH)T[super m])[sub i,j].  iX[sub i,j].  The  residue type of t" ==|*+!?|== UNI__8484__[uni__969__] is the residue of t[sup ==|*??$|==]t.  It is 0000, 0001, or 1010. >Symbolic representation of one- and two-level operators. Note  that the power k in the  and  constructors can be 8 positive or negative, and should be regarded modulo 8. Note: when we use a list of  operators to express a > sequence of operators, the operators are meant to be applied A right-to-left, i.e., as in the mathematical notation for matrix = multiplication. This is the opposite of the quantum circuit  notation. (uni__969__[sub i])[super k]. (T[sub i,j])[super k]. H[sub i,j]. X[sub i,j]. *An index for a row or column of a matrix. 9A type class for things that have residues. In a typical  instance, a- is a ring whose elements are expressed with " coefficients in UNI__8484__, and b( is a corresponding ring whose elements 5 are expressed with coefficients in UNI__8484__[sub 2]. !Return the residue of something.  Invert a  operator. Invert a list of  operators. 5Construct a two-level matrix with the given entries. 3Construct a one-level matrix with the given entry. =Convert a symbolic one- or two-level operator into a matrix. >Convert a list of symbolic one- or two-level operators into a B matrix. Note that the operators are to be applied right-to-left, & exactly as in mathematical notation.  Replace the ith element of a list by x. "Apply a unary operator to element i of a list. $Apply a binary operator to elements i and j of a list.  =Split a list into pairs. Return a list of pairs, and a final , element if the length of the list was odd. !,Given an element of the form uni__969__[sup m] , return m! ==|*+!?|== {0,==|*?~.|==,7}, or   if not of that form. "$Multiply a scalar by uni__969__[sup n]. #Divide an element of _, by ==|*+~.|==2, or throw an error if it is  not divisible. $ Apply the X) operator to a 2-dimensional vector over _. % Apply the H) operator to a 2-dimensional vector over  _9. This throws an error if the result is not well-defined  over _. &Apply a  operator to a _-vector, represented as D a list. Throws an error if any operation produces a scalar that is  not in _. 'Apply a list of  operators to a _ -vector, D represented as a list. Throws an error if any operation produces a  scalar that is not in _. (Return the residue's  . )Return the residue's shift. The shift is defined so that:  0001, 1110, 0011 have shift 0,  0010, 1101, 0110 have shift 1, $ 0100, 1011, 1100 have shift 2, and  1000, 0111, 1001 have shift 3. Residues of type  have shift 0. *Return the residue's   and the shift. +Given two irreducible residues a and b of the same type, find  an index m such that a + uni__969__[sup m]b = 0000. If no such index  exists, find an index m such that a + uni__969__[sup m]b = 1111. ,0Check whether a residue is reducible. A residue r is called  reducible  if it is of the form r = ==|*+~.|==2 ==|*-.!|== r', i.e., r& ==|*+!?|== {0000, 0101, 1010, 1111}. ->Perform a single row operation as in Lemma 4, applied to rows i  and j. The entries at rows i and j are x and y, ( respectively, with respective residues a and b. A precondition  is that x and y1 are of the same residue type. Returns a list of ? two-level operations that decreases the denominator exponent. .*Row reduction: Given a unit column vector v , generate a 2 sequence of two-level operators that reduces the i th standard  basis vector e[sub i] to v!. Any rows that are already 0 in 0 both vectors are guaranteed not to be touched. /Input an exact n ==|?!%|==n' unitary operator with coefficients in  [bold D] [uni__969__]1, and output an equivalent sequence of two-level E operators. This is the algorithm from the Giles-Selinger paper. It " has superexponential complexity. Note: the list of  operators will be returned in @ right-to-left order, i.e., as in the mathematical notation for D matrix multiplication. This is the opposite of the quantum circuit  notation. 0BConvert from the alternate generators to the original generators. 1Invert a list of # operators, and convert the output  to a list of  operators. 2>Perform a single row operation as in Lemma 4, applied to rows i  and j:, using the generators of Section 6. The entries at rows  i and j are x and y), respectively, with respective residues  a and b. A precondition is that x and y are of the same E residue type. Returns a list of two-level operations that decreases  the denominator exponent. 3*Row reduction: Given a unit column vector v , generate a 2 sequence of two-level operators that reduces the i th standard  basis vector e[sub i] to v!. Any rows that are already 0 in D both vectors are guaranteed not to be touched, except possibly row  i"+1 may be multiplied by a scalar. 4Input an exact n ==|?!%|==n' unitary operator with coefficients in  [bold D] [uni__969__]1, and output an equivalent sequence of two-level E operators (in the alternative generators, where all but at most one C of the generators has determinant 1). This is the algorithm from > the Giles-Selinger paper, Section 6. It has superexponential  complexity. Note: the list of  operators will be returned in @ right-to-left order, i.e., as in the mathematical notation for D matrix multiplication. This is the opposite of the quantum circuit  notation. 8      !"#$%&'()*+,-./01234FGHIJKLMN/      !"#$%&'()*+,-./01234/ !"#$%&'   ()*+,-./  01234,      !"#$%&'()*+,-./01234FGHIJKLMNNone,5/Syllables is a circuit of the form (uni__949__|T) (HT|SHT)[sup *]. 6!A sequence of the form ==|*?~.|==SHT. 7!A sequence of the form ==|*?~.|==HT. 8 The sequence T. 9The empty sequence uni__949__. :6A representation of normal forms, optimized for right  multiplication. <BA type class for all things that a list of gates can be converted D to. For example, a list of gates can be converted to an element of  U(2) or an element of SO(3), using various (exact or 5 approximate) representations of the matrix entries. =.Convert a list of gates to any suitable type. >?A type class for all things that can be exactly converted to a ; list of gates. These are the exact representations of the  single-qubit Clifford+T group. ?/Convert any suitable thing to a list of gates. @7An enumeration type to represent symbolic basic gates (X, Y,  Z, H, S, T, W, E). Note: when we use a list of @s to express a sequence of A operators, the operators are meant to be applied right-to-left, B i.e., as in the mathematical notation for matrix multiplication. 7 This is the opposite of the quantum circuit notation. IInvert a gate list. J*Convert any precise format to any format. K The Pauli X operator. L The Pauli Y operator. M The Pauli Z operator. NThe Hadamard operator. OThe S operator. PThe T operator. QThe E operator. RThe W = [exp i uni__960__/4] global phase operator. S7Convert a symbolic gate to the corresponding operator. T The Pauli X operator. U The Pauli Y operator. V The Pauli Z operator. WThe Hadamard operator. X The operator S. Y The operator E. ZThe T operator. [:Convert a symbolic gate to the corresponding Bloch sphere  operator. \Conversion from U(2) to SO(3). ]+Convert a Clifford operator to a matrix in SO(3). ^Convert a matrix in SO*(3) to a Clifford gate. Throw an error if  the matrix isn' t Clifford. _0Right-multiply the given normal form by a gate. `The identity as a normal form. a7Multiply two normal forms. The right factor can be any  >. b+Invert a normal form. The input can be any >. c Convert any > list to a :, thereby normalizing it. dInput an exact matrix in SO"(3), and output the corresponding  Clifford+T8 normal form. It is an error if the given matrix is not  an element of SO*(3), i.e., orthogonal with determinant 1. 8This implementation uses the Matsumoto-Amano algorithm. ANote: the list of gates will be returned in right-to-left order, B i.e., as in the mathematical notation for matrix multiplication. 7 This is the opposite of the quantum circuit notation. eInput an exact matrix in U"(2), and output the corresponding  Clifford+T5 normal form. The behavior is undefined if the given  matrix is not an element of U$(2), i.e., unitary with determinant  1. ?We use a variant of the Kliuchnikov-Maslov-Mosca algorithm, as  implemented in %Quantum.Synthesis.MultiQubitSynthesis. ANote: the list of gates will be returned in right-to-left order, B i.e., as in the mathematical notation for matrix multiplication. 7 This is the opposite of the quantum circuit notation. fCompactly encode a : as an ). g Decode a : from its ) encoding. This is the  inverse of f. hFEncode a Clifford operator as an integer in the range 0==|*+??|==191. iBDecode a Clifford operator from its integer encoding. This is the  inverse of h H56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghiOPQRSTUVWXYZ[\]^_`a556789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi5@HGFEDCBA>?<=IJKLMNOPQRSTUVWXYZ[\]^:;59876_`abcdefghi959876:;<=>?@HGFEDCBAIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghiOPQRSTUVWXYZ[\]^_`a Nonej>A type class for things that can be printed to LaTeX format. Minimal complete definition: k or l. kPrint to LaTeX format. l5Print to LaTeX format, with precedence. Analogous to b. m8Generic showlatex-like method that factors out a common  denominator exponent. jklmcdefghijklmnopqjklmjklmjklmcdefghijklmnopq NonenDecompose a unitary operator UE into Euler angles (uni__945__, uni__946__, uni__947__, uni__948__). # These angles are computed so that  U = [exp i uni__945__] R[sub z](uni__946__) R[sub x](uni__947__) R[sub z](uni__948__). oCompute the operator  U = [exp i uni__945__] R[sub z](uni__946__) R[sub x](uni__947__) R[sub z](uni__948__). from the given Euler angles. nononono None p,An elementary rotation is either a combined x- and  z-rotation, applied at indices j and k, or a phase change  applied at index j.  r uni__948__ uni__947__ j k represents the operator  R[sub z] (uni__948__)R[sub x] (uni__947__), applied to levels j and k. [image ERot_zx.png]  q uni__952__ j represents the operator [exp i uni__952__] applied to level  j. [image ERot_phase.png] Note: when we use a list of ps to express a sequence of A operators, the operators are meant to be applied right-to-left, B i.e., as in the mathematical notation for matrix multiplication. 7 This is the opposite of the quantum circuit notation. s=Convert a symbolic elementary rotation to a concrete matrix. t1Convert a sequence of elementary rotations to an n ==|?!%|==n -matrix. u Convert an n ==|?!%|==n/-matrix to a sequence of elementary rotations. ;Note: the list of elementary rotations will be returned in @ right-to-left order, i.e., as in the mathematical notation for E matrix multiplication. This is the opposite of the quantum circuit  notation. vConstruct a two-level n ==|?!%|==n,-matrix from a given 2==|?!%|==2-matrix and  indices j and k. wExtract the phase of the jth diagonal entry of the given  matrix. x&Perform a two-level operation on rows j and k of a matrix U, 0 such that the resulting matrix has a 0 in the (j,k )-position. D Return the inverse of the two-level operation used, as well as the  updated matrix. y Return a "random" unitary n ==|?!%|==n-matrix. These matrices will @ not quite be uniformly distributed; this function is primarily  meant to generate test cases. zBGenerate a random matrix, decompose it, and then re-calculate the  matrix from the decomposition. pqrstuvwxyz pqrstuvwxyz prqstuvwxyz prqstuvwxyzNonerstuvrstuv None{A useful operation for the w monad, used to ensure that $ some condition holds (i.e., return  if the condition is  false). To be used like this:  do  x <- something  y <- something_else  ensure (x > y)  ... |1Return the head of a list, if non-empty, or else . }9Exponentiation via repeated squaring, parameterized by a : multiplication function and a unit. Given an associative  multiplication function * with unit e, the function }  (*) e a n efficiently computes a[sup n] = a * (a  * (==|*?~.|== * (a * e)==|*?~.|==)). ~Given positive numbers b and x , return (n, r ) such that  x = r b[sup n] and  1 ==|**.$|== r < b$. In other words, let n = ==|*-+.|==log[sub b] x==|*-+!|== and  r = x b[sup ==|*+??|==n]". This can be more efficient than   (x b x1) depending on the type; moreover, it also works  for exact types such as  and k. @A combinator for turning a probabilistic function that succeeds @ with some small probability into a probabilistic function that - always succeeds, by trying again and again. Like 6, but also returns a count of the number of attempts. @A combinator for turning a probabilistic function that succeeds @ with some small probability into a probabilistic function that 5 succeeds with a higher probability, by repeating it n times. =Return a square root of an element of UNI__8484__[==|*+~.|==2], if such a square  root exists, or else . Input an integer p0, and maybe output a root of ==|*+??|==1 modulo p. * This succeeds with probability at least 1/2 if p is a positive C prime ==|**.!|== 1 (mod 4); otherwise, the success probability is  unspecified (and may be 0). Input a positive prime p9 ==|**.!|== 1 (mod 4), and output a root of ==|*+??|==1. 3Input uni__958__ ==|*+!?|== UNI__8484__[==|*+~.|==2], and maybe output some t" ==|*+!?|== UNI__8484__[uni__969__] such that  t[sup ==|*??$|==]tD = uni__958__. If uni__958__ ==|**.%|== 0, uni__958__[sup ==|*??^|==] ==|**.%|== 0 and p = uni__958__[sup ==|*??^|==]uni__958__ is a Y prime ==|**.!|== 1 (mod 4) in UNI__8484__, then this succeeds with probability at least  1/A2. Otherwise, the success probability is unspecified and may be  0. 3Input uni__958__ ==|*+!?|== UNI__8484__[==|*+~.|==2]= such that uni__958__ ==|**.%|== 0, uni__958__[sup ==|*??^|==] ==|**.%|== 0, and p =  uni__958__[sup ==|*??^|==]Buni__958__ is a prime ==|**.!|== 1 (mod 4) in UNI__8484__. Output t" ==|*+!?|== UNI__8484__[uni__969__] such that  t[sup ==|*??$|==]t> = uni__958__. If the hypotheses are not satisfied, this will  likely loop forever. Input two intervals [x uni__8320__, x uni__8321__] ==|**~*|== UNI__8477__ and [y uni__8320__, y uni__8321__] ==|**~*|== UNI__8477__. Output  a list of all points z = a + ==|*+~.|==2b# ==|*+!?|== UNI__8484__[==|*+~.|==2] such that z ==|*+!?|==  [x uni__8320__, x uni__8321__] and z[sup ==|*??^|==] ==|*+!?|== [y uni__8320__, y uni__8321__]. The list will be < produced lazily, and will be sorted in order of increasing z. aIt is a theorem that there will be at least one solution if UNI__916__xUNI__916__y ==|**.%|== (1 N + ==|*+~.|==2)uni__178__, and at most one solution if UNI__916__xUNI__916__y < 1, where UNI__916__x = xuni__8321__ ==|*+??|== xuni__8320__ ==|**.%|== 0  and UNI__916__y = yuni__8321__ ==|*+??|== yAuni__8320__ ==|**.%|== 0. Asymptotically, the expected number of $ solutions is UNI__916__xUNI__916__y/= =|*+~.|==8. CThis function is formulated so that the intervals can be specified  exactly (using a type such as k), or approximately (using a  type such as y or z e). Input two intervals [x uni__8320__, x uni__8321__] ==|**~*|== UNI__8477__ and [y uni__8320__, y uni__8321__] ==|**~*|== UNI__8477__ and a / source of randomness. Output a random element z = a + ==|*+~.|==2b # ==|*+!?|== UNI__8484__[==|*+~.|==2] such that z ==|*+!?|== [x uni__8320__, x uni__8321__] and z[sup ==|*??^|==] ==|*+!?|== [y uni__8320__,  y uni__8321__]. DNote: the randomness will not be uniform. To ensure that the set of y solutions is non-empty, we must have UNI__916__xUNI__916__y ==|**.%|== (1 + ==|*+~.|==2)uni__178__, where UNI__916__x =  xuni__8321__ ==|*+??|== x+uni__8320__ ==|**.%|== 0 and UNI__916__y = yuni__8321__ ==|*+??|== y4uni__8320__ ==|**.%|== 0. If there are no solutions " at all, the function will return . CThis function is formulated so that the intervals can be specified  exactly (using a type such as k), or approximately (using a  type such as y or z e). Input an integer e, two intervals [x uni__8320__, x uni__8321__] ==|**~*|== UNI__8477__ and [y uni__8320__,  y uni__8321__]C ==|**~*|== UNI__8477__, and a source of randomness. Output random z = a +  ==|*+~.|==2b# ==|*+!?|== UNI__8484__[==|*+~.|==2] such that a + ==|*+~.|==2b ==|*+!?|== [x uni__8320__, x uni__8321__], a - ==|*+~.|==2b ==|*+!?|==  [y uni__8320__, y uni__8321__], and a-e is even. DNote: the randomness will not be uniform. To ensure that the set of z solutions is non-empty, we must have UNI__916__xUNI__916__y ==|**.%|== 2(==|*+~.|==2 + 1)uni__178__, where UNI__916__x =  xuni__8321__ ==|*+??|== x+uni__8320__ ==|**.%|== 0 and UNI__916__y = yuni__8321__ ==|*+??|== y4uni__8320__ ==|**.%|== 0. If there are no solutions " at all, the function will return . CThis function is formulated so that the intervals can be specified  exactly (using a type such as k), or approximately (using a  type such as y or z e). 9The internal implementation of the approximate synthesis  algorithm. The parameters are: % an angle uni__952__, to implement a R[sub z](uni__952__) = [exp ==|*+??|==i uni__952__Z/2]  gate;  a precision p5 ==|**.%|== 0 in bits, such that uni__949__ = 2[sup -p];  a source of randomness g. 8With some probability, output a unitary operator in the  Clifford+T group that approximates R[sub z]%(uni__952__) to within uni__949__ in E the operator norm. This operator can then be converted to a list of  gates with ?. Also output log[sub 0.1] of the actual  error, or  if the error is 0. *This implementation does not use seeding. As a special case, if the R[sub z]$(uni__952__) is a Clifford operator I (to within the given uni__949__), always return this operator directly. MNote: the parameter uni__952__ must be of a real number type that has enough @ precision to perform intermediate calculations; this typically & requires precision O(uni__949__[sup 2]'). A more user-friendly function that  does this automatically is . 7A user-friendly interface to the approximate synthesis  algorithm. The parameters are: % an angle uni__952__, to implement a R[sub z](uni__952__) = [exp ==|*+??|==i uni__952__Z/2]  gate;  a precision b5 ==|**.%|== 0 in bits, such that uni__949__ = 2[sup -b];  a source of randomness g. *Output a unitary operator in the Clifford+T group that  approximates R[sub z]=(uni__952__) to within uni__949__ in the operator norm. This 8 operator can then be converted to a list of gates with  ?. *This implementation does not use seeding. Note: the argument theta( is given as a symbolic real number. It C will automatically be expanded to as many digits as are necessary D for the internal calculation. In this way, the caller can specify,  e.g., an angle of {/128 :: , without having to worry 1 about how many digits of uni__960__ to specify.  A version of $ that also returns some statistics:  log[sub 0.1]' of the actual approximation error (or  if the 2 error is 0), and the number of candidates tried.  A version of + that returns a list of gates instead of a ( matrix. The inputs are the same as for . ANote: the list of gates will be returned in right-to-left order, B i.e., as in the mathematical notation for matrix multiplication. 7 This is the opposite of the quantum circuit notation. {|}~{|}~{|}~{|}~| !"#$%&'($)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnnopqrstuvvwxyzz{|}~~@B      !"#$%&'()*+,-./0123456789:;<=>??@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklm n o p q r s t u v w x y z { | } ~                         !"#$%&'()*+,-./ 0 1 2 3 4 56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrs t u v w x y z { | } ~    newsynth-0.1.0.0Quantum.Synthesis.CliffordQuantum.Synthesis.ArcTan2Quantum.Synthesis.SymRealQuantum.Synthesis.RingQuantum.Synthesis.Matrix!Quantum.Synthesis.EuclideanDomain%Quantum.Synthesis.MultiQubitSynthesisQuantum.Synthesis.CliffordTQuantum.Synthesis.LaTeXQuantum.Synthesis.EulerAngles'Quantum.Synthesis.RotationDecompositionQuantum.Synthesis.Newsynth Quantum.Synthesis.Ring.FixedPrecQuantum.Synthesis.Ring.SymRealAxisAxis_SHAxis_HAxis_I ToClifford to_cliffordClifford clifford_X clifford_Y clifford_Z clifford_H clifford_S clifford_SH clifford_E clifford_Wclifford_decomposeclifford_decompose_coset clifford_id clifford_mult clifford_invclifford_tconjArcTan2arctan2ToRealto_realSymRealACoshATanhASinhCoshTanhSinhACosATanASinCosTanSinPowerLogSqrtExpEulerPiRecipSignumAbsNegateDivTimesMinusPlusDecimalConstdynamic_fixedprecdynamic_fixedprec2integerfloatconst_piconst_enegativepositive plus_term minus_term times_termdiv_term power_term unary_fununary_op binary_fun binary_opexp6exp7exp8exp10 parenthesized expression parse_SymRealParityparityToQOmegatoQOmegaDenomExpdenomexpdenomexp_factor WholePart from_wholeto_wholeRealPartrealToDyadic maybe_dyadicQOmegaDOmegaZOmegaOmegaCFloatCDouble QRComplex DRComplexQComplexDComplexZComplexCplxQRootTwoDRootTwoZRootTwoRootTwo Rationals ToRationals unRationalsDyadicZ2OddEvenFloorfloor_of ceiling_of NormedRingnormAdjoint2adj2Adjointadj OmegaRingomega ComplexRingi RootHalfRingroothalf RootTwoRingroottwoHalfRinghalfRingdecompose_dyadicinteger_of_dyadic fromDyadicshowsPrec_rational fromRationals fromZRootTwo fromDRootTwo fromQRootTwo fromZComplex fromDComplex fromQComplex fromDRComplex fromQRComplex omega_real fromZOmegazroottwo_of_zomega fromDOmega fromQOmega to_dyadicdenomexp_decomposeshowsPrec_DenomExplobitlog2intsqrtSO3U2MatrixVectorConsNilNatnnatnatNNatSuccZeroTen_andTenNineEightSevenSixFiveFourThreeTwoOnefromNNatvector_singleton vector_lengthlist_of_vectorvector_zipwith vector_map vector_enumvector_of_functionvector vector_index vector_repeatvector_transpose vector_foldl vector_foldr vector_tail vector_head vector_appendvector_sequenceunMatrix matrix_size.+..-. matrix_map matrix_enummatrix_of_function scalarmult.*. null_matrixmatrix_transposeadjoint matrix_indexmatrix_entriesmatrix_sequencetr hs_sqnormstack_verticalstack_horizontaltensor_verticalconcat_verticaltensor_horizontalconcat_horizontaltensoroplusmatrix_controlledmatrix_of_columnsmatrix_of_rowsmatrixcolumns_of_matrixrows_of_matrix matrix2x2from_matrix2x2 matrix3x3 matrix4x4column3 from_column3 column_matrixcnotswapzrotEuclideanDomainrankdivmod euclid_mod euclid_div euclid_gcdextended_euclideuclid_inverseis_unitinv_modrounddiv TwoLevelAlt TL_omega_altTL_WTL_TiHTTL_iX ResidueTypeRT_1010RT_0001RT_0000TwoLevelTL_omegaTL_TTL_HTL_XIndexResidueresidueinvert_twolevelinvert_twolevelstwolevel_matrixonelevel_matrixmatrix_of_twolevelmatrix_of_twolevels list_insert transform_at transform_at2 list_pairs log_omega omega_power reduce_ZOmega opX_zomega opH_zomegaapply_twolevel_zomegaapply_twolevels_zomega residue_type residue_shiftresidue_type_shiftresidue_offset reduciblerow_step reduce_columnsynthesis_nqubittwolevels_of_twolevelaltsinvert_twolevels_alt row_step_altreduce_column_altsynthesis_nqubit_alt SyllablesSApp_SHTSApp_HTS_TS_I NormalForm FromGates from_gatesToGatesto_gatesGateWETSHZYX invert_gatesconvertu2_Xu2_Yu2_Zu2_Hu2_Su2_Tu2_Eu2_W u2_of_gateso3_Xso3_Yso3_Zso3_Hso3_Sso3_Eso3_T so3_of_gate so3_of_u2so3_of_cliffordclifford_of_so3normalform_appendnf_idnf_multnf_inv normalizesynthesis_bloch synthesis_u2normalform_packnormalform_unpack clifford_packclifford_unpack ShowLaTeX showlatex showlatex_pshowlatex_denomexp euler_anglesmatrix_of_euler_angles ElementaryRot ERot_phaseERot_zxmatrix_of_elementarymatrix_of_elementariesrotation_decompositiontwolevel_matrix_of_matrix get_phaserowoprandom_unitarytestensure maybe_headpowerfloorlog keeptryingkeeptrying_counttry_for zroottwo_rootroot_minus_one_steproot_minus_one dioph_stepdioph gridpointsgridpoint_randomgridpoint_random_parity newsynth_stepnewsynthnewsynth_statsnewsynth_gatesbaseGHC.BaseStringconj2conj3cinvtconj$fToCliffordAxis$fToClifford[]$fToCliffordChar$fToCliffordClifford$fShowClifford GHC.Floatatan2 RealFloat$fArcTan2FixedPrec$fArcTan2Float$fArcTan2Doubleghc-prim GHC.Classes== Data.MaybeNothing $fToReal[]$fToRealFixedPrec $fToRealFloat$fToRealDouble $fToRealInt$fToRealInteger $fToRealRatio$fToRealSymReal$fArcTan2SymReal$fFloatingSymReal$fFractionalSymReal $fNumSymReal $fShowSymRealGHC.ShowShow Data.ComplexComplexGHC.RealRationalfloorceilingGHC.NumNum+-*abssignum Fractionalshow$fParityRootTwo $fParitya$fToQOmegaOmega$fToQOmegaCplx$fToQOmegaDyadic$fToQOmegaRootTwo$fToQOmegaRatio$fToQOmegaInteger$fDenomExpCplx $fDenomExp[] $fDenomExp() $fDenomExp(,)$fDenomExpOmega$fDenomExpRootTwo$fWholePartCplxCplx$fWholePart[][]$fWholePart()()$fWholePart(,)(,)$fWholePartOmegaOmega$fWholePartRootTwoRootTwo$fWholePartDyadicInteger$fRealPartOmegaRootTwo$fRealPartCplxa$fToDyadicOmegaOmega$fToDyadicCplxCplx$fToDyadicRootTwoRootTwo$fToDyadicRationalsDyadic$fToDyadicRatioDyadic$fToDyadicDyadicDyadic $fShowCplx $fShowOmega$fOmegaRingOmega$fOmegaRingOmega0$fNormedRingOmega$fAdjoint2Omega$fAdjointOmega$fComplexRingOmega$fRootTwoRingOmega$fRootHalfRingOmega$fHalfRingOmega$fFractionalOmega $fNumOmega $fShowOmega0$fNormedRingCplx$fAdjoint2Cplx $fAdjointCplx$fRootTwoRingCplx$fRootHalfRingCplx$fHalfRingCplx$fComplexRingCplx$fFractionalCplx $fNumCplx $fShowCplx0$fFloorRootTwo$fNormedRingRootTwo$fAdjoint2RootTwo$fAdjointRootTwo$fComplexRingRootTwo$fRootHalfRingRootTwo$fHalfRingRootTwo$fRootTwoRingRootTwo$fFractionalRootTwo $fShowRootTwo $fOrdRootTwo $fNumRootTwo$fShowRationals$fAdjoint2Dyadic$fAdjointDyadic$fHalfRingDyadic $fNumDyadic $fOrdDyadic $fEqDyadic $fShowDyadic $fRealDyadic $fAdjoint2Z2 $fAdjointZ2$fNumZ2$fShowZ2 $fFloorDouble $fFloorFloat $fFloorRatio$fFloorInteger$fNormedRingInteger$fAdjoint2Ratio $fAdjoint2Int$fAdjoint2Integer$fAdjointComplex$fAdjointRatio$fAdjointFloat$fAdjointDouble $fAdjointInt$fAdjointInteger $fOmegaRinga$fComplexRingComplex$fRootHalfRingComplex$fRootHalfRingFloat$fRootHalfRingDouble$fRootTwoRingComplex$fRootTwoRingFloat$fRootTwoRingDouble$fHalfRingComplex$fHalfRingRatio$fHalfRingFloat$fHalfRingDouble$fRinga$fFloorFixedPrec$fAdjoint2FixedPrec$fAdjointFixedPrec$fHalfRingFixedPrec$fRootTwoRingFixedPrec$fRootHalfRingFixedPrec integer-gmpGHC.Integer.TypeIntegerGHC.List replicate Control.Monadsequence$fComplexRingMatrix$fRootTwoRingMatrix$fRootHalfRingMatrix$fHalfRingMatrix$fAdjoint2Matrix$fAdjointMatrix $fNumMatrix$fDenomExpMatrix$fWholePartMatrixMatrix$fToDyadicMatrixMatrix $fShowMatrix $fShowMatrix0 $fShowMatrix1 $fShowMatrix2$fDenomExpVector$fWholePartVectorVector$fToDyadicVectorVector $fShowVector $fEqVector $fNatSucc $fNatZero $fShowNNat$fEuclideanDomainOmega$fEuclideanDomainRootTwo$fEuclideanDomainCplx$fEuclideanDomainInteger$fResidueMatrixMatrix$fResidueVectorVector$fResidueCplxCplx $fResidue[][] $fResidue()()$fResidue(,)(,)$fResidueRootTwoRootTwo$fResidueOmegaOmega$fResidueIntegerZ2$fFromGatesInteger$fToGatesInteger$fToGatesMatrix$fToGatesTwoLevel$fToGatesMatrix0$fFromGatesNormalForm$fShowNormalForm$fToGatesSyllables$fToGatesNormalForm$fToCliffordMatrix$fFromGatesMatrix$fFromGatesMatrix0 $fFromGates[]$fFromGates[]0$fToGatesClifford $fToGatesAxis $fToGatesChar $fToGates[] $fToGatesGate showsPrec$fShowLaTeXSymReal $fShowLaTeX[]$fShowLaTeXMatrix$fShowLaTeXMatrix0$fShowLaTeXDouble$fShowLaTeXCplx$fShowLaTeXOmega$fShowLaTeXRootTwo$fShowLaTeXDyadic$fShowLaTeXRatio$fShowLaTeXMatrix1$fShowLaTeXOmega0$fShowLaTeXInteger$fShowLaTeX[]0$fShowLaTeXTwoLevel$fAdjoint2SymReal$fAdjointSymReal$fHalfRingSymReal$fRootTwoRingSymReal$fRootHalfRingSymRealMaybelogBase GHC.TypesDoublefixedprec-0.2.1.0Data.Number.FixedPrec FixedPrecpi