pyeeg.solvers.create_laplacian_matrix
- pyeeg.solvers.create_laplacian_matrix(n_lags: int, alpha: float = 1.0) ndarray
Create a Laplacian matrix for smoothness constraints in quadratic regularization.
The Laplacian matrix approximates the second derivative, promoting smoothness in the TRF coefficients across time lags.
Parameters:
- n_lagsint
Number of time lags (dimension of the TRF).
- alphafloat, optional
Scaling factor for the Laplacian. Default is 1.0.
Returns:
- Lndarray (n_lags, n_lags)
Laplacian matrix for smoothness regularization.
Notes:
- The Laplacian matrix L has the form:
L[i, i-1] = -1 L[i, i] = 2 L[i, i+1] = -1
for interior points, with appropriate boundary conditions.