pyeeg.solvers.svd_solver

pyeeg.solvers.svd_solver(A, b, lambda_=0.0, M=None, truncated_svd=False, verbose=False)

Solve the linear system Ax = b using the SVD method.

This method assumes that we are solving the normal equation: (X^T X + lambda I + M) x = X^T y Thus, A = X^T X and b = X^T y.

Parameters: A : ndarray

Matrix A. Typically of shape (n_features * n_lags, n_features * n_lags) in the context of TRF.

bndarray

Right-hand side vector. Typically of shape (n_features * n_lags, n_outputs) in the context of TRF.

lambda_float, optional

Regularization parameter (Tikhonov/L2 regularization).

Mndarray, optional

Quadratic regularization matrix. If provided, solves (A + M) x = b instead of (A + lambda I) x = b. Useful for smoothness constraints (e.g., Laplacian matrix).

truncated_svdbool, optional

Whether to use the truncated SVD method. If True, lambda_ must be between 0 and 1; it represents the fraction of the total variance to keep.

Returns: x : ndarray

Solution vector.