Repository metrics
- Stars
- (675 stars)
- PR merge metrics
- (PR metrics pending)
Description
🚀 Feature Description
Currently, the svd3 implementation in kornia-algebra operates only on f32 tensors. Many computer vision and numerical workflows benefit from higher precision, especially in geometric estimation, optimization routines, and 3D transformations.
Adding f64 support would enable users who require higher numerical precision to use the same SVD functionality without converting data or implementing their own double-precision version.
This feature would extend the current functionality while remaining fully backward compatible.
📂 Feature Category
Rust Core Library
💡 Motivation
In computer vision pipelines, f64 precision is often required for:
- geometric estimation (pose estimation, bundle adjustment)
- optimization routines
- 3D reconstruction
- numerical stability in iterative algorithms
Currently, users must either:
- downcast their data to
f32, or - implement their own SVD for
f64.
Providing a native f64 implementation would make kornia-algebra more flexible for scientific and high-precision workflows.
💭 Proposed Solution
Extend the current SVD3 implementation to support f64.
This can be done by:
- Replicating the existing
f32implementation. - Replacing the scalar type with
f64. - Ensuring the same API structure is preserved.
Example conceptual API:
svd3_f32(...)
svd3_f64(...)
or if generics are preferred:
svd3<T: Float>(...)
The initial implementation could simply mirror the f32 version to keep the change minimal and safe.
📚 Library Reference
Similar functionality exists in:
- nalgebra – supports both
f32andf64linear algebra operations - OpenCV – SVD routines support double precision
- Standard numerical linear algebra implementations typically support both float precisions
These libraries demonstrate that supporting both scalar types is standard practice in numerical APIs.
🔄 Alternatives Considered
-
Converting
f64tensors tof32before calling SVD → loses precision -
Using external linear algebra libraries → adds unnecessary dependency overhead
Providing native support inside kornia-algebra keeps the ecosystem self-contained.
🎯 Use Cases
Examples where f64 SVD3 would be beneficial:
- 3D pose estimation
- homography estimation
- bundle adjustment pipelines
- structure-from-motion
- numerical experimentation and research
📝 Additional Context
The change would be purely additive and should not introduce breaking changes.
The existing f32 implementation can remain unchanged while the f64 variant is added alongside it.
🤝 Contribution Intent
- I plan to submit a PR to implement this feature
- I'm requesting this feature but not planning to implement it