Core

The core contains the number-crunching functionalities of emg3d.solver.solve, the computationally most demanding parts. These functions are implemented as just-in-time (jit) compiled functions using the numba.jit-decorator of numba.

«Numba translates Python functions to optimized machine code at runtime using the industry-standard LLVM compiler library. Numba-compiled numerical algorithms in Python can approach the speeds of C or FORTRAN.» (from the numba website.)

These functions are not meant to be called directly, particularly not from an end-user; they are called from functions in emg3d.solver.solve.

For an end-user it can still be insightful to look at the documentation and code of these functions if you are interested in understanding how the multigrid solver works, the theory and its implementation.

For a developer interested in making emg3d faster this is the right place to start, as by far the most time is spent in these functions, particularly in solve.

Functions

amat_x(rx, ry, rz, ex, ey, ez, eta_x, eta_y, ...)

Residual with or without source term.

blocks_to_amat(amat, bvec, middle, left, ...)

Insert middle, left, and rhs into main arrays amat and bvec.

gauss_seidel(ex, ey, ez, sx, sy, sz, eta_x, ...)

Gauss-Seidel method.

gauss_seidel_x(ex, ey, ez, sx, sy, sz, ...)

Gauss-Seidel method with line relaxation in x-direction.

gauss_seidel_y(ex, ey, ez, sx, sy, sz, ...)

Gauss-Seidel method with line relaxation in y-direction.

gauss_seidel_z(ex, ey, ez, sx, sy, sz, ...)

Gauss-Seidel method with line relaxation in z-direction.

restrict(crx, cry, crz, rx, ry, rz, wx, wy, ...)

Restriction of residual from fine to coarse grid.

restrict_weights(nodes, cell_centers, h, ...)

Restriction weights for the coarse-grid correction operator.

solve(amat, bvec)

Solve A x = b using a non-standard Cholesky factorisation.