Expand description
Real-centered linear algebra primitives backed by exact hyperreal arithmetic.
hyperlattice exposes complex numbers, 2D/3D/4D vectors, and 3x3/4x4
matrices whose coordinate and scalar type is Real. Primitive
floating-point values are supported only at API edges: finite f32/f64
inputs are lifted through checked Real constructors, and
Real::to_f64_lossy provides a named lossy export for rendering, IO, and
other external libraries.
Most arithmetic that can fail returns BlasResult. Checked APIs use
ZeroStatus and reject both definite zero and unknown-zero divisors,
returning Problem::UnknownZero for the latter.
Exactness is carried as conservative structure, not by eagerly
canonicalizing every coordinate after every vector or matrix operation.
Following Yap’s exact geometric computation model, lattice-owned facts such
as sparsity, shared scales, determinant schedules, and transform kinds are
non-certifying scheduling metadata until an exact Real or predicate route
consumes them. See Yap, “Towards Exact Geometric Computation,”
Computational Geometry, 1997, pp. 3-23.
§Examples
use hyperlattice::{Matrix3, Real, Vector3, sqrt};
fn r(value: i32) -> Real {
value.into()
}
let v = Vector3::new([r(3), r(4), r(0)]);
assert_eq!(v.dot(&v), r(25));
assert_eq!(sqrt(v.dot(&v)).unwrap(), r(5));
let identity = Matrix3::identity();
assert_eq!(identity * v.clone(), v);Structs§
- Complex
- Complex scalar with real and imaginary components.
- Displacement2
Facts - Cheap structural facts known about a 2D displacement.
- Matrix3
- Three-by-three row-major matrix.
- Matrix4
- Four-by-four row-major matrix.
- Matrix3
Structural Facts - Public structural facts for a
Matrix3. - Matrix4
Structural Facts - Public structural facts for a
Matrix4. - Matrix
Prepared Cache State - Public cache-state summary for prepared matrix handles.
- Orient2
Facts - Cheap structural facts for a 2D orientation determinant.
- Prepared
Matrix3 - Prepared handle for repeated use of a borrowed
Matrix3. - Prepared
Matrix4 - Prepared handle for repeated use of a borrowed
Matrix4. - Prepared
Right Divisor3 - Cached structural and exact-structure metadata for repeated right-division by the same 3×3 divisor.
- Prepared
Right Divisor4 - Cached structural and exact-structure metadata for repeated right-division by the same 4×4 divisor.
- Product
Sum2 Facts - Cheap zero facts for a short sum of pairwise products.
- Product
Term2 Facts - Cheap zero facts for one pairwise product
left * right. - Rational
- Ratio of two integers
- Real
- (More) Real numbers
- Real
Domain Facts - Domain facts for common unary functions.
- Real
Facts - Conservative public facts about a real value.
- Real
Magnitude Bits - A known most-significant binary digit for a nonzero value.
- Real
Symbolic Dependency Mask - Opaque bit mask of symbolic dependencies visible in a
Real. - Shared
Scale Vec - Owned vector coordinates certified to share one exact rational scale.
- Vector2
- Two-dimensional vector.
- Vector3
- Three-dimensional vector.
- Vector4
- Four-dimensional vector.
- Vector2
Facts - Cheap structural facts known for a
Vector2. - Vector3
Facts - Cheap structural facts known for a
Vector3. - Vector4
Facts - Cheap structural facts known for a
Vector4. - Vector
Shared Scale Facts - Conservative fact packet for a shared-scale vector object.
- Vector
Shared Scale View - Borrowed view of vector coordinates that share an exact rational scale.
Enums§
- Axis2
- Coordinate axis in a 2D vector.
- Matrix3
Transform Kind - Conservative homogeneous 2D transform kind for a
Matrix3. - Matrix4
Transform Kind - Conservative homogeneous 3D transform kind for a
Matrix4. - Matrix
Determinant Schedule Hint - Advisory determinant schedule selected from retained matrix facts.
- Problem
- Problems when either parsing or attempting Arithmetic with
Realnumbers or when trying to make or convert to aRational. - Rational
Storage Class - Coarse exact-rational storage cost bucket.
- Real
Domain Status - Conservative domain status for common real-valued functions.
- Real
Exact SetDenominator Kind - Coarse denominator class for an exact borrowed set with a shared scale.
- Real
Exact SetDyadic Exponent Class - Coarse class for the largest dyadic denominator exponent in a borrowed set.
- Real
Exact SetSign Pattern - Conservative sign pattern for a borrowed set of
Realvalues. - Real
Expression Degree - Coarse bounded expression degree for structural dispatch.
- Real
Sign - Exact sign knowledge exposed by structural inspection.
- Real
Zero OneMinus OneStatus - Cheap exact classification for signed unit and zero values.
- Signed
Axis2 - Signed 2D basis axis certified by vector structural facts.
- Signed
Axis4 - A signed 4D basis axis used by caller-certified signed-permutation matrices.
- Vector4
Homogeneous Kind - Exact structural classification of a 4D homogeneous coordinate.
- Zero
Status - Whether structural inspection can prove zero or nonzero status.
Functions§
- acos
- Returns the inverse cosine of
value. - acos_
with_ abort - Returns the inverse cosine after attaching an abort signal.
- acosh
- Returns the inverse hyperbolic cosine of
value. - acosh_
with_ abort - Returns the inverse hyperbolic cosine after attaching an abort signal.
- asin
- Returns the inverse sine of
value. - asin_
with_ abort - Returns the inverse sine after attaching an abort signal.
- asinh
- Returns the inverse hyperbolic sine of
value. - asinh_
with_ abort - Returns the inverse hyperbolic sine after attaching an abort signal.
- atan
- Returns the inverse tangent of
value. - atan_
with_ abort - Returns the inverse tangent after attaching an abort signal.
- atanh
- Returns the inverse hyperbolic tangent of
value. - atanh_
with_ abort - Returns the inverse hyperbolic tangent after attaching an abort signal.
- cos
- Returns the cosine of
value. - cosh
- Returns the hyperbolic cosine of
value. - displacement2
- Returns the 2D displacement vector
to - fromas[dx, dy]. - displacement2_
facts - Return structural facts about the 2D displacement
to - from. - dot2
- Returns the 2D dot product
left.x * right.x + left.y * right.y. - e
- Returns Euler’s number.
- exp
- Returns
eraised tovalue. - i
- Returns the imaginary unit as a complex scalar.
- ln
- Returns the natural logarithm of
value. - log10
- Returns the base-10 logarithm of
value. - log10_
with_ abort - Returns the base-10 logarithm after attaching an abort signal.
- one
- Returns the multiplicative identity.
- orient2_
expr - Builds the exact scalar expression for the orientation determinant of
points
a,b, andc. - orient2_
expr_ facts - Return structural facts for the orientation determinant of
a,b,c. - pi
- Returns pi.
- positive_
product_ sum2 - Returns a short positive sum of pairwise products.
- pow
- Raises
baseto a scalar exponent. - powi
- Raises
baseto an integer exponent using exponentiation by squaring. - product_
sum2_ facts - Return structural zero facts for a short sum of pairwise products.
- product_
term2_ facts - Return structural zero facts for one pairwise product term.
- reciprocal
- Returns the multiplicative inverse of
value. - reciprocal_
checked - Returns the multiplicative inverse after rejecting zero and unknown-zero values.
- reciprocal_
checked_ with_ abort - Returns the checked multiplicative inverse after attaching an abort signal.
- reciprocal_
ref - Returns the multiplicative inverse of
valuewithout consuming it. - reciprocal_
ref_ checked - Returns the checked multiplicative inverse without consuming
value. - signed_
product_ sum2 - Returns a short signed sum of pairwise products.
- sin
- Returns the sine of
value. - sinh
- Returns the hyperbolic sine of
value. - sqrt
- Returns the principal square root of
value. - squared_
distance2 - Returns the squared 2D distance between two points.
- squared_
norm2 - Returns the squared 2D norm
x * x + y * y. - tan
- Returns the tangent of
value. - tanh
- Returns the hyperbolic tangent of
value. - tau
- Returns tau, equal to
2 * pi. - wedge2
- Returns the 2D exterior product
left.x * right.y - left.y * right.x. - zero
- Returns the additive identity.
- zero_
status - Classifies a real value as zero, non-zero, or unknown.
- zero_
status_ with_ abort - Classifies a real value after attaching an abort signal.
Type Aliases§
- Abort
Signal - Shared cancellation signal used by abort-aware APIs.
- Blas
Result - Result type used by fallible operations in this crate.
- Checked
Blas Result - Result type used by APIs that reject unknown-zero conditions.
- Exact
Real SetFacts - Exact-rational structure shared by a fixed set of
Realvalues.