btd_partition

sisl_toolbox.btd.btd_partition(csr, method='gps', cost='speed', refine=True, dense=None, **kwargs)

Permutation table and block sizes of the block-tridiagonal matrix of minimal cost

The permutation table reduces the bandwidth of csr (see reduce_bandwidth), and the permuted matrix is partitioned into the block-tridiagonal matrix that minimizes the cost model, see btd_blocks. The indices within each block are sorted, which improves memory access when assembling and post-processing the blocks.

Parameters:
  • csr (SparseCSR | _SparseGeometry) – the sparse matrix, columns may extend into supercells. For a sparse geometry object (e.g. Hamiltonian) its sparse pattern is used. The rows are the nodes of the partitioning, i.e. use the atomic sparse pattern (H.toSparseAtom()) to partition atoms, and H to partition orbitals.

  • method (str) – the bandwidth reduction method, see reduce_bandwidth

  • cost ({"speed", "memory", "speed-diagonal"}) – the cost model of the block-tridiagonal matrix, see btd_blocks

  • refine (bool) – refine the permutation table, see reduce_bandwidth

  • dense (Sequence[TypeAliasForwardRef('~numpy.typing.ArrayLike')] | None) – rows of csr that are fully coupled, one array per dense block. E.g. the nodes (atoms or orbitals) of an electrode self-energy. The dense blocks are added to the graph, so each dense block is guaranteed to span at most 2 neighboring blocks.

  • **kwargs – passed to the routine of method

Returns:

PermuteBTD

Return type:

holding both the block-sizes and the permutation table.