help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] delete function generates an error in movstat.h


From: Montezano, Daniel
Subject: Re: [Help-gsl] delete function generates an error in movstat.h
Date: Thu, 26 Jul 2018 17:25:29 +0000

Hi Patrick,

Thanks for the reply.
The source code I am trying to compile follows below.

The file vector.dat contains the following list of numbers:
12, -20, 12, 24, 23, 8, -19, 9, -4, 2, 3, 4, 1, 7, 6, 7, 0, -1, -1, 2, 44, 1, 
-9, 7, 5, 5, 6, 6, 1, 1

Thanks!

Daniel



----------BEGIN SOURCE CODE--------------------------------------
#include <stdio.h>
#include <iostream>
#include <stdlib.h>

#include <gsl/gsl_math.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_movstat.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>

using namespace std;
int main(int argc, char** argv) {
    // window length
    const size_t K = 13;
    // time series length
    const size_t N = 30;


    // input time series
    gsl_vector *x = gsl_vector_alloc (N);
    {
        FILE * f = fopen ("vector.dat","r");
        gsl_vector_fscanf (f,x);
        fclose (f);
    }


    // output mean time series
    gsl_vector *xmean = gsl_vector_alloc(N);
    // workspace for the rolling computation
    gsl_movstat_workspace * wkspc = gsl_movstat_alloc (K);


    // compute the rolling mean for a gsl_vector
    gsl_movstat_mean (GSL_MOVSTAT_END_PADZERO, x, xmean, wkspc);

    // important to free these things to prevent crashes
    gsl_vector_free(x);
    gsl_vector_free(xmean);
    gsl_movstat_free (wkspc);

    return 0;
}
---------------------- END SOURCE CODE---------------------



Can you provide your source code?

On 07/13/2018 07:31 PM, Montezano, Daniel wrote:
> Hi,
>
> I am trying to compile an example from the docs. Compute a rolling mean using
> the new package Moving Window Statistics.
>
> My code is producing the following error (Windows 10, MinGW.org GCC-6.3.0-1,
> GSL 2.5):
>
>
>> g++ gsl_rolling_stats.cpp -lgsl -o gsl_rolling_stats.exe
>>  In file included from gsl_rolling_stats.cpp:11:0:
>>  c:\documents\progrs\mingw32\include\gsl\gsl_movstat.h:58:9: error: expected
>>  unqualified-id before 'delete'
>>  int (*delete) (void * vstate);
>>       ^~~~~~
>>  c:\documents\progrs\mingw32\include\gsl\gsl_movstat.h:58:9: error: expected
>>  ')' before 'delete'
> I compiled GSL compiled from source using MinGW and msys. I have tested my
> GSL installation with other GSL code and everything is working fine.
>
> I appreciate any help.
>
> Thank you!
>
> Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]