Skip to content

A separate procedure to encode the circuits #28

@JingyiMei98

Description

@JingyiMei98

Now we use quokka-sharp as

    import quokka-sharp as qk
    # the input circuit should be in QASM format
    # compute probability of measurement outcome 0 on the first qubit
    res = qk.Measure("circ1.qasm", "firstzero")
    print(res.prob)
    # compute probability of measurement outcome 0 on the all qubits
    res = qk.Measure("circ1.qasm", "allzero")
    print(res.prob)

To avoid encoding the circuits twice, we can rewrite the function as

    import quokka-sharp as qk
    # the input circuit should be in QASM format
    # compute probability of measurement outcome 0 on the first qubit
    cnf1 = qc2cnf1("circ1.qasm")
    res = qk.Measure(cnf1, "firstzero")
    # compute probability of measurement outcome 0 on the all qubits
    res = qk.Measure(cnf1, "allzero")

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions