Fixes
[texmacs.git] / doc / plugins / qcl / qcl-main.it.tm
blob878e5b5eb2125d78e77ee7b29f9f541a805a0f71
1 <TeXmacs|1.0.1.18>
3 <style|<tuple|tmdoc|maxima>>
5 <\body>
6   <\expand|tmdoc-title>
7     Utilizzare sessioni di Qcl in <TeXmacs>
8   </expand>
10   <name|Qcl> è un linguaggio di programmazione di alto livello e indipendente
11   dall'architettura per i computer quantistici, con una sintassi derivata dai
12   linguaggi procedurali classici come il <name|C> o il <name|Pascal>. Questo
13   permette la completa implementazione e la simulazione di algoritmi
14   quantistici (includendo componenti classiche) in un formalismo consistente.
15   L'interfaccia di <TeXmacs> è utile soprattutto per visualizzare in modo
16   leggibile gli stati quantici. Per maggiori informazioni si veda
18   <\verbatim>
19     \ \ \ \ http://tph.tuwien.ac.at/~oemer/qcl.html
20   </verbatim>
22   Come consiglio, gli utilizzatori farebbero meglio ad installare la versione
23   binaria più recente, ora vi è la 0.5, poiché è difficile compilare dai
24   codici sorgenti. Inoltre, se si installa <name|Qcl> dalla versione binaria,
25   ci si assicuri che tutta la directory di libreria, <verbatim|lib>, sia
26   sotto la directory in cui sono posti i file binari <verbatim|qcl>.
28   <\session|qcl|default>
29     <\output>
30       QCL Quantum Computation Language (32 qubits, seed 1051277574)
32       [0/32] <with|mode|math|1<hspace|0.25spc><with|color|magenta|\|<with|math
33       font family|rm|0>\<rangle\>>>
34     </output>
36     <\input|<\with|color|red>
37       <\verbatim>
38         qcl\<gtr\>\ 
39       </verbatim>
40     </with>>
41       qureg a[1];
42     </input>
44     <\input|<\with|color|red>
45       <\verbatim>
46         qcl\<gtr\>\ 
47       </verbatim>
48     </with>>
49       Rot(pi/4,a);
50     </input>
52     <\output>
53       [1/32] <with|mode|math|0.92388<hspace|0.25spc><with|color|magenta|\|<with|math
54       font family|rm|0>\<rangle\>>-0.38268<hspace|0.25spc><with|color|magenta|\|<with|math
55       font family|rm|1>\<rangle\>>>
56     </output>
58     <\input|<\with|color|red>
59       <\verbatim>
60         qcl\<gtr\>\ 
61       </verbatim>
62     </with>>
63       Mix(a);
64     </input>
66     <\output>
67       [1/32] <with|mode|math|0.38268<hspace|0.25spc><with|color|magenta|\|<with|math
68       font family|rm|0>\<rangle\>>+0.92388<hspace|0.25spc><with|color|magenta|\|<with|math
69       font family|rm|1>\<rangle\>>>
70     </output>
72     <\input|<\with|color|red>
73       <\verbatim>
74         qcl\<gtr\>\ 
75       </verbatim>
76     </with>>
77       dump;
78     </input>
80     <\output>
81       <\with|color|blue>
82         <\verbatim>
83           STATE: 1 / 32 qubits allocated, 31 / 32 qubits free
84         </verbatim>
85       </with>
87       <\with|mode|math>
88         0.38268<hspace|0.25spc><with|color|magenta|\|<with|math font
89         family|rm|0>\<rangle\>>+0.92388<hspace|0.25spc><with|color|magenta|\|<with|math
90         font family|rm|1>\<rangle\>>
91       </with>
92     </output>
94     <\input|<\with|color|red>
95       <\verbatim>
96         qcl\<gtr\>\ 
97       </verbatim>
98     </with>>
99       include "shor.qcl";
100     </input>
102     <\input|<\with|color|red>
103       <\verbatim>
104         qcl\<gtr\>\ 
105       </verbatim>
106     </with>>
107       operator dft(qureg q) { const n=#q; int i; int j;for i=1 to n { for j=1
108       to i-1 { if q[n-1] and q[n-j] {Phase(pi/2^(i-j));}} H(q[n-1]);}
109       flip(q); }
110     </input>
112     <\output>
113       <\with|color|red>
114         <\verbatim>
115           at "operator dft(qureg q) { c ...":
116         </verbatim>
117       </with>
119       <\with|color|red>
120         <\verbatim>
121           illegal scope: Global symbol dft already defined
122         </verbatim>
123       </with>
124     </output>
126     <\input|<\with|color|red>
127       <\verbatim>
128         qcl\<gtr\>\ 
129       </verbatim>
130     </with>>
131       dft(a);
132     </input>
134     <\output>
135       [1/32] <with|mode|math|0.70711<hspace|0.25spc><with|color|magenta|\|<with|math
136       font family|rm|0>\<rangle\>>+0.70711<hspace|0.25spc><with|color|magenta|\|<with|math
137       font family|rm|1>\<rangle\>>>
138     </output>
140     <\input|<\with|color|red>
141       <\verbatim>
142         qcl\<gtr\>\ 
143       </verbatim>
144     </with>>
145       \;
146     </input>
147   </session>
149   <apply|tmdoc-copyright|2003|Chu-Ching Huang, Lucia Gecchelin>
151   <expand|tmdoc-license|Permission is granted to copy, distribute and/or
152   modify this document under the terms of the GNU Free Documentation License,
153   Version 1.1 or any later version published by the Free Software Foundation;
154   with no Invariant Sections, with no Front-Cover Texts, and with no
155   Back-Cover Texts. A copy of the license is included in the section entitled
156   "GNU Free Documentation License".>
157 </body>
159 <\initial>
160   <\collection>
161     <associate|paragraph width|150mm>
162     <associate|odd page margin|30mm>
163     <associate|page right margin|30mm>
164     <associate|page top margin|30mm>
165     <associate|reduction page right margin|25mm>
166     <associate|page type|a4>
167     <associate|reduction page bottom margin|15mm>
168     <associate|even page margin|30mm>
169     <associate|reduction page left margin|25mm>
170     <associate|page bottom margin|30mm>
171     <associate|reduction page top margin|15mm>
172     <associate|language|italian>
173   </collection>
174 </initial>
176 <\references>
177   <\collection>
178     <associate|toc-10|<tuple|8.2|?>>
179     <associate|toc-11|<tuple|8.3|?>>
180     <associate|gly-1|<tuple|1|?>>
181     <associate|idx-1|<tuple|<uninit>|?>>
182     <associate|idx-2|<tuple|1|?>>
183     <associate|gly-2|<tuple|2|?>>
184     <associate|toc-12|<tuple|8.4|?>>
185     <associate|gly-3|<tuple|3|?>>
186     <associate|toc-13|<tuple|8.5|?>>
187     <associate|idx-3|<tuple|3|?>>
188     <associate|gly-4|<tuple|4|?>>
189     <associate|toc-14|<tuple|8.6|?>>
190     <associate|idx-4|<tuple|7|?>>
191     <associate|gly-5|<tuple|5|?>>
192     <associate|toc-15|<tuple|8.7|?>>
193     <associate|idx-5|<tuple|8|?>>
194     <associate|gly-6|<tuple|6|?>>
195     <associate|toc-16|<tuple|8.8|?>>
196     <associate|gly-7|<tuple|7|?>>
197     <associate|gly-8|<tuple|8|?>>
198     <associate|gly-9|<tuple|9|?>>
199     <associate|toc-1|<tuple|1|?>>
200     <associate|toc-2|<tuple|2|?>>
201     <associate|toc-3|<tuple|3|?>>
202     <associate|toc-4|<tuple|4|?>>
203     <associate|toc-5|<tuple|5|?>>
204     <associate|toc-6|<tuple|6|?>>
205     <associate|toc-7|<tuple|7|?>>
206     <associate|toc-8|<tuple|8|?>>
207     <associate|toc-9|<tuple|8.1|?>>
208   </collection>
209 </references>