Apache-2.0 WITH LLVM-exception
Version:0.1.0
Alire CI: Dependencies:No dependency.
Dependents:No dependents.
Badge:
A formally verified Ada/SPARK library for computing distance and similarity metrics.
with Ada.Numerics.Elementary_Functions;
with Distance.Numeric.Signatures;
with Distance.Numeric.Euclidean_Generic;
procedure Example is
type Float_Vector is array (Positive range <>) of Float;
package Float_Math is new Ada.Numerics.Elementary_Functions (Float);
package Float_Sig is new Distance.Numeric.Signatures
(Element_Type => Float,
Zero => 0.0,
One => 1.0,
Sqrt => Float_Math.Sqrt,
"**" => Float_Math."**",
Max_Element => Float'Last);
function Euclidean is new Distance.Numeric.Euclidean_Generic
(Numeric_Ops => Float_Sig, Index_Type => Positive, Vector => Float_Vector);
D : Float := Euclidean ((0.0, 0.0), (3.0, 4.0)); -- D = 5.0
begin
null;
end Example;
For fixed-point and integer types, you can use Spark_Math to provide the required operations.