Skip to content

Utility function: "wrap" a kernel #331

@jon-wurtz

Description

@jon-wurtz

A utility function that encapsulates some kernel that operates on qubits.

For example, if you have some kernel with a signature

def kernel(*qubits:Qubit, **kwargs) -> None

aka acting on some list of qubits as a unitary or other operation, make a utility function that "wraps" that for ease of simulation so that one does not need to write the following code snippet every time

def main():
    qbts = bloqade.squin.qubit.new( ## ) 
    kernel( *qbts, **kwargs )
    bits = bloqade.squin.measure(*qbts)
    return bits

main2 = bloqade.circuit.utils.wrap(kernel,**kwargs)
# main == main2

where ##, the number of qubits, is computed by evaluating the required number of input qubits in kernel or is set as a variable in the wrapper (nqubits = ###).

Metadata

Metadata

Assignees

Labels

area: stdlibArea: standard library related issues.category: enhancementCategory: this is an enhancement of an existing feature.priority: lowPriority: low priority issues and tasks, backlogs, good-to-haves.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions