adagsl_335d13f0/examples/movstat/src/windowing.adb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
with Ada.Text_Io; use Ada.Text_Io;
with Ada.Integer_Text_IO ; use Ada.Integer_Text_IO ;
with Ada.Long_Float_Text_IO ; use Ada.Long_Float_Text_IO ;

with gsl.sort_double ;
with gsl.statistics ;
package body windowing is

   function windowingfn( windowsize : size_t ; data : in out gsl.double_array ; params : System.Address ) return double is
        alpha : Long_Float ;
        for alpha'Address use params ;
   begin
        -- Put("Size "); Put(Integer(arg1));
        -- Put(" Param "); Put(param);
        -- New_Line;
        gsl.sort_double.sort(data , 1 , windowsize );
        return gsl.statistics.trmean_from_sorted_data(double(alpha),data,1,windowsize);
   end windowingfn ;

end windowing ;