Did I find the right examples for you? yes no

sputils.isshape

All Samples(32)  |  Call(18)  |  Derive(0)  |  Import(14)

```from .dia import dia_matrix
from . import sparsetools
from .sputils import upcast, upcast_char, to_native, isdense, isshape, \
getdtype, isscalarlike, isintlike, IndexMixin

```
```
elif isinstance(arg1, tuple):
if isshape(arg1):
# It's a tuple of matrix dimensions (M, N)
# create empty matrix
```

```from data import _data_matrix
import sparsetools
from sputils import upcast, upcast_char, to_native, isdense, isshape, \
getdtype, isscalarlike, isintlike

```
```
elif isinstance(arg1, tuple):
if isshape(arg1):
# It's a tuple of matrix dimensions (M, N)
# create empty matrix
```

```
from .base import spmatrix, isspmatrix
from .sputils import (isdense, getdtype, isshape, isintlike, isscalarlike,
upcast, upcast_scalar)

```
```
self.dtype = getdtype(dtype, default=float)
if isinstance(arg1, tuple) and isshape(arg1):  # (M,N)
M, N = arg1
self.shape = (M, N)
```
```        Any non-zero elements that lie outside the new shape are removed.
"""
if not isshape(shape):
raise TypeError("dimensions must be a 2-tuple of positive"
" integers")
```

```from data import _data_matrix
import sparsetools
from sputils import upcast, to_native, isdense, isshape, getdtype, \
isscalarlike, isintlike

```
```
elif isinstance(arg1, tuple):
if isshape(arg1):
# It's a tuple of matrix dimensions (M, N)
# create empty matrix
```

```from .compressed import _cs_matrix
from .base import isspmatrix, _formats
from .sputils import isshape, getdtype, to_native, upcast
from . import sparsetools
from .sparsetools import bsr_matvec, bsr_matvecs, csr_matmat_pass1, \
```
```
elif isinstance(arg1,tuple):
if isshape(arg1):
# it's a tuple of matrix dimensions (M,N)
self.shape = arg1
```
```                    blocksize = (1,1)
else:
if not isshape(blocksize):
raise ValueError('invalid blocksize=%s' % blocksize)
blocksize = tuple(blocksize)
```

```
from .base import spmatrix, isspmatrix
from .sputils import getdtype, isshape, issequence, isscalarlike, ismatrix, \
IndexMixin, upcast_scalar

```
```            self.data = A.data
elif isinstance(arg1,tuple):
if isshape(arg1):
if shape is not None:
raise ValueError('invalid use of shape parameter')
```

```from compressed import _cs_matrix
from base import isspmatrix, _formats
from sputils import isshape, getdtype, to_native, upcast
import sparsetools
from sparsetools import bsr_matvec, bsr_matvecs, csr_matmat_pass1, \
```
```
elif isinstance(arg1,tuple):
if isshape(arg1):
#it's a tuple of matrix dimensions (M,N)
self.shape  = arg1
```
```                    blocksize = (1,1)
else:
if not isshape(blocksize):
raise ValueError('invalid blocksize=%s' % blocksize)
blocksize = tuple(blocksize)
```

```
from base import spmatrix, isspmatrix
from sputils import isdense, getdtype, isshape, isintlike, isscalarlike, upcast

try:
```
```
self.dtype = getdtype(dtype, default=float)
if isinstance(arg1, tuple) and isshape(arg1): # (M,N)
M, N = arg1
self.shape = (M, N)
```
```        Any non-zero elements that lie outside the new shape are removed.
"""
if not isshape(shape):
raise TypeError("dimensions must be a 2-tuple of positive"
" integers")
```

```from .base import isspmatrix
from .data import _data_matrix, _minmax_mixin
from .sputils import upcast, upcast_char, to_native, isshape, getdtype, isintlike

```
```    def __init__(self, arg1, shape=None, dtype=None, copy=False):
_data_matrix.__init__(self)

if isinstance(arg1, tuple):
if isshape(arg1):
```

```
from base import spmatrix, isspmatrix
from sputils import getdtype, isshape, issequence, isscalarlike

class lil_matrix(spmatrix):
```
```            self.data  = A.data
elif isinstance(arg1,tuple):
if isshape(arg1):
if shape is not None:
raise ValueError('invalid use of shape parameter')
```

1 | 2  Next