Skip to content

Core-library Functions

Following is a comprehensive list of QMOD built-in function declarations:

Atomic (Gate-level) Functions

Atomic functions are functions that generally map directly to operations in the quantum-program, and supported by underlying execution framework.

qfunc H(target: qbit);
qfunc X(target: qbit);
qfunc Y(target: qbit);
qfunc Z(target: qbit);
qfunc I(target: qbit);
qfunc S(target: qbit);
qfunc T(target: qbit);
qfunc SDG(target: qbit);
qfunc TDG(target: qbit);
qfunc PHASE<theta: real>(target: qbit);
qfunc RX<theta: real>(target: qbit);
qfunc RY<theta: real>(target: qbit);
qfunc RZ<theta: real>(target: qbit);
qfunc R<theta: real, phi: real>(target: qbit);
qfunc RXX<theta: real>(target: qbit[2]);
qfunc RYY<theta: real>(target: qbit[2]);
qfunc RZZ<theta: real>(target: qbit[2]);
qfunc CH(control: qbit, target: qbit);
qfunc CX(control: qbit, target: qbit);
qfunc CY(control: qbit, target: qbit);
qfunc CZ(control: qbit, target: qbit);
qfunc CRX<theta: real>(control: qbit, target: qbit);
qfunc CRY<theta: real>(control: qbit, target: qbit);
qfunc CRZ<theta: real>(control: qbit, target: qbit);
qfunc CPHASE<theta: real>(control: qbit, target: qbit);
qfunc SWAP(qbit0: qbit, qbit1: qbit);
qfunc IDENTITY(target: qbit[]);

In Python the optional argument external of the decorator qfunc indicates that the definition of the function is specified elsewhere.

@qfunc(external=True)
def H(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def X(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def Y(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def Z(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def I(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def S(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def T(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def SDG(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def TDG(
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def PHASE(
    theta: CReal,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def RX(
    theta: CReal,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def RY(
    theta: CReal,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def RZ(
    theta: CReal,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def R(
    theta: CReal,
    phi: CReal,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def RXX(
    theta: CReal,
    target: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def RYY(
    theta: CReal,
    target: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def RZZ(
    theta: CReal,
    target: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def CH(
    control: QBit,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def CX(
    control: QBit,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def CY(
    control: QBit,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def CZ(
    control: QBit,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def CRX(
    theta: CReal,
    control: QBit,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def CRY(
    theta: CReal,
    control: QBit,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def CRZ(
    theta: CReal,
    control: QBit,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def CPHASE(
    theta: CReal,
    control: QBit,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def SWAP(
    qbit0: QBit,
    qbit1: QBit,
) -> None:
    pass


@qfunc(external=True)
def IDENTITY(
    target: QArray[QBit],
) -> None:
    pass

Builtin Functions

qfunc prepare_state<probabilities: real[], bound: real>(output out: qbit[log(probabilities.len, 2)]);
qfunc prepare_amplitudes<amplitudes: real[], bound: real>(output out: qbit[log(amplitudes.len, 2)]);
qfunc unitary<elements: real[][]>(target: qbit[log(elements[0].len, 2)]);
qfunc add(left: qbit[], right: qbit[], output result: qbit[Max(left.len, right.len) + 1]);
qfunc modular_add(left: qbit[], right: qbit[]);
qfunc integer_xor(left: qbit[], right: qbit[]);
qfunc U<theta: real, phi: real, lam: real, gam: real>(target: qbit);
qfunc CCX(control: qbit[2], target: qbit);
qfunc allocate<num_qubits: int>(output out: qbit[num_qubits]);
qfunc free(input in: qbit[]);
qfunc randomized_benchmarking<num_of_cliffords: int>(target: qbit[]);
qfunc inplace_prepare_state<probabilities: real[], bound: real>(target: qbit[log(probabilities.len, 2)]);
qfunc inplace_prepare_amplitudes<amplitudes: real[], bound: real>(target: qbit[log(amplitudes.len, 2)]);
qfunc single_pauli_exponent<pauli_string: Pauli[], coefficient: real>(qbv: qbit[pauli_string.len]);
qfunc suzuki_trotter<pauli_operator: PauliTerm[], evolution_coefficient: real, order: int, repetitions: int>(qbv: qbit[pauli_operator[0].pauli.len]);
qfunc qdrift<pauli_operator: PauliTerm[], evolution_coefficient: real, num_qdrift: int>(qbv: qbit[pauli_operator[0].pauli.len]);
qfunc exponentiation_with_depth_constraint<pauli_operator: PauliTerm[], evolution_coefficient: real, max_depth: int>(qbv: qbit[pauli_operator[0].pauli.len]);
@qfunc(external=True)
def prepare_state(
    probabilities: CArray[CReal],
    bound: CReal,
    out: Output[QArray[QBit]],
) -> None:
    pass


@qfunc(external=True)
def prepare_amplitudes(
    amplitudes: CArray[CReal],
    bound: CReal,
    out: Output[QArray[QBit]],
) -> None:
    pass


@qfunc(external=True)
def unitary(
    elements: CArray[CArray[CReal]],
    target: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def add(
    left: QArray[QBit],
    right: QArray[QBit],
    result: Output[QArray[QBit]],
) -> None:
    pass


@qfunc(external=True)
def modular_add(
    left: QArray[QBit],
    right: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def integer_xor(
    left: QArray[QBit],
    right: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def U(
    theta: CReal,
    phi: CReal,
    lam: CReal,
    gam: CReal,
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def CCX(
    control: QArray[QBit],
    target: QBit,
) -> None:
    pass


@qfunc(external=True)
def allocate(
    num_qubits: CInt,
    out: Output[QArray[QBit]],
) -> None:
    pass


@qfunc(external=True)
def free(
    in_: Input[QArray[QBit]],
) -> None:
    pass


@qfunc(external=True)
def randomized_benchmarking(
    num_of_cliffords: CInt,
    target: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def inplace_prepare_state(
    probabilities: CArray[CReal],
    bound: CReal,
    target: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def inplace_prepare_amplitudes(
    amplitudes: CArray[CReal],
    bound: CReal,
    target: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def single_pauli_exponent(
    pauli_string: CArray[Pauli],
    coefficient: CReal,
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def suzuki_trotter(
    pauli_operator: CArray[PauliTerm],
    evolution_coefficient: CReal,
    order: CInt,
    repetitions: CInt,
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def qdrift(
    pauli_operator: CArray[PauliTerm],
    evolution_coefficient: CReal,
    num_qdrift: CInt,
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def exponentiation_with_depth_constraint(
    pauli_operator: CArray[PauliTerm],
    evolution_coefficient: CReal,
    max_depth: CInt,
    qbv: QArray[QBit],
) -> None:
    pass

Application Functions

qfunc molecule_ucc<molecule_problem: MoleculeProblem, excitations: int[]>(qbv: qbit[molecule_problem_to_hamiltonian(molecule_problem)[0].pauli.len]);
qfunc molecule_hva<molecule_problem: MoleculeProblem, reps: int>(qbv: qbit[molecule_problem_to_hamiltonian(molecule_problem)[0].pauli.len]);
qfunc molecule_hartree_fock<molecule_problem: MoleculeProblem>(qbv: qbit[molecule_problem_to_hamiltonian(molecule_problem)[0].pauli.len]);
qfunc fock_hamiltonian_ucc<fock_hamiltonian_problem: FockHamiltonianProblem, excitations: int[]>(qbv: qbit[fock_hamiltonian_problem_to_hamiltonian(fock_hamiltonian_problem)[0].pauli.len]);
qfunc fock_hamiltonian_hva<fock_hamiltonian_problem: FockHamiltonianProblem, reps: int>(qbv: qbit[fock_hamiltonian_problem_to_hamiltonian(fock_hamiltonian_problem)[0].pauli.len]);
qfunc fock_hamiltonian_hartree_fock<fock_hamiltonian_problem: FockHamiltonianProblem>(qbv: qbit[fock_hamiltonian_problem_to_hamiltonian(fock_hamiltonian_problem)[0].pauli.len]);
qfunc log_normal_finance<finance_model: LogNormalModel, finance_function: FinanceFunction>(func_port: qbit[finance_model.num_qubits], obj_port: qbit);
qfunc gaussian_finance<finance_model: GaussianModel, finance_function: FinanceFunction>(func_port: qbit[((finance_model.num_qubits + finance_model.rhos.len) + floor(log(sum(finance_model.loss), 2))) + 1], obj_port: qbit);
qfunc pauli_feature_map<feature_map: QSVMFeatureMapPauli>(qbv: qbit[feature_map.feature_dimension]);
qfunc bloch_sphere_feature_map<feature_dimension: int>(qbv: qbit[ceiling(feature_dimension / 2)]);
@qfunc(external=True)
def molecule_ucc(
    molecule_problem: MoleculeProblem,
    excitations: CArray[CInt],
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def molecule_hva(
    molecule_problem: MoleculeProblem,
    reps: CInt,
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def molecule_hartree_fock(
    molecule_problem: MoleculeProblem,
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def fock_hamiltonian_ucc(
    fock_hamiltonian_problem: FockHamiltonianProblem,
    excitations: CArray[CInt],
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def fock_hamiltonian_hva(
    fock_hamiltonian_problem: FockHamiltonianProblem,
    reps: CInt,
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def fock_hamiltonian_hartree_fock(
    fock_hamiltonian_problem: FockHamiltonianProblem,
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def log_normal_finance(
    finance_model: LogNormalModel,
    finance_function: FinanceFunction,
    func_port: QArray[QBit],
    obj_port: QBit,
) -> None:
    pass


@qfunc(external=True)
def gaussian_finance(
    finance_model: GaussianModel,
    finance_function: FinanceFunction,
    func_port: QArray[QBit],
    obj_port: QBit,
) -> None:
    pass


@qfunc(external=True)
def pauli_feature_map(
    feature_map: QSVMFeatureMapPauli,
    qbv: QArray[QBit],
) -> None:
    pass


@qfunc(external=True)
def bloch_sphere_feature_map(
    feature_dimension: CInt,
    qbv: QArray[QBit],
) -> None:
    pass