SuiteSparseMatrixCollection.jl

A straightforward interface to the SuiteSparse Matrix Collection
Author JuliaSmoothOptimizers
Popularity
9 Stars
Updated Last
4 Months Ago
Started In
February 2019

SuiteSparseMatrixCollection.jl

Documentation Linux/macOS/Windows/FreeBSD Coverage DOI
docs-stable docs-dev build-gh build-cirrus codecov doi

A straightforward interface to the SuiteSparse Matrix Collection.

References

Davis, Timothy A. and Hu, Yifan (2011). The University of Florida sparse matrix collection. ACM Transactions on Mathematical Software, 38(1), 1--25. 10.1145/2049662.2049663

How to Cite

If you use SuiteSparseMatrixCollection.jl in your work, please cite using the format given in CITATION.bib.

How to install

pkg> add SuiteSparseMatrixCollection
pkg> test SuiteSparseMatrixCollection

Updating the database

Clone this repository, activate the utils environment and run gen_db.jl to check if the database needs to be updated.

Updating Artifacts.toml

Clone this repository, activate the utils environment and run gen_artifacts.jl to check if Artifacts.toml needs to be updated.

Examples

julia> using SuiteSparseMatrixCollection

julia> # name-based selection can be done with `ssmc_matrices()`
julia> ssmc = ssmc_db()
julia> ssmc_matrices(ssmc, "HB", "bcsstk")  # all matrices whose group contains "HB" and name contains "bcsstk"
julia> ssmc_matrices(ssmc, "", "bcsstk")    # all matrices whose name contains "bcsstk"
julia> ssmc_matrices(ssmc, "HB", "")        # all matrices whose group contains "HB"

julia> # select symmetric positive definite matrices with ≤ 100 rows and columns
julia> tiny = ssmc[(ssmc.numerical_symmetry .== 1) .& (ssmc.positive_definite.== true) .&
                   (ssmc.real .== true) .& (ssmc.nrows .≤ 100), :]

julia> # fetch the matrices selects in MatrixMarket format
julia> paths = fetch_ssmc(tiny, format="MM")   # matrices are downloaded in paths
julia> downloaded_matrices = installed_ssmc()  # name of all downloaded matrices
julia> delete_ssmc("HB", "bcsstk02")           # delete the matrix "bcsstk02" of group "HB"
julia> delete_all_ssmc()                       # delete all matrices from the SuiteSparseMatrixCollection

Matrices are available in formats:

Use DataFrames syntax to further examine a list of selected matrices:

julia> tiny[!, [:name, :nrows, :ncols, :positive_definite, :lower_bandwidth]]
12×5 DataFrame
│ Row │ name          │ nrows │ ncols │ positive_definite │ lower_bandwidth │
│     │ String        │ Int64 │ Int64 │ Bool              │ Int64           │
├─────┼───────────────┼───────┼───────┼───────────────────┼─────────────────┤
│ 1   │ bcsstk01      │ 4848135              │
│ 2   │ bcsstk02      │ 6666165              │
│ 3   │ bcsstm02      │ 666610               │
│ 4   │ nos4          │ 100100113              │
│ 5   │ ex5           │ 2727120              │
│ 6   │ mesh1e1       │ 4848147              │
│ 7   │ mesh1em1      │ 4848147              │
│ 8   │ mesh1em6      │ 4848147              │
│ 9   │ LF10          │ 181813               │
│ 10  │ LFAT5         │ 141415               │
│ 11  │ Trefethen_20b │ 1919116              │
│ 12  │ Trefethen_20  │ 2020116

Matrices in Rutherford-Boeing format can be opened with HarwellRutherfordBoeing.jl:

pkg> add HarwellRutherfordBoeing

julia> using HarwellRutherfordBoeing

julia> matrix = ssmc[ssmc.name .== "bcsstk01", :]
1×30 DataFrame. Omitted printing of 17 columns
│ Row │ group  │ nnzdiag │ nrows │ numerical_symmetry │ amd_vnz │ binary │ structural_rank │ is_nd │ is_graph │ RB_type │ lower_bandwidth │ explicit_zeros │ amd_flops │
│     │ String │ Int64   │ Int64 │ Float64            │ Int64   │ Bool   │ Int64           │ Bool  │ Bool     │ String  │ Int64           │ Int64          │ Float64   │
├─────┼────────┼─────────┼───────┼────────────────────┼─────────┼────────┼─────────────────┼───────┼──────────┼─────────┼─────────────────┼────────────────┼───────────┤
│ 1   │ HB     │ 48481.065104810        │ rsa     │ 3506009.0    │

julia> path = fetch_ssmc(matrix, format="RB")
1-element Array{String,1}:
 "/Users/dpo/dev/JSO/SuiteSparseMatrixCollection.jl/src/../data/RB/HB/bcsstk01"

julia> A = RutherfordBoeingData(joinpath(path[1], "$(matrix.name[1]).rb"))
Rutherford-Boeing data 23 of type rsa
48 rows, 48 cols, 224 nonzeros

Matrices in MM format can be opened with MatrixMarket.jl.

Used By Packages

No packages found.