`MPSStateSpace::SampleOnce` crashes for two-qubit states
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
Start at the reduced-density-matrix contraction inside MPSStateSpace::SampleOnce in lib/mps_statespace.h, near line 536, where the Eigen resize assertion fires. Build the reproducer from the issue with a two-qubit, bond-dimension-4 zero state and confirm the 4x2 versus 2x2 shape mismatch. Done means the call returns a two-bit sample without aborting, and the matrix shapes agree with the bond dimensions of the MPS tensors.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the issue
MPSStateSpace::SampleOnce() aborts with an Eigen dimension assertion when sampling a two-qubit MPS state.
Tell us how to reproduce the issue
To reproduce the issue, create a two-qubit MPS with bond dimension 4, initialize it to the zero state, allocate two scratch states of the same dimensions, and call SampleOnce():
auto ss = MPSStateSpace<For, float>(1);
auto mps = ss.Create(2, 4);
auto scratch = ss.Create(2, 4);
auto scratch2 = ss.Create(2, 4);
std::mt19937 rand_source(1234);
std::vector<bool> results;
ss.SetStateZero(mps);
ss.SampleOnce(mps, scratch, scratch2, &rand_source, &results);
The call aborts with an Eigen assertion:
Eigen::DenseBase<...>::resize(...)
Assertion `rows == this->rows() && cols == this->cols()
&& "DenseBase::resize() does not actually allow to resize."' failed.
The failure occurs at lib/mps_statespace.h:536, during the final reduced-density-matrix contraction.
GDB reports that the destination matrix is mapped as 4 x 2, whereas the multiplication produces a 2 x 2 result.
The expectation is that SampleOnce() should return a two-bit sample for a valid two-qubit MPS state without aborting.
Tell us the version of qsim or qsimcirq (if relevant)
No response
Tell us the computing environment (if relevant)
Ubuntu 26.04.1 LTS, GCC 15.2.0, C++17.
- Lenguaje dominante
- C++
- Estrellas
- 702
- Forks
- 219
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 8
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de quantumlib/qsim
-
`MPSStateSpace::Sample` accesses results out of bounds when the output vector is emptyPosiblemente ocupada @aadityarshah la tomó hace 42 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
quantumlib/qsim#1126 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 57/100
quantumlib/qsim#1146 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
quantumlib/qsim#1145 ·
Los mantenedores suelen responder en 2 días
-
Implement expectation values for the MPS SimulatorPosiblemente ocupada @rupasri118 la tomó hace 36 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
quantumlib/qsim#1122 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
quantumlib/qsim#1121 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de quantumlib/qsim
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
ai_p1 comp-sql-syntax
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
ClickHouse/ClickHouse#133888 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
documentation good first issue
Dificultad 2/5 Medio día Aptitud para principiantes 66/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
jbcoe/cc-protocol#507 ·
Los mantenedores suelen responder en 1 día