ngnrsaa / qflex

Flexible Quantum Circuit Simulator (qFlex) implements an efficient tensor network, CPU-based simulator of large quantum circuits.
Apache License 2.0
97 stars 25 forks source link

grid layouts #62

Closed alexandrupaler closed 5 years ago

alexandrupaler commented 5 years ago

Are the grid layouts bristlecone48 and bristlecone70 the only supported for the moment? Will there be other grids like sycamore_48?

The current file format is restricted to 12x12 grids. Is this a hard limit? Can it be, for example, 7x7 or 15x15?

95-martin-orion commented 5 years ago

See issue #47 for other planned layouts. The grid size should be controlled by user input - 12x12 is the only case we currently have examples for, but there's no reason we should reject smaller or larger grids.

alexandrupaler commented 5 years ago

For clarity, would renaming the fields I, J and K from QflexInput be an option? I -> nr_rows_grid J -> nr_cols_grid K -> I am not sure what grid_of_groups_of_tensors does, but K is its len

...or something less verbose

alexandrupaler commented 5 years ago

For the argv in main.cpp, would it be fine if I and J are the first line in the grid file?

95-martin-orion commented 5 years ago

+1 to renaming I / J / K. My preferred names for these are "grid_height", "grid_width", and "super_cycles" respectively (K is the number of time we cycle through the set of eight 2-qubit gate orientations).

Regarding I and J as input: we have some conflicting requirements on where these should come from. @benjaminvillalonga, can you give some insight on this?

alexandrupaler commented 5 years ago

@benjaminvillalonga in the circuit files the line 3 cz 67 68 means at moment 3 execute cz between qubit 67 and 68?

alexandrupaler commented 5 years ago

For a circuit consisting of a single qubit and gate executed on Bristlecone70 I get the following error python: tensor.cpp:709: void qflex::Tensor::reorder(std::vector<std::__cxx11::basic_string<char> >, qflex::s_type*): Assertion new_ordering_in_indices && indices_in_new_ordering' failed.

How should I handle such errors in the Python interface? Or what should I do for such errors not to appear?

95-martin-orion commented 5 years ago

This suggests an internal error in determining tensor index order...could you paste the circuit and ordering files used for this test?

How should I handle such errors in the Python interface? Or what should I do for such errors not to appear?

Currently we include std::cout logs with every assertion in the C++ code; all that's needed to handle these is for Python to respect the std::cout logging.

alexandrupaler commented 5 years ago

I see. My circuit had a single qubit and a single Hadamard. The ordering was bristlecone_70. The error was because the ordering did not fit to the circuit.