Questions on the construction and manipulation of sparse arrays in Mathematica, with functions like SparseArray[] and Band[].
14
votes
6answers
359 views
Matrix Rotation
If I have a matrix of any size, say
$\begin{pmatrix}
72 & 32 & 64 \\
18 & 8 & 16 \\
63 & 28 & 56 \\
\end{pmatrix}$
$\begin{pmatrix}
72 & 32 \\
18 & 8 \\
63 ...
0
votes
0answers
60 views
Is it in general faster to get the eigenvectors and eigenvalues of a dense array rather than a sparse array?
I always thought that things in general go faster when working with sparse array but, I got this:
Eigenvalues::arhm: Because finding 144 out of the 144 ...
5
votes
1answer
42 views
How to relate memory usage with occupied positions of SparseArrays?
What is the relation of memory usage of a SparseArray
and the number of its occupied positions?
Let's say you build a 100.000.000 by 10 element SparseArray.
And fill the two position 1/1 and ...
2
votes
1answer
85 views
How to combine SparseArray and If
Because I am dealing with huge matrixes, my computer can not handle it, because of the memory. But, in my matrix, a very small percentage of the elements are non-zero. So I should use SparseArray as ...
2
votes
0answers
38 views
How to estimate system recource usage of a SparseArray? [duplicate]
Build a 100.000.000 by 10 element SparsArray.
Fill position 1/1 and 100.000.000/10 with a value 999.999.999.999.999.
...
1
vote
1answer
80 views
How to store a SparseArray? [duplicate]
How to Export/Write a SparseArray?
How to Import/Read a SparseArray?
Is it always stored as a normal array?
How can it be stored in a dense form?
Is a numerical SparseArray different to
Export/Import ...
1
vote
0answers
89 views
Dynamically filling matrix with a[[n,m]] = 1/a[[m,n]]
I'm building a square matrix, with 1s on the diagonal and elements in U the inverse of elements in L, which are random integers drawn from the sequence 1, ..., 9. Given the nature of the problem I ...
6
votes
0answers
108 views
Calculating the rank of a huge sparse array
By virtue of the suggestion in my previous question, I constructed the sparse matrix whose size is $518400 \times 86400$, mostly filled with $0$ and $\pm 1$. Now I want to calculate its rank.
Since ...
4
votes
1answer
87 views
Why is Flattening a CoefficientArray so slow?
I have a vector of $n$ degree $n$ polynomials in $(x,y,z)$, each of whose coefficients is an inhomogenous linear expression in $3 n^2$ variables. I want to write down the linear equations in these $3 ...
11
votes
1answer
491 views
How to work around Mathematica hanging when showing a large SparseArray?
Note: This is fixed in 9.0.1.
In Mathematica 9, if I display any large SparseArray object in the default way (which looks something like ...
9
votes
2answers
274 views
Speeding up construction of simple tridiagonal matrix
I have the following code to construct a tridiagonal matrix:
...
9
votes
2answers
210 views
Speed up 4D matrix/array generation
I have to fill a 4D array, whose entries are $\mathrm{sinc}\left[j(a-b)^2+j(c-d)^2-\phi\right]$ for a fixed value of $\phi$ (normally -15) and a fixed value of $j$ (normally about 0.00005). The way ...
3
votes
1answer
141 views
How to get the determinant and inverse of a large sparse symmetric matrix?
For example, the following is a $12\times 12$ symmetric matrix. Det and Inverse take too much time and don't even work on my ...
5
votes
1answer
111 views
Summing tensors in mathematica
How do I perform the following summation in mathematica?
\begin{equation}
\Sigma_{m=1}^5 e_{ijklm}A^{mn}
\end{equation}
I have the $e_{ijklm}$ tensor of rank 5 in 5 dimension as a array and $A^{mn}$ ...
1
vote
1answer
208 views
Import Excel sheet into 3D array?
I have an excel spreadsheet that I would like to plot in a 3D graph using mathematica. The X and Y values are the location of the cell, and the Z value is the number of the scale.
How can I import ...
7
votes
1answer
119 views
How to create a large sparse block matrix
I need to generate a very large sparse block matrix, with blocks consisting only of ones along the diagonal. I have tried several ways of doing this, but I seem to always run out of memory.
The ...
15
votes
1answer
206 views
Adding three integer sparse matrices is very slow. Adding only two is fast
Adding more than two sparse matrices in one step in Mathematica 9 is very slow (in fact I couldn't even wait for it to finish).
Here's an example. Let's generate a large sparse matrix:
...
2
votes
1answer
88 views
How to interpret the FullForm of a SparseArray?
SparseArrays are atomic objects, but they do have a FullForm which reveals information about them.
What is the meaning of the ...
5
votes
1answer
144 views
10
votes
1answer
275 views
Sparse convolution of sparse arrays
The documentation for ListConvolve mentions that "ListConvolve works with sparse arrays", which is true. The result, however is never sparse, eg:
...
0
votes
0answers
105 views
How to apply rules to the elements of a sparse array? [closed]
I have two text files that I am importing, one is a sparse array of format {large row index,column,value1} and the other is {large row index,value2}. The row values are a small subset of a much larger ...
7
votes
2answers
186 views
Using ReplaceAll on SparseArray
I'm using SparseArrays in a notebook in which I am doing complex conjugation manually, i.e. writing $\sqrt{-1}$ as i and ...
2
votes
1answer
125 views
Efficiently importing XPM matrix data into Mathematica
The XPM file format is an image file format. Although it is primarily intended for icon pixmaps, it can also be used to store matrix data. For example, the GROMACS chemical simulation package uses ...
9
votes
1answer
393 views
Exporting a Large Multidimensional Sparse Array
I'm trying to export a sparse array from Mathematica to share with collaborators who primarily use Matlab.
The sparse array in question is 4 dimensional, (72 x 93 x 94 x 172) with ~4M non-zero ...
3
votes
3answers
222 views
Support for Compressed Sparse Column sparse matrix representation
Is there native support for Compressed Sparse Column (CSC) format for sparse matrices, like importing and manipulating them?
14
votes
2answers
490 views
Using the Krylov method for Solve: Speeding up a SparseArray calculation
I'm trying to implement this Total Variation Regularized Numerical Differentiation (TVDiff) code in MMA (which I found through this SO answer): essentially I want to differentiate noisy data. The full ...
6
votes
2answers
348 views
Efficient by-element updates to SparseArrays
I have a very large SparseArray called A. What is the most efficient way to update say element ...
13
votes
3answers
431 views
Efficient way to combine SparseArray objects?
I have several SparseArray objects, say sa11, sa12, sa21, sa22, which I would like to combine into the equivalent of {{sa11, sa12}, {sa21, sa22}}.
As an example, I ...


