Dirac-to-Dirac reduction with custom weight functions.
This variant allows user-defined Python callbacks to compute position-dependent weights and their derivatives.
Useful for:
- Structure-aware reduction
- Context-dependent weighting
- Experimental extensions
Required Callbacks
- wX(x): returns weight
- wXD(x): returns gradient of weight
Example
def wX(x):
return np.exp(-np.sum(x**2))
def wXD(x):
return -2 * x * np.exp(-np.sum(x**2))
result = d2d.approximate_function_double(
y, M, L, N, x,
wX=wX,
wXD=wXD
)