Sparse matrices in SciPy defined by a function -


is possible define sparse matrix in scipy function rather laying out possible values? in doc's see sparse matrix can created by

there 7 available sparse matrix types:  csc_matrix: compressed sparse column format  csr_matrix: compressed sparse row format  bsr_matrix: block sparse row format  lil_matrix: list of lists format  dok_matrix: dictionary of keys format  coo_matrix: coordinate format (aka ijv, triplet format)  dia_matrix: diagonal format 

all of these force specify matrix beforehand, takes memory. there way can supply function calculate (i,j) when needed? end goal calculate few largest eigenvectors of matrix through lanczos method.

short answer "no", it's pretty easy think roll own matrix-like object. if using eigsh answer, (which appears implementation of lanczos algorithm.), matrix-like requires matvec(x) method, may or may not easy.

i realize not complete answer, hope sets on way.


Comments