Skip to content

Refine is_skew_symmetric Unit Tests to Validate Zero-Diagonal Constraint #1168

@srinjoy933

Description

@srinjoy933

The current unit tests for is_skew_symmetric in test_linalg_matrix_property_checks.fypp effectively verify the off-diagonal symmetry condition (A_{ij} = -A_{ji}), but they lack a critical edge-case check: the zero-diagonal constraint.By definition, a skew-symmetric matrix (whether real, complex, or integer) must have all diagonal elements equal to zero because the condition a_{ii} = -a_{ii} only holds when a_{ii} = 0.The SolutionThis PR introduces an A_false_diag test case across all supported types (Real, Complex, Integer). This matrix satisfies the off-diagonal skew-symmetry but contains at least one non-zero diagonal element.Specifically, it tests purely imaginary values for complex kinds (e.g., 0 + 1i) to ensure they aren't incorrectly flagged as skew-symmetric. Adding this validation ensures the stdlib implementation strictly adheres to the mathematical definition and prevents regressions where a "nearly" skew-symmetric matrix (with a non-zero trace) might erroneously pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions