Currently, the codebase uses double throughout for floating-point arithmetic. To support other precisions (e.g., float for reduced memory usage or GPU performance), we should introduce a type alias at a central location.
Proposed approach:
Add something like:
using Scalar = double; // or float
in a central header. For the name, Scalar is clean and conventional in numerical computing. Alternatives worth considering: Real (mathematically expressive, common in PDE codes), value_type (STL-style, but verbose), or fp_t (short but cryptic). Scalar or Real are the strongest candidates — preference should lean toward Scalar as it is unambiguous and widely understood in scientific computing contexts.
Follow-up benefits:
- Removes all explicit template specializations in the Linear Algebra layer.
- Eliminates the need to cast
Vector to ConstVector when passing into functions like l2_norm, since the type relationship becomes consistent across the board.
Open Question: How to make it compatible with Mumps float and double specific data types. How to habdle hard coded thresholds (eps=1e-12).
Currently, the codebase uses
doublethroughout for floating-point arithmetic. To support other precisions (e.g.,floatfor reduced memory usage or GPU performance), we should introduce a type alias at a central location.Proposed approach:
Add something like:
in a central header. For the name,
Scalaris clean and conventional in numerical computing. Alternatives worth considering:Real(mathematically expressive, common in PDE codes),value_type(STL-style, but verbose), orfp_t(short but cryptic).ScalarorRealare the strongest candidates — preference should lean towardScalaras it is unambiguous and widely understood in scientific computing contexts.Follow-up benefits:
VectortoConstVectorwhen passing into functions likel2_norm, since the type relationship becomes consistent across the board.Open Question: How to make it compatible with Mumps float and double specific data types. How to habdle hard coded thresholds (eps=1e-12).