LH10
LH10

Reputation: 25

Maximum size sparse matrix NumPy

I am working on a model which reflects the spread of innovations through a society of N individuals. I have an adjacency matrix A of size NxN, note that this adjacency matrix is sparse.

I want to do simulations for NxN=10^7. I first tried Matlab, but unfortunately Matlab cannot handle NxN>10^4.

Is it possible to use NumPy for my simulations?

Upvotes: 0

Views: 2022

Answers (1)

Stop harming Monica
Stop harming Monica

Reputation: 12590

Scipy can handle NxN sparse matrices with N=10^7

import scipy.sparse as sparse
N = 10e7
sparse.bsr_matrix((N, N))

Output:

<100000000x100000000 sparse matrix of type '<class 'numpy.float64'>'
    with 0 stored elements (blocksize = 1x1) in Block Sparse Row format>

Whether it is suitable for your simulations depends on a number of things that we don't know. You might need to use a different sparse matrix class.

Upvotes: 1

Related Questions