11 changed files with 5 additions and 63 deletions
@ -0,0 +1,5 @@ |
|||
cmake_minimum_required(VERSION 3.19.7) |
|||
|
|||
project(sqint) |
|||
|
|||
add_executable(${PROJECT_NAME} src/parse.cpp src/QReg.cpp) |
@ -1,43 +0,0 @@ |
|||
##
|
|||
# QPL Interpreter
|
|||
#
|
|||
# @file
|
|||
# @version 0.1
|
|||
|
|||
IDIR=include |
|||
CPPFLAGS=-g -I$(IDIR) -lstdc++ -std=c++11 -Wall |
|||
|
|||
LIBS= |
|||
|
|||
ODIR=obj |
|||
LDIR=lib |
|||
|
|||
BDIR=bin |
|||
|
|||
_DEPS = parse.h QReg.h |
|||
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) |
|||
|
|||
_OBJ = parse.o QReg.o |
|||
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) |
|||
|
|||
$(ODIR)/%.o: src/%.cpp $(DEPS) |
|||
$(CXX) -c -o $@ $< $(CPPFLAGS) |
|||
|
|||
MKDIR_P = mkdir -p |
|||
|
|||
.PHONY: clean directories |
|||
|
|||
all: directories parse |
|||
|
|||
parse: $(OBJ) |
|||
$(CXX) -o $(BDIR)/$@ $^ $(CPPFLAGS) |
|||
|
|||
directories: ${BDIR} ${ODIR} |
|||
|
|||
${BDIR}: |
|||
${MKDIR_P} ${BDIR} |
|||
|
|||
${ODIR}: |
|||
${MKDIR_P} ${ODIR} |
|||
clean: |
|||
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~ |
@ -1,20 +0,0 @@ |
|||
class QuantumSimExample: |
|||
def __init__( |
|||
self, |
|||
n_qubits, |
|||
): |
|||
self.n_qubits = n_qubits |
|||
self.qubits = [0] * n_qubits |
|||
# in this classical simulation, we use 2^n_qubits complex numbers |
|||
self.amps = [0] * (1 << n_qubits) |
|||
self.amps[len(self.amps) - 1] = 1 |
|||
|
|||
def __repr__(self) -> str: |
|||
return f"TestQubits[{self.n_qubits}], amps: {self.amps}" |
|||
|
|||
def main(): |
|||
quantum_sim_example = QuantumSimExample(n_qubits=3) |
|||
print(quantum_sim_example) |
|||
|
|||
if __name__ == '__main__': |
|||
main() |
Loading…
Reference in new issue