scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersReturns
_ldl_sanitize_ipiv(a, lower=True)

Since FORTRAN uses 1-indexing and LAPACK uses different start points for upper and lower formats there are certain offsets in the indices used below.

Let's assume a result where the matrix is 6x6 and there are two 2x2 and two 1x1 blocks reported by the routine. To ease the coding efforts, we still populate a 6-sized array and fill zeros as the following :

pivots = [2, 0, 2, 0, 1, 1]

This denotes a diagonal matrix of the form :

[x x        ]
[x x        ]
[    x x    ]
[    x x    ]
[        x  ]
[          x]

In other words, we write 2 when the 2x2 block is first encountered and automatically write 0 to the next entry and skip the next spin of the loop. Thus, a separate counter or array appends to keep track of block sizes are avoided. If needed, zeros can be filtered out later without losing the block structure.

Parameters

a : ndarray

The permutation array ipiv returned by LAPACK

lower : bool, optional

The switch to select whether upper or lower triangle is chosen in the LAPACK call.

Returns

swap_ : ndarray

The array that defines the row/column swap operations. For example, if row two is swapped with row four, the result is [0, 3, 2, 3].

pivots : ndarray

The array that defines the block diagonal structure as given above.

This helper function takes the rather strangely encoded permutation array returned by the LAPACK routines ?(HE/SY)TRF and converts it into regularized permutation and diagonal pivot size format.

Examples

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 : /scipy/linalg/_decomp_ldl.py#157
type: <class 'function'>
Commit: