Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Segmentation fault" when trying to do FFT on 1-element vector. #3

Open
vi opened this issue May 11, 2014 · 0 comments
Open

"Segmentation fault" when trying to do FFT on 1-element vector. #3

vi opened this issue May 11, 2014 · 0 comments

Comments

@vi
Copy link

vi commented May 11, 2014

vector-fftw seems not to like 1-element vectors.

module Main where

import qualified Numeric.FFT.Vector.Unnormalized as FFT
import Data.Vector (fromList, toList)
import Data.List.Split (splitOneOf)
import Data.List (intersperse)
import Control.Monad (forever)
import Control.Arrow ((>>>))

main = forever $
         getLine                      -- read lines
    >>=(   splitOneOf " \t"           -- | split then to chunks on whitespace
    >>>      map read                 -- | | conert them to a list of Doubles
    >>>         fromList              -- | | | convert the list to Vector
    >>>            FFT.run FFT.dct1   -- | | | |  DCT
    >>>         toList                -- | | | convert resulting Vector back to list
    >>>      map show                 -- | | convert each Double back to String
    >>>    intersperse " "            -- | put " " between all chunks
    >>>    concat                     -- | make one happy string from chunks and " "s
    >>>  putStrLn )                   -- output it
$ ghc dct.hs
[1 of 1] Compiling Main             ( dct.hs, dct.o )
Linking dct ...
$ ./dct
1 2 3
8.0 -2.0 0.0
3 0
3.0 3.0
2
Segmentation fault
bgamari added a commit that referenced this issue May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant