I'm trying to work out how much memory is used for simulations of different sizes using the Aer simulator.
Here are my calculations:
$$ \text{Number of Qubits} = n $$ $$ \text{Number of Amplitudes} = 2^{n} $$ $$ \text{Array Size } = {2^n}^2 = 2^{2n} $$ $$ \text{ Memory in Bytes needed for double precision complex number } = 16 $$ $$ \text{ Memory needed (Bytes)} = 16 *2^{2n} $$
(I'm a bit confused at the exact definition of a GB of ram whether it's in powers of ten or two)
From this, simulations of circuits with over 18 qubits are rather difficult.
My questions are these:
- Are these calculations correct ?
- Does this stand true for both the shot based 'qasm-simulator' and 'statevector' simulator?
- AER is well coded: does it have simplifications like those described in the solution to this answer (How much memory is required to simulate a 48-qubit circuit?)?
I realise that my calculations are the worse case scenario. I think the statevector matrix would be upper triangular and so at least half of the amplitudes would be 0, meaning there would be at least some memory gained through sparse matrices ! Thank-You !