[SciPy-user] Sparse matrices
david at dwavesys.com
Wed Nov 10 15:08:13 CST 2004
Travis Oliphant wrote:
> Nils Wagner wrote:
>> Hi all,
>> from scipy import *
>> A = sparse.dok_matrix()
>> for i in range(3):
>> A[i,i] = 0.0+0.0j
>> # A[i,i] = 0.1+0.0j
>> n,m = A.shape
>> print n,m
>> print A
>> n, m should be equal to 3, but this is only valid for non-zero entries.
>> Am I missing something ?
> Entering a zero value into a sparse matrix causes no storage and
> therefore no shape changes. A remains an empty sparse matrix. What
> are you trying to do?
One thing that it is interesting. These sparse arrays are dynamically
allocated I assume? In the PySparse package, arrays are dynamically
allocated, but the shape must be set upon initialization. It looks like
you've made a more flexible package here.
More information about the SciPy-user