<commit_before>//
// math_window.c : demonstrate windowing functions
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <getopt.h>

#include "liquid.h"
#include "liquid.doc.h"

// print usage/help message
void usage()
{
    printf("math_window [options]\n");
    printf("  u/h   : print usage\n");
    printf("  n     : window size, default: 51\n");
    printf("  N     : fft size, default: 1024\n");
    printf("  b     : Kaiser-Bessel beta factor\n");
    printf("  w     : window type {kaiser, hamming, hann, blackmanharris, kbd}\n");
    //printf("  o     : output filename\n");
}

int main(int argc, char*argv[])
{
    // options
    unsigned int n=51;      // window size
    unsigned int nfft=1024; // number of fft points
    float beta = 3.0f;      //
    enum {
        KAISER=0,
        HAMMING,
        HANN,
        BLACKMANHARRIS,
        KBD
    } wtype;

    int dopt;
    while((dopt = getopt(argc,argv,"uhn:N:b:w:")) != EOF){
        switch (dopt) {
        case 'h':
        case 'u': usage();              return 0;
        case 'n': n = atoi(optarg);     break;
        case 'N': nfft = atoi(optarg);  break;
        case 'b': beta = atof(optarg);  break;
        case 'w': 
            if      (strcmp(optarg,"kaiser")==0)         wtype = KAISER;
            else if (strcmp(optarg,"hamming")==0)        wtype = HAMMING;
            else if (strcmp(optarg,"hann")==0)           wtype = HANN;
            else if (strcmp(optarg,"blackmanharris")==0) wtype = BLACKMANHARRIS;
            else if (strcmp(optarg,"kbd")==0)            wtype = KBD;
            else {
                fprintf(stderr,"error: %s, unknown/unsupported window '%s'\n", argv[0], optarg);
                exit(1);
            }
            break;
        default:
            fprintf(stderr,"error: %s, invalid option\n", argv[0]);
            exit(1);
        }
    }<commit_msg>doc|math: defaulting wtype to Kaiser-Bessel window<commit_after>//
// math_window.c : demonstrate windowing functions
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <getopt.h>

#include "liquid.h"
#include "liquid.doc.h"

// print usage/help message
void usage()
{
    printf("math_window [options]\n");
    printf("  u/h   : print usage\n");
    printf("  n     : window size, default: 51\n");
    printf("  N     : fft size, default: 1024\n");
    printf("  b     : Kaiser-Bessel beta factor\n");
    printf("  w     : window type {kaiser, hamming, hann, blackmanharris, kbd}\n");
    //printf("  o     : output filename\n");
}

int main(int argc, char*argv[])
{
    // options
    unsigned int n=51;      // window size
    unsigned int nfft=1024; // number of fft points
    float beta = 3.0f;      //
    enum {
        KAISER=0,
        HAMMING,
        HANN,
        BLACKMANHARRIS,
        KBD
    } wtype = KAISER;

    int dopt;
    while((dopt = getopt(argc,argv,"uhn:N:b:w:")) != EOF){
        switch (dopt) {
        case 'h':
        case 'u': usage();              return 0;
        case 'n': n = atoi(optarg);     break;
        case 'N': nfft = atoi(optarg);  break;
        case 'b': beta = atof(optarg);  break;
        case 'w': 
            if      (strcmp(optarg,"kaiser")==0)         wtype = KAISER;
            else if (strcmp(optarg,"hamming")==0)        wtype = HAMMING;
            else if (strcmp(optarg,"hann")==0)           wtype = HANN;
            else if (strcmp(optarg,"blackmanharris")==0) wtype = BLACKMANHARRIS;
            else if (strcmp(optarg,"kbd")==0)            wtype = KBD;
            else {
                fprintf(stderr,"error: %s, unknown/unsupported window '%s'\n", argv[0], optarg);
                exit(1);
            }
            break;
        default:
            fprintf(stderr,"error: %s, invalid option\n", argv[0]);
            exit(1);
        }
    }
{'fraction_non_alphanumeric': 0.15511892450879008, 'fraction_numerical': 0.012926577042399173, 'mean_word_length': 1.8851603281133482, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5409271', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1329, 'n_words': 324}