Questions tagged [sparse-arrays]

Questions on the construction and manipulation of sparse arrays in Mathematica, with functions like SparseArray[] and Band[].

222 questions
149 views

What would be the Mathematica equivalent of sparse in MATLAB?

The sparse function in MATLAB does the following: S = sparse(i,j,v) generates a sparse matrix S from the triplets i, j, and v such that S(i(k),j(k)) = v(k). The ...
192 views

Something wrong when I apply Derivative on a SparseArray

Bug introduced in v5.0 or earlier, and persisting through v11.0.1 or later There, I create a SparseArray using command ...
152 views

Using Cases to pick out entries of a SparseArray

I'm trying to use a SparseArray for some large homological algebra calculations. I'd like to find indices of a SparseArray ...
158 views

Possible Bug in LinearSolveFunction with Sparse Vectors

Bug introduced in 5.0 and fixed in 11.0 LinearSolveFunction is new in 5.0 Consider the following set of equations and corresponding variables: ...
346 views

How to compile code that involve sparse array?

I have the following code ...
516 views

Nonzero element positions of a matrix

Let m={{1, 2, 0}, {4, 0, 9}}; I want to find the position of every nonzero element of the above matrix. The code ...
157 views

How to create overlapped block matrices and simplify the result

This is sort of a duplicate of Creating overlapped block matrices, but the question wasn't fully answered since the OP never returned to clarify. I am using Kuba's answer for FEM, but I have been ...
2k views

How to convert a matrix into a sparse matrix [duplicate]

If I have a matrix: row 1)1 0 0 4 row 2)0 0 0 0 row 3)5 1 0 0 row 4)0 5 0 0 row 5)0 0 0 9 How would I put it in a sparse matrix format: ...
226 views

...
392 views

efficient elementwise multiplication of SparseArray vector and matrix

I have a large $d\times d$ SparseArray $P$, and I want to multiply a vector (also a SparseArray) $v$ of length $d$ elementwise ...
803 views

How to convert a sparse matrix to a list of sparse arrays?

I have a matrix stored as a SparseArray. How can I convert it to a List of its rows, where each row is stored as a ...