vincent-maillou / qttools

Quantum Transport Algorithms Toolbox
GNU General Public License v3.0
5 stars 1 forks source link

Issue with _get_items #60

Open awinka opened 2 days ago

awinka commented 2 days ago

In the _get_items method there is a if-statement checking if the length of the indices inds to be extracted has the same length as the input rows, see reference below:

https://github.com/vincent-maillou/qttools/blob/3fac381befe9470d5fd45e268120cf097465e0dd/src/qttools/datastructures/dsbcoo.py#L103C1-L103C15

The idea then is to just return the data for the indices inds, without needing the value_inds. However, this assumes that the ordering of the input rows and cols is the same as the ordering of the object itself, which is not always the case. For example if the rows and cols come from a DSBSparse object with other block sizes, the returned arr array has the wrong ordering.

Suggested solution:

Remove the if-statement and just use the body of it instead.

vetschn commented 1 day ago

Yep, reproducible on my end, good catch!