# Questions tagged [sparse-arrays]

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

309 questions
Filter by
Sorted by
Tagged with
1 vote
29 views

### Method for MinimumBandwidthOrdering [closed]

MinimumBandwidthOrdering[m, Method -> "RCMD"] What method is 'RCMD' in Mathematica? Reverse Cuthill-McKee, Reduced Canonical Matrix Diagram, Restricted Minimum Column Degree, other?
• 53
71 views

### How could I see the memory use on sparse array and constant array matrices? What is the advantage? [duplicate]

I have a huge matrix defined using constant array function and it allocates so much memory preventing the calculation. Therefore, I would like to change the constant array matrix into sparse matrix ...
1 vote
98 views

### Efficient memory usage while building a large sparse matrix

I am sure the following problem has been solved already, but I am unable to find any solution... Any help appreciated! So I am building a pretty huge matrix (or tensor, actually) using ...
• 73
56 views

### Dot product of arrays that are members of the same list

Lets say I have a list of n arrays: n=3; list = Table[RandomInteger[{-10, 10}, {2, 2}], n]; I would like to calculate the matrix corresponding to: ...
102 views

How can one do a fast sparse tensor addition? Below, I have the following code: We first generate 3 random sparse 1000x1000x1000 tensors with 10^6 entries each. Then, I want to add them. But the usual ...
85 views

### How do I create a banded matrix using values from a given function [closed]

I would like to create a matrix were values of the function P make up the diagonals. I tried using the For loop but did not get it right. ...
140 views

### Speeding Up Sparse Matrix Generalized Eigenvalues

I have a generalized eigenvalue problem $${\mathbf A}\vec v = \lambda {\mathbf B} \vec v$$ for which I am trying to find the smallest eigenvalue $\lambda$ and the associated eigenvector $\vec v$. ...
• 263
97 views

### Reconstruction on large sparse array

I'm struggling with a reconstruction of a large sparse array. What I'm trying to do is to rearrange a 2 dimensional array (respresenting a system matrix for a given system of equations) such that I ...
• 23
917 views

### Implementation of MATLAB's "numgrid" function [closed]

I am looking for an implementation of MATLAB's numgrid function, in particular the "B" mode. For example, I want to get the matrix corresponding to the ...
• 6,531
158 views

### Insert a dynamic vector into a matrix

If I have the following dynamic vector Cs[NN_] := Table[{Sin[(2*i - 1) τ], Sin[(2*i - 1) τ]}, {i, 1, NN}] // Flatten The size of Cs depends on the integer ...
• 1,307
1 vote
77 views

### Plotting multidimensional tables

I have a tridiagonal matrix created by ...
• 749
39 views

### Trying to map SparseArray over a defined list, the SparseArray defined with 3 subvalues i want to map the 3rd. subValue(list) over the defined list

I have a SparseArray already defined as following ...
1 vote
53 views

### Erratic behavior retrieving large data (several tens of gigabytes) that has been serialized by Mathematica

Hardware: PC with 256GB RAM OS: Windows 10 Mathematica: Version 13.0.1 One of my projects has led to the creation of a SparseArray whose ByteCount is ~ 35GB in RAM. At the time of creation the ...
• 2,064
88 views

### Define a function with sparsearray

I am trying to define a function using SparseArray, but the entries were defined before. How can I avoid this error? Code is: ...
• 121
1 vote
23 views

### Why does Sparsearray diagonalization by Krylov technique become slower for very large sizes?

Here is an example sparse matrix, taken from example Hamiltonian, which was a question I asked before in this forum. ...
23 views

### Threshold on triangular SparseArray

I am confused by the behavior of Threshold on sparse UpperTringularize (and LowerTringularize...
• 7,633
74 views

### Fastest Way to make rows and columns zero and corresponding (i,i) element 1 of a large Sparse Matrix

I have a 5552 by 5552 sparse matrix: ...
345 views

• 51
214 views

### Permute association key and generate a sparse array

Imagine having an Association Av = <|{1, 4, 2, 3} -> a, {2, 4, 2, 4} -> b|> It can be much longer. I am searching ...
• 16.7k
72 views

### How can I define a function using ArrayFlatten without using SetDelayed?

I created a matrix F2 using SparseArray and ArrayFlatten as follows: ...
• 3,841
61 views

### Seeming inconsistencies with "Eigenfunction" [duplicate]

I am working on a problem which involves calculating the spectrum of a family of 2970x2970 Hermitian matrices. I have done similar things with Mathematica in the past, but this time there is an odd, ...
• 647