You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to simulate a quantum system with Intel QS and need to declare a QubitRegister before initializing it with the number of qubits. However, the default constructor of QubitRegister does not seem to work properly. After including <qureg.hpp>, simply doing
iqs::QubitRegister<ComplexDP> psi;
will throw an error. The error occurs at the checking statement if(GlobalSize()) assert(GlobalSize() * 2UL == new_num_amplitudes);, but after disabling this checking statement other errors come up in num_qubits and in using state vs state_storage.
I'd like to propose the following changes: we should comment out Line 60 of qureg_init.cpp and change Line 38-39 from
Resize(1UL);
state_storage[0] = {1., 0.};
to
Resize(2UL);
state[0] = {1., 0.};
Changing these three lines and rebuilding the library worked for me. These changes also seem consistent with the rest of the QubitRegister class.
The text was updated successfully, but these errors were encountered:
Thanks for looking into the issue and suggesting a fix.
Indeed QubitRegister objects were thought to be initialized with a specific number of qubits.
There is a method to resize the register, but it is not up to date with the rest of the implementation.
I will look into your suggested fix (by the way, have you tested it with MPI enabled?).
As part of the IQS development, we worked on a different approach.
We worked on a method to resize the state register by either adding extra qubits in the |00...0> state, or by removing qubits after projecting them to |00...0><00...0|.
It is MPI-ready and we should be able to open the corresponding PR soon.
I'm trying to simulate a quantum system with Intel QS and need to declare a
QubitRegister
before initializing it with the number of qubits. However, the default constructor ofQubitRegister
does not seem to work properly. After including<qureg.hpp>
, simply doingwill throw an error. The error occurs at the checking statement
if(GlobalSize()) assert(GlobalSize() * 2UL == new_num_amplitudes);
, but after disabling this checking statement other errors come up innum_qubits
and in usingstate
vsstate_storage
.I'd like to propose the following changes: we should comment out Line 60 of qureg_init.cpp and change Line 38-39 from
to
Changing these three lines and rebuilding the library worked for me. These changes also seem consistent with the rest of the
QubitRegister
class.The text was updated successfully, but these errors were encountered: