# Fitting the algorithm to the quantum computer, and vice versa

When Cinderella lost her shoe, the solutions did not have any degree of freedom. There was only one woman - so the legend goes - that could comfortably wear the magical shoe.

Fortunately, when trying to create a fit between an algorithm and a quantum computer, there are many more degrees of freedom.

The need to make sure there is 'enough computer' to run the algorithm is symptomatic to the current limited state of quantum computers. When there are fewer than 100 qubits and when the qubits are noisy, not every algorithm can successfully run.

There are two motivations for finding a fit: The first is to run a given algorithm on an existing quantum computer. The second is to understand how large a quantum computer needs to be to run a particular version of the algorithm.

What can be done to find the fit? Quite a few things, even if staying purely in the realm of quantum computing:

- Simplify the algorithm.
- Use a computer with more qubits.
- Trade off qubits for circuit depth: sometimes, if additional qubits are available, allowing for more ancilla qubits, the circuit can become shallower and thus less susceptible to noise.
- Reduce the desired accuracy. For instance, state preparation (the process of loading probability mass functions into qubits) is an important steps in many algorithms, but perhaps the values don't need to be 99.9% accurate and 97% accuracy can suffice as well.
- Change the order of operations. For instance (see this previous post) when calculating a*a-b*b one could first calculate a*a, then calculate and b*b from it, but one could also rewrite this as (a+b)*(a-b) and perhaps that yields a more efficient implementation.
- Identify qubits that are no longer required at some point in the algorithm and reuse them.

This fitting process is not just academic. Even if you are sure that the desired algorithm does not fit in today's quantum computers, you might want to know how large the computer needs to be to run it, and thus be able to extrapolate how far in the future might this solution be feasible.

The point is that fitting is important, but might require a lot of experimentation. However, such experimentation is very difficult to do using gate-level software design tools. This is one reason that we are so excited about the Classiq quantum algorithm design platform, because it lets the designer change the constraints at will and then automatically labors to find a solution that meets these constraints.

For instance, see the video below on finding the sweet spot for state preparation

When Cinderella lost her shoe, the solutions did not have any degree of freedom. There was only one woman - so the legend goes - that could comfortably wear the magical shoe.

Fortunately, when trying to create a fit between an algorithm and a quantum computer, there are many more degrees of freedom.

The need to make sure there is 'enough computer' to run the algorithm is symptomatic to the current limited state of quantum computers. When there are fewer than 100 qubits and when the qubits are noisy, not every algorithm can successfully run.

There are two motivations for finding a fit: The first is to run a given algorithm on an existing quantum computer. The second is to understand how large a quantum computer needs to be to run a particular version of the algorithm.

What can be done to find the fit? Quite a few things, even if staying purely in the realm of quantum computing:

- Simplify the algorithm.
- Use a computer with more qubits.
- Trade off qubits for circuit depth: sometimes, if additional qubits are available, allowing for more ancilla qubits, the circuit can become shallower and thus less susceptible to noise.
- Reduce the desired accuracy. For instance, state preparation (the process of loading probability mass functions into qubits) is an important steps in many algorithms, but perhaps the values don't need to be 99.9% accurate and 97% accuracy can suffice as well.
- Change the order of operations. For instance (see this previous post) when calculating a*a-b*b one could first calculate a*a, then calculate and b*b from it, but one could also rewrite this as (a+b)*(a-b) and perhaps that yields a more efficient implementation.
- Identify qubits that are no longer required at some point in the algorithm and reuse them.

This fitting process is not just academic. Even if you are sure that the desired algorithm does not fit in today's quantum computers, you might want to know how large the computer needs to be to run it, and thus be able to extrapolate how far in the future might this solution be feasible.

The point is that fitting is important, but might require a lot of experimentation. However, such experimentation is very difficult to do using gate-level software design tools. This is one reason that we are so excited about the Classiq quantum algorithm design platform, because it lets the designer change the constraints at will and then automatically labors to find a solution that meets these constraints.

For instance, see the video below on finding the sweet spot for state preparation

## About "The Qubit Guy's Podcast"

Hosted by The Qubit Guy (Yuval Boger, our Chief Marketing Officer), the podcast hosts thought leaders in quantum computing to discuss business and technical questions that impact the quantum computing ecosystem. Our guests provide interesting insights about quantum computer software and algorithm, quantum computer hardware, key applications for quantum computing, market studies of the quantum industry and more.

If you would like to suggest a guest for the podcast, please contact us.