<commit_before>! Copyright (c) 2012 <NAME>
! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel locals math math.constants math.functions
math.vectors sequences sequences.extras sequences.private ;
IN: math.transforms.fft

<PRIVATE

:: (slow-fft) ( seq inverse? -- seq' )
    seq length :> N
    inverse? 1 -1 ? 2pi * i* N / :> O
    N iota [| k |
        0 seq [ O k * * e^ * + ] each-index
        inverse? [ N / ] when
    ] map ; inline

:: (fft) ( seq inverse? -- seq' )
    seq length :> N<commit_msg>math.transforms.fft: specify algorithm.<commit_after>! Copyright (c) 2012 <NAME>
! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel locals math math.constants math.functions
math.vectors sequences sequences.extras sequences.private ;
IN: math.transforms.fft

<PRIVATE

! Discrete Fourier Transform
:: (slow-fft) ( seq inverse? -- seq' )
    seq length :> N
    inverse? 1 -1 ? 2pi * i* N / :> O
    N iota [| k |
        0 seq [ O k * * e^ * + ] each-index
        inverse? [ N / ] when
    ] map ; inline

! Cooley–Tukey Algorithm
:: (fft) ( seq inverse? -- seq' )
    seq length :> N
{'fraction_non_alphanumeric': 0.14073426573426573, 'fraction_numerical': 0.013986013986013986, 'mean_word_length': 2.705501618122977, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3814253', 'n_tokens_mistral': 407, 'n_tokens_neox': 387, 'n_words': 124}