To access and edit the quantum circuit and view the Bloch sphere of the quantum state online, click the hyperlink(to run and see the Bloch sphere you have to sign in). The final code is also posted on the git-hub(some self-written script of the project is called in that file).
The circuit is as follows:
and the quantum circuit from the reference is
(Chandak, S., Mardia, J., & Tolunay, M. Implementation and analysis of stabilizer codes in pyQuil.).
After I completed the construction follows the upper reference, a global phase factor pi shows up for the logical state of |1>, so I appended a controlled-phase flip operation(CU1(pi), CX, CU1(pi), CX). To get the logical state of |0>, just remove the leftmost X gate.
Here comes another reference:
Gottesman, Daniel. "Stabilizer codes and quantum error correction." arXiv preprint quant-ph/9705052 (1997).
For the detail of the stabilize code encoding, you can read section 4.2(Network for Encoding) of the Gottesman book or section 10.5.8(Quantum circuits for encoding, decoding, and correction) of the Nielson book.
Here comes my code, first I generated the physical qubits
from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit,Aer,execute
from qiskit.providers.aer import QasmSimulator
from qiskit.circuit.library.standard_gates import CU1Gate
from numpy import pi
def physicalQubits(ipt):
qr=QuantumRegister(5)
circ=QuantumCircuit(qr)
if ipt==1:
circ.x(qr[0])
# controlled phase flip - if the input state is |1>,
# then flip the global phase by pi
CU1=CU1Gate(pi)
circ.append(CU1,[qr[0],qr[1]])
circ.cx(qr[0],qr[1])
circ.append(CU1,[qr[0],qr[1]])
circ.cx(qr[0],qr[1])
circ.h(qr[4])
circ.s(qr[4])
# g1
circ.cz(qr[4],qr[3])
circ.cz(qr[4],qr[1])
circ.cy(qr[4],qr[0])
circ.h(qr[3])
#g2
circ.cz(qr[3],qr[2])
circ.cz(qr[3],qr[1])
circ.cx(qr[3],qr[0])
circ.h(qr[2])
#g3
circ.cz(qr[2],qr[4])
circ.cz(qr[2],qr[3])
circ.cx(qr[2],qr[0])
circ.h(qr[1])
circ.s(qr[1])
#g4
circ.cz(qr[1],qr[4])
circ.cz(qr[1],qr[2])
circ.cy(qr[1],qr[0])
return circ.to_gate()
Then, you can get(in this place, to get the following output, you have to append the classical register and the corresponding measurement and execute instruction by yourself, since the requirement of this question is to not use classical register)

But until this place, I only showed you that the quantum states are correct, while the phase continues unknown, so what follows is the code to check the phase:
from qiskit.aqua.operators import StateFn,I
def ini(circ,qr,ipt):
# Input binary form, and append [0] ahead for qr1 block.
for i in range(len(ipt)):
if ipt[len(ipt)-i-1]:
circ.x(qr[i])
return 0
def Dec2Bi(num):
# Decimal to binary list.
res=list(bin(num)[2:])
return [int(res[i]) for i in range(len(res))]
def checkPhases():
operator=I.tensorpower(5)
for i in range(32):
qr=QuantumRegister(5)
circ=QuantumCircuit(qr)
ini(circ,qr,Dec2Bi(i))
psi=StateFn(circ)
phi1=StateFn(physicalQubits(0))
print('expectation value for state '+bin(i)[2:]+' and the physical qubits of 0:')
print((~psi@operator@phi1).eval())
phi2=StateFn(physicalQubits(1))
print('expectation value for state '+bin(i)[2:]+' and the physical qubits of 1:')
print((~psi@operator@phi2).eval())
Then call the function--
checkPhases()
You'll get the result and if the phase is non-zero, the result of the corresponding one should be a negative one.
Another way to check that this construction of gate works correctly is to get the state vector(psi0) of the constructed state and the state vector(psi1) after an arbitrary stabilizer is acted on it and see whether <psi0|psi1> equals one. I have checked the result but the code is omitted(you can still access the corresponding on git-hub).