Optimization API#

The optimization namespace separates problem descriptions, globalization strategies, and solver classes. All public solvers return (solution, final_cost, history).

Problem classes#

class geojax.optimization.Minimize(*, M, cost, x0=None, solver=None, key=None, grad=None, egrad=None, precon=None, ehess_vec=None, rhess_vec=None)#

Bases: object

Riemannian minimization problem.

Parameters:
  • M (Any) – Manifold object.

  • cost (CostFn) – Scalar objective cost(x) to minimize.

  • grad (Optional[GradFn]) – Optional Riemannian gradient grad(x). If supplied, it takes priority over egrad and autodiff.

  • egrad (Optional[GradFn]) – Optional ambient Euclidean gradient egrad(x). It is converted to a Riemannian gradient using M.egrad_to_rgrad.

  • precon (Optional[PreconFn]) – Optional preconditioner precon(x, grad). If omitted, the identity preconditioner is used.

  • ehess_vec (Optional[HessVecFn]) – Optional ambient Euclidean Hessian-vector product. Automatic conversion requires the geometry to advertise exact ehess_to_rhess support.

  • rhess_vec (Optional[HessVecFn]) – Optional Riemannian Hessian-vector product. Supply this for second-order methods whenever the geometry does not advertise an exact automatic conversion.

  • x0 (Optional[Array])

  • solver (Optional[Any])

  • key (Optional[Array | int])

split_key()#

Return a fresh JAX PRNG key and advance the problem key.

Return type:

Any

solve()#

Solve the problem using the configured class-style solver.

Return type:

tuple[Any, float, List[InfoEntry]]

ehess_vec(x, u)#

Ambient Euclidean Hessian-vector product.

When only a Riemannian grad callback is available, this method returns its directional derivative instead. rhess_vec handles that path separately through the geometry’s advertised connection support.

Parameters:
  • x (Any)

  • u (Any)

Return type:

Any

rhess_vec(x, u)#

Riemannian Hessian-vector product.

Parameters:
  • x (Any)

  • u (Any)

Return type:

Any

hessian_operator(x)#

Return u -> rhess_vec(x, u).

Parameters:

x (Any)

Return type:

Callable[[Any], Any]

class geojax.optimization.LeastSquares(*, M, residual, x0=None, solver=None, key=None, jacobian_vec=None, adjoint_jacobian=None, precon=None)#

Bases: Minimize

Nonlinear least-squares problem on a manifold.

The objective is 0.5 * ||residual(x)||_2**2. Residuals may be real arrays or arbitrary pytrees of real arrays. Jacobian-vector and adjoint-Jacobian products are obtained with JAX autodiff unless callbacks are supplied.

Parameters:
  • M (Any)

  • residual (ResidualFn)

  • x0 (Optional[Array])

  • solver (Optional[Any])

  • key (Optional[Array | int])

  • jacobian_vec (Optional[JacobianVecFn])

  • adjoint_jacobian (Optional[AdjointJacobianFn])

  • precon (Optional[Callable[[Array, Array], Array]])

residual_value(x)#

Evaluate the residual pytree.

Parameters:

x (Any)

Return type:

Any

residual_norm(x)#

Return the Euclidean norm of the residual.

Parameters:

x (Any)

Return type:

Any

jacobian_vec(x, u)#

Apply the residual Jacobian to tangent vector u.

Parameters:
  • x (Any)

  • u (Any)

Return type:

Any

adjoint_jacobian(x, z)#

Apply the metric adjoint residual Jacobian and return a tangent vector.

A user callback must return the Riemannian adjoint in T_x M. The autodiff path first forms the ambient pullback and then converts it with M.egrad_to_rgrad.

Parameters:
  • x (Any)

  • z (Any)

Return type:

Any

normal_operator(x, u, damping=0.0)#

Apply J(x)^* J(x) + damping * I to u.

Parameters:
  • x (Any)

  • u (Any)

  • damping (float)

Return type:

Any

cost_and_grad(x)#

Evaluate the least-squares objective and gradient with one residual trace.

Parameters:

x (Any)

Return type:

tuple[Any, Any]

class geojax.optimization.FiniteSum(*, M, loss, num_terms, x0=None, solver=None, key=None, precon=None)#

Bases: Minimize

Finite-sum problem mean_i loss(x, i) for stochastic solvers.

Parameters:
  • M (Any)

  • loss (LossFn)

  • num_terms (int)

  • x0 (Optional[Array])

  • solver (Optional[Any])

  • key (Optional[Array | int])

  • precon (Optional[Callable[[Array, Array], Array]])

batch_cost_and_grad(x, indices)#

Return mini-batch cost and Riemannian gradient.

Parameters:
  • x (Any)

  • indices (Any)

Return type:

tuple[Any, Any]

sample_batch(key, batch_size, *, replace=True)#

Draw uniformly distributed term indices.

Parameters:
  • key (Any)

  • batch_size (int)

  • replace (bool)

Return type:

Any

Line searches#

class geojax.optimization.LineSearchProtocol(*args, **kwargs)#

Bases: Protocol

Protocol implemented by all public line-search strategies.

class geojax.optimization.ConstantStep(stepsize=1.0, normalize_step=False)#

Bases: object

Take a fixed multiplier or fixed Riemannian-length step.

Parameters:
  • stepsize (float)

  • normalize_step (bool)

class geojax.optimization.BacktrackingArmijo(contraction_factor=0.5, sufficient_decrease=0.0001, max_steps=25, initial_stepsize=1.0, normalize_step=True)#

Bases: object

Monotone Armijo search along a retraction curve.

Parameters:
  • contraction_factor (float)

  • sufficient_decrease (float)

  • max_steps (int)

  • initial_stepsize (float)

  • normalize_step (bool)

class geojax.optimization.AdaptiveArmijo(contraction_factor=0.5, sufficient_decrease=0.0001, max_steps=25, initial_stepsize=1.0, normalize_step=True, optimism=2.0)#

Bases: BacktrackingArmijo

Armijo search initialized from progress in the preceding iteration.

Parameters:
  • contraction_factor (float)

  • sufficient_decrease (float)

  • max_steps (int)

  • initial_stepsize (float)

  • normalize_step (bool)

  • optimism (float)

class geojax.optimization.StrongWolfe(sufficient_decrease=0.0001, curvature=0.9, initial_stepsize=1.0, expansion=2.0, max_stepsize=50.0, max_steps=20, max_zoom_steps=25, normalize_step=True, approximate_wolfe=False, roundoff_factor=8.0)#

Bases: object

Strong-Wolfe search using exact retraction-curve derivatives.

JAX forward-mode differentiation supplies the velocity of alpha -> retr(x, direction, alpha). Pairing that velocity with the trial gradient gives the actual derivative used by the curvature test, including for nonlinear retractions.

approximate_wolfe optionally permits Hager–Zhang approximate-Wolfe acceptance when objective changes are within roundoff_factor times the cost dtype’s machine epsilon times abs(cost). The exact curve derivative must satisfy both the approximate-Wolfe inequalities and the usual strong-curvature bound. This never relaxes a solver’s gradient stopping criterion; ordinary strong Wolfe remains the default.

Parameters:
  • sufficient_decrease (float)

  • curvature (float)

  • initial_stepsize (float)

  • expansion (float)

  • max_stepsize (float)

  • max_steps (int)

  • max_zoom_steps (int)

  • normalize_step (bool)

  • approximate_wolfe (bool)

  • roundoff_factor (float)

class geojax.optimization.LineSearchState(previous_cost=None, previous_directional_derivative=None, previous_alpha=None, previous_stepsize=None)#

Bases: object

Information carried between consecutive line searches.

Parameters:
  • previous_cost (float | None)

  • previous_directional_derivative (float | None)

  • previous_alpha (float | None)

  • previous_stepsize (float | None)

class geojax.optimization.LineSearchResult(point, cost, gradient, stepsize, alpha, stats, state)#

Bases: object

Point, values, diagnostics, and reusable state from a line search.

Parameters:

Smooth solvers#

class geojax.optimization.SteepestDescent(requires_gradient=True, tolgradnorm=1e-06, maxiter=1000, maxtime=inf, minstepsize=1e-10, verbosity=2, line_search=<factory>, statsfun=None, stopfun=None, key=None)#

Bases: object

Minimize a smooth objective along its negative Riemannian gradient.

Parameters:
  • requires_gradient (bool)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • line_search (LineSearchProtocol)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

  • key (Any | None)

solve(problem)#

Solve problem and return (solution, final_cost, history).

Parameters:

problem (Any)

Return type:

tuple[Any, float, List[InfoEntry]]

class geojax.optimization.ConjugateGradient(tolgradnorm=1e-06, maxiter=1000, maxtime=inf, minstepsize=1e-10, verbosity=2, beta_type='H-S', orth_value=inf, line_search=<factory>, statsfun=None, stopfun=None, key=None)#

Bases: object

Nonlinear Riemannian conjugate-gradient solver.

beta_type may be 'S-D'/'steep', 'F-R', 'P-R', 'H-S', 'H-Z', 'L-S', 'P-R-SATO' or 'H-S-SATO'. The default is 'H-S', following Manopt.

Parameters:
  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • beta_type (str)

  • orth_value (float)

  • line_search (LineSearchProtocol)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

  • key (Any | None)

solve(problem)#

Solve problem and return (solution, final_cost, history).

Parameters:

problem (Any)

Return type:

tuple[Any, float, List[InfoEntry]]

class geojax.optimization.BarzilaiBorwein(requires_gradient=True, bb_type='alternate', initial_stepsize=1.0, min_stepsize=1e-12, max_stepsize=1000000000000.0, line_search=<factory>, tolgradnorm=1e-06, maxiter=1000, maxtime=inf, minstepsize=1e-14, verbosity=2, statsfun=None, stopfun=None)#

Bases: object

Riemannian gradient descent with BB1, BB2, or alternating step estimates.

Parameters:
  • requires_gradient (bool)

  • bb_type (str)

  • initial_stepsize (float)

  • min_stepsize (float)

  • max_stepsize (float)

  • line_search (LineSearchProtocol)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

class geojax.optimization.LBFGS(requires_gradient=True, memory=10, tolgradnorm=1e-06, maxiter=1000, maxtime=inf, minstepsize=1e-10, verbosity=2, line_search=<factory>, cautious_update=True, cautious_threshold=1e-10, statsfun=None, stopfun=None)#

Bases: object

Limited-memory Riemannian BFGS with transported secant pairs.

Parameters:
  • requires_gradient (bool)

  • memory (int)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • line_search (LineSearchProtocol)

  • cautious_update (bool)

  • cautious_threshold (float)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

class geojax.optimization.NewtonCG(requires_gradient=True, tolgradnorm=1e-06, maxiter=200, maxtime=inf, minstepsize=1e-10, verbosity=2, maxinner=100, cg_relative_tolerance=None, cg_absolute_tolerance=1e-10, curvature_tolerance=0.0, line_search=<factory>, statsfun=None, stopfun=None)#

Bases: object

Riemannian Newton method with an inexact Hessian solve.

Hessian-vector products come from problem.rhess_vec. The inner conjugate-gradient solve is truncated on non-positive curvature; a non-descent Newton direction falls back to preconditioned steepest descent.

Parameters:
  • requires_gradient (bool)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • maxinner (int)

  • cg_relative_tolerance (float | None)

  • cg_absolute_tolerance (float)

  • curvature_tolerance (float)

  • line_search (LineSearchProtocol)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

class geojax.optimization.TrustRegions(requires_gradient=True, tolgradnorm=1e-06, maxiter=200, maxtime=inf, minstepsize=0.0, verbosity=2, initial_radius=1.0, max_radius=100.0, rho_prime=0.1, kappa=0.1, theta=1.0, maxinner=250, statsfun=None, stopfun=None)#

Bases: object

Approximate Riemannian trust-regions method.

Uses truncated conjugate gradient to approximately minimize the quadratic model. A geometry must advertise an exact automatic Hessian conversion or the problem must supply rhess_vec explicitly.

Parameters:
  • requires_gradient (bool)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • initial_radius (float)

  • max_radius (float)

  • rho_prime (float)

  • kappa (float)

  • theta (float)

  • maxinner (int)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

class geojax.optimization.AdaptiveRegularizationCubics(requires_gradient=True, tolgradnorm=1e-06, maxiter=200, maxtime=inf, minstepsize=0.0, verbosity=2, initial_sigma=1.0, min_sigma=1e-12, max_sigma=1000000000000.0, acceptance_threshold=0.1, very_successful_threshold=0.9, decrease_factor=0.5, increase_factor=2.0, subproblem_iterations=10, subproblem_tolerance=0.1, subproblem_backtracks=20, statsfun=None, stopfun=None)#

Bases: object

Adaptive cubic regularization on a Riemannian manifold.

At x the solver approximately minimizes

<g, eta> + 0.5 <eta, Hess f(x)[eta]> + sigma/3 ||eta||^3

in the tangent space. The subproblem begins at its exact Cauchy point and may be refined by model-gradient steps. The ratio of actual to predicted decrease controls acceptance and the next regularization parameter.

Parameters:
  • requires_gradient (bool)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • initial_sigma (float)

  • min_sigma (float)

  • max_sigma (float)

  • acceptance_threshold (float)

  • very_successful_threshold (float)

  • decrease_factor (float)

  • increase_factor (float)

  • subproblem_iterations (int)

  • subproblem_tolerance (float)

  • subproblem_backtracks (int)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

Structured objectives#

class geojax.optimization.GaussNewton(requires_gradient=True, tolgradnorm=1e-06, maxiter=200, maxtime=inf, minstepsize=1e-10, verbosity=2, maxinner=100, cg_relative_tolerance=0.001, cg_absolute_tolerance=1e-10, line_search=<factory>, statsfun=None, stopfun=None)#

Bases: object

Gauss-Newton using matrix-free normal equations in each tangent space.

Parameters:
  • requires_gradient (bool)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • maxinner (int)

  • cg_relative_tolerance (float)

  • cg_absolute_tolerance (float)

  • line_search (LineSearchProtocol)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

class geojax.optimization.LevenbergMarquardt(requires_gradient=True, tolgradnorm=1e-06, maxiter=200, maxtime=inf, minstepsize=0.0, verbosity=2, initial_damping=0.001, min_damping=1e-12, max_damping=1000000000000.0, damping_increase=2.0, damping_decrease=3.0, acceptance_threshold=0.0001, maxinner=100, cg_relative_tolerance=0.001, cg_absolute_tolerance=1e-10, statsfun=None, stopfun=None)#

Bases: object

Damped Gauss-Newton method with gain-ratio damping updates.

Parameters:
  • requires_gradient (bool)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • initial_damping (float)

  • min_damping (float)

  • max_damping (float)

  • damping_increase (float)

  • damping_decrease (float)

  • acceptance_threshold (float)

  • maxinner (int)

  • cg_relative_tolerance (float)

  • cg_absolute_tolerance (float)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

class geojax.optimization.StochasticGradient(requires_gradient=True, batch_size=1, step_schedule=<factory>, momentum=0.0, clip_norm=None, replace=True, evaluation_period=10, tolgradnorm=0.0, maxiter=1000, maxtime=inf, minstepsize=0.0, verbosity=2, key=None, statsfun=None, stopfun=None, update_rule=None)#

Bases: object

Mini-batch Riemannian stochastic gradient with optional momentum.

Parameters:
  • requires_gradient (bool)

  • batch_size (int)

  • step_schedule (StepScheduleProtocol)

  • momentum (float)

  • clip_norm (float | None)

  • replace (bool)

  • evaluation_period (int)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • key (Any | int | None)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

  • update_rule (RiemannianSGD | RiemannianAdam | None)

class geojax.optimization.StepScheduleProtocol(*args, **kwargs)#

Bases: Protocol

Callable schedule returning the multiplier for iteration k.

class geojax.optimization.ConstantSchedule(stepsize=0.01)#

Bases: object

Constant stochastic-gradient step multiplier.

Parameters:

stepsize (float)

class geojax.optimization.PolynomialDecay(initial_stepsize=0.1, decay_rate=0.01, power=0.5, minimum_stepsize=0.0)#

Bases: object

Schedule initial_stepsize / (1 + decay_rate * k)**power.

Parameters:
  • initial_stepsize (float)

  • decay_rate (float)

  • power (float)

  • minimum_stepsize (float)

class geojax.optimization.CosineDecay(initial_stepsize=0.1, final_stepsize=0.0, decay_steps=1000)#

Bases: object

Cosine interpolation from initial_stepsize to final_stepsize.

Parameters:
  • initial_stepsize (float)

  • final_stepsize (float)

  • decay_steps (int)

class geojax.optimization.AlternatingGradient(requires_gradient=True, block_order=None, tolgradnorm=1e-06, maxiter=1000, maxtime=inf, minstepsize=1e-10, verbosity=2, line_search=<factory>, statsfun=None, stopfun=None)#

Bases: object

Cycle through Product factors using one gradient block at a time.

block_order refers to the leaves of the Product factor pytree in JAX’s deterministic flattening order. When omitted, every leaf is visited once per outer iteration.

Parameters:
  • requires_gradient (bool)

  • block_order (Sequence[int] | None)

  • tolgradnorm (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • verbosity (int)

  • line_search (LineSearchProtocol)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

Derivative-free solvers#

class geojax.optimization.ParticleSwarm(requires_gradient=False, swarm_size=30, inertia=0.5, cognitive=1.5, social=1.5, initial_velocity_scale=0.1, maxiter=200, maxtime=inf, minstepsize=0.0, tolgradnorm=-inf, verbosity=2, statsfun=None, stopfun=None)#

Bases: object

Derivative-free particle swarm with tangent velocities and transport.

Parameters:
  • requires_gradient (bool)

  • swarm_size (int)

  • inertia (float)

  • cognitive (float)

  • social (float)

  • initial_velocity_scale (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • tolgradnorm (float)

  • verbosity (int)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

class geojax.optimization.NelderMead(requires_gradient=False, initial_scale=0.1, reflection=1.0, expansion=2.0, contraction=0.5, shrink=0.5, tolcostspread=1e-10, tolsimplexdiameter=1e-08, maxiter=1000, maxtime=inf, minstepsize=0.0, tolgradnorm=-inf, verbosity=2, statsfun=None, stopfun=None)#

Bases: object

Derivative-free manifold simplex search using intrinsic trial points.

Parameters:
  • requires_gradient (bool)

  • initial_scale (float)

  • reflection (float)

  • expansion (float)

  • contraction (float)

  • shrink (float)

  • tolcostspread (float)

  • tolsimplexdiameter (float)

  • maxiter (int)

  • maxtime (float)

  • minstepsize (float)

  • tolgradnorm (float)

  • verbosity (int)

  • statsfun (Callable[[Any, Any, InfoEntry], Dict[str, Any]] | None)

  • stopfun (Callable[[Any, Any, InfoEntry], Tuple[bool, str]] | None)

Iteration records#

class geojax.optimization.InfoEntry(iter, cost, gradnorm, stepsize, time, linesearch=None, beta=None, reason='', extra=<factory>)#

Bases: object

Per-iteration optimization statistics.

This mirrors the useful parts of Manopt’s info struct-array in a Python dataclass. beta is used by conjugate-gradient methods and left as None by algorithms that do not define a beta parameter.

Parameters:
  • iter (int)

  • cost (float)

  • gradnorm (float)

  • stepsize (float)

  • time (float)

  • linesearch (LineSearchStats | None)

  • beta (float | None)

  • reason (str)

  • extra (Dict[str, Any])

class geojax.optimization.LineSearchStats(costevals, stepsize, alpha, accepted, gradevals=0, method='', reason='')#

Bases: object

Common diagnostics returned by a line-search strategy.

Parameters:
  • costevals (int)

  • stepsize (float)

  • alpha (float)

  • accepted (bool)

  • gradevals (int)

  • method (str)

  • reason (str)

Derivative diagnostics#

geojax.optimization.check_gradient(problem, point, direction, *, steps=(0.1, 0.05, 0.025, 0.0125, 0.00625))#

Compare the configured gradient to objective changes along a retraction.

For a smooth objective the linear Taylor error decays quadratically until rounding dominates. Steps multiply the supplied, unnormalized tangent.

Parameters:
  • problem (Any)

  • point (Any)

  • direction (Any)

  • steps (Iterable[float])

Return type:

TaylorCheck

geojax.optimization.check_hessian(problem, point, direction, second_direction, *, steps=(0.1, 0.05, 0.025, 0.0125, 0.00625), second_order_curve=None)#

Compare the Hessian to geodesic cost curvature and check metric symmetry.

Supply two nonzero tangents. The first defines the Taylor model, and the pair tests self-adjointness. By default the geometry must advertise an exact exponential. For other geometries, supply a second-order retraction as a function of (point, direction, step) with initial velocity equal to the direction and zero covariant acceleration at zero.

Parameters:
  • problem (Any)

  • point (Any)

  • direction (Any)

  • second_direction (Any)

  • steps (Iterable[float])

  • second_order_curve (Callable[[Any, Any, float], Any] | None)

Return type:

TaylorCheck

geojax.optimization.check_adjoint(problem, point, direction, cotangent)#

Check the metric adjoint identity for a least-squares residual Jacobian.

The cotangent matches the residual pytree and leaf shapes. Compare the Euclidean pairing of J u with z to the manifold inner product of u with the configured adjoint applied to z.

Parameters:
  • problem (Any)

  • point (Any)

  • direction (Any)

  • cotangent (Any)

Return type:

AdjointCheck

class geojax.optimization.TaylorCheck(steps, directional_gradient, gradient_estimates, linear_errors, directional_hessian=None, hessian_estimates=(), quadratic_errors=(), symmetry_error=None)#

Bases: object

Directional metric pairings, centered differences, and absolute Taylor errors.

Errors compare the objective at the positive step with its linear and quadratic models. Hessian-specific fields are absent on gradient checks.

Parameters:
  • steps (tuple[float, ...])

  • directional_gradient (float)

  • gradient_estimates (tuple[float, ...])

  • linear_errors (tuple[float, ...])

  • directional_hessian (float | None)

  • hessian_estimates (tuple[float, ...])

  • quadratic_errors (tuple[float, ...])

  • symmetry_error (float | None)

class geojax.optimization.AdjointCheck(residual_pairing, tangent_pairing, absolute_error)#

Bases: object

Residual and manifold metric pairings and their absolute difference.

Parameters:
  • residual_pairing (float)

  • tangent_pairing (float)

  • absolute_error (float)

Functional optimizer updates#

class geojax.optimization.RiemannianSGD(momentum=0.0)#

Bases: object

Pure gradient step with transported momentum, usable with jit and scan.

Pass a Riemannian gradient at the current point and a nonnegative scalar learning rate. Traced calls assume valid inputs and feasible retractions.

Parameters:

momentum (float)

init(manifold, point)#

Initialize zero momentum with the same pytree as the point.

Parameters:
  • manifold (Any)

  • point (Any)

Return type:

SGDState

update(manifold, point, gradient, state, learning_rate)#

Return one retracted SGD update without mutating the input state.

Parameters:
  • manifold (Any)

  • point (Any)

  • gradient (Any)

  • state (SGDState)

  • learning_rate (Any)

Return type:

StepResult

class geojax.optimization.RiemannianAdam(beta1=0.9, beta2=0.999, epsilon=1e-08)#

Bases: object

Riemannian Adam with one adaptive scalar per manifold factor.

The second moment tracks the squared metric norm, stored as an RMS to avoid overflow from squaring large gradients. On a vector Euclidean factor the scale is shared across coordinates. A Product of scalar Euclidean factors gives the ordinary coordinatewise Adam update. The first moment follows the geometry’s vector transport. Use isometric transport for the usual intrinsic interpretation. Traced calls assume valid inputs.

Parameters:
  • beta1 (float)

  • beta2 (float)

  • epsilon (float)

init(manifold, point)#

Initialize first moments and per-factor RMS values at point.

Parameters:
  • manifold (Any)

  • point (Any)

Return type:

AdamState

update(manifold, point, gradient, state, learning_rate)#

Return one bias-corrected adaptive update and its transported state.

Parameters:
  • manifold (Any)

  • point (Any)

  • gradient (Any)

  • state (AdamState)

  • learning_rate (Any)

Return type:

StepResult

class geojax.optimization.SGDState(momentum)#

Bases: NamedTuple

Momentum at the current point.

Parameters:

momentum (Any)

momentum: Any#

Alias for field number 0

class geojax.optimization.AdamState(iteration, first_moment, root_second_moment)#

Bases: NamedTuple

Transported first moment and root second moment per geometry factor.

Parameters:
  • iteration (Any)

  • first_moment (Any)

  • root_second_moment (Any)

iteration: Any#

Alias for field number 0

first_moment: Any#

Alias for field number 1

root_second_moment: Any#

Alias for field number 2

class geojax.optimization.StepResult(point, state, stepsize)#

Bases: NamedTuple

Updated point, optimizer state at that point, and proposed tangent step norm.

Parameters:
  • point (Any)

  • state (Any)

  • stepsize (Any)

point: Any#

Alias for field number 0

state: Any#

Alias for field number 1

stepsize: Any#

Alias for field number 2