Skip to content

Default constructor of QubitRegister not working properly #91

Open
@snsunx

Description

@snsunx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions