Skip to content

_split_col_subsets ignores columns when non-monotonic #92

@MarcAntoineSchmidtQC

Description

Maybe this is not the right function for what I am looking for. I expected this function to be perfect for the __getitem__ column subsetting but it's not working if the columns are not monotonic. PR #91 depends on fixing this issue.

Minimal working example:

import quantcore.matrix as mx
import numpy as np

a = mx.DenseMatrix(np.arange(16, dtype=float).reshape(4, 4))
sm = mx.SplitMatrix(matrices=[a])

sm._split_col_subsets([0, 2, 3])
# Correct - Out[6]: ([array([0, 1, 2], dtype=int32)], [array([0, 2, 3], dtype=int32)], 3)

ms._split_col_subsets([0, 3, 2])
# Incorrect - Out[9]: ([array([0, 1], dtype=int32)], [array([0, 3], dtype=int32)], 3)
# Expected: ([array([0, 1, 2], dtype=int32)], [array([0, 3, 2], dtype=int32)], 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions