---
title: "Fast algorithm for extracting the diagonal of the inverse matrix"
description: "A hierarchical Schur complement method extracts inverse diagonals and makes electron density calculations faster for two-dimensional metals."
canonical: "https://research.elamur.ai/free/en/papers/car-2009-fast-algorithm-extracting-diagonal-inverse/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/car-2009-fast-algorithm-extracting-diagonal-inverse/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2009](https://md.research.elamur.ai/free/en/papers/2009/) / Fast algorithm for extracting the diagonal of the inverse matrix with application to the electronic structure analysis of metallic systems

# Fast algorithm for extracting the diagonal of the inverse matrix with application to the electronic structure analysis of metallic systems

Paper · 2009 · Roberto Car, E Weinan, Lin Lin et al.

**Authors:** [Roberto Car](https://md.research.elamur.ai/free/en/authors/roberto-car/), [E Weinan](https://md.research.elamur.ai/free/en/authors/e-weinan/), [Lin Lin](https://md.research.elamur.ai/free/en/authors/lin-lin/), [Jianfeng Lu](https://md.research.elamur.ai/free/en/authors/jianfeng-lu/) and [Lexing Ying](https://md.research.elamur.ai/free/en/authors/lexing-ying/) · **Year:** 2009 · **Venue:** Communications in Mathematical Sciences · **Licence:** No open licence stated (free-to-read copy; rights reserved) — text kept private

Communications in Mathematical Sciences

- [PDF](https://www.intlpress.com/site/pub/files/_fulltext/journals/cms/2009/0007/0003/CMS-2009-0007-0003-a012.pdf)
- [DOI 10.4310/cms.2009.v7.n3.a12](https://doi.org/10.4310/cms.2009.v7.n3.a12)

## Summary

To calculate where electrons are distributed in a metal, one approach asks for the diagonal entries of several large matrix inverses. The original matrices can be sparse because the discretized Hamiltonian couples nearby grid points. Their inverses can still have appreciable entries between distant points. Forming each full inverse is expensive, and discarding its distant entries can introduce substantial error. The authors show how to obtain the diagonal by using the locations of zeros in the original matrix.

The method divides the grid into nested blocks. On the way up this hierarchy, it eliminates points inside each block and folds their effect into interactions among the remaining boundary points. The resulting matrix on those points is called a Schur complement. At the top, the method inverts the final boundary matrix directly. On the way back down, it uses pieces of that inverse to recover the pieces needed by smaller blocks. The central observation is that each block needs the inverse restricted to its own boundary, including entries between different points on that boundary. The calculation yields the exact diagonal in exact arithmetic and costs on the order of the three-halves power of the number of unknowns on the two-dimensional grids studied.

On a periodic Anderson lattice, the inverse-diagonal calculation took 0.86 seconds at grid size 128 × 128, compared with 3672.53 seconds for dense inversion. Where the authors could compare the diagonals directly, relative errors were at the level of machine accuracy. At 1024 × 1024, the inverse-diagonal calculation took 190.44 seconds per pole. The dense-inversion time at that size was estimated.

The electronic-structure calculation combines these inverse diagonals with a polynomial approximation for the remainder of the Fermi operator, the matrix that gives the electronic occupations at a specified temperature and chemical potential. Handling more of its pole terms explicitly reduces the polynomial order needed for the remainder and makes a shorter spatial cutoff viable. The tests show how these choices affect density and energy errors on the Anderson lattice. The large-grid calculation took roughly 3.27 hours. Its expected accuracy was inferred from the smaller grids, where reference values were available.

## Deep dive: Fast algorithm for extracting the diagonal of the inverse matrix with application to the electronic structure analysis of metallic systems

A hierarchical Schur complement method extracts inverse diagonals and makes electron density calculations faster for two-dimensional metals. · about 35 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Why a sparse Hamiltonian leads to a dense inverse

A Hamiltonian describes the energies and couplings in an electronic system. In the paper’s setting, it is represented by a matrix whose rows and columns are associated with points on a computational grid. A finite-difference discretization of the differential operator can give each point only a small set of neighbors with which it interacts directly. The matrix entry for a pair of points outside that interaction range is then zero. This sparsity is a property of the matrix used to pose the problem.

The entries of its inverse answer a different question. An inverse entry describes the response at one coordinate to a source at another. The effect can pass through intermediate points, so the absence of a direct interaction between two coordinates gives little reason for their inverse entry to vanish. The same issue holds after the Hamiltonian is shifted by the chemical potential and an imaginary frequency. The shift changes diagonal entries and preserves the original pattern of off-diagonal zeros.

At finite temperature, the electronic density is obtained from the diagonal of the Fermi operator. The chemical potential controls the total occupation and is chosen to give the required number of electrons. The authors also want the electronic energy, which is the trace of the product of the Fermi operator and the Hamiltonian. The trace is the sum of a matrix’s diagonal entries. These outputs are much smaller than a full matrix of responses between all pairs of grid points.

One way of evaluating the Fermi operator is to diagonalize the Hamiltonian. Its eigenvalues can then be passed through the scalar Fermi–Dirac function, which gives occupations as a function of energy. The authors give cubic cost in the matrix dimension for direct diagonalization. They instead start from a representation of the Fermi operator as a sum involving inverses of shifted Hamiltonians. Each inverse is associated with a pole, a shift at a particular imaginary frequency. Once the problem has this form, a faster way to obtain inverse diagonals can reduce the cost of evaluating the density.

The distinction between insulators and metals matters to that reduction. In the insulating case discussed by the authors, the entries of the inverse decay exponentially with distance from the diagonal. A method can then set sufficiently distant entries to zero and exploit the resulting sparsity. In the metallic case of interest, the decay is slow, so this truncation can remove contributions large enough to affect the answer. The matrix after shifting by the chemical potential also falls outside the positive-definite setting assumed by several approaches the authors discuss. A positive-definite real symmetric matrix has a positive quadratic form for every non-zero real vector. The shifted matrix in the pole calculation is complex, and the inverse entries exhibit oscillations associated with the chemical-potential shift.

#### What earlier approaches exploited

The simplest baseline is to form the full inverse and read off the diagonal. Dense inversion has the same cubic scaling identified for direct diagonalization. It also computes a separate result for each pair of coordinates, even when the requested output contains only one entry per coordinate. The question is whether the work needed to produce those pairwise responses can be avoided while retaining their influence on the diagonal.

One strategy discussed in the paper is Newton–Schulz iteration, which refines an approximation to an inverse through matrix products. In the insulating case, rapid decay permits truncation during those products and makes linear scaling possible in the setting the authors describe. The same approach to truncation becomes inaccurate for the metallic inverses motivating the paper. The distinction concerns which entries can be dropped at a specified accuracy, rather than how many non-zero entries the original Hamiltonian has.

A second approach changes the representation of the matrices. The authors describe wavelets, which represent variation at different spatial scales, as a way to keep both a positive-definite matrix and its inverse sparse enough for efficient computation. Their discussion separates the growth rate of the operation count from its coefficient. If a truncation distance and the number of wavelet levels are held fixed, the cost can grow linearly with system size while still being expensive for every grid point. The paper’s illustrative tensor-product construction for two dimensions gives a coefficient on the order of 10⁹ for truncation distance 10 and 8 wavelet levels. The example is a rough operation-count argument about that construction.

Hierarchical matrices provide another way to compress a positive-definite problem. The idea is to approximate suitable off-diagonal blocks of the inverse by low-rank factors. Low rank means that many columns of a block can be represented through a smaller set of directions. If sufficiently small ranks give a good approximation, matrix products and inversions can be carried out with much less work. The authors describe both iterative and block-factorization routes using this structure. They also explain why they regard the oscillatory inverses in the metallic application as poor candidates for the efficient representations on which these routes rely.

The paper considers Monte Carlo diagonal estimation as well. Such methods can estimate the diagonal from products of the inverse with vectors, with each product obtainable by solving a linear system. Fast procedures for these solves can make the approach attractive. Its accuracy depends on the matrix and the estimator. The authors note that bands or rapid off-diagonal decay can improve the accuracy, whereas the inverse they seek has neither property in the needed form.

The most direct ancestor of the proposed method is sparse elimination. The authors credit nested dissection and multifrontal methods with the idea of organizing elimination through a hierarchy of subdomains and assembling the resulting updates. They also acknowledge the FIND algorithm as a closely related approach for computing entries of sparse matrix inverses. Their own derivation starts from the geometry of the grid and asks which inverse entries must be recovered after elimination. The advance they emphasize is the downward selection of inverse blocks, using a hierarchy that sparse elimination already knows how to construct.

### The method, step by step

#### What survives when an interior is eliminated

Consider a group of grid points surrounded by a row of boundary points. The group can interact directly with that boundary, and the boundary can interact with the rest of the grid. The group and the rest have no direct coupling. Eliminating the group from a linear system replaces the equations on the remaining points with a smaller system. The replacement accounts for the possible paths through the eliminated points by changing the couplings among their boundary points.

This elimination is exact. The boundary update may be dense within the boundary even when the original local interactions are sparse. It represents the influence of the interior that has been removed from the active system. If several interiors have separate boundaries and no interactions outside their own blocks, they can be eliminated separately. Their updates are assembled into the next matrix, where some of the surviving points become interiors of larger blocks.

To see why this helps with inversion, imagine asking for the inverse entries among the original interior points. There is a contribution from solving with the interior in isolation. There is also a contribution from the surrounding system, which the interior can reach only through its boundary. For this second contribution, the required information is the response between points on that boundary in the reduced system. The reduced inverse includes the influence of the entire exterior. Keeping just the relevant submatrix preserves that influence.

The same reasoning can be applied to the reduced system. After a further elimination, the boundary response needed by a smaller block can be recovered from a boundary response on a larger block. Eventually, the set of surviving points is small enough to invert directly. Working backward from this inverse yields the requested entries all the way down to the original grid.

From the sparse matrix to its inverse diagonal The steps in order.

#### The local matrix identity

The paper first writes the dependency using three groups of indices. The first group is the region of interest, the second is its interface, and the third is the rest. A simultaneous reordering of rows and columns puts the matrix into the following form.

```
M = [ A   B   0
      Bᵀ  C   D
      0   Dᵀ  E ]
```

Here `M` is the original symmetric matrix. `A`, `C` and `E` are the parts of the matrix internal to the first group, interface and exterior, respectively. `B` couples the first group to the interface, and `D` couples the interface to the exterior. `ᵀ` means transpose. Each `0` is a zero block of the appropriate size. For the complex symmetric matrices considered, the transpose in this identity is the ordinary transpose.

Eliminating the first group gives the following matrix on the interface and exterior.

```
S = [ C − Bᵀ A⁻¹ B   D
      Dᵀ             E ]
```

`S` is the Schur complement. `A⁻¹` is the inverse of the interior matrix `A`. The term subtracted from `C` is the interface update from elimination, built from the coupling `B` and its transpose. `D`, `Dᵀ` and `E` retain their roles in the original matrix. To use this identity, the interior inverse must exist.

The inverse of the reduced system supplies the interface response. The formula for the original interior response is

```
G(I₁,I₁) = A⁻¹ + A⁻¹ B G₁(I₂,I₂) Bᵀ A⁻¹
```

`G` is the inverse of `M`, and `G₁` is the inverse of `S` in this local illustration. `I₁` and `I₂` are the index sets for the first group and the interface. Parentheses with two index sets mean restriction to the given rows and columns. `A⁻¹`, `B` and `Bᵀ` are the interior inverse and the couplings already obtained from the original block matrix. Juxtaposition denotes matrix multiplication.

The first term in the formula is what the block could compute from its internal equations alone. In the second term, the factors on either side of the selected `G₁` block link interior coordinates to interface coordinates. Since both links select the interface, only rows and columns of `G₁` on that interface enter the product. Off-diagonal entries within that submatrix can contribute even to a diagonal entry of `G`. The operation therefore retains a square boundary block. Keeping only its scalar diagonal would omit interactions that the formula uses.

#### The upward pass through the grid

The authors illustrate the hierarchy on a 16 × 16 lattice. The top level contains the full grid. Inside it are 4 blocks, and each of those is divided into 4 smaller blocks. Thus the finest level contains 16 blocks. The diagrams use disjoint blocks to make the index sets easy to see. The implementation for the experiments uses shared edges, a change discussed below.

At the finest level, each block is split into interior and boundary points. An interior point can interact directly only with points in its block. A boundary point can participate in interactions that connect different blocks. Moving all interiors before all boundaries in the matrix ordering creates a block-diagonal interior matrix. The matrix coupling interiors to boundaries also has blocks associated with the individual spatial blocks. The restriction to all boundary points can have couplings across blocks.

At the next level, the active grid consists of the survivors of the first elimination. A point on the boundary of a fine block could now be inside a larger block. Its classification is determined by interactions in the active system. In particular, the dense updates introduced at the finer level stay within the finer block boundaries. When those blocks are grouped, the parent can eliminate the points that have become interior and retain the ones needed to connect to the rest of the domain. The same ordering makes the parent interiors independent of one another at their level.

For the general recurrence, it is convenient to give the active reduced matrices a separate symbol. Let `S₀` denote `M`, and let `Sₗ` be the reduced matrix after eliminating interiors at level `l`. Let `Gₗ` be the inverse of `Sₗ`. The subscript `l` counts levels from the finest one upward. The paper describes the change of ordering with a permutation matrix, which reassigns indices without changing the linear system they represent.

```
Pₗ⁻¹ Sₗ₋₁ Pₗ = [ Aₗ  Bₗ
                   Bₗᵀ Cₗ ]
```

`Sₗ₋₁` is the preceding reduced matrix. `Pₗ` and `Pₗ⁻¹` apply the index permutation and its inverse on the appropriate sides. `Aₗ` is the interior-to-interior block, `Bₗ` is the interior-to-boundary block, and `Cₗ` is the boundary-to-boundary block before the update. `ᵀ` again denotes transpose. The subscript `l` on those three blocks refers to the separation chosen at the current level.

The next reduced system follows from block Gaussian elimination.

```
Sₗ = Cₗ − Bₗᵀ Aₗ⁻¹ Bₗ
```

`Sₗ` is defined on the boundary indices left at level `l`. `Aₗ⁻¹` is the inverse of the current interior block matrix. The remaining symbols are the coupling `Bₗ`, its transpose `Bₗᵀ`, and the original boundary restriction `Cₗ` at this level. Because the factors involving interiors decompose by spatial block, the subtraction can be assembled from local updates.

The algorithm stores a coupling product for each block. Its sign is convenient for expressing both passes.

```
Kₗ;ᵢⱼ = −Bₗ;ᵢⱼᵀ Aₗ;ᵢⱼ⁻¹
```

`Kₗ;ᵢⱼ` maps interior coordinates to boundary coordinates for the block with indices `i,j` at level `l`. The semicolon in the subscript separates the level from the block indices. `Bₗ;ᵢⱼ` and `Aₗ;ᵢⱼ` are the local pieces of `Bₗ` and `Aₗ`. The superscripts `ᵀ` and `⁻¹` mean transpose and inverse. The leading minus sign lets the construction add the product of `Kₗ;ᵢⱼ` with the local coupling `Bₗ;ᵢⱼ` to the existing boundary restriction.

At the end of the upward pass, the authors invert the final Schur complement directly. This operation includes the coupling information accumulated from every finer block. Both the upward updates and the later recovery use submatrices indexed by the same physical points. An implementation can therefore express the permutation through index sets, as in the paper’s algorithm, without constructing a separate dense permutation matrix.

#### The downward pass and the entries it keeps

Ordinary block elimination also gives a formula for recovering the inverse on the larger system represented just before a level’s elimination. Written to show the index permutations, it is

```
Gₗ₋₁ = Pₗ Lₗᵀ [ Aₗ⁻¹  0
                   0      Gₗ ] Lₗ Pₗ⁻¹
```

`Gₗ₋₁` and `Gₗ` are the inverses of the active matrices before and after level `l`, respectively. `Aₗ⁻¹` is the assembled interior inverse for that level. `0` denotes zero blocks. `Pₗ` and `Pₗ⁻¹` restore the preceding indexing around the product. `Lₗ` is the elimination factor in the paper’s inverse formula, and `Lₗᵀ` is its transpose. The factor has the form

```
Lₗ = [ I          0
       Bₗᵀ Aₗ⁻¹  I ]
```

`I` is the identity on the corresponding interior or boundary index set. `0` denotes a zero block. `Bₗᵀ Aₗ⁻¹` is the transposed coupling multiplied by the interior inverse. This factor is itself assembled from the local block data.

The full product displays the exact relationship between successive inverses. For implementation, the authors restrict it to a single spatial block, whose interior indices are `U` and boundary indices are `V`. In the following formula, `A` and `K` refer to the stored interior matrix and coupling product of that block.

```
Gₗ₋₁(U ∪ V,U ∪ V) =
[ A⁻¹ + Kᵀ Gₗ(V,V) K   Kᵀ Gₗ(V,V)
  Gₗ(V,V) K             Gₗ(V,V)    ]
```

`Gₗ₋₁` is the inverse at the preceding level. `U ∪ V` is the union of the current block’s interior and boundary lists, ordered with `U` before `V` in the displayed block matrix. `Gₗ(V,V)` is the part of the current reduced inverse restricted to that block’s boundary. `A⁻¹` and `K` are the stored local quantities from elimination, and `Kᵀ` is the transpose. The upper-left block gives inverse entries among the recovered interior points. The other blocks give the two orientations of the interior-to-boundary response and the original boundary response.

The lower-right block states an important invariant. If both points survive a level, their inverse entry in the larger system is already the entry of the reduced inverse. Elimination changes the direct matrix on the boundary to make this true. During reconstruction, the boundary block can therefore pass through unchanged. Filling in interiors requires additional products, while an entry on two surviving boundary points can be copied.

Now consider a child of the current block. The boundary of that child lies among the points represented by the current block’s `U` and `V` sets. Its boundary submatrix can include entries from the upper-left, mixed and lower-right blocks in the formula. The permutation identifies which coordinates in the parent result are the same grid points as those in the child’s boundary. Taking the corresponding rows and columns gives the inverse block needed for the next downward step. This is why the algorithm reconstructs mixed interior-to-boundary terms as well as entries among interiors.

Between distinct blocks of the same level, the reduced inverse can be dense. Those cross-block entries do not enter the local recovery of either block because the interior inverse and interior-to-boundary coupling act only within that block. The algorithm can skip the cross-block entries entirely. It still includes their indirect physical effects through the correct boundary response that was recovered at the parent level. At the finest level, every original point belongs to a recovered local block. Taking the scalar diagonal from those blocks gives the output in the original grid indexing.

#### How the grid geometry determines the cost

The cost analysis uses a square grid. The number of unknowns is `N`, and the side length is a power of the base used for the successive subdivisions.

```
√N = 2ᴸ
```

`√N` is the number of grid points along a side. `L` is the exponent giving that side length. The constant `2` reflects the division of each side into halves when the hierarchy is refined. The hierarchy stops at a maximum level denoted by `lₘₐₓ`.

```
nᴮ(l) = 2²⁽ˡₘₐₓ⁻ˡ⁾
```

`nᴮ(l)` is the number of blocks at level `l`. `lₘₐₓ` is the coarsest level, where there is a single block. Each step toward a finer level halves the extent in each grid direction, which gives the factor expressed in the exponent. The number of points that contribute to work in a coarser block is the number still active after finer interiors have been removed. As the blocks grow, these active points are drawn from boundaries created by earlier subdivisions.

```
nᴾ(l) = { 2²⁽ᴸ⁺¹⁻ˡₘₐₓ⁾       for l = 1
         { 2ᴸ⁺ˡ⁻ˡₘₐₓ⁺³ − 16   for l > 1
```

`nᴾ(l)` counts active points in a block in the disjoint construction analyzed by the authors. `L` comes from the grid side length, `l` is the level, and `lₘₐₓ` is the coarsest level. The first row applies to the finest blocks, where every point is still present. The second row counts points remaining in a block after earlier eliminations. The numerical constants belong to the paper’s grid and blocking arrangement.

The local dense operations in both passes are bounded by the cube of this active block size. This gives the following operation count at a level.

```
O(nᴮ(l) nᴾ(l)³)
```

`O` describes an upper bound on the growth rate up to a constant. `nᴮ(l)` counts how many separate block computations are needed, and `nᴾ(l)³` bounds the work per block. In the upward pass, the work includes inverting the interior matrix, forming the stored coupling product and updating the boundary. In the downward pass, it includes the products for the interior and mixed inverse blocks.

The authors choose a hierarchy deep enough to keep the finest block size fixed as the grid grows. Their example uses a maximum level of `L − 1`, which leaves 16 points per finest block. The accumulation of finest-level work then grows linearly with the number of grid points. Towards the top, there are fewer blocks, each with a larger interface. The level counts above bound the combined work of the passes by the same order as the final dense inversion. That last matrix resides on a boundary whose length is on the order of the side length of the square.

```
O(N³⁄²)
```

This is the total operation count in the analyzed two-dimensional construction, including the final boundary inversion. `N` is the total number of grid unknowns. The exponent comes from cubic dense operations on a boundary whose size grows with the square root of `N`. The calculation uses the sparse pattern of the original matrix to organize the work. It makes no low-rank approximation to the boundary blocks.

#### Shared edges, wider stencils and other geometries

With disjoint blocks, there can be a row of boundary points on each side of the division between neighbors. The authors’ implementation lets adjacent blocks share an edge. The separator can then be represented by a common set of points. Each interior still has a boundary through which it couples to other blocks, so the elimination and recovery identities continue to apply. Shared edges reduce the dimensions of the dense local work, leaving the same scaling exponent. The authors’ example shows that at the second level, the number of interior nodes slated for removal drops by about half.

A stencil is the pattern of grid points used to evaluate a discrete differential operator at one point. The main presentation uses the five-point stencil, which involves the point itself and its nearest neighbors. A stencil with a longer interaction range requires a wider boundary to ensure that interior points have no direct coupling outside their block. The authors retain the same bound in the number of unknowns for the higher-order stencils they discuss, with larger local matrices increasing the coefficient.

A compact nine-point scheme illustrates another reason to recover selected off-diagonal inverse entries. In the paper’s example, the continuous equation has the form

```
(−Δ + V)u = f
```

`Δ` is the Laplacian, `V` is multiplication by a potential, `u` is the unknown solution, and `f` is the forcing. The inverse operator maps the forcing to the solution. On a grid, the paper distinguishes the inverse of the discrete operator matrix from the entire discrete mapping when the forcing itself is transformed.

```
(D₉ + (I + D₅/12)Vₕ)uₕ = (I + D₅/12)fₕ
```

`D₉` and `D₅` are the compact nine-point and five-point matrices in the authors’ discretization. `I` is the identity, `Vₕ` is a diagonal matrix of the grid values of `V`, and `uₕ` and `fₕ` are the solution and forcing on the grid. The coefficient `12` comes from the compact discretization in the paper. The matrix on the left is the matrix to be inverted.

```
M⁻¹(I + D₅/12)
```

This is the discrete Green’s function, meaning the matrix that takes the discrete forcing to the solution. `M` is the operator multiplying `uₕ` in the preceding equation. The factor involving `I` and `D₅` comes from the right side of that equation. A diagonal entry of this product needs entries of `M⁻¹` for the point itself and its nearest neighbors because those are the coordinates coupled by the right-hand factor. If both members of such a pair are boundary points at some level where their entry is recovered, the downward recurrence preserves that entry. Pairs inside a finest block can be taken from its local inverse block.

The paper also describes extensions in which the separator geometry or the representation changes. A system that grows in two dimensions and has fixed thickness in the third can be subdivided along the growing dimensions. The cost bound keeps its two-dimensional exponent, with a coefficient that depends on the thickness. In a bulk three-dimensional domain, a separator is a surface. The largest dense inverse has a dimension that grows with the two-thirds power of the total number of unknowns, and the direct extension has quadratic cost in that number. For elliptic problems with suitable low-rank off-diagonal structure in the intermediate matrices, the authors describe an approximate use of hierarchical representations that can bring the operation count down to linear. Its extra assumption concerns compressibility of those matrices.

#### From inverse diagonals to density and energy

For the electronic application, the Hamiltonian includes a kinetic term and a spatial potential. The continuum expression used to introduce it is

```
H = −Δ/2 + V(x)
```

`H` denotes the Hamiltonian and also denotes its matrix once discretized. `Δ` is the Laplacian, `V(x)` is the potential at position `x`, and the coefficient `1/2` sets the kinetic term in the paper’s units. In matrix expressions involving the chemical potential, a scalar shift is understood to act through the identity.

```
P = 2[I + exp(β(H − μI))]⁻¹
```

`P` is the finite-temperature density matrix given by the Fermi operator. `β` is inverse temperature in the paper’s convention, the reciprocal of the thermal energy `kᴮT`, with `kᴮ` the Boltzmann constant and `T` temperature. `μ` is the chemical potential, `I` is the identity, and `exp` is the matrix exponential. `⁻¹` denotes a matrix inverse. The factor `2` accounts for spin degeneracy. The chemical potential is chosen so that the trace of `P` gives the prescribed electron count.

The density profile and electronic energy come from different uses of the same operator.

```
ρ = diag(P)
```

`ρ` is the electronic density profile on the grid. `diag` takes the diagonal entries of its matrix argument and returns them as a vector. `P` is the density matrix.

```
E = Tr(PH)
```

`E` is the electronic energy. `Tr` denotes the trace, and `PH` is the matrix product of the density matrix `P` and the Hamiltonian `H`. The product can be evaluated through the pole and tail terms without producing a full dense representation of `P`.

The pole representation used in the paper is the Matsubara expansion. Introduce the shifts and the corresponding inverse matrices as follows.

```
μₗ = (2l − 1)πi/β
```

`μₗ` is the imaginary frequency of pole `l`, where `l` is a positive integer. `π` is the circle constant and `i` is the imaginary unit. `β` is the inverse temperature. The expression in parentheses selects the odd multiples of the basic frequency.

```
Qₗ = [H − (μ + μₗ)I]⁻¹
```

`Qₗ` is the inverse matrix for the pole indexed by `l`. `H`, `μ` and `I` are the Hamiltonian, chemical potential and identity. `μₗ` is the imaginary shift. The matrix inside the brackets is the sparse input to the inverse-diagonal algorithm.

```
P = I − (4/β) Re ∑ₗ₌₁^∞ Qₗ
```

`P` is the Fermi operator, `I` is the identity, and `Re` takes the real part of the sum of the matrices `Qₗ`. The sum runs over all positive pole indices `l` up to infinity, indicated by `∞`. `4/β` is the expansion coefficient. The expansion represents the same matrix function as the exponential formula.

The electronic-structure algorithm treats a finite set of poles explicitly. The remaining poles and the identity form the tail. This split is an identity before an approximation is made for the tail.

```
P = −(4/β) Re ∑ₗ₌₁^ᴺᴾᵒˡᵉ Qₗ + Pₜₐᵢₗ(H; Nᴾᵒˡᵉ)
```

`Nᴾᵒˡᵉ` is the number of explicitly evaluated poles and is the upper limit of the sum. `Pₜₐᵢₗ(H; Nᴾᵒˡᵉ)` is the rest of the Fermi operator at Hamiltonian `H` for this choice of pole count. `Qₗ`, `Re`, `β` and `P` retain their previous meanings. The semicolon in the argument list denotes that the pole count is a parameter of the tail function.

The paper gives the tail both as an infinite remainder and in terms of the digamma function. The remainder specifies the starting index directly.

```
Pₜₐᵢₗ(H; Nᴾᵒˡᵉ) = I − (4/β) Re ∑ₗ₌ₙ^∞ Qₗ
```

`n` here is the first pole index after the retained poles, namely `Nᴾᵒˡᵉ + 1`. The upper limit `∞` means that all following poles belong to the tail. `I` gives the constant term of the Fermi operator. The digamma function used in the paper is defined by

```
ψ(x) = Γ′(x)/Γ(x)
```

`ψ` denotes the digamma function, `Γ` is the gamma function, and `Γ′` is its derivative with respect to its argument `x`. The identity for the remainder permits the authors to treat the tail as a scalar function of energy when choosing a polynomial approximation. They evaluate the resulting polynomial on the matrix `H`.

The density formula applies the diagonal operation to the split Fermi operator.

```
ρ = −(4/β) Re ∑ₗ₌₁^ᴺᴾᵒˡᵉ diag(Qₗ) + diag(Pₜₐᵢₗ)
```

`ρ` is the full density profile. `diag(Qₗ)` is the inverse diagonal for explicit pole `l`, and `diag(Pₜₐᵢₗ)` is the diagonal contribution from the tail. `Nᴾᵒˡᵉ` fixes which poles are included, `β` gives the prefactor, and `Re` takes the real part. This is the point at which the previous inverse-diagonal calculation replaces a much larger matrix operation.

For energy, the authors use the fact that multiplying the pole inverse by its own shifted Hamiltonian gives the identity. This lets them obtain its energy contribution from the same inverse diagonal they already computed for the density.

```
Tr(QₗH) = Tr(I) + (μ + μₗ) Tr(Qₗ)
```

`Tr(QₗH)` is the trace needed from pole `l` before applying the expansion coefficient. `Tr(I)` is the constant trace of the identity matrix. `μ` and `μₗ` are the real and imaginary shifts, and `Tr(Qₗ)` is the sum of the computed inverse diagonal. The tail energy contribution is the trace of the tail polynomial times `H`, evaluated through an additional matrix product.

#### Approximating the tail

The paper uses a Chebyshev expansion for the tail. Chebyshev polynomials form a sequence in which the next polynomial can be evaluated from the previous terms. The algorithm uses the same recurrence with matrices, accumulating each term with a coefficient chosen for the scalar tail function and the target accuracy.

```
T₃ ← 2HT₂ − T₁
```

`T₁` and `T₂` are the previous two matrix polynomial terms, and `T₃` is the next term. The labels denote the roles in one update. `H` is the matrix argument in the recurrence, with the paper initializing the sequence with the identity and `H`. `←` means assignment. The factor `2` is part of the Chebyshev recurrence. After using `T₃` in the expansion, the algorithm shifts the terms into the previous-term roles for the next update.

The multiplication in this recurrence is truncated by a cutoff radius. In the paper’s two-dimensional rule, an entry is removed if its grid coordinates differ by more than the cutoff along either axis.

```
A[(i,j),(i′,j′)] ← 0 if |i − i′| > Rᶜᵘᵗ or |j − j′| > Rᶜᵘᵗ
```

`A` is the resulting matrix of a multiplication. `(i,j)` and `(i′,j′)` are the grid coordinates indexing its row and column. The bars denote absolute coordinate differences. `Rᶜᵘᵗ` is the cutoff radius in grid coordinates, and `0` is the value substituted beyond it. This is an approximation in the tail calculation. The earlier elimination and inverse recovery do not use this cutoff.

The authors explain the tradeoff through the temperature dependence of the Fermi operator. After the first poles are taken out, the remaining scalar function behaves as though the temperature had increased. For the same requested polynomial accuracy, the tail can then be represented with fewer terms. The approximate dependence of the required order is

```
Nᶜʰᵉᵇ ∼ βΔE/Nᴾᵒˡᵉ
```

`Nᶜʰᵉᵇ` denotes the required Chebyshev order, `β` is inverse temperature, `ΔE` is the spectral width of the discretized Hamiltonian, and `Nᴾᵒˡᵉ` is the positive count of explicit poles. `∼` expresses the dependence described by the paper for the tail, at a given target accuracy. The width `ΔE` measures the energy range to be covered.

The authors relate the faster spatial decay of the tail to the same removal of poles. More explicit poles increase the rate of decay of the remaining contribution in a metal at finite temperature. This can lower the radius needed for a given accuracy. Their operation count for a two-dimensional tail calculation makes the radius particularly consequential.

```
O(Nᶜʰᵉᵇ (Rᶜᵘᵗ)⁴ N)
```

`Nᶜʰᵉᵇ` counts the polynomial work, `Rᶜᵘᵗ` is the truncation radius, and `N` is the number of grid unknowns. `O` describes the cost bound. The fourth power is the cutoff dependence of the truncated matrix multiplication in the authors’ analysis. Since the spatial decay rate in their argument does not depend on grid size, a radius chosen for a given accuracy can be held fixed as the grid grows under the same conditions.

The resulting estimate for the combined calculation is

```
O(Nᴾᵒˡᵉ N³⁄² + (βΔE/Nᴾᵒˡᵉ) N exp(−C Nᴾᵒˡᵉ/β))
```

`Nᴾᵒˡᵉ` and `N` are the number of explicit poles and spatial unknowns. The first term counts the separate inverse-diagonal calculations on a two-dimensional grid. In the second term, `βΔE/Nᴾᵒˡᵉ` represents the polynomial order dependence, `N` counts the spatial work, and `exp` is the scalar exponential. `C` is a constant in the authors’ estimate for how the spatial cutoff contribution decreases with the pole count. The formula describes the cost tradeoff. The reported calculations select actual pole counts, radii and polynomial orders, then compare the resulting accuracy.

### Experiments and results

#### The Anderson lattice test

The experiments use an Anderson lattice on a square grid with periodic boundaries. Periodicity connects points across opposite edges, which is relevant when deciding which points lie on separators. The Hamiltonian uses nearest-neighbor tight-binding couplings. The on-site potential is sampled uniformly between 0 and 10⁻³ in the reported atomic units. This random potential supplies spatial variation while preserving the nearest-neighbor interaction pattern used by the decomposition.

The temperature is 300K. The chemical potential is set through the trace condition on the Fermi operator.

```
Tr(P) = Nᴱˡᵉᶜᵗʳᵒⁿ
```

`Tr(P)` sums the diagonal entries of the finite-temperature density matrix. `Nᴱˡᵉᶜᵗʳᵒⁿ` is the chosen number of electrons, which scales in proportion to the size of the system. The authors use 32 electrons on the 32 × 32 grid and 128 electrons on the 64 × 64 grid.

The authors give a spectral width of approximately 4 and an inverse temperature of approximately 1000, with a product of roughly 4000. They describe the random potential as producing a gap on the order of 5 × 10⁻⁴, comparable to the reported thermal energy of approximately 10⁻³. On that basis they treat the test as metallic in character. The density matrix is full in this setting. The work of evaluating the electronic density is therefore a pertinent test of a scheme that keeps the influence of distant points through the Schur complements.

A figure shows entries of the density matrix along a row of the 128 × 128 lattice. Its horizontal coordinate is the displacement of the second point from the reference point. The plotted values remain appreciable away from the diagonal and decay slowly across that row. The display illustrates the behavior that makes direct spatial truncation of the full density matrix expensive. The reference coordinates differ between the discussion and the figure caption, so the row and qualitative decay are the features that can be identified consistently.

#### Cost and accuracy of extracting one inverse diagonal

The baseline for the inverse calculation is dense direct inversion. The reported implementation uses MATLAB on an Intel Xeon 3GHz CPU with 64GB of memory. The first comparison isolates the inverse-diagonal algorithm, before the Chebyshev tail is introduced. Its timing concerns extracting the diagonal of a single inverse, and its accuracy measures the relative L₁ error between the recovered diagonal and the dense reference diagonal.

Measured time for one inverse diagonal on the 128 × 128 Anderson lattice The hierarchical method extracts the diagonal much faster than forming the dense inverse.

**The numbers**

| System or setting | seconds |
| --- | --- |
| Dense direct inversion | 3672.53 |
| Hierarchical inverse-diagonal extraction (this paper) | 0.86 |

On the 32 × 32 grid, the hierarchical extraction took 0.03 seconds, while the measured direct inversion took 1.07 seconds. The paper describes the resulting speedup as around 35 at that size. On the 64 × 64 grid, the two measured times were 0.16 seconds and 60.01 seconds, respectively. The chart shows the largest grid for which the table reports a measured dense time.

The hierarchical method took 4.68 seconds at 256 × 256, 28.61 seconds at 512 × 512 and 190.44 seconds at 1024 × 1024. The dense times given alongside those rows are estimates of 2.72 days, 174.11 days and 30.53 years, respectively. This distinction is important because those rows establish the measured cost of the proposed algorithm but only indicate the likely cost of its baseline. The authors describe direct inversion as impractical starting at 256 × 256.

The hierarchy’s measured growth is slightly better over this range than the stated three-halves bound. The authors attribute this to the contribution of the finest-level work, which grows linearly when the smallest blocks are kept fixed. Their explanation reconciles the observed timings with the asymptotic result. It also identifies the source of work that will matter increasingly on larger grids, the dense operations on the largest separators.

Relative L₁ diagonal errors for the measured dense comparisons are 4.87 × 10⁻¹⁴ on the 32 × 32 grid, 1.18 × 10⁻¹⁴ on the 64 × 64 grid and 5.16 × 10⁻¹⁴ on the 128 × 128 grid. In this metric, the absolute coordinate errors are assessed together relative to the reference diagonal. The values are consistent with differences due to finite-precision arithmetic in these tests. This comparison also identifies where significant error can enter the combined electronic calculation. The finite set of pole diagonals can be recovered to this precision, while the polynomial and spatial truncation of the tail have separate approximation errors.

#### Accuracy and cost of the electronic calculation

The tail tests start on the 32 × 32 lattice. The authors specify 10⁻⁵ as the target accuracy for the Chebyshev expansion. They assess the final energy and density with errors normalized by the electron count. The energy comparison uses the following quantity.

```
Δεᵣₑₗ = |Ê − E|/Nᴱˡᵉᶜᵗʳᵒⁿ
```

`Δεᵣₑₗ` is the energy error per electron. `Ê` is the energy from the combined pole and tail calculation, `E` is the reference energy, and the bars denote absolute value. `Nᴱˡᵉᶜᵗʳᵒⁿ` is the prescribed electron count. The normalization is by that count, so the quantity measures an energy discrepancy per electron.

For the density error, the paper writes

```
Δρᵣₑₗ = Tr|P̂ − P|/Nᴱˡᵉᶜᵗʳᵒⁿ
```

`Δρᵣₑₗ` denotes the reported L₁ density-profile error per electron. `P̂` and `P` denote the computed and reference density matrices. The trace and absolute-value notation express the accumulation of absolute discrepancies for the density comparison, and the denominator is again the electron count. The paper describes this as an error of the profile, the diagonal in real space.

A direct Chebyshev expansion of the full Fermi operator, with 0 explicit poles, would require about 19,000 in polynomial order for the stated target. After handling 20 poles separately, the authors use a tail of order 354. With 40 and 80 poles the required orders are 178 and 90, respectively. These counts characterize the scalar approximation of the tail. The final density and energy also depend on the truncation radius used when applying the polynomial to the grid.

Chebyshev order on the 32 × 32 Anderson lattice by explicit pole count Removing more explicit poles reduces the polynomial order needed at the same approximation target.

**The numbers**

| System or setting | Chebyshev order |
| --- | --- |
| No explicit poles, approximate order | 19,000 |
| 20 explicit poles | 354 |
| 40 explicit poles | 178 |
| 80 explicit poles (this paper) | 90 |

At cutoff radius 4, using 20 explicit poles gives a density error per electron of 7.47 × 10⁻² and an energy error per electron of 2.79 × 10⁻² on the 32 × 32 grid. With 40 poles at that radius, the density and energy errors are 3.96 × 10⁻² and 6.05 × 10⁻³, respectively. With 80 poles they are 5.30 × 10⁻³ and 2.86 × 10⁻³. Increasing the radius to 8 also lowers the errors for the tested pole counts. Together these results show how the polynomial target and the observed errors measure different parts of the calculation. Even a polynomial chosen for the specified target can produce larger final errors if the matrix products are cut off too close to the diagonal.

The next comparison holds the pole counts, polynomial orders and radii fixed and examines the change in the reported errors from 32 × 32 to 64 × 64. At 20 poles and radius 4, the signed difference in normalized density error, with the larger grid first, is −1.42 × 10⁻⁵. The corresponding difference for energy is 5.08 × 10⁻⁶. At 80 poles and radius 4, these differences are −2.22 × 10⁻⁹ for density and 1.62 × 10⁻⁸ for energy. The differences give a direct comparison of errors normalized by electron count. Their small magnitude supports the reported weak dependence on size across those grids.

For the 1024 × 1024 run, the authors choose 40 poles, Chebyshev order 178 and cutoff radius 8. Based on the smaller-grid tests, they expect the relative energy and L₁ density errors to be below 0.05%. They report an average of 190.44 seconds per pole and 7618 seconds for the pole part. The tail takes 4162 seconds. The reported total is 11,780 seconds, roughly 3.27 hours. This timing includes the tail and all explicit poles, whereas the dense-inversion comparison concerns one inverse. The experiment establishes that the full method was run at this grid size and gives the associated cost.

### What the ablations show

#### Changing the way blocks meet

The paper’s construction starts with disjoint blocks, while its implementation uses blocks with shared edges. This is a comparison of two geometries for the same elimination and extraction procedure. In the authors’ illustration of a coarser level, sharing edges reduces the size of the interior work after the preceding elimination. The paper reports a practical speedup of 5–8 for the shared-edge version. The complexity bound remains the same, so the comparison concerns the amount of work at a given size, rather than its asymptotic exponent.

The paper gives a geometric explanation and a practical speedup range. It does not give paired timings by grid size for this comparison. The measured scaling against dense inversion is a separate experiment. It describes the shared-edge implementation as used and includes the benefit of its block layout. The two observations together show how the same hierarchy can improve both the asymptotic cost compared with dense inversion and the cost within the class of hierarchical implementations.

#### Separating explicit poles from the approximate tail

The final electronic calculation contains two mechanisms whose effects can be examined independently. The dense comparison evaluates the pole solver by itself and finds agreement near machine accuracy. The parameter sweep then changes the pole count and cutoff radius in the approximate electronic calculation. Once the inverse diagonals are accurate, changes in the measured density and energy errors primarily reflect what is left to the tail calculation and how aggressively that tail is truncated.

Varying the pole count at a fixed radius changes which part of the Fermi operator is approximated by polynomials. The tail becomes smoother as a scalar function and more localized as a matrix. The required polynomial order decreases alongside this change. This experiment therefore compares complete choices of how to split the Fermi operator, with Chebyshev order adapted to the same target. It cannot isolate the effect of pole count while holding polynomial order fixed. A decrease in error despite the smaller polynomial order is consistent with a simpler tail and less damage from spatial truncation.

Changing the radius at a fixed pole count has a narrower interpretation. The scalar function defining the tail and the chosen polynomial order stay fixed. The change is how many entries are kept when matrices are multiplied. The improvements at the larger radius show that the spatial truncation is contributing appreciably to the errors. Since the same explicit pole calculation enters both settings, it cannot account for the improvement.

The comparison with a polynomial for the full Fermi operator illustrates the extreme of the tradeoff. With no poles handled explicitly, the scalar approximation takes a much higher order at the stated target. The authors also argue that the spatial cutoff required in that case would make the matrices effectively dense on the system considered. The order comparison is quantified. They do not give a corresponding full timing comparison for the pure polynomial baseline under matched electronic accuracy.

The two-grid comparison asks a different question. The reported errors are per electron, so the relevant observation is whether that normalized error changes when the grid grows under the same settings. It changes weakly in the comparison, and the reported differences tend to be smaller when more poles have been taken out. This agrees with the picture of a localized tail whose truncation can behave similarly on different grid sizes. It also explains why the authors carry the settings over to the much larger grid, while leaving the large-grid error as an expectation.

### Limitations

#### Limits identified by the authors

The authors limit the main complexity claim to two dimensions and describe the straightforward bulk three-dimensional version as unsatisfactory for demanding calculations. Its cost grows quadratically because the large separators are surfaces. A system of fixed thickness can still be treated as effectively two-dimensional for the operation count, but that argument depends on the thickness remaining fixed as the other dimensions grow.

They also point out that real applications can require more unknowns than the largest experiment in the paper. Computations for separate blocks at a given level are independent in the organization they describe. The authors identify a parallel implementation as future work. The timing results therefore establish what their reported implementation could do. They provide no measured parallel speedup or communication cost at the largest separators.

The wider-stencil and elliptic extensions each qualify the scope of the main numerical example. A wider interaction range can make separators larger and increase time even when the two-dimensional exponent stays the same. Compression for an elliptic problem can improve the exponent under additional low-rank structure, at the cost of approximating intermediate blocks. The experiments on the metallic Anderson lattice establish the results for the uncompressed inverse-diagonal calculation. They do not measure the performance or accuracy of a compressed elliptic variant.

#### Limits visible in the experiments and derivation

Exactness applies to inverse recovery for the discretized matrix under the block-elimination identities, in exact arithmetic and with the required inverses defined. The direct comparisons verify accuracy for the tested poles and grid sizes in finite precision. The derivation gives no roundoff bound or systematic comparison across different matrix conditioning. A grid discretization can also have error relative to a continuum electronic problem even when the resulting inverse diagonal is recovered exactly.

The electronic calculation introduces another layer of approximation. The identity splitting the Fermi operator into explicit poles and a tail puts all remaining poles into the tail. In the computation, that tail is represented with a finite polynomial and truncated products. The final errors depend on those choices and on the Hamiltonian and temperature. Consequently, machine-accuracy results for a pole diagonal give no corresponding precision guarantee for the final electronic density or energy. The reported per-electron errors measure the performance of that final calculation against its reference in the small-grid tests.

The numerics cover a periodic, square, nearest-neighbor Anderson lattice at the specified temperature, with a small random on-site potential. The density-matrix figure displays one row, and the paper gives no distribution of errors over different disorder realizations or temperature settings. The results show that the proposed calculation works in a setting with the slow off-diagonal decay that motivates it. The experiment does not establish how the best pole count or cutoff changes across larger spectral widths, colder systems or different Hamiltonians.

The dense inversion baseline answers a specific question about the savings from avoiding a full dense inverse. It is deliberately a different workload, since the baseline returns every inverse entry. The paper discusses FIND as a related way to obtain selected inverse entries. The reported timing table contains no matched comparison with FIND, iterative stochastic estimators or other sparse approaches to the same output. It establishes a measured advantage over dense inversion at the sizes with measured baselines. The larger dense timings are estimates, and the comparison offers no ranking against other methods designed to exploit sparsity.

The claim of weak size dependence in electronic accuracy rests on the comparison between the 32 × 32 and 64 × 64 systems and on the decay argument for the tail. The normalization by electron count is well suited to comparing average discrepancies across those grids. It can leave local variations in error unreported. At 1024 × 1024, the timing is measured and the error threshold is an expectation. The experiment gives no reference-based verification of that threshold at the largest size.

Finally, the geometric derivation addresses structured grids with separators predictable from short-range couplings. In a different sparse matrix, elimination can produce larger interfaces or different dependencies. The local block identity still specifies which inverse information is required where the zero-block structure holds. Obtaining the same operation count would also require a comparable hierarchy of small separators. The paper’s cost analysis and timing results are tied to that structure.

### What came after

There are no later citing studies listed for this work. The authors’ closing directions were to exploit independent block computations in parallel and to improve the treatment of the largest separators in bulk three-dimensional systems.

## Cite

Cite as Roberto Car, E Weinan, Lin Lin, Jianfeng Lu and Lexing Ying. 2009. Fast algorithm for extracting the diagonal of the inverse matrix with application to the electronic structure analysis of metallic systems. Communications in Mathematical Sciences.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.4310/cms.2009.v7.n3.a12](https://doi.org/10.4310/cms.2009.v7.n3.a12)

```bibtex
@inproceedings{car2009fast,
  title = {{Fast algorithm for extracting the diagonal of the inverse matrix with application to the electronic structure analysis of metallic systems}},
  author = {Roberto Car, E Weinan, Lin Lin, Jianfeng Lu and Lexing Ying},
  booktitle = {Communications in Mathematical Sciences},
  year = {2009},
  doi = {10.4310/cms.2009.v7.n3.a12},
  url = {https://doi.org/10.4310/cms.2009.v7.n3.a12}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
