In [1]:
from scipy.sparse import csr_matrix, csc_matrix, lil_matrix, dok_matrix, eye
In [2]:
n = 1000
In [3]:
csr = eye(n, format='csr')
csc = eye(n, format='csc')
lil = eye(n, format='lil')
dok = eye(n, format='dok')
In [4]:
%%timeit
csr.getrow(0)
In [5]:
%%timeit
csc.getrow(0)
In [6]:
%%timeit
lil.getrow(0)
In [7]:
%%timeit
dok.getrow(0)
In [8]:
%%timeit
csr[0]
In [9]:
%%timeit
csc[0]
In [10]:
%%timeit
lil[0]
In [11]:
%%timeit
dok[0]
In [12]:
%%timeit
csr.getcol(0)
In [13]:
%%timeit
csc.getcol(0)
In [14]:
%%timeit
lil.getcol(0)
In [15]:
%%timeit
dok.getcol(0)
In [16]:
%%timeit
csr[:, 0]
In [17]:
%%timeit
csc[:, 0]
In [18]:
%%timeit
lil[:, 0]
In [19]:
%%timeit
dok[:, 0]
In [20]:
%%timeit
csr[0, 0]
In [21]:
%%timeit
csc[0, 0]
In [22]:
%%timeit
lil[0, 0]
In [23]:
%%timeit
dok[0, 0]
In [24]:
%%timeit
csr[:10]
In [25]:
%%timeit
csc[:10]
In [26]:
%%timeit
lil[:10]
In [27]:
%%timeit
dok[:10]
In [28]:
%%timeit
csr[:, :10]
In [29]:
%%timeit
csc[:, :10]
In [30]:
%%timeit
lil[:, :10]
In [31]:
%%timeit
dok[:, :10]
In [32]:
%%timeit
csr[:10, :10]
In [33]:
%%timeit
csc[:10, :10]
In [34]:
%%timeit
lil[:10, :10]
In [35]:
%%timeit
dok[:10, :10]