Skip to content

Incorrect spectral radius calculation in README #51

@sunnyc0206

Description

@sunnyc0206

The README example currently computes the spectral radius of matrix A using:

A.max().item()

This is mathematically incorrect. The spectral radius ρ(A) is defined as the maximum absolute value of the eigenvalues of A, not the maximum element of the matrix.

Expected Behavior

The spectral radius should be computed as:

The spectral radius rho(A) is defined as the maximum absolute value of the eigenvalues of A i.e rho(A) = max |lambda_i|

Proposed Fix

Update the computation to:

rho = torch.linalg.eigvals(A).abs().max().item()

Impact

  • Prevents misleading stability diagnostics in the example
  • Aligns documentation with the stated condition ρ(A)<1
  • Improves correctness for users referencing the README

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