| Title: | High-Performance Fixed Effects Solver |
|---|---|
| Description: | Fast iterative solvers (CG, GMRES) with Schwarz domain-decomposition preconditioners for absorbing high-dimensional fixed effects in panel data regressions. The computational core is written in Rust via the 'within' crate and accessed through 'extendr'. |
| Authors: | Alexander Fischer [aut, cre], Kristof Schroeder [aut] |
| Maintainer: | Alexander Fischer <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-27 06:09:39 UTC |
| Source: | https://github.com/py-econometrics/within |
Computes fixed-effect coefficients by solving the normal equations
where is the dummy-variable design
matrix implied by categories and is the diagonal weight matrix.
solve( categories, y, weights = NULL, method = c("cg", "gmres"), tol = 1e-08, maxiter = 1000L, restart = 30L, preconditioner = c("additive", "multiplicative", "off") )solve( categories, y, weights = NULL, method = c("cg", "gmres"), tol = 1e-08, maxiter = 1000L, restart = 30L, preconditioner = c("additive", "multiplicative", "off") )
categories |
Integer matrix of shape |
y |
Numeric vector of length |
weights |
Numeric vector of length |
method |
Character, one of |
tol |
Convergence tolerance on the relative residual norm.
Default |
maxiter |
Maximum number of Krylov iterations. Default |
restart |
GMRES restart parameter (ignored for CG). Default |
preconditioner |
Character, one of |
A named list with components:
Numeric vector of fixed-effect coefficient estimates.
Numeric vector. Response after subtracting estimated fixed effects.
Logical. Did the solver meet the tolerance?
Integer. Number of Krylov iterations performed.
Numeric. Final relative residual norm.
Numeric. Wall-clock seconds (setup + solve).
Numeric. Wall-clock seconds for operator/preconditioner construction.
Numeric. Wall-clock seconds for the iterative solve.
Builds the operator and preconditioner once, then solves for each column
of Y in parallel. More efficient than calling solve in a loop.
solve_batch( categories, Y, weights = NULL, method = c("cg", "gmres"), tol = 1e-08, maxiter = 1000L, restart = 30L, preconditioner = c("additive", "multiplicative", "off") )solve_batch( categories, Y, weights = NULL, method = c("cg", "gmres"), tol = 1e-08, maxiter = 1000L, restart = 30L, preconditioner = c("additive", "multiplicative", "off") )
categories |
Integer matrix of shape |
Y |
Numeric matrix of shape |
weights |
Numeric vector of length |
method |
Character, one of |
tol |
Convergence tolerance. Default |
maxiter |
Maximum Krylov iterations. Default |
restart |
GMRES restart parameter. Default |
preconditioner |
Character, one of |
A named list with components:
Numeric matrix (n_dofs, k).
Numeric matrix (n_obs, k).
Logical vector of length k.
Integer vector of length k.
Numeric vector of length k.
Numeric scalar. Wall-clock seconds for the entire batch.
Numeric vector of length k. Per-RHS solve time.