scipy 1.8.0 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturns

Notes

This helper function simply runs over the array looking for the nonzero entries whether there exists a banded structure in the array or not. Hence, the performance depends on the density of nonzero entries and also memory-layout. Fortran- or C- contiguous arrays are handled best and otherwise suffers from extra random memory access cost.

The strategy is to look for only untested band elements in the upper and lower triangular parts separately; depending on the memory layout we scan row-wise or column-wise. Moreover, say we are scanning rows and in the 6th row, 4th entry is nonzero then, on the succeeding rows the horizontal search is done only up to that band entries since we know that band is occupied. Therefore, a completely dense matrix scan cost is in the the order of n.

Parameters

a : ndarray

Input array of size (N, M)

Raises

TypeError

If the dtype of the array is not supported, in particular, NumPy float16, float128 and complex256 dtypes.

Returns

lu : tuple

2-tuple of ints indicating the lower and upper bandwith. A zero denotes no sub- or super-diagonal on that side (triangular), and, say for N rows (N-1) means that side is full. Same example applies to the upper triangular part with (M-1).

bandwidth(a) Return the lower and upper bandwidth of a 2D numeric array.

Examples

>>> from scipy.linalg import bandwidth
>>> A = np.array([[3., 0., 0., 0., 0.],
...               [0., 4., 0., 0., 0.],
...               [0., 0., 5., 1., 0.],
...               [8., 0., 0., 6., 2.],
...               [0., 9., 0., 0., 7.]])
>>> bandwidth(A)
(3, 1)
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : None#None
type: <class 'builtin_function_or_method'>
Commit: