From 098322a839bf52cc6154d325a06e385ae031fd52 Mon Sep 17 00:00:00 2001 From: Luis-Varona Date: Mon, 4 Aug 2025 21:33:33 -0300 Subject: [PATCH] Remove redundant _laplacian_1neg_spectra(spec::SSpectra) method Remove the unnecessary and redundant method from (this method literally did nothing whatsoever; I left it in from a previous design approach). --- CHANGELOG.md | 1 + src/laplacian_s_spectra.jl | 83 -------------------------------------- 2 files changed, 1 insertion(+), 83 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b41a818..dbc1074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ### Changed +- Remove the unnecessary and redundant `_laplacian_1neg_spectra(spec::SSpectra)` method from `src/laplacian_s_spectra.jl` (this method literally did nothing whatsoever; I left it in from a previous design approach) (#38). - Changed `check_spectrum_integrality` to compute the real integer eigenvalues lazily (comparison was already lazy, but taking the real part and rounding was not) (#37). ## [0.1.0] - 2025-08-01 diff --git a/src/laplacian_s_spectra.jl b/src/laplacian_s_spectra.jl index 03b612d..ef663ee 100644 --- a/src/laplacian_s_spectra.jl +++ b/src/laplacian_s_spectra.jl @@ -159,7 +159,6 @@ end """ _laplacian_1neg_spectra(L) -> SSpectra - _laplacian_1neg_spectra(spec) -> SSpectra [TODO: Write here] """ @@ -167,88 +166,6 @@ function _laplacian_1neg_spectra(L::AbstractMatrix{<:Integer}) return _classified_laplacian_1neg_spectra(classify_laplacian(L)) end -function _laplacian_1neg_spectra(spec::SSpectra) - if spec.S != (-1, 0, 1) - throw( - ArgumentError( - "Expected `{-1, 0, 1}`-spectra` to compute `{-1, 1}`-spectra, got $(spec.S)-spectra", - ), - ) - end - - L = copy(spec.matrix) - n = size(L, 1) - S = (-1, 1) - multiplicities = copy(spec.multiplicities) - - eigenspaces_01neg = spec.s_eigenspaces - - #= If `n > 1` is odd, then all non-kernel eigenvectors must be orthogonal to the - all-ones vector and thus are precluded from having all entries from {-1, 1}. If `n = 1`, - then the kernel is the only eigenspace, so we need not handle that case separately. =# - if iseven(n) - s_eigenspaces = OrderedDict{Int,Matrix{Int}}() - s_eigenbases = OrderedDict{Int,Union{Nothing,Matrix{Int}}}() - - for eigval in keys(multiplicities) - multi = multiplicities[eigval] - eigvecs = Iterators.filter( - col -> !any(iszero, col), eachcol(eigenspaces_01neg[eigval]) - ) - - if isempty(eigvecs) - eigenspace = Matrix{Int}(undef, n, 0) - eigenbasis = nothing - else - eigenspace = stack(eigvecs) - pot_eigenbasis = _extract_independent_cols(eigenspace) - - if size(pot_eigenbasis, 2) < multi - eigenbasis = nothing - else - eigenbasis = pot_eigenbasis - end - end - - s_eigenspaces[eigval] = eigenspace - s_eigenbases[eigval] = eigenbasis - end - else - dim_kernel = multiplicities[0] - kernel_vecs = Iterators.filter( - col -> !any(iszero, col), eachcol(eigenspaces_01neg[0]) - ) - - if isempty(kernel_vecs) - kernel = Matrix{Int}(undef, n, 0) - null_basis = nothing - else - kernel = stack(kernel_vecs) - pot_null_basis = _extract_independent_cols(kernel) - - if size(pot_null_basis, 2) < dim_kernel - null_basis = nothing - else - null_basis = pot_null_basis - end - end - - s_eigenspaces = OrderedDict( - eigval => Matrix{Int}(undef, n, 0) for eigval in keys(multiplicities) - ) - s_eigenspaces[0] = kernel - - s_eigenbases = OrderedDict{Int,Union{Nothing,Matrix{Int}}}( - eigval => nothing for eigval in keys(multiplicities) - ) - s_eigenbases[0] = null_basis - end - - s_diagonalizable = all(!isnothing, values(s_eigenbases)) - - return SSpectra(L, S, multiplicities, s_eigenspaces, s_eigenbases, s_diagonalizable) -end - """ _classified_laplacian_01neg_spectra(CL) -> SSpectra