(self, a, threshold=0.0)
| 2294 | return self.todense(a) |
| 2295 | |
| 2296 | def eliminate_zeros(self, a, threshold=0.0): |
| 2297 | if self.issparse(a): |
| 2298 | if threshold > 0: |
| 2299 | mask = self.abs(a) <= threshold |
| 2300 | mask = ~mask |
| 2301 | mask = mask.nonzero() |
| 2302 | else: |
| 2303 | mask = a._values().nonzero() |
| 2304 | nv = a._values().index_select(0, mask.view(-1)) |
| 2305 | ni = a._indices().index_select(1, mask.view(-1)) |
| 2306 | return self.coo_matrix(nv, ni[0], ni[1], shape=a.shape, type_as=a) |
| 2307 | else: |
| 2308 | if threshold > 0: |
| 2309 | a[self.abs(a) <= threshold] = 0 |
| 2310 | return a |
| 2311 | |
| 2312 | def todense(self, a): |
| 2313 | if self.issparse(a): |
nothing calls this directly
no test coverage detected