pub fn pre_smith<R, TL, TR, V>(
ring: R,
L: &mut TL,
R: &mut TR,
A: SubmatrixMut<'_, V, El<R>>,
)where
R: RingStore + Copy,
R::Type: PrincipalIdealRing,
TL: TransformTarget<R::Type>,
TR: TransformTarget<R::Type>,
V: AsPointerToSlice<El<R>>,
unstable-enable
only.Expand description
Transforms A
into A'
via transformations L, R
such that
L A R = A'
and A'
is diagonal.
§(Non-)Uniqueness of the solution
Note that this is not the complete Smith normal form, as that requires the entries on the diagonal to divide each other. However, computing this pre-smith form is much faster, and can still be used for solving equations (the main use case). However, it is not unique.
§Warning on infinite rings (in particular Z)
For infinite principal ideal rings, this function is correct, but in some situations, the performance can be terrible. The reason is that no care is taken which of the many possible results is returned - and in fact, this algorithm can sometimes choose one that has exponential size in the input. Hence, in these cases it is recommended to use another algorithm, e.g. based on LLL to perform intermediate lattice reductions (not yet implemented in feanor_math).
§Availability
This API is marked as unstable and is only available when the unstable-enable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.