SparseArrays.jl icon indicating copy to clipboard operation
SparseArrays.jl copied to clipboard

[BUG] Inorrect `issymmetric` output for some non-symmetric sparse matrices

Open sztal opened this issue 8 months ago • 1 comments

I resubmit the bug report from #605 here, as this is probably the proper repo for that.

It seems that LinearAlgebra.issymmetric returns incorrect values for some sparse matrices. Here is a minimal working example.

using LinearAlgebra, SparseArrays
S = sparse([2, 3, 1], [1, 1, 3], [1, 1, 1], 3, 3)
issymmetric(S)  # true
issymmetric(Matrix(S))  # false

I think that this is such a core method that the bug should be treated with high priority.

Best!

Version info

Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 9 5900HX with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Environment:
  JULIA_PROJECT = @.
  JULIA_PKG_PRESERVE_TIERED_INSTALLED = true
  JULIA_REVISE = manual
  JULIA_EDITOR = vim

Pkg status

  [4c555306] ArrayLayouts v1.11.1
  [6e4b80f9] BenchmarkTools v1.6.0
⌃ [31a5f54b] Debugger v0.7.11
⌃ [31c24e10] Distributions v0.25.119
  [1a297f60] FillArrays v1.13.0
⌃ [86223c79] Graphs v1.12.1
⌃ [5903a43b] Infiltrator v1.8.8
⌅ [aa1ae85d] JuliaInterpreter v0.9.46
  [0b1a1467] KrylovKit v0.9.5
  [5078a376] LazyArrays v2.6.1
⌃ [91a5bcdd] Plots v1.40.13
⌃ [295af30f] Revise v3.7.5
⌃ [2913bbd2] StatsBase v0.34.4
  [5a0628fe] Supposition v0.3.5
  [1e6cf692] TestEnv v1.102.1

sztal avatar Jul 11 '25 19:07 sztal

This one is indeed a bit worrisome.

@fredrikekre I believe you touched some of this code last. Would it be possible for you to take a look?

ViralBShah avatar Dec 25 '25 10:12 ViralBShah