Did I find the right examples for you? yes no

# csr.csr_matrix

All Samples(43)  |  Call(22)  |  Derive(0)  |  Import(21)

```        # Pre-multiply by a (1 x m) row vector 'a' containing all zeros
# except for a_i = 1
from .csr import csr_matrix
m = self.shape[0]
if i < 0:
i += m
if i < 0 or i >= m:
raise IndexError("index out of bounds")
row_selector = csr_matrix(([1], [[0], [i]]), shape=(1,m), dtype=self.dtype)
```

```        # Pre-multiply by a (1 x m) row vector 'a' containing all zeros
# except for a_i = 1
from csr import csr_matrix
m = self.shape[0]
if i < 0:
i += m
if i < 0 or i >= m:
raise IndexError("index out of bounds")
row_selector = csr_matrix(([1], [[0], [i]]), shape=(1,m), dtype=self.dtype)
```

```    def transpose(self, copy=False):
from .csr import csr_matrix
M,N = self.shape
return csr_matrix((self.data,self.indices,self.indptr),(N,M),copy=copy)

```
```                 indptr, indices, data)

from .csr import csr_matrix
A = csr_matrix((data, indices, indptr), shape=self.shape)
A.has_sorted_indices = True
```

```    def transpose(self, copy=False):
from csr import csr_matrix
M,N = self.shape
return csr_matrix((self.data,self.indices,self.indptr),(N,M),copy=copy)

```
```                 indptr, indices, data)

from csr import csr_matrix
A = csr_matrix((data, indices, indptr), shape=self.shape)
A.has_sorted_indices = True
```

```
"""
from .csr import csr_matrix
if self.nnz == 0:
return csr_matrix(self.shape, dtype=self.dtype)
```
```                      indptr, indices, data)

A = csr_matrix((data, indices, indptr), shape=self.shape)
A.sum_duplicates()

```

```
"""
from csr import csr_matrix
if self.nnz == 0:
return csr_matrix(self.shape, dtype=self.dtype)
```
```                      indptr, indices, data)

A = csr_matrix((data, indices, indptr), shape=self.shape)
A.sum_duplicates()

```

```        self.data[:len(nonzero_blocks)] = self.data[nonzero_blocks]

from .csr import csr_matrix

# modifies self.indptr and self.indices *in place*
```

```        self.data[:len(nonzero_blocks)] = self.data[nonzero_blocks]

from csr import csr_matrix

# modifies self.indptr and self.indices *in place*
```

```                raise TypeError('unsupported matrix type')
else:
from .csr import csr_matrix
A = csr_matrix(A, dtype=dtype).tolil()

```
```        data = np.asarray(data, dtype=self.dtype)

from .csr import csr_matrix
return csr_matrix((data, indices, indptr), shape=self.shape)

```

```                raise TypeError('unsupported matrix type')
else:
from csr import csr_matrix
A = csr_matrix(A, dtype=dtype).tolil()

```
```        data = np.asarray(data, dtype=self.dtype)

from csr import csr_matrix
return csr_matrix((data, indices, indptr), shape=self.shape)

```

1 | 2  Next