calculate_dF_dPi#

static DEpsCalculator.calculate_dF_dPi(d_eps_data: dict[str, dict[str, dict[str, ndarray]]], dF_deps: ndarray, global_shape: ndarray) tuple[ndarray, tuple[str]]#

Contract dF/dEps (dense) with dEps/dPi (sparse) to get dF/dPi.

Parameters:
d_eps_datadict

Nested dictionary containing the sparse representation of dEps/dPi for each geometric parameter Pi.

  • Top layer: keys are geometric parameter names (str).

  • Second layer: keys are 'eps_x', 'eps_y', 'eps_z'.

  • Third layer: keys are 'data', 'indices', 'indptr' representing the sparse matrix dEps in CSC format.

The dense form would be a 4D ndarray of shape (Nx, Ny, Nz, Nlambda).

dF_depsnp.ndarray

Array containing dF/dEps values. Must be 5-dimensional with shape (Nx, Ny, Nz, Nlambda, 3), where the last dimension holds the vector components of the field.

global_shapenp.ndarray

Shape (4,) array [Nx, Ny, Nz, Nlambda] associated with d_eps_data.

Returns:
dF_dPinp.ndarray

1D array of length len(d_eps_data) containing dF/dPi values.

geom_namestuple[str]

Geometric parameter names corresponding to each entry in dF_dPi.

Raises:
ValueError

If dF_deps is not 5-dimensional.

ValueError

If global_shape is not length 4 or does not match dF_deps.shape[:-1].