{ } Raw JSON

bundles / scipy 1.17.1 / scipy / sparse / linalg / _dsolve / linsolve / spbandwidth

function

scipy.sparse.linalg._dsolve.linsolve:spbandwidth

source: /scipy/sparse/linalg/_dsolve/linsolve.py :830

Signature

def   spbandwidth ( A )

Summary

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

Extended Summary

Computes the lower and upper limits on the bandwidth of the sparse 2D array A. The result is summarized as a 2-tuple of positive integers (lo, hi). A zero denotes no sub/super diagonal entries on that side (triangular). The maximum value for lo (hi) is one less than the number of rows(cols).

Only the sparse structure is used here. Values are not checked for zeros.

Parameters

A : SciPy sparse array or matrix

A sparse matrix preferrably in CSR or CSC format.

Returns

below, above : 2-tuple of int

The distance to the farthest non-zero diagonal below/above the main diagonal.

Examples

import numpy as np
from scipy.sparse.linalg import spbandwidth
from scipy.sparse import csc_array, eye_array
A = csc_array([[3, 0, 0], [1, -1, 0], [2, 0, 1]], dtype=float)
spbandwidth(A)
D = eye_array(3, format='csr')
spbandwidth(D)

Aliases

  • scipy.sparse.linalg.spbandwidth