A sparse matrix in coordinate list format.
COO matrices are created either as:
A = coo_matrix(None, dims=(m, n), [dtype])
for a zero matrix, or as:
A = coo_matrix((obj, ij), [dims])
where the dimensions are optional. If supplied, we set (M, N) = dims.
If not supplied, we infer these from the index arrays
ij[0][:] and ij[1][:]
The arguments 'obj' and 'ij' represent three arrays:
1. obj[:] the entries of the matrix, in any order
2. ij[0][:] the row indices of the matrix entries
3. ij[1][:] the column indices of the matrix entries
So the following holds:
A[ij[0][k], ij[1][k] = obj[k]
Inherits from
Attributes
Inherited from base classes
Method summary
Inherited from base classes
- __add__(self, other)
- __cmp__(self, other)
- __div__(self, other)
- __getattr__(self, attr)
- __len__(self)
- __mul__(self, other)
- __neg__(self)
- __nonzero__(self)
- __pow__(self, other)
- __radd__(self, other)
- __repr__(self)
- __rmul__(self, other)
- __rsub__(self, other)
- __str__(self)
- __sub__(self, other)
- __truediv__(self, other)
- asformat(self, format)
- astype(self, t)
- conj(self)
- conjugate(self)
- copy(self)
- dot(self, other)
- getH(self)
- getcol(self, j)
- getformat(self)
- getmaxprint(self)
- getnnz(self)
- getnzmax(self)
- getrow(self, i)
- listprint(self, start, stop)
- matmat(self, other)
- matvec(self, other)
- mean(self, axis = None)
- rmatvec(self, other, conjugate = True)
- save(self, file_name, format = """%d %d %f
""")
- setdiag(self, values, k = 0)
- sum(self, axis = None)
- toarray(self)
- todense(self)
- transpose(self)
Methods
- __init__(self, arg1, dims = None, dtype = None)
- getdata(self, num)
- rowcol(self, num)
- tocoo(self, copy = False)
- tocsc(self)
- tocsr(self)