QIS-XML: A metadata specification for Quantum Information Science
While Quantum Information Science (QIS) is still in its infancy, the ability for quantum based hardware or computers to communicate and integrate with their classical counterparts will be a major requirement towards their success. Little attention ho…
Authors: : John Smith, Jane Doe, Robert Johnson
1 Intr oduction Quantum Information Science (QIS) is in its infanc y and quantum computers are currentl y at an experimental stage. No production s ystem exists and, while small protot ypes are being tested in laboratories (using a fe w “qubits”), we ma y not see such realit y for another 10 or 20 years. The challenge is that, whil e we do understand the underl ying theoretical ph y sics, the engineering needed to build quantum hardware is not yet here. Nevertheless, quantum technolog y see m to be an inescapable outcome. At the current pace, Moore's law 1 will reach its li mit around 2020 2 . Once transistors become a few or s ingle ato ms i n size, quantu m mechanical effects can no longer be ignored (toda y's t y pical transistors are as s mall as 20 atoms). While we do not know exactly when production grade quantum hardware will become availabl e, ra pid progr ess i s being made and several protot ypes have been demonstrated to work. Their existence is unavoidable given the physical li mits of ever shrinking hardware. QIS i s not and cannot be a stand alone technolog y . The “Classic” Information Science (CIS) is already deepl y rooted in our society and represents a significant segment of the global economy . This i mplies that to be successful, an y kind of quantum information s y ste m 1 http://en.wikipedia.org/wiki/Moore_Law 2 “Moore's Law is dead, says Gordon Moore”, T echW orld, http://snipurl.com/1s2e7 will need to smoothl y integrate in this existing environment. Int eracting w ith quantum s ystems will also require an interf ace that will naturall y be build on classic com puters. This mer ging o f t echnologies in essence can be seen as a unification of the two fields of expertise into a “Complete Infor mation Science”. It is likel y that the f irst generations of quant um computers will be in the form of co-processors, remote s y stems or highl y specialize d circuits whose functionalities will simpl y extend standard computers and applications. Classic computers will re m ain the common interface for end- users and the develop ment platform of choice for progra mm ers (at l east until we have a quantum operating s y stem). The classic information science will therefore need to become “quantum aware ” to be able t o manage QIS objects. This i ntegration means that (1) classic and quantum c omputers will need to communicate with each other and (2) classic computers will need to be able to r epr esent and manage QIS concepts . A widel y us ed technolog y that is particularl y attractive to answer suc h require m ents is t he eXtensible Markup Language 3 or XML. I ts pri mary purpose is to facilitate the sharing of structured data and metadata a cross different i nformation s y ste ms. This pape r introduces such approach through the proposal of QIS-XML, a metadata specification for Quantum Information Science. 3 http://en.wikipedia.org/wiki/Xml QIS-XML 1 v2007.12 QIS-XML: A metadata specification for Quantum Information Science Pascal Heus, Richard Gomez George Mason University , College of Science, Depart m ent of Co mputational and Data Sciences pascal.heus@gmail.com / rgomez@gmu.edu December 2007 Keywords: quantum computer , information science, XML, interoperabilit y , standards While Quantum Information Sc ience (QIS) is still in its infancy , the abilit y for quantum based hardware or computers to co mmunicate and integrate with the ir cl assical counterparts will be a major requirement towards their success. Little attention however has been paid to this aspect o f QIS. T o manage and exchange information between systems, toda y's classic Information T echnolo gy (IT) co mmonly uses the eXtensible Markup Language (XML) and its related tools. XML is co mposed of numerous specifications related to various fields of expertise. No such global specification however has been defined for quantum computers. QIS-XML is a proposed XML metadata specification for the description of fundamental co mponents of Q IS (gates & circuits) and a platform for t he development of a hardware independent low level pseudo -code for quantum algorithms. This paper la ys out the general characteristics of the QIS-XML specification and outlines practical applications through protot y pe use cases. 2 Metadata and XML Providing a comprehensive introduction to XML is outside the scope of this paper . A wi de body of knowledge is a vailable on t he topic and numerous resources ar e available on the I nternet. The ke y concepts are introduced below to facilitate the understanding of the paper . 2.1 Metadata When we need to desc ribe an object or an e ntit y , we t y picall y use adjectives to capture its fundamental characteristics. For exa mple, if we want to d escribe a book, we can use its title, author , year of publication or ISBN number . For a car , a different set of att ributes can be used suc h as manufacturer, brand, color, price, etc. In the information technology worl d, these characteristics are know as metadata 4 and is typically defined as “ data about t he data” . Metadata does not change an y thing about the ite m it describes but rather captures its nature b y attaching a set of descri ptive attributes to the object. An important aspect of met adata is that it can be stored, ac cessed or exchanged with having to pass along the underl y ing object. W e can browse a librar y catalog re motely or select a car f rom a br ochure without going to the dealership. 2.2 The eXtensible Markup Language T raditionally , when computer s y ste ms needed to capture such information, metadata was stored into a relational database system. While this works well in an isolated environment, databas es run off proprietary solutions which make the exchange of information between agencies or individuals chall enging. Database systems als o are li mited in functionalities and cannot alwa y s perfor m all the tasks we require for metadata management. The emergence of the I nternet and of global communities has lea d to new a pproaches based on openness and interoperabilit y . XML is one such technology . It all ows co mputer systems to manage metadat a (or data) in a har monized way . It is non-proprietary (in the public domain) a nd can be used in an y operating environment (W indows, Linux, Sol aris, Mac). It is a langua ge that “tags” or “markups” ele ments of infor mation and stores the m in a si mple text format that can be read by an y computer . XML and i ts r elated standards a re maintained by the 4 http://en.wikipedia.org/wiki/Metadata W orl d W ide W eb 5 consorti um (headed b y by Sir T im Berners-Lee 6 , often referred to as the inventor of the W orl d W ide W eb). XML is widel y used on the W eb, in partic ular to exchange information between organizations and different co mputer sy ste ms. It has emer ged in recent years as a dominant technolog y . While invisible to most end users, XML is driving todays' Internet. XML is actuall y a t erm that enco mpasses several technologies and functionalities. Adopting XML allows i nformation s ystems not onl y t o capture metadata (in XML) but al so to validate i t against agreed upon specificati ons (using DTD 7 or Sche ma 8 ), transform it into other form ats s uch as HTML or PDF (using XSL T 9 ), search it like a dat abase to lookup information (using XPath 10 or XQuer y 11 ), exchange it (using SOAP 12 or REST 13 based web services) and even edit it (using XForms 14 ). All these f unctionalities are inherent to the XML technolog y and require little efforts to implement. Here are simple examples of what an XML docum ent looks like: Da Vinci Code Dan Brown I, robot Isaac Asimov John Doe jdoe@example.org Richard Feynman scientist 5 http://www .w3.org/ 6 http://en.wikipedia.org/wiki/T im_Berners-Lee 7 http://en.wikipedia.org/wiki/Document_T ype_Definition 8 http://en.wikipedia.org/wiki/XML_Schema 9 http://en.wikipedia.org/wiki/Xslt 10 http://en.wikipedia.org/wiki/Xpath 1 1 http://en.wikipedia.org/wiki/Xquery 12 http://en.wikipedia.org/wiki/SOAP 13 http://en.wikipedia.org/wiki/REST 14 http://en.wikipedia.org/wiki/Xforms QIS-XML 2 v2007.12 The l anguage see m and is pretty s imple. Fi rst i t is human readable! XML is not a proprietar y for mat and is s tored as regular text. W e can also see that “elements” of infor m ation are deli mited b y an opening and a closing “tag” (delimited b y “<” and “>”) that contains text or other elements (children). In s ome case, “attributes” can also be direc tly embedded i n the tag itself as it is the case for the ISBN number of the book. While the syntax of XML contains a few m ore rules, this gives a general idea of its basic principles. What is important to understand is that it can be used to describe many man y di f ferent things (it is extensible). Different metadata, differ ent specifications Having a common language t o describe data is a good start but i s certainl y not enough to satisf y all m etadata management needs. Just like we create different databases structures, we also need a wa y t o define the elements of information we want to use when describing an object ( the se mantic). For exa mple, we would not de scribe a book or a car using the sa me attributes. Even if we are talking about the same object, it is very easy f or d ifferent agencies or individuals to co m e up with different structures. If we want to be able to universally manage and exchange metadata, we need to a gree on common semantic to describe objects. This is what is known in XML as a “ specification ” and i s defined using a Document T ype Definiti on 15 or a an XML Sche ma 16 . The XML world is m ade of many spe cifications, each one specializing in a specific kind of object such as book, press release, car , weather , etc (the XML language itself is actuall y an XML specification). It is not uncommon f or several specifications to exist for the same t y pe of object and they s ometime compete with ea ch other . When this happens, it is then up to each age ncy to select one or to imple ment several at the same time (it is also ac tuall y qui te easy to transform one specification into another). XML specifications are t ypically maintained by an agenc y (or consortium) and made publicl y available 17 . They can also be subm itted to the International Standard Organization (ISO) to become an official ISO standard. 15 http://en.wikipedia.org/wiki/Document_T y pe_Definition 16 http://en.wikipedia.org/wiki/XML_schema 17 For example, see http://www .oasis-open.org or http://www .w3.org/ XML and QIS When it comes to Quantu m Information Science, no XML specification is readily available toda y . QIS however would greatl y benefit f rom s uch standard as a common language to unify both fields of i nformation science. Given the wide acceptance of the technolog y a mongst the Infor m ation T e chnolog y (IT) community , it would ensure that quantum based s ystems and relat ed applications can dialog with their classic counterparts. It would also allow the de velopment of harmonized tools as well a s the integration of quantum functionalities into modern co mputer languages. This paper introduces QIS-XML as a proposed XML specification for the description of fundamental components of QIS (gates & circuits) and a platform for the development of a hardware independent low level pseudo-code for quantu m al gorithms based on gates and circuits. Its basic concepts are introduced below al ong with a few use cases. More in depth information a long with the sche ma and its documentation are a vailable on the QIS-XML web site 18 . Note that the remaining of this document assumes familiarit y with t he basic concepts of quantum computing (qubits, gates, circuits, algorith ms). 3 QIS-XML Model The objective of QIS-XML is to provide a metadata model for representing quantum gates, quantum circuits and l ow level quantum pseudo-code . Creating such model in XML essentiall y consists in creating a schema that descri bes the various descriptive ele ments and attributes for each entit y (the semantic). When designing XML schema, various techniques are are commonly available. For QIS-XML, we choose a venetian blind design 19 to maximize co mponent re- usabilit y . Note: t o facilit ate the co mprehension of this section, we strongl y recommend the reader to als o c onsults the figures and illustrations availa ble in annex. 3.1 Modules Instead of making QIS-XML a single large XML specification, we took a modular approach t hat allows 18 http://www .qi sxml.org 19 http://www . xfront.com/GlobalV ersusLocal.html QIS-XML 3 v2007.12 users and developers t o only use the co mponents they need. This bette r f its i n a distributed/federated environment where components can be designed b y different agencies and referenced for reuse. The Q IS-XML specification i s organ ized into the following modules: – Instance : a global wrapper t o bring together t he other components (gates, circuits and progra ms); – Reusable : describes a set of common ele m ents that can be used b y the all other modules; – Gate : describes quantum gates and bring t hem together into gate libraries; – Cir cuit : describes quantum circuits and bring them together into circuit libraries; – Pr ogram : describes algorit hms and bring them together into program libraries; The first two modules exist primaril y for technical reasons. The last three represent our quantum entities and build upon each ot her: gates provide the fundamental ele ments, circuits are made of gates, algorithms are made of circuit s acting on quantum memory . In XML, when designing a schema (such as a module), we associate it with what is called a namespace 20 . A namespace ensures that elements and attributes belonging to a schema do not c onflict with another one carrying the same na me in another schem a. For example, the “title ” ele ment ca n exist in dif ferent schemas (a book, a person or a movie). In order to know which one we are talking about we need to define the context to which the y belong. The following namespaces have be en defined for QIS- XML: 20 http://en.wikipedia.org/wiki/XML_Namespace Module Namespace Prefix Instance qis:instance:1_0 i Gate qis:gate:1_0 g Circuit qis:circuit:1_0 c Program qis:program:1_0 p Reusable qis:reusable:1_0 r 3.2 Instance Module The instance module (Fig.1) is a wrapper and a ver y simple structure. I t consists in a top level QIS element made of collections of gate, circuit or progra m libraries. Note that libraries can be include d directl y in the document or b y referencing external entities (the referencing mec hanisms are explained below). The ability f or the instance to point to external e lements i s particularl y important as we do expect to bring together components from di f ferent places. For example, we c ould use the standard QIS-XML gate library , a few circuits designed by different people and write our own pr ogram. As t hese ma y be st ored at different locations, an inst ance docu ment allows to put these different pieces together . In nearl y all cases, QIS- XML docu ments will be disse minated in t he form of an Instance. 3.3 Reusable Module The reusable module contains elem ent t ypes useful t o all the other modules. It includes concepts fundamental to QIS as well as types t o support referencing mechanisms. Fundamental types These elements either r epresent data t y pes that do not readil y exists in XML or are specific to QIS. Complex Number (Fig. 2) : an element that can hold a r eal and imaginary value. As providing simple quantitative values is sometimes not sufficient, we als o include the option to provi de a symbolic exp ression that can be used t o e valuate the value of a co mplex number . Matrix : t he Matrix t y pe is defined as a sequence of cells . A Matrix comes with two attributes – @rows and @cols – to specif y its dimensions. A Matrix Cell is then defined as a Co mplex Number wit h two extra QIS-XML 4 v2007.12 QIS-XML Instance Prog ram R eu sabl e G at e C i rc u i t attributes – @row and @col – to specif y its location of within the matrix. W e made the general assumption that if a c ell i s not defined within a matrix, its value is zero. Qubit : is s imply defined as a co llection of two complex numbers: Zero and One. Unitary T ransf ormation (Fig. 2) : is as a special t ype of matrix. Instead of having rows and columns, it is alwa y s square and has a @size attribute that specifies the nu mber of qubi ts of t he transformation. A size 1 is a 2x2 matrix, size 2 a 4x4, e tc. It also comes with a Multiplier element as a complex number t o scale the whole matrix. Example: Unitary Transformation for a Toffoli Gate < Transformation size =" 3 "> < Cell row =" 1 " col =" 1 " r =" 1 "/> < Cell row =" 2 " col =" 3 " r =" 1 "/> < Cell row =" 3 " col =" 2 " r =" 1 "/> < Cell row =" 4 " col =" 4 " r =" 1 "/> < Cell row =" 5 " col =" 5 " r =" 1 "/> < Cell row =" 6 " col =" 6 " r =" 1 "/> < Cell row =" 7 " col =" 8 " r =" 1 "/> < Cell row =" 8 " col =" 7 " r =" 1 "/> Transformation > Input and Output : are si mple structure containing a Name and a Description to provide extra infor mation regarding a gate, circuit or progra m I/O. Referencing mechanism Given the m odular approach of QIS-XML, we need a mechanism to point to various elements of infor mation (they reside in different modules and can be stored at different locations ). This requires two things: a wa y t o uniquely identify an element and a way to make a r efer ence to it. Y ou wi ll shortl y see that all e lements that can be referenced (such as libraries, gates, circuits, me mory) come with an Identification ele ment ( Fig.3). The identification is composed of a mandator y ID and optional elements t o specif y the agenc y maintaining the object and its version. The general rule is that an ID must be unique within its maintenance agenc y (this minimizes the risk of duplicate identifiers). Note that agenc y and version can be inherit ed from parents (a gate in a gate libra ry b y default belongs t he the librar y 's agenc y ). The other then complementar y t ype is the Refer ence (Fig.3) that can be used to point to a n identified element. It holds at l east the element ID as well as an optional a gency , versi on, and library ID (these are onl y reall y required in case of ambiguity). A URI attribute allows to make refe rences to ext ernal documents (such as a librar y on the Internet or a local file). Example: Identification of a C-NOT Gate < r:Identification > < r:ID > C-NOT r:ID > r:Identification > Example: reference to the above C-NOT Gate < c:GateRef > < r:ID > C-NOT r:ID > c:GateRef > 3.4 Gate Module This module is used to describe Quant um Gates 21 . It defines at the top level a Gate Librar y ele ment t hat holds a collection of one or more gates. The Gate element (Fig.4) then hol ds all the characteri stics of a gate. Fundamentall y , a qua ntum Gat e can simpl y be define d as a unitary T ransformation . The size attribute of the unitar y transfor mation deter mines the size of the Gate (its nu mber of qubits). T o provide further information about the gate, we a dded a elements s uch as a Name (required), Nickname and Description as well as Input and Output to describe t he gate's I/O. As we expect for a gate to be reused elsewhere (like in a circuit), we also have a mandator y Identification element. In some cas es, gates can be parametrized (their unitar y transformation is not constant). T o manage this case, we added a repeatable Parameter element whose Name can be reused i n s ym bolic expre ssions of the transformation cells' values. The Gate t ype also include a coupl e of extra elements. One is the Image e lement that can be used to provide a picture or illustration of t he gate. Another one is Pr oprietaryData which allows an y t ype of additional information for t his specific gate. This has been included to allow manufacturers or applications to capture implementation specific information within QIS-XML. Example: Single qubit Z Gate < g:Gate > < r:Identification > < r:ID > Z r:ID > r:Identification > < g:Name > Pauli-Z g:Name > < r:Transformation size =" 1 "> < r:Cell row =" 1 " col =" 1 " r =" 1 "/> 21 http://en.wikipedia.org/wiki/Quantum_gate QIS-XML 5 v2007.12 < r:Cell row =" 2 " col =" 2 " r =" -1 "/> r:Transformation > g:Gate > Example: Single qubit Hadamard Gate < g:Gate > < r:Identification > < r:ID > H r:ID > r:Identification > < g:Name > Hadamard g:Name > < r:Transformation size =" 1 "> < r:Multiplier r =" 0.707106781 "> < r:Symbolic syntax =" odf "> 1/sqrt(2) r:Symbolic > < r:Symbolic syntax =" html "> 1/sqrt(2) r:Symbolic > r:Multiplier > < r:Cell row =" 1 " col =" 1 " r =" 1 "/> < r:Cell row =" 1 " col =" 2 " r =" 1 "/> < r:Cell row =" 2 " col =" 1 " r =" 1 "/> < r:Cell row =" 2 " col =" 2 " r =" -1 "/> r:Transformation > g:Gate > Example: Multi qubit Toffoli Gate < g:Gate > < r:Identification > < r:ID > TOFFOLI r:ID > r:Identification > < g:Name > Toffoli g:Name > < g:Nickname > controlled-controlled- not g:Nickname > < g:Description > The Toffoli gate is a reversible gate that takes three bits as input. The first two are control bits and are left unchanged by the gate. The third bit is flipped if both control bits are equal to 1. It is also known as the “controlled-controlled-not” gate g:Description > < r:Transformation size =" 3 "> < r:Cell row =" 1 " col =" 1 " r =" 1 "/> < r:Cell row =" 2 " col =" 3 " r =" 1 "/> < r:Cell row =" 3 " col =" 2 " r =" 1 "/> < r:Cell row =" 4 " col =" 4 " r =" 1 "/> < r:Cell row =" 5 " col =" 5 " r =" 1 "/> < r:Cell row =" 6 " col =" 6 " r =" 1 "/> < r:Cell row =" 7 " col =" 8 " r =" 1 "/> < r:Cell row =" 8 " col =" 7 " r =" 1 "/> r:Transformation > g:Gate >s Note that we do not expect to need man y different gate libraries. The fundamental set of quantu m gates is fairl y well de fined. At the times of this paper , the following gates have been described using QIS-XML: – Single qubit gates: Hada mard, Identity , Pauli-X, Pauli-Y , Pauli-Z, Phase, Phase Shift, Square Root of Not, π/8 – Multiple qubit gates: Controlled-NOT (2), Controlled π/8 (2), Controlled Phase (2), Controlled-Z (2), Deutsch Gate (3), Fredkin (3), Swap (2), T offoli (3) This librar y is publicly available and can be reused at will b y referencing. It is however often easier to use a local verbatim cop y in a local QIS instance to avoid having to resolve references. 3.5 Circuit Module The circuit module (Fi g.5) builds upon the gate module and introduce the notion of quantu m circuits The module is defined at t he top level as a Circuit Library ele ment that holds a collection of one or m ore circuit or gate equivalence circuit (explained below). Fundamentall y , a quantu m circuit has a specific size (it's nu mber of i nput and out put qubits) and is made of one or more steps that appl y unitar y transfor mation (gates) to its qubits. The QIS-XML model reflect this structure. The Cir cuit element type (Fig.7) has been des igned as a collecti on of Step el ements made of one or more Operation elements. Steps represent the vertical cross- sections of a quantu m circuit and an operation is used to Map the circuit's qubits t o the input of a quantu m Gate (or possibl y another Circuit). Identification of a operation's gate (circuit) is made b y reference. The operation element also provides the option to make a Measur ement on a qubit. Li ke for gates, a few additional ele ments are avail able to provide descriptive information for the circuit: Name (required), Description, Input, Output, Propr ietaryData along with a mandator y Identification . Example: 3 qubit phase flip circuit < c:Circuit size =" 3 "> < r:Identification > < r:ID > three_qb_phase_flip r:ID > r:Identification > < c:Name > 3-qubit phase flip code c:Name > < c:Step > < c:Operation > < c:Map qubit =" 1 " input =" 1 "/> < c:Map qubit =" 2 " input =" 2 "/> < c:GateRef > < r:ID > C-NOT r:ID > QIS-XML 6 v2007.12 c:GateRef > c:Operation > c:Step > < c:Step > < c:Operation > < c:Map qubit =" 1 " input =" 1 "/> < c:Map qubit =" 3 " input =" 2 "/> < c:GateRef > < r:ID > C-NOT r:ID > c:GateRef > c:Operation > c:Step > < c:Step > < c:Operation > < c:Map qubit =" 1 " input =" 1 "/> < c:GateRef > < r:ID > H r:ID > c:GateRef > c:Operation > < c:Operation > < c:Map qubit =" 2 " input =" 1 "/> < c:GateRef > < r:ID > H r:ID > c:GateRef > c:Operation > < c:Operation > < c:Map qubit =" 3 " input =" 1 "/> < c:GateRef > < r:ID > H r:ID > c:GateRef > c:Operation > c:Step > c:Circuit > A few attributes have been i ncluded to meet special cases. For exa mple, t he map ele ment ca n optionally specif y a @val ue attribute to set the input to a fixed value of ze ro or one. A @r everse attribute is also attached to the operation ele ment to signal that t he associated unitar y transformation should act ually be reversed (appl y th e conjugate transform). Gate Equivalent Circuit One of the functionality that we wante d to support i n QIS-XML was the abilit y to describe “Gat e Equivalent Circuits”. This is motivated b y the idea t hat an y quantum gate can be represented in terms of sets of universal gates. For exa mple, the set {Hadamard, Phase, C-NOT , pi/8} can be used to construct an y quantum operation 22 . Other such examples include the 3-qubit Deutsch Gate or universal c ircuit as recently suggested b y D e Sousa and Ramos 23 . 22 Quantum Computation and Quantum Information", Michael A. Nielsen, Isaac L. Chuang, 2000, p.189 23 "Universal quantum circuit for n-qubit quantum gate: A programmable quantum", P . B. M. Sousa, R. V . Ramos, 2006 The pu rpose of this Gate EquivalentCir cuit ( Fig.6) element is to capture s uch i nformation in a nticipation that ac tual hardware i mplementation of quantum computers are likely to be li mited to a specific set of universal gates. This means that a circuit described in QIS-XML is terms of “logi cal” gates will need to be transformed i nto a new circuit using the actual universal set supported by the hardware. Such transformation could be one of the steps performed b y a proprietar y quantum compiler . B y including in QIS- XML the description of gates in terms of universal sets, it provides t he abili ty to publish proprietar y circuit equivalent libraries in a standard XML format. The main difference between the GateEquivalentCir cuit ( Fig.6) and the regular c ircuit is that it adds a reference to the gate it replaces and includes the abilit y to remap the gate inputs to the circuit inputs (or fix their value). An optional Model element can also be used to identify a universal set or a specific manufacturer's co mputer model. Example: A SWAP gate equivalent using 3 C-NOT gates < c:GateEquivalentCircuit > < c:GateReference > < r:ID > SWAP r:ID > c:GateReference > < c:Circuit size =" 2 "> < c:Description > A SWAP gate equivalent using 3 C-NOT gates. The I/O are swapped as input of the second gate. c:Description > < c:Step > < c:Operation > < c:Map qubit =" 1 " input =" 1 "/> < c:Map qubit =" 2 " input =" 2 "/> < c:GateRef > < r:ID > C-NOT r:ID > c:GateRef > c:Operation > c:Step > < c:Step > < c:Operation > < c:Map qubit =" 1 " input =" 2 "/> < c:Map qubit =" 2 " input =" 1 "/> < c:GateRef > < r:ID > C-NOT r:ID > c:GateRef > c:Operation > QIS-XML 7 v2007.12 c:Step > < c:Step > < c:Operation > < c:Map qubit =" 1 " input =" 1 "/> < c:Map qubit =" 2 " input =" 2 "/> < c:GateRef > < r:ID > C-NOT r:ID > c:GateRef > c:Operation > c:Step > c:Circuit > c:GateEquivalentCircuit > 3.6 Program Module The progra m modules aims at the description of si mple low le vel quantu m algorithms. The m o dule is defined at the t op level as a Program Librar y ele ment that holds a collection of one or more programs. A Pr ogram (Fig.7) brings together two entitie s: the algorithm to be executed and the quantum memory it acts upon. The memor y is a collection of qubits that can be organized in various r e gisters . The algorithm is a collection of circuit executions and measur ements (with the si mple case being a singl e circuit and a single measurement). The memory model The initial design of the memor y element was a si mple quantum register but it was later influenced by Bernhard ¨Omer QCL 24 progra mming language whose memory management is ver y flexible. In QCL, a global quantu m memory of N qubits is available and multiple quantu m registers acting on a subset of t he available qubit are defined (equi valent of variables). A similar model was also presented by Bettelli, S., L. Serafini, and T . Calarco in 2001. 25 . This same approach has been a dopted in QIS-XML where we define a Memory (Fig.8) and a Regist er (Fig.9) type. The onl y required ele m ent for Memory is its “size” attribute in nu mber of qubits. Like most ele ments in QIS-XML, it al so c ontains an Identification and a Name. A Memory also comes with a Pr epare ele ment (further described under Register below) and a collection of Qubit ele ments that can actuall y be used to store values if neede d. Note that the Qubit ele ment here is an extended version of the reusable r:Qubit t y pes and adds an @index attribut e to capture the memory location (1-based index). 24 http://tph.tuwien.ac.at/~oeme r/qcl.html 25 http://arxiv .org/abs/cs/0103009 The Register is conceptually si milar to a variable and can be defined globall y (as a child of the program element) or within an Execute element (where it is mandator y ). A Register is simpl y a subset of the program's Memor y . It has a m an dator y @size attribute in qubits a nd a set of e lements us ed to describe which qubits of the main Memor y it refers to. Example: A 6-quibit memory < p:Memory size =" 6 "/> Example: A register using the whole memory with qubits 1 & 2 initialized to the value 1 < p:Register size =" 6 "> < p:Prepare > < p:QubitSet > < p:QubitIndex > 1 p:QubitIndex > < p:QubitIndex > 2 p:QubitIndex > < p:Value r =" 1 "/> p:QubitSet > s p:Prepare > p:Register > There are t hree ways a register can make references to segment of the main program Me mory: – The QubitIndex el ement can be used to refer to a specific qubit – The QubitRange (Fig.10) element can be used to refer t o a range of of qubit using its St artQubit and EndQubit children ele ments – The RegisterRefer enc e can be used t o refer to another Register definition Note t hat combinations of the above three ele ments are allowed and that all i ndex r eferences in QIS-XML are 1-based (the first qubit is qubit 1, not 0). QIS-XML also makes the assu mption that if no index or range is specified, it addresses the whole Me mory starting from qubit 1 up to the @size of the register . T o set values of qubit s in the re gister , we use the Pr epare (Fig . 1 1) ele ment. Pr epare is a collection of one of more QubitSet (Fig. 10) ele ments that can be used to se t the V alue of specific qubi t o f the R egister . It us es the same referential m e chanis m as for Memory except t hat here the index va lues are in relati on to the Register (not the memory). The V alue ele ment is a complex number . Algorithm: Execution and Measurements The program itself or algor ithm is made of a sequence of Execute (Fig.12) and Measur e elements. QIS-XML 8 v2007.12 The Execute element is where the memor y and circuits come together . Its basic version is composed of a Register ele m ent and a Circuit. The mandator y Register (who m u st have the sa me s ize of t he Ci rcuit) points to the qubits in Memor y that the Circuit is acting upon. The Circu i t itself c an then be described directly (inline) as a child ele ment or si mply be a reference to a existing Circuit defined elsewhere in a Circuit librar y . An experi mental Program (or ProgramRef) ele ment as also been included in the schema as in the ory an Execute step could call a subprogram. Memory management be comes trick y in this case and this option needs further evaluation. The Measur e element in a progra m (not to be confused in Measurement under Circuit) can be used to specif y qubit measure m ents after of between Execute steps. By default, if no Measurement el ement is specified, QIS- XML assu m es that all qubits are m easur ed and returned at the end of the Program execution. Measurement can be used in two cases: 1. Specify which Memory qubit should be measure at the end of the Program. This is is desirable t o reduce the nu m ber of required measurements or to onl y measure the relevant qubits (error correction or anc illary qubits can be ignored and may not be of interest) 2. If a progra m is co mposed of multiple Execute steps, it might be desirable t o perf orm measurements between the Execute ele ments. A Program example The exa mple below is a simple pr ogram that perfor ms a 2+1 operati on using a 2-qubit adder circuit (defined elsewhere in the demo library). This requires a 6- qubit Memor y and c ontains a single execute step. The circuit's qubit 1 and 4 are used to specify the first number and qubit 2 and 5 the second. W e therefore set qubit 4 and qubit 2 to specif y the deci mal nu mber 2 and 1 r espectivel y . Details on this particular adder circuit are presented later in this document. Example: Perfoming the 2+1 operation using a 2- quibit adder circuit defined in a circuit library < p:Program > < r:Identification > < r:ID > two_plus_one r:ID > r:Identification > < p:Name > Two plus One p:Name > < p:Memory size =" 6 "/> < p:Execute > < p:Register size =" 6 "> < p:Prepare > < p:QubitSet > < p:QubitIndex > 2 p:QubitIndex > < p:QubitIndex > 4 p:QubitIndex > < p:Value r =" 1 "/> p:QubitSet > p:Prepare > p:Register > < p:CircuitRef > < r:ID > adder2 r:ID > p:CircuitRef > p:Execute > p:Program > This is a basic example but it illustrates the simplicity of QIS-XML 3.7 Status This concludes the definition of QIS-XML. The schema and technical documentation are publicl y available on the QIS-XML web site. While this current version is certainly us able (as we will demonstrate in the use case below) , it should be c onsi dered a prototype. The specifi cation need to be tested on complex use cases and will l ikely need adjustments, in particular t he Progra m module. The Gate and Circuit modules can be considered fairl y stable. 4 QIS-XML T ransformation and V alidation W e now have the abilit y to describe quantum gates, circuits and simple algorith ms in a language that can be understood b y all m o dern classic computers. This sections exa mines other t wo ext ra aspects of metadata. One c oncerns representation: while XML is in theor y human readable, t his is usually not exactl y QIS-XML 9 v2007.12 what we want to s how to the end-users. How can XML be delivered in a user-friendly fashion? The other is about qualit y control : how can we ensure that an XML document contains the information it clai ms t o hold and that it meets its se mantic rules. 4.1 From XML to HTML As mentioned in the introducti on, the XML technolog y comes with tools to transfor m XML documents into other for mats. This process u ses what are called Extensible St y l esheet Language T ransfor m ations 26 (XSL T). It is ver y co mmonly used to convert an XML into HTML w e b pages bu t can a l so cre ate PDF documents, convert into other XML formats or simply output text. Like nearl y everything in the XML world, an XSL T is written using the XML l anguage and t herefore save d as an XML document, t ypically with the “.xsl” or “.xslt” extension. Explai ning how XSL T are written is outside the scope of this docum ent. Nu merous resources and tutorials a re available on the I nternet 27 . In the context of QIS, it is interesting to note that XSL is a T uring complete 28 language. T o create an HTML page out of an XML docu ment (like a QIS-XML file), we basica lly need an XSL T that extract the r elevant inf ormation fro m the document and describes how it fits into t he HTML page la y out (HTML is concerned with pres entation, not content). As this basicall y depends on the metadat a elements contained in the docu ment, a XSL transformation is t y pi cally designed t o work with a single XML specification. I t however works with an y document that validates agai nst the specific sc hema. For example, a XSL T designed to work with QIS-XML should be able to transform any valid QIS-XML document. 26 See http://en.wikipedia.o rg/wiki/X SL_T ransformations 27 A good place to start is http://www .w3schools.com 28 See http://en.wikipedia.o rg/wiki/T uring_compl ete In order to perform the transformation itself, we need one more thing: an application that can c ombine the XML source document and the XSL T ransformation to produce the actual output (see illustration). This is known as an XSL processor . XML being a global standard, such util ity is actuall y built in most operating system and directl y available in your fa vorite HTML browser . Most m odern programming languages ( C++, Java, .NET , pHp, etc.) also ha ve the ability to nativel y perform such operation. This means that if you have an XML doc ument and a XSL transfor mation, you can basically use it on an y computer without the need t o install or develop an y software. Y ou ca n a lso integrate it into an y applic ation you might be developing. This begins to show so me of the tremendous advantages of the XML technology: It works transparentl y across s ystems and is language independent. W ith XSL T , we can now convert out test QIS-XML document that contains information (metadata) on gates and circuits into an HTML page. This ba sically is a r epr e sentation of the XML c ontent that can be displa y ed in a browser . There a re of course man y different “views” we can generate for our QIS-XML: list of gates, list of circuits, counting the nu mber of gate and circuits, information on all the one qubit gates and circuits, etc. Each of the se can be an individual XSL T or more complex parametrized transfor mations with r eusable code. In the XML world, XSL is actuall y the closest thing to a progra mm ing language. The examples provided in annex of this docu ment have all been built using XSL T (Fig.13 & 14). A useful concept to also i ntroduce here as well is that an XML document is a well structured information container . An XSL transformation can “quer y ” the content of the XML file to format it into an HTML for presentation to the user . This is a nother ver y powerful feature of XML: a docu ment can be treated as a database sy ste m and therefore queried to extract information. Just like traditional databa ses have the Structured Quer y Language 29 (SQL) to perfor m searches, XML is e quipped with a language called XPath 30 that can be us ed to retrieve metadata from a document. The major diffe r ence i s that these queries can be performed by the XSL pr ocessor and therefore you do not need to install an y new software on your computer or even design the database! It's build in the 29 See http://en.wikipedia.o rg/wiki/Sql 30 See http://en.wikipedia.o rg/wiki/Xpath QIS-XML 10 v2007.12 X SL Pr ocess or X ML D o c u men t X SL T D o c u men t H T ML , PD F T e x t , e tc . technolog y . 4.2 QIS-XML V alidation XML and Schema validation T o ensure metadata qualit y , an i mportant operation that can be perfor med natively by XML is called validation . This is t ypically a t wo step process. First an XML document can be checked if it is s yntactically correct (does i t follows the rules of t he XML language?). If yes, a docu m ent is considere d well- formed 31 . In such case, we can al so further validate the document against it's sche ma. For exa mple, the QIS- XML sche ma defined in the previous section defines a semantic made of elements and attributes that can be mandator y or re peatable. W e can therefore verif y that an XML docu ment cl aiming to be in QIS-XML (b y declaring membership in a QIS- XML nam e space) meets these criteria. I f so, the docu ment i s call ed valid 32 . Such validation can be perfor med b y what is calle d an XML parser . A parser is a utilit y software that takes an XML doc ument as input, controls its s y nt ax against the rules of the XML language (like a spell che cker) and then vali dates its content against the schema defined by the na mespace(s). Both free open source and commercial parsers are widel y available. Second level validation XML Schema ba sed valida tion however has its limits and cannot perform so me of t he advanced checks required b y QIS-XML. For example, verif ying that a qubit total probabilit y is equal to one or that a circuit does not m ap t he sa me qubit m ul tiple time in a single step is be y ond the se m antic rules. Such s econd level validation can actuall y be achieved programmatically . XSL T ra nsformations introduced in the previous section for e xample can be used for such purpose as well. Funda mentall y , perform ing validation consists in parsing the XML content to c heck its consistency and coherence and produce a report out of it. If the report happens to be in HTML format, it can be viewed i n a browser . It is in essence the same as a transfor mation of the XML metadata. Simple XSL T based second level validation has been devel oped for QIS-XML and an output exa mple is pr esented i n Annex (Fig. 15). W e 31 http://en.wikipedia.org/wiki/W ell- formed_XML_document 32 http://en.wikipedia.org/wiki/W ell- formed_XML_document expect t he vali dation mecha nisms to gr ow as t he QIS- XML increases in co mplexity . V al idation benefits While it is not al ways required t o validate XML documents when working locall y (known sources), it becomes an i mportant feature when infor mation i s exchanged between various organizations to ens ure that it meets the standard before be ing processed. Having such functionalities directl y e mbedded in the technolog y minimizes the develop ment and maintenance costs and facilit ates qualit y assurance. These are all other good reasons to adopt an XML based framework. 5 QIS-XML V isuali zation Another direct bene fit of using QIS-XML is the abili ty to provide a graphic al r epresentation of gates, circuits and progra ms. A gain, when you think about it, this is conceptuall y a transformation of the QIS-XML document into a diagra m or an image. The natural XML reflex is therefore to t hink XSL T but the problem in this case is that image f ile are of ten proprietar y binary f ormats (GIF , JPG, PNG, TIF , etc.). While XSL T could in theor y produce such output, a specialized program develop using Java or C woul d be more efficient (and more appropriate). Fortunately , XML comes again to the rescue. There is a W3C 33 XML specification c alled Scalable V e ctor Graphics 34 (SVG) that can be used to to describe two- dimensional vector graphics. Since a quantu m circuit diagram can be broken down into a collection of lines, circle, boxes and te xt, we should therefore be able t o “describe” t he diagram as a c omposition of these basic elements. Numerous resources are a vailable on the Internet on SVG-XML 35 . Whil e i t provi des a set of advanced functionalities, ba sic SVG is fairl y straightforward t o use. SVG c an be displa y ed in most web browsers, either nativel y and after the installation of a free plugin 36 . 33 See http://www .w3c.org 34 See http://en.wikipedia.o rg/wiki/Svg 35 A good place to start is http://www .w3schools.com/svg/default.asp 36 http://en.wikipedia.org/wiki/Svg#Support_for_SVG_in_ web_browsers QIS-XML 11 v2007.12 SVG using XSL T Converting the QIS-XML into SVG-XML using pure XSL transforms is a bit of a challenging process. The representation of single qubit gates is simple but the automatic la y o ut of a circuit diagram is more problematic. Issues such as connecting li nes between gate's inputs/outputs, moving multi-qubit gate's nodes to the proper location, or f ixed map @input value, required quite a lot of development effort. The implementation we have achieved works for circuits using well defined gates but will need i mprovements in order to manage more complex cases (such as circuits in circuit ). As mentioned before, the XSL T language has its li mitations. For com p lex cases, a more flexible programming language would be more appropriate Example:SVG representation of a Hadamard gate < svg:svg width =" 50 " height =" 60 "> < svg:g transform =" translate(25,25) "> < svg:line x1 =" -25 " y1 =" 0 " x2 =" -20 " y2 =" 0 " style =" stroke:black;stroke-width:1;stroke-opacity: 1; "/> < svg:rect x =" -20 " y =" -20 " width =" 40 " height =" 40 " style =" opacity:1; fill:none; stroke:black; stroke-width:1; stroke-opacity:1; "/> < svg:line x1 =" 20 " y1 =" 0 " x2 =" 25 " y2 =" 0 " style =" stroke:black;stroke-width:1;stroke-opacity: 1; "/> < svg:text x =" -11 " y =" 10 " style =" font-size:30px; font- weight:bold; "> H svg:text > svg:g > svg:svg > Additional exa mples are available in Annex (Fig.16 & 17). Benefits V isualization i s an important functionalit y when it comes to QIS. The abilit y to t ransform standar d gates, circuits or even progra ms into a graphic or diagram representation i s a powerful feature. While developi ng utilit y software that perfor ms this with high efficiency may require some e f f orts, the benefits are considerable and again available nativel y in XML. 6 QIS-XML Applications 6.1 Gate / Circuit librarie s One of the advantages of QIS-XML is the abilit y to capture and exchange information about quantu m circuits. The metadata exchange mechanis ms are integrand part of t he XML technol ogy and allows developers t o publish their circuits in global libraries and make the m available t o other users. By using a common language (QIS-XML), this sharing of information pro motes a colla borative research and development environ ment. This is further f acilitated b y QIS-XML referencing mechani sms whi ch allow users to remotel y i ntegrate circuits into their own d esigns or libraries. Fro m the progra mming perspective, t hese can be seen as low level function libraries that can be called locally or remotely . The availability of standard visualization tools also facilitate the understanding of the circuits. QIS-XML therefore provides a standard environ ment that can foster collaborative work and facilitate the understanding of the QIS technolog y . 6.2 Programming The motivation being the programming module of QIS-XML is to provide quantum progra mming languages and quantum equip ment m anufacturers with a platfor m neutral low level pseudo- code. This i s somewhat equivale nt to a general purpose assembly language 37 . A quantum programming language compiler could for example convert high level code int o l ow level QIS- XML program ( using memor y and circ uits). Thi s information can then sent to the ac t ual quantum hardware. Such exchange process can be local (to a co-processor) or through quantu m remote procedure calls (for example a se rvice available on the Internet). W e could even i magine distributing t he code across multiple quantum pr ocessors, each specializing into i ts specific function. 37 http://en.wikipedia.org/wiki/Assembl y _l anguage QIS-XML 12 v2007.12 A pr ogram can be compiled into QIS-XML and submitted to differ ent loc al or r emote quantum processors or computers wher e it is converted into har dware specific code. Q IS- XM L Prog ra m Prog ram Propr i eta ry C om pi l er Propr i eta ry C om pi l er Propr i eta ry C om pi l er Q u an t u m C om pu t er L ocal Proce ssor R em ot e Proce ssor Q IS- X ML C om pi l er The hardware itself then has a local co mpiler that t urns QIS-XML inst ructions into hardware spe cific commands. This ma y involve converting logical gates into universal subsets implemented by the equipment (possibl y described using QIS-XML equivalent circuits) and turni ng the XML into a proprietar y s et of instructions. The advantages of this s ystems are that the high level language compiler does not need t o be aware of the local hardware implementation of the c ircuits ( or their equivalent) a nd the quantu m processor can be located anywhere, the infor mation exchange taking place using standard XML mechanis ms (like SOAP 38 or REST 39 ). Use case: Genadder & simulators As a proof of conc ept for the progra mming framework, we used a si m ple quantu m ci rcuit generator and, through QIS-XML, converted its out put into code that can be executed on various quantum computer simulators (given that we do not have hardware available toda y ) . This process is illustrated by Fig. 19. The circuit generator we used is “Genadder” 40 . It was designed b y NIST in 2003 to create quantum circuits to add two bi nary numbers of an y width. The original version of Genadder out puts circuits description in a text for m at. W e adjusted the C source code to instead generate the circuits in a QIS-XML format. Once this was co m pleted, it allowed us to visualize the circuits using the QIS-XML to SVG-XML transfor m s (Fig. 18) and to include the circuit in a QIS-XML program to perform the actual addition operation (Fig.20). W e then selected three quantu m computer si mulators to execute the p rogr am: the Fraunhofer Quantum Computing Simulator 41 , t he QCL 42 simulator and QuiDDPro 43 as target platforms. These were selected for their functionalities, stabilit y , performance and product maturity . Many other s imulators were identified but were no longer mai ntained, not well documented or inappr opriate for our purpose (the complete list is available and maintai ned on the web 44 ). Each simulator using a different syntax, the next step consisted in converti ng the QIS-XML program into 38 http://en.wikipedia.org/wiki/SOAP 39 http://en.wikipedia.org/wiki/REST 40 http://hissa.nist.gov/~black/Quantum/ genadder .ht ml 41 http://www .qc.fraunhofer .d e/ 42 http://tph.tuwien.ac.at/~oeme r/qcl.html 43 http://vlsicad.ee cs.umich.edu/Quantum/qp 44 http://rgomez.cos.gmu.edu/qis/?lvl1=simulators source code that could be executed on the selected simulators. This is a transformation of the XML i nto a text file and can be carried over using standard XSL T ransfor mation. Like for SVG however , high performance converter would be better implemented in a common programing language such as Java or C. W e did complete this step for the Fraunhofer (Fig. 21) and the QCL simulator (Fig. 22) but lack of time pre vented us to generate code for the QuiDDPro si mulator . W e however achieved the expected result s on the first two simulators and repeated the test for circuits wi th up to 50-qubits. This simple exa mple illustrate how QIS-XML could benefit both programmers and ha rdware implementers by having the high level code written in a co mmon language, converted to QIS-XML circuits and programs, and transparentl y executed on d i f f erent hardware platforms. Note that a detailed description of this pro c ess is available on the QIS-XML web site. 6.3 T ools Interoperabilit y Another potential application of QIS-XML is its abil it y to provide a harmonized information storage framework for QIS tools in order t o facilit ate their interaction. Most of the QIS manage ment and programming applications will actuall y be executed on classic computers and will need to exchange information with each other . For example, a quantu m circuit designer software could feed its output to a specialized vis ualization tool or function library t o be used in a progr amming environment. W i thout a standard storage s ystem, these applications are l ikely to use proprietary data for mats and exchanging information would require complicated and unnecessary conversions. QIS-XML alleviate this issue b y providing a common language for the ca pture of gate, c ircuits and l ow level programming instructions. QIS-XML 13 v2007.12 Differ ent appli cations sharing QIS-XML as common storage format to ensur e inter operabili ty and information exchange Q IS- XM L Prog ram m i n g L an g u ag e C i rc u i t D esi g n er V i su al i z at i on T ool 7 Status and next steps Status While full y functional, the QIS-XML specification should currentl y be considered a protot ype. It n e eds to be used b y a broader range of users and will likel y require several adjust ments, in particular the programming module. Further t esting will need to establish if the specification scales up t o complex circuits or algorithms and is suitable as a neutral platform for tools and co mpilers. It can nevertheless be used toda y b y an y one interested in appl y i ng or adopting the XML technolog y in t he field of QIS. W e hope this paper will incite others to experiment with it and contribute to its enhance ment. Need for tools QIS-XML also need spe cific tools. The i nitial XSL transformations use d to provide second level validation, generate the SVG, or convert programs to proprietar y c ode have their li mitations and could benefit from an i mplementation in a language such as Java or C. Utili ties will a lso be required for the management of complex circuits and programs or to implement features such as external referencing. Hardware Device Capability Module? One potential extension to QIS-XML would be a quantum device ca pability module. One of the issue we identified while working on the code c onverter for the si mulators is that we do not really know in advance what a hardware quantum component (or a software si mulator) is capable of. This makes it difficult to establish whether it supports the execution of specific QIS-XML code. Having a s tandard structure to describe t he characteristics of quantum hardware would be ver y us eful to address this issue. Such module could capture infor mation such as the number of qubits , type of gates supported b y the component, the circuit equivalence model, abilit y to reverse gat es, the memor y s y s te m, the level of programmabilit y , etc. Such module is a bit co mparable to the device capabilit y s y stem commonl y used b y printers to describe their characteristic s. Adoption & Sustainability Finall y , l ike an y XML specifi cation, QIS-XML cannot be driven b y a small gr oup of individuals. T o ensure global adoption, it will need to be endorsed at t he institutional level by agencies and org ani zations who will support its development, foster its adoption, and make it a sustainable s tandard. This specific issue will actuall y be addressed in another paper suggesting the establishment of a QIS Alliance whose overall objective will be to examine the issues of integration and i nt eroperabilit y between classic and qu antum information science. One of the activit y of the QIS Alliance would be to maintain QIS-XML. 8 Conclusions W e have demonstrated through this work how the widel y used XML standard coul d benefit quantu m and classic infor mation sciences b y bridging both worlds. W e also introduced QIS-XML as a potential solution to address funda mental infor mation exchange and quantum programming issues. W e believe that t he above i s likel y just scratching the surface of what is potentiall y achievable using QIS- XML and other QIS oriented other XML specifications. W e hope this initial ef fort will inspire others to l ook at quantum and classic infor mation sciences as a unified science and to further i nvestigate the issues of integration and interoperabilit y . Classic computers will be around for a long time and will re main the preferred interface for end users and de velopers. The ability for quantum computing technolog y to c ommunicate with classic computers along with the availabilit y of relevant open t ools will play a major role in the success and future of QIS. QIS-XML 14 v2007.12 Annex 1: QIS-XML Objects Figur e 2: Some fundamental T ypes QIS-XML 15 Annexes Figur e 1: The Instance Module Figur e 3: The Identification and Reference types QIS-XML 16 Annexes Figur e 4: The Gate T ype QIS-XML 17 Annexes Figur e 5: The Cir cuit T ype QIS-XML 18 Annexes Figur e 7: The Pr ogram T ype Figur e 6: The Gate Equivalence Circuit T ype QIS-XML 19 Annexes Figur e 9: The Register T ype Figur e 8: The Memory T ype Figur e 10:Qubit Range and QubitSet types QIS-XML 20 Annexes Figur e 1 1: T he Pr epar e type Figur e 12: The Execute T ype Annex 2: Output and visualization examples QIS-XML 21 Annexes Figur e 14: An HTML r epresentation of the T offoli G ate Figur e 13: T ransformation of an XML document i nto HTML using XSL T and an XSL P r ocessor QIS-XML 22 Annexes Figur e 16: SVG-XML r epre s entation of common quantum gates Figur e 15: XSLT based second level validation for a 9-quibit Shor code cir cuit (in which an err or has been intr oduced). QIS-XML 23 Annexes Figur e 18: SVG V ersion ofa a 3-quibit adder generated by the modified Genadder Figur e 17: SVG-XML r epre s entation of selected quantum cir cui ts Figur e 19: Using QIS-XML to execute GenAdder cir cuits on various simulators < p:Program > < r:Identification > < r:ID > six_plus_seven r:ID > r:Identification > < p:Name > Six plus Seven p:Name > < p:Memory size =" 15 "/> < p:Execute > < p:Register size =" 15 "> < p:Prepare > < p:QubitSet > < p:QubitIndex > 4 p:QubitIndex > < p:QubitIndex > 7 p:QubitIndex > < p:QubitIndex > 2 p:QubitIndex > < p:QubitIndex > 5 p:QubitIndex > < p:QubitIndex > 8 p:QubitIndex > < p:Value r =" 1 "/> p:QubitSet > p:Prepare > p:Register > < p:CircuitRef > < r:ID > adder5 r:ID > p:CircuitRef > p:Execute > < p:Measure > < p:Register size =" 6 "> < p:QubitIndex > 2 p:QubitIndex > < p:QubitIndex > 5 p:QubitIndex > < p:QubitIndex > 8 p:QubitIndex > < p:QubitIndex > 11 p:QubitIndex > < p:QubitIndex > 14 p:QubitIndex > < p:QubitIndex > 15 p:QubitIndex > p:Register > p:Measure > p:Program > Figur e 20: QIS-XML Pr ogr am to compute 6+7 using a 5-qubit adder QIS-XML 24 Annexes Q ML C om pi l er Q u i D DPr o Com pi l er Q C L C om pi l er Q C L Si m u l at or O u tpu t Frau n h of er Si m u l at or Q C L Si m u l at or O u tpu t O u tpu t SV G T ran sf or m SV G D i ag ra m Q IS- XM L Prog ram G en A dder Q IS- XM L Ci rcu i t < QML > < Circuit Name =" default " Size =" 6 " Id =" default.qml " Description =""> < Operation Step =" 0 "/> < Operation Step =" 1 "> < Application Name =" G " Id =" 0 " Bits =" 1 "> < Gate Type =" PAULI_X "/> Application > < Application Name =" G " Id =" 0 " Bits =" 3 "> < Gate Type =" PAULI_X "/> Application > Operation > < Operation Step =" 2 "> < Application Name =" G " Id =" 0 " Bits =" 0,1,2 "> < Gate Type =" TOFFOLI "/> Application > Operation > < Operation Step =" 3 "> < Application Name =" G " Id =" 0 " Bits =" 0,1 "> < Gate Type =" CNOT "/> Application > Operation > < Operation Step =" 4 "> < Application Name =" G " Id =" 0 " Bits =" 3,4,5 "> < Gate Type =" TOFFOLI "/> Application > Operation > < Operation Step =" 5 "> < Application Name =" G " Id =" 0 " Bits =" 3,4 "> < Gate Type =" CNOT "/> Application > Operation > < Operation Step =" 6 "> < Application Name =" G " Id =" 0 " Bits =" 2,4,5 "> < Gate Type =" TOFFOLI "/> Application > Operation > < Operation Step =" 7 "> < Application Name =" G " Id =" 0 " Bits =" 2,4 "> < Gate Type =" CNOT "/> Application > Operation > < Operation Step =" 8 "> < Application Name =" G " Id =" 0 " Bits =" 0,1,2 "> < Gate Type =" TOFFOLI "/> Application > Operation > < Operation Step =" 9 "> < Application Name =" G " Id =" 0 " Bits =" 0,2 "> < Gate Type =" CNOT "/> Application > Operation > Circuit > QML > Figur e 21: QML generated code of a 2-qubit adder to perform 2+1 QIS-XML 25 Annexes // ============================= // QIS-XML QCL Compiler v2007.04 // ============================= int i; int value; // Allocate program memory qureg memory[6]; // WARNING: p:Register not fully implemented *** qureg registerIDAQ3MTE = memory; // PREPARE i = 1; measure registerIDAQ3MTE[1],value; if value != 1 { X(registerIDAQ3MTE[1]); } measure registerIDAQ3MTE[3],value; if value != 1 { X(registerIDAQ3MTE[3]); } // CIRCUIT adder2 // STEP 1 // OPERATION 1 qureg registerIDAGFMTE = registerIDAQ3MTE[0]®isterIDAQ3MTE[1]®isterIDAQ3MTE[2]; CNot(registerIDAGFMTE[2] , registerIDAGFMTE[0] & registerIDAGFMTE[1]); // STEP 2 // OPERATION 1 qureg registerIDATFMTE = registerIDAQ3MTE[0]®isterIDAQ3MTE[1]; CNot(registerIDATFMTE[1],registerIDATFMTE[0]); // STEP 3 // OPERATION 1 qureg registerIDA3FMTE = registerIDAQ3MTE[3]®isterIDAQ3MTE[4]®isterIDAQ3MTE[5]; CNot(registerIDA3FMTE[2] , registerIDA3FMTE[0] & registerIDA3FMTE[1]); // STEP 4 // OPERATION 1 qureg registerIDAKGMTE = registerIDAQ3MTE[3]®isterIDAQ3MTE[4]; CNot(registerIDAKGMTE[1],registerIDAKGMTE[0]); // STEP 5 // OPERATION 1 qureg registerIDAUGMTE = registerIDAQ3MTE[2]®isterIDAQ3MTE[4]®isterIDAQ3MTE[5]; CNot(registerIDAUGMTE[2] , registerIDAUGMTE[0] & registerIDAUGMTE[1]); // STEP 6 // OPERATION 1 qureg registerIDABHMTE = registerIDAQ3MTE[2]®isterIDAQ3MTE[4]; CNot(registerIDABHMTE[1],registerIDABHMTE[0]); // STEP 7 // OPERATION 1 qureg registerIDALHMTE = registerIDAQ3MTE[0]®isterIDAQ3MTE[1]®isterIDAQ3MTE[2]; CNot(registerIDALHMTE[2] , registerIDALHMTE[0] & registerIDALHMTE[1]); // STEP 8 // OPERATION 1 qureg registerIDAYHMTE = registerIDAQ3MTE[0]®isterIDAQ3MTE[2]; CNot(registerIDAYHMTE[1],registerIDAYHMTE[0]); // MEASUREMENT for i=0 to 5{ measure memory[i],value; print i,"=",value; } Figur e 22: QCL generated pr ogram to compute 2+1 QIS-XML 26 Annexes
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment