G-Cubed
Python G-Cubed 5.0.2.0 · build 1
Generation details
Source revision
4c4a95aded1b5ca5e8f9c292ad8250440cd9c18b (modified inputs)
Source fingerprint
e2c719b38e03c6b1748f10e26bc1caf1ead5674dd1beee6628a6ccf7b90fd39b
Generated (UTC)
2026-11-11T03:06:22.844261+00:00
Generator
pdoc 16.0.0, CPython 3.14.8
Generation metadata

gcubed.projections.terminal_closure

Equilibrium continuation of the converged projection intercept recurrence.

The existing policy matrices already express jump variables conditional on inherited states. This module closes their intercepts, without changing the homogeneous state transition or imposing terminal levels on capital or wealth. Beyond T, exogenous forcing is affine in the model's working coordinates and the combined projection constants keep their configured geometric decay.

class TerminalClosureError(builtins.ValueError):

The requested tail lacks a unique, economically compatible continuation.

Inherited Members
builtins.BaseException
BaseException
with_traceback
add_note
args
def build_terminal_recurrence( parameters: gcubed.projections.gcubed_parameters.GCubedParameters) -> tuple[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]], numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]], numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]]:

Build u_t = K u_(t+1) + F_x x_t + F_c c_t from solved matrices.

u stacks the complete jump intercept (c2) and the expected-variable intercept passed backward (c4_lead). Constants stack state, jump and expected-variable reconciliation differences plus intertemporal constants. Static variables do not enter this dynamic boundary condition.

class TerminalTailSolver:

Prepared affine/geometric continuation, reusable across ITC perturbations.

For u_t = K u_(t+1) + f + (t-T) g + d**(t-T) c, solve for u_t = a + (t-T) b + d**(t-T) z. Consequently (I-K)b=g, (I-K)a=f+Kb and (I-dK)z=c. seed returns u_(T+1), which the existing backward loop requires.

A unit mode needs an explicitly justified level and, optionally, a drift. Constraints apply to recurrence intercepts; the caller must account for the state-dependent portion of any model normalization. All equations are checked, so inconsistent forcing is rejected rather than projected away.

Every non-unit mode of the backward recurrence must lie strictly inside the unit circle. Otherwise an algebraic particular solution does not establish a unique equilibrium continuation. Spectrum classification uses a 1e-8 tolerance around +1 and the unit circle, without changing any root. Undamped alternating or complex modes require another terminal method.

TerminalTailSolver( recurrence: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]], decay_factor: float, *, normalization_rows: tuple[int, ...] = (), normalization_values: tuple[float, ...] = (), normalization_growth: tuple[float, ...] = (), residual_tolerance: float = 1e-08)

Factor tail equations once without changing any model eigenvalues.

recurrence: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]
eigenvalues: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.complex128]]
decay_factor: float
normalization_values: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]
normalization_growth: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]
affine_system: gcubed.projections.terminal_closure._ConstrainedSystem
decaying_system: gcubed.projections.terminal_closure._ConstrainedSystem | None
def seed( self, forcing_at_terminal: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]], forcing_growth: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]], decaying_forcing_at_terminal: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]) -> numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]:

Return the next-year intercept for one or more constant perturbations.

def forcing_adjoint( self, seed_adjoint: numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]) -> tuple[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]], numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]], numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]]]:

Return affine, growth and geometric forcing sensitivities of the seed.

Normalization values are held fixed. The returned transpose maps apply to forcing perturbations compatible with the economic normalization. Multiple columns are independent target cotangents.