% 
% File:	  test18.qasm
% Date:	  25-Mar-04
% Author: I. Chuang <ichuang@mit.edu>
%
% Sample qasm input file - multiple-control bullet op
% 
% 	def	MeasH,0,'\dmeter{H}'
% 	def	Z4,3,'bullet'	% handled specially
% 
% 	qubit	q0,\psi
% 	qubit	q1,+
% 	qubit	q2,+
% 	qubit	q3,\phi
% 
% 	nop	q0
% 	nop	q2
% 	Z4	q0,q1,q2,q3
% 	MeasH	q1
% 	MeasH	q2

%  Time 01:
%    Gate 00 nop(q0)
%    Gate 01 nop(q2)
%  Time 02:
%    Gate 02 Z4(q0,q1,q2,q3)
%  Time 03:
%    Gate 03 MeasH(q1)
%    Gate 04 MeasH(q2)

% Qubit circuit matrix:
%
% q0: gAA, gBA, n  , n  
% q1: n  , gBB, gCB, N  
% q2: gAC, gBC, gCC, N  
% q3: n  , gBD, n  , n  

\documentclass[11pt]{article}
\input{xyqcirc.tex}

% definitions for the circuit elements

\def\gAA{*-{}\w\A{gAA}}
\def\gAC{*-{}\w\A{gAC}}
\def\gBA{\b\w\A{gBA}}
\def\gBB{\b\w\A{gBB}}
\def\gBC{\b\w\A{gBC}}
\def\gBD{\b\w\A{gBD}}
\def\gCB{\dmeter{H}\w\A{gCB}}
\def\gCC{\dmeter{H}\w\A{gCC}}

% definitions for bit labels and initial states

\def\bA{\qv{q_{0}}{\psi}}
\def\bB{\qv{q_{1}}{+}}
\def\bC{\qv{q_{2}}{+}}
\def\bD{\qv{q_{3}}{\phi}}

% The quantum circuit as an xymatrix

\xymatrix@R=5pt@C=10pt{
    \bA & \gAA &\gBA &\n   &\n  
\\  \bB & \n   &\gBB &\gCB &\N  
\\  \bC & \gAC &\gBC &\gCC &\N  
\\  \bD & \n   &\gBD &\n   &\n  
%
% Vertical lines and other post-xymatrix latex
%
\ar@{-}"gBD";"gBA"\ar@{-}"gBD";"gBB"\ar@{-}"gBD";"gBC"
}

\end{document}
