Prefix Arithmetic#

While syntactically more compact/elegant, infix arithmetic expressions allow barely any customization regarding precision, method etc. which can be detrimental when efficiency is a concern. Because of this we expose the underlying prefix arithmetic functions:

In-place adders#

fourier_adder(a, b[, perform_QFT])

In-place adder function based on this paper Performs the addition

cuccaro_adder(qf2, qf1, *args[, ...])

In-place adder function based on this paper Performs the addition

gidney_adder(qf2, qf1, *args[, ...])

In-place adder function based on this paper performs the addition

qcla(a, b[, radix_base, radix_exponent, ...])

Implementation of the higher radix quantum carry lookahead adder (QCLA) as described here.

QuantumFloat processing#

sbp_mult(factor_1_qf, factor_2_qf[, output_qf])

Performs multiplication based on the evaluation of semi-boolean polynomials.

sbp_add(summand_1_qf, summand_2_qf[, output_qf])

Performs addition based on the evaluation of semi-boolean polynomials.

sbp_sub(summand_1_qf, summand_2_qf[, output_qf])

Performs subtraction based on the evaluation of semi-boolean polynomials.

hybrid_mult(x, y[, output_qf, init_op, ...])

An advanced algorithm for multiplication which has better depth, gate-count and compile time than sbp_mult.

inpl_add(*args[, permeability, is_qfree, verify])

inpl_mult(qf, mult_int[, treat_overflow])

Performs inplace multiplication of a QuantumFloat with a classical integer.

q_divmod(numerator, divisor[, adder, prec])

Performs division up to arbitrary precision.

q_div(numerator, divisor[, prec])

Performs division up to arbitrary precision and uncomputes the remainder.

qf_inversion(qf[, prec])

Calculates the multiplicative inverse of a QuantumFloat.

QuantumArray processing#

q_matmul(q_array_0, q_array_1[, ...])

Matrix multiplication for QuantumArrays.

semi_classic_matmul(q_matrix, cl_matrix[, ...])

Performs matrix multiplication between a classical numpy array and a QuantumArray

inplace_matrix_app(vector, matrix)

Performs inplace matrix application to a vector-valued QuantumArray.

dot(a, b[, out])

Port of the popular numpy function with similar semantics.

tensordot(a, b, axes)

Port of numpy tensordot with similar semantics.