Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute MATLAB/Octave Online

% Quantum Computation

plus = [1/sqrt(2); 1/sqrt(2)];
minus = [1/sqrt(2); -1/sqrt(2)];
Id2 = eye(2);
X = [0 1; 1 0];
Y = [0 -1i; 1i 0];
Z = [1 0; 0 -1];
H = [1/sqrt(2) 1/sqrt(2); 1/sqrt(2) -1/sqrt(2)];
S = [1 0; 0 1i];
Sdag = [1 0; 0 -1i];
% U1 = [1 0; 0 exp(1i*phi)];
% U2 = [1/sqrt(2) -exp(1i*lambda)/sqrt(2); exp(1i*phi)/sqrt(2) exp(1i*lambda+1i*phi)/sqrt(2)];
% U3 = [cos(theta/2) -exp(1i*lambda)*sin(theta/2); exp(1i*phi)*sin(theta/2) exp(1i*lambda+1i*phi)*cos(theta/2)];
T = [1 0; 0 (1+1i)/sqrt(2)];
Tdag = [1 0; 0 (1-1i)/sqrt(2)];
Cnot = [1 0 0 0; 0 1 0 0; 0 0 0 1; 0 0 1 0];
%R1 = kron(Cnot, Id2);
%R1 = Z*plus;  % = minus
%R2 = Z*minus; % = plus

Z1 = Z*plus; % = minus
Y1 = Y*plus; % = -1i*minus
H1 = H*plus;  % = |0>
S1 = S*plus;
HS1 = H*S1;
SY1 = S*Y1;
SZ1 = S*Z1;
ZY1 = Z*Y1;

R1 = kron(SY1, HS1)
R2 = kron(Y1, SY1);
R3 = kron(R1, R2);

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.