# qrisp.hybrid_mult#

hybrid_mult(x, y, output_qf=None, init_op='h', terminal_op='qft', phase_tolerant=False, cl_factor=1)[source]#

An advanced algorithm for multiplication which has better depth, gate-count and compile time than `sbp_mult`. It does not support squaring a single QuantumFloat though.

This algorithm also operates on the Fourier transform. Because of this, between successive multiplications targeting the same QuantumFloat it is not neccessary to Fourier-Transform. This advantage is expressed in the parameters init_op and terminal_op. These can be set to either ‘h’, ‘qft’ or None to leave out self canceling Fourier-transforms.

Parameters
xQuantumFloat

The first factor to multiply.

yQuantumFloat

The second factor to multiply.

output_qfQuantumFloat, optional

The QuantumFloat to store the result in. By default a suited QuantumFloat is created.

init_opstr, optional

The operation to bring output_qf into it’s Fourier-transform. The default is ‘h’.

terminal_opstr, optional

The operation to bring output_qf back from it’s Fourier-transform. The default is “qft”.

phase_tolerantbool, optional

If set to True, differing results introduce differing extra phases. This can be usefull to save resources incase this functions will get uncomputed. The default is False.

cl_factorfloat, optional

Allows to multiply the result by a classical factor without any extra gates. The default is 1.

Returns
output_qfQuantumFloat

The QuantumFloat containing the result.

Examples

We multiply two QuantumFloat with eachother and an additional classical factor

```from qrisp import QuantumFloat, hybrid_mult
qf_0 = QuantumFloat(3)
qf_1 = QuantumFloat(3)
qf_0[:] = 3
qf_1[:] = 4
qf_res = hybrid_mult(qf_0, qf_1, cl_factor = 2)
print(qf_res)
```
```# Yields: {24: 1.0}
```