SparseArrays.jl
SparseArrays.jl copied to clipboard
SparseArrays.jl is a Julia stdlib
```julia using SparseArrays hcat(spzeros(1, 0), sparsevec([1], [0])) 1×1 SparseMatrixCSC{Float64,Int64} with 1 stored entry: [1, 1] = 0.0 cat(spzeros(1, 0), sparsevec([1], [0]), dims = 2) 1×1 SparseMatrixCSC{Float64,Int64} with 0 stored entries...
I have a use case for sparse matrices where most values are 0 but some need to be indicated as missing. It seems like some very basic functionality for `SparseMatrixCSC{T}`...
``` julia> versioninfo() Julia Version 1.4.0 Commit b8e9a9ecc6 (2020-03-21 16:36 UTC) Platform Info: OS: Windows (x86_64-w64-mingw32) CPU: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-8.0.1 (ORCJIT,...
We've had aliasing safeguards for broadcast and generic `map!` for a while (see JuliaLang/julia#21693, JuliaLang/julia#25890 in particular). However, I believe this machinery was never ported to SparseArrays's `map!`: ``` julia>...
Broadcasting division where the second argument has multiple dimensions causes the zeros in the matrix to be materialized ``` julia> using SparseArrays julia> m = sparse([0 2; 1 0]) 2×2...
Julia is not detecting reshaped sparse arrays as sparse. This has a wierd consequence when trying to create a sparse vector from a sparse matrix. ```julia julia> D = sparse(Diagonal([1,1,1,1]))...
I am trying to output a "large" (16x16) sparse matrix to look at its elements. I find that it is always output as Braille pattern. That should not be; there...
The following piece of code assembles the two-dimensional discrete Laplacian on an `n x n` grid: ``` using SparseArrays using LinearAlgebra function laplacian_2d(n) Δ = spdiagm( -1 => fill(-1.0, n-1),...
I have a function that is broadcasting a multiplication between a vector and a vector of vectors. This works as expected on dense vectors. If I pass a sparse vector...
``` julia> VERSION v"1.7.0-DEV.1108" julia> rem.(sparse([1 2; 3 4]), 2) 2×2 SparseMatrixCSC{Int64, Int64} with 2 stored entries: 1 ⋅ 1 ⋅ julia> big.(rem.(sparse([1 2; 3 4]), 2)) 2×2 SparseMatrixCSC{BigInt, Int64}...