histogram.cpp
void window_filter(vector<realtype> &input, int winsize, vector<realtype> &res)
{
    res.clear();

    int inpSize=input.size();
    for(int i=0; i<=inpSize-winsize; i++)
    {
        realtype accum=0.0;
        //int badcount=0;
        for(int j=i; j<winsize+i; j++)
        {
            if(input[j]==-1) continue;
            accum+=input[j];
        }
        accum/=(realtype)winsize;
        res.push_back(accum);
    }
}
//optimize this later
//when you shift the window, instead of recalculating accum completely
//simply subtract the number leaving and add the number arriving
//then divide to get avg
optimize this later
when you shift the window, instead of recalculating accum completely
simply subtract the number leaving and add the number arriving
then divide to get avg
optimize this later when you shift the window instead of recalculating accum completely simply subtract the number leaving and add the number arriving then divide to get avg
void window_filter(vector<realtype> &input, int winsize, vector<realtype> &res)
{
    res.clear();
    int inpSize=input.size();
    for(int i=0; i<=inpSize-winsize; i++)
    {
        realtype accum=0.0;
        for(int j=i; j<winsize+i; j++)
        {
            if(input[j]==-1) continue;
            accum+=input[j];
        }
        accum/=(realtype)winsize;
        res.push_back(accum);
    }
}
void window_filter ( vector < realtype > & input , int winsize , vector < realtype > & res ) { res . clear ( ) ; int inpSize = input . size ( ) ; for ( int i = 0 ; i <= inpSize - winsize ; i ++ ) { realtype accum = 0.0 ; for ( int j = i ; j < winsize + i ; j ++ ) { if ( input [ j ] == -1 ) continue ; accum += input [ j ] ; } accum /= ( realtype ) winsize ; res . push_back ( accum ) ; } }
optimize this later
when you shift the window, instead of recalculating accum completely
simply subtract the number leaving and add the number arriving
then divide to get avg
optimize this later when you shift the window instead of recalculating accum completely simply subtract the number leaving and add the number arriving then divide to get avg
//int badcount=0;