Optimization and Geometric Updates¶
Clifford coefficients can be ordinary PyTorch parameters. A loss differentiates through products or actions to those coordinates, and an optimizer determines the update. Geometric parameter roles are declared explicitly; clifra does not infer them from tensor width, grade, or name.
Ordinary coefficient parameters¶
An optimizer sees coefficient coordinates. For a fixed product \(y_k=\sum_{i,j}c_{ijk}x_i w_j\), autograd computes \(\partial L/\partial w_j\) through the signature-dependent coefficients \(c_{ijk}\). An ordinary SGD or Adam step then updates \(w\) in those coordinates.
This applies to vector operands, mixed-grade values, and factors used to construct a blade. It does not require a generated transformation. A squared error between aligned coefficient tensors is a positive coordinate objective; a signed scalar form is a different function with different gradients. A nonnegative coefficient loss can be used with an indefinite Clifford product without changing its signature.
The parameterization determines which constraints survive an update. Arbitrary grade-\(k\) coefficients remain in that grade but need not describe a simple blade. Vector factors combined with a wedge remain decomposable but can become dependent. A normalized direction or stored rotor requires its own update semantics.
Ordinary Adam, SGD, or a closure-based optimizer can update coefficient parameters. Higher derivatives follow the executed tensor program where defined; singular inverses and piecewise guards require the same numerical care as in the forward calculation.
Explicit coefficient adjustments¶
clip_coefficients_ bounds Euclidean coefficient length along a selected axis.
normalize_coefficients_ gives each nonzero coefficient vector unit Euclidean
length and leaves zero vectors at zero. Both operations use the Euclidean coefficient norm; they do not certify unit signature norm, blade simplicity, or rotor membership.
post_update runs explicit callbacks in order under torch.no_grad().
PostUpdateSGD provides the same boundary after a successful SGD step, outside
its loss closure. Callbacks select parameters explicitly; they are not inferred
from tags or gradient presence.
Adjustments preserve tensor identity but leave optimizer state unchanged. For example, clipping a parameter does not project Adam moments or SGD momentum into a geometric tangent space. The optimization method is the coordinate update followed by the declared adjustment, with those state semantics.
See Optimize Clifford parameters for runnable coefficient and post-update examples.
Bivector generator parameters¶
For a bivector parameter \(B\), the action is generated by \(R=\exp(-B/2)\). Every finite bivector defines this exponential; an additive update to its coefficients does not require renormalizing a stored rotor.
A coefficient penalty and a geometric constraint are different objectives. Bounding \(\sum_i b_i^2\) limits generator coordinate size. In an indefinite signature it does not bound every transformed vector's Euclidean length: hyperbolic actions can amplify coefficient magnitudes. Likewise, a generator norm is not a distance between the resulting rotations.
Tangents at a stored rotor¶
A different representation stores a unit rotor \(R\) directly. Tangents generated by right multiplication have the form \(T=RB\), where \(B\) is a bivector. Left trivialization retrieves \(B=\widetilde R T\), using \(\widetilde R R=1\).
The helper project_to_rotor_tangent_space implements
For a unit rotor this maps into tangents \(RB\) and is idempotent: applying it to an existing tangent returns that tangent. This algebraic property does not make it a Euclidean orthogonal projection in every signature.
exponential_update implements
For \(T=RB\), this is \(R\exp(B)\). The signed step size is already included in \(T\); the helper adds no minus sign or half-angle factor. The convention \(\exp(-B/2)\) for a generated action must be supplied explicitly if desired.
Both helpers require identically shaped tensors in canonical full storage, with dtype and device matching the algebra. The caller must supply a unit rotor, as the helpers do not test or repair arbitrary multivectors. The group update is differentiable, but it is not the Riemannian exponential for an arbitrary metric and leaves optimizer moments unchanged.
Conditioning and constraints¶
Strict inversion raises at an exactly zero denominator, while a very small nonzero denominator can still produce large values and gradients. Stabilized inversion changes that formula near zero. Neither choice determines whether an application should approach a null direction.
Similarly, coefficient normalization has a singular geometric target at zero; the helper's zero convention is part of its behavior. Check the constraints actually needed by the calculation, such as a projection residual, vector form preservation, or rotor identity, independently of the optimizer's loss.