Skip to content

Likely bug in issymmetric(A::AbstractSparseMatrixCSC) #605

Closed
@sztal

Description

@sztal

I found a likely bug in issymmetric(A::AbstractSparseMatrixCSC), which considers symmetric a matrix which is clearly non-symmetric. Here is an example.

using LinearAlgebra, SparseArrays
S = sparse([2, 3, 1], [1, 1, 3], [1, 1, 1], 3, 3)

S looks like this:

3×3 SparseMatrixCSC{Int64, Int64} with 3 stored entries:
 ⋅  ⋅  1
 1  ⋅  ⋅
 1  ⋅  ⋅

And this is what issymmetric does:

M = Matrix(S)
issymmetric(S)  # true
issymmetric(M)  # false

The bug most likely applies also to ishermitian.

Version info

Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 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.0
  [6e4b80f9] BenchmarkTools v1.6.0
  [31a5f54b] Debugger v0.7.10
  [31c24e10] Distributions v0.25.117
  [1a297f60] FillArrays v1.13.0
  [86223c79] Graphs v1.12.0
⌃ [aa1ae85d] JuliaInterpreter v0.9.41
⌃ [0b1a1467] KrylovKit v0.9.3
⌃ [5078a376] LazyArrays v2.4.0
  [295af30f] Revise v3.7.2
  [2913bbd2] StatsBase v0.34.4
Info Packages marked with ⌃ have new versions available and may be upgradable.

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