Skip to content

ensure error is raised for invalid parameters in partial_trace #1388

@aman-coder03

Description

@aman-coder03

currently, partial_trace does not explicitly validate:
that input_mat is square.
that np.prod(dim) equals the matrix dimension.
that sys indices are within valid subsystem bounds.

in some cases, invalid inputs lead to NumPy IndexError or unintended behavior rather than a clear ValueError.
i propose adding explicit validation checks along with corresponding unit tests for invalid inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions