Questions on the construction and manipulation of sparse arrays in Mathematica, with functions like SparseArray[] and Band[].
2
votes
1answer
78 views
How to create a SparseArray satisfying multiple conditions on Parts and Elements of a Matrix?
I have a matrix m1 of size $3 \times 19$.
Rows $1$, $2$ and $3$ represent $3$ different groups, and columns represent $4$ different blocks:
block1 - columns $1$, ...
-3
votes
1answer
55 views
the way to save multidimensional array in text file [closed]
I have an array which is defined as a table, e.g.
g = Table[ cos[l1*3.]*sqrt[l2*1.]*l3 + l1*1 , {l1, 0, 3}, {l2, 0, 3}, {l3, 0, 3}];
then, I need to save it in ...
4
votes
3answers
106 views
SparseArray row operations
Given a large (very) sparse matrix, A, how can I efficiently "operate" on only the nonzeros in a given row? For example: For each row in A, generate a list of column indices that have a magnitude ...
2
votes
0answers
64 views
Det and MatrixRank freezes on SparseArray with nonzero default value
Why does the following simple code never come to an end (at least with version 8)
n = 5;
mat = SparseArray[{i_, i_} -> 1, {n, n}, -1/(n - 1)];
MatrixRank[mat]
...
3
votes
1answer
88 views
Assigning Sequence to Part of a SparseArray (bug?)
Part
▪ You can make an assignment like t[[spec]]=value to modify any part or sequence of parts in an expression.
▪ If ...
0
votes
0answers
84 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
56 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 ...
1
vote
0answers
40 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.
...
2
votes
1answer
122 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 ...
1
vote
1answer
115 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
3answers
162 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
128 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 ...
14
votes
6answers
417 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 ...
5
votes
1answer
108 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 ...
3
votes
1answer
178 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 ...