text:
{-# LANGUAGE BangPatterns        #-}
{-# LANGUAGE CPP                 #-}
{-# LANGUAGE DataKinds           #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections       #-}
{-# LANGUAGE TypeFamilies        #-}
{-# LANGUAGE TypeOperators       #-}

import           Control.Monad                (foldM)
import           Control.Monad.Random         (MonadRandom, getRandomR)

#if __GLASGOW_HASKELL__ < 800
import           Data.List                    (unfoldr)
#else
import           Data.List                    (cycle, unfoldr)
#endif
import           Data.Semigroup               ((<>))

import qualified Numeric.LinearAlgebra.Static as SA

import           Options.Applicative

import           Grenade
import           Grenade.Recurrent

-- The defininition for our simple recurrent network.
-- This file just trains a network to generate a repeating sequence
-- of 0 0 1.
--
-- The F and R types are Tagging types to ensure that the runner and
-- creation function know how to treat the layers.
type R = Recurrent

type RecNet = RecurrentNetwork '[ R (LSTM 1 4), R (LSTM 4 1)]
                               '[ 'D1 1, 'D1 4, 'D1 1 ]

type RecInput = RecurrentInputs '[ R (LSTM 1 4), R (LSTM 4 1)]

randomNet :: IO RecNet
randomNet = randomRecurrent

netTest :: MonadRandom m => RecNet -> RecInput -> LearningParameters -> Int -> m (RecNet, RecInput)
netTest net0 i0 rate iterations =
    foldM trainIteration (net0,i0) [1..iterations]
  where
    trainingCycle = cycle [c 0, c 0, c 1]

    trainIteration (net, io) _ = do
      dropping <- getRandomR (0, 2)
      count    <- getRandomR (5, 30)
      let t     = drop dropping trainingCycle
      let example = ((,Nothing) <$> take count t) ++ [(t !! count, Just $ t !! (count + 1))]
      return $ trainEach net io example

    trainEach !nt !io !ex = trainRecurrent rate nt io ex

data FeedForwardOpts = FeedForwardOpts Int LearningParameters

feedForward' :: Parser FeedForwardOpts
feedForward' = FeedForwardOpts <$> option auto (long "examples" <> short 'e' <> value 40000)
                               <*> (LearningParameters
                                    <$> option auto (long "train_rate" <> short 'r' <> value 0.01)
                                    <*> option auto (long "momentum" <> value 0.9)
                                    <*> option auto (long "l2" <> value 0.0005)
                                    )

generateRecurrent :: RecNet -> RecInput -> S ('D1 1) -> [Int]
generateRecurrent n s i =
  unfoldr go (s, i)
    where
  go (x, y) =
    do let (_, ns, o) = runRecurrent n x y
           o'         = heat o
       Just (o', (ns, fromIntegral o'))

  heat :: S ('D1 1) -> Int
  heat x = case x of
    (S1D v) -> round (SA.mean v)

main :: IO ()
main = do
    FeedForwardOpts examples rate <- execParser (info (feedForward' <**> helper) idm)
    putStrLn "Training network..."

    net0                    <- randomNet
    (trained, bestInput)    <- netTest net0 0 rate examples

    let results = generateRecurrent trained bestInput (c 1)

    print . take 50 . drop 100 $ results

c :: Double -> S ('D1 1)
c = S1D . SA.konst

max_stars_repo_name: koenigmaximilian/grenade

max_issues_repo_name: koenigmaximilian/grenade

max_forks_repo_name: koenigmaximilian/grenade


text:
module Statistics.Information.Discrete.TotalCorrelation where

import Data.Matrix
import Statistics.Information.Discrete.Entropy
import Statistics.Information.Discrete.MutualInfo
import Statistics.Information.Utils.Matrix

tc :: Eq a => Int -> Matrix a -> Double
tc base xs = sum hxs - hx where
  hxs = [entropy base col | col <- map colVector (columns xs)]
  hx = entropy base xs

ctc :: Eq a => Int -> Matrix a -> Matrix a -> Double
ctc base xs ys = sum hxs - hx where
  hxs = [centropy base col ys | col <- map colVector (columns xs)]
  hx = centropy base xs ys

corex_tcs :: Eq a => Int -> Matrix a -> Matrix a -> Double
corex_tcs base xs ys = tc base xs - ctc base xs ys

corex_mis :: Eq a => Int -> Matrix a -> Matrix a -> Double
corex_mis base xs ys = sum mixs - mi_all where
  mixs = [mi base col ys | col <- map colVector (columns xs)]
  mi_all = mi base xs ys

residual :: Eq a => Int -> Matrix a -> Double
residual base xs = sum $ [hlessxi i | i <- [1..(ncols xs)]] where
  hlessxi i = centropy base (colVector $ getCol i xs) $ residualMatrix xs i

dtc :: Eq a => Int -> Matrix a -> Double
dtc base xs = entropy base xs - residual base xs

ext: hs

max_stars_repo_name: eligottlieb/Shannon

max_issues_repo_name: eligottlieb/Shannon

max_forks_repo_name: eligottlieb/Shannon


text:
{-# LANGUAGE FlexibleContexts #-}

import           AI.Layer
import           AI.Neuron

import           AI.Network
import           AI.Network.FeedForwardNetwork

import           AI.Trainer
import           AI.Trainer.BackpropTrainer

--import Network.Visualizations
import           Numeric.LinearAlgebra
import           System.IO
import           System.Random

main :: IO ()
main = do

  -- Convolutional Settings
  let field = 3
  let stride = 0
  let padding = 0
  let filters = 2
  let dimensions = 1
  let widthIn = 4
  let heightIn = 4
  let widthOut = 2
  let heightOut = 2
  let connectivity = connectLocally field stride padding filters dimensions widthIn heightIn widthOut heightOut
  let randomization = randomizeLocally field stride padding filters dimensions widthIn heightIn widthOut heightOut

  g <- newStdGen
  let l = LayerDefinition sigmoidNeuron (16 * dimensions) connectFully randomizeFully
  let l' = LayerDefinition sigmoidNeuron (4 * filters) connectivity randomization

  let n = createNetwork uniforms g [l, l'] :: FeedForwardNetwork

  print $ predict (fromList [0..15]) n

max_stars_repo_name: jbarrow/LambdaNet

max_issues_repo_name: jbarrow/LambdaNet

max_forks_repo_name: jbarrow/LambdaNet


text:
module ForMNIST
 ( makeImageMatrix
 , loadImage
 , loadLabel
 , datasize
 , loadImageTest
 , loadLabelTest
 ) where

-------------------------------------------------------------
--module
-------------------------------------------------------------

import qualified Data.ByteString.Lazy as B
import Numeric.LinearAlgebra
import Tools

------------------------------------------------

-------------------------------------------------------------
--MNISTのデータを回収する。
-------------------------------------------------------------
datasize = 10000

--与えられたリスト[a]から指定した要素数(num)ごとに分割してリストのリスト[[a]]を作る。
divideEqually :: Int -> [a] -> [[a]]
divideEqually _ [] = []
divideEqually num xs = xs1 : (divideEqually num xs2)
    where (xs1, xs2) = splitAt num xs

--画像イメージのBytestring(xs)から指定した長さを切り取ってリスト[Double]を作成する。
convertImage :: B.ByteString -> [Double]
convertImage xs = fmap toEnum $ fmap fromEnum . B.unpack $ B.drop byte xs
    where byte = 16  + 784*60000 -784 * datasize

--リストのリスト[[a]]からMatrixのリスト[[Matrix]]を作成する。
makeImageMatrix :: [[Double]] -> [Matrix Double]
makeImageMatrix [] = []
makeImageMatrix (x:xs) = (row x) : (makeImageMatrix xs)

loadImage1 :: B.ByteString -> [[Double]]
loadImage1 xs = divideEqually 784 (convertImage xs)

--画像イメージのBytestring(xs)から指定した長さを切り取ってMatrixのリスト[[Matrix]]を作成する。
loadImage :: B.ByteString -> [Matrix Double]
loadImage xs = makeImageMatrix $ divideEqually 784 (convertImage xs)

--ビジュアル化用なのでIntで出力する。
convertImage2 :: B.ByteString -> [Int]
convertImage2 xs = fmap fromEnum . B.unpack $ B.drop byte xs
    where byte = 16  + 784*10000 -784 * datasize

--ラベルのBytestring(xs)から指定した長さを切り取ってリスト[Int]を作成する。
loadLabel :: B.ByteString -> [Int]
loadLabel xs = fmap fromEnum . B.unpack $ B.drop byte xs
    where byte = 8  + 1*60000 - 1 * datasize

loadLabelTest :: B.ByteString -> [Int]
loadLabelTest xs = fmap fromEnum . B.unpack $ B.drop byte xs
    where byte = 8  + 1*10000 - 1 * 1000

convertImageTest :: B.ByteString -> [Double]
convertImageTest xs = fmap toEnum $ fmap fromEnum . B.unpack $ B.drop byte xs
    where byte = 16  + 784*10000 -784 * 1000

loadImageTest :: B.ByteString -> [Matrix Double]
loadImageTest xs = makeImageMatrix $ divideEqually 784 (convertImageTest xs)

------------------------------------------------

max_stars_repo_name: llbxg/Fukami

max_issues_repo_name: llbxg/Fukami

max_forks_repo_name: llbxg/Fukami


text:
{-# OPTIONS_GHC -Wall                     #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing  #-}
{-# OPTIONS_GHC -fno-warn-type-defaults   #-}
{-# OPTIONS_GHC -fno-warn-unused-do-bind  #-}
{-# OPTIONS_GHC -fno-warn-missing-methods #-}
{-# OPTIONS_GHC -fno-warn-orphans         #-}

{-# LANGUAGE MultiParamTypeClasses        #-}
{-# LANGUAGE TypeFamilies                 #-}
{-# LANGUAGE ScopedTypeVariables          #-}
{-# LANGUAGE ExplicitForAll               #-}
{-# LANGUAGE DataKinds                    #-}

{-# LANGUAGE FlexibleInstances            #-}
{-# LANGUAGE MultiParamTypeClasses        #-}
{-# LANGUAGE FlexibleContexts             #-}
{-# LANGUAGE TypeFamilies                 #-}
{-# LANGUAGE BangPatterns                 #-}
{-# LANGUAGE GeneralizedNewtypeDeriving   #-}
{-# LANGUAGE TemplateHaskell              #-}
{-# LANGUAGE DataKinds                    #-}
{-# LANGUAGE DeriveGeneric                #-}

module Particle ( main ) where

import           Data.Random hiding ( StdNormal, Normal )
import           Data.Random.Source.PureMT ( pureMT )
import           Control.Monad.State ( evalState, replicateM )
import           Numeric.LinearAlgebra.Static
                 ( R, vector, Sym,
                   headTail, matrix, sym,
                   diag
                 )
import           GHC.TypeLits ( KnownNat )
import           Data.Random.Distribution.Static.MultivariateNormal ( Normal(..) )
import qualified Data.Vector as V
import           Data.Vector ( Vector )
import           Data.List ( transpose )
import           Control.Parallel.Strategies
import           GHC.Generics (Generic)

import           Numeric.Particle

import qualified Graphics.Rendering.Chart as C
import Graphics.Rendering.Chart.Backend.Diagrams
import Data.Colour
import Data.Colour.Names
import Data.Default.Class
import Control.Lens

import Diagrams.Backend.Cairo.CmdLine
import Diagrams.Prelude hiding ( render, Renderable, trace, Vector, sample )
import Diagrams.Backend.CmdLine

import Data.Csv
import System.IO hiding ( hGetContents )
import Data.ByteString.Lazy ( hGetContents )

nParticles :: Int
nParticles = 1000 -- 500

data SystemState a = SystemState { x1  :: a, x2  :: a }
  deriving (Show, Generic)

instance NFData a => NFData (SystemState a)

newtype SystemObs a = SystemObs { y1  :: a }
  deriving Show

(.+), (.*), (.-) :: (Num a) => V.Vector a -> V.Vector a -> V.Vector a
(.+) = V.zipWith (+)
(.*) = V.zipWith (*)
(.-) = V.zipWith (-)

deltaT, g :: Double
deltaT = 0.01
g  = 9.81

type PendulumState = R 2

stateUpdate :: Particles (SystemState Double) ->
                Particles (SystemState Double)
stateUpdate xPrevs = V.zipWith SystemState x1s x2s
  where
    ix = V.length xPrevs

    x1Prevs = V.map x1 xPrevs
    x2Prevs = V.map x2 xPrevs

    deltaTs = V.replicate ix deltaT
    gs = V.replicate ix g
    x1s = x1Prevs .+ (x2Prevs .* deltaTs)
    x2s = x2Prevs .- (gs .* (V.map sin x1Prevs) .* deltaTs)

stateUpdateNoisy :: MonadRandom m =>
                    Sym 2 ->
                    Particles (SystemState Double) ->
                    m (Particles (SystemState Double))
stateUpdateNoisy bigQ xPrevs = do
  let xs = stateUpdate xPrevs

      x1s = V.map x1 xs
      x2s = V.map x2 xs

  let ix = V.length xPrevs
  etas <- replicateM ix $ sample $ rvar (Normal 0.0 bigQ)

  let eta1s, eta2s :: V.Vector Double
      eta1s = V.fromList $ map (fst . headTail) etas
      eta2s = V.fromList $ map (fst . headTail . snd . headTail) etas

  return (V.zipWith SystemState (x1s .+ eta1s) (x2s .+ eta2s))

obsUpdate :: Particles (SystemState Double) ->
             Particles (SystemObs Double)
obsUpdate xs = V.map (SystemObs . sin . x1) xs

weight :: forall a n . KnownNat n =>
          (a -> R n) ->
          Sym n ->
          a -> a -> Double
weight f bigR obs obsNew = pdf (Normal (f obsNew) bigR) (f obs)

bigP :: Sym 2
bigP = sym $ diag 0.1

initParticles :: MonadRandom m =>
                 m (Particles (SystemState Double))
initParticles = V.replicateM nParticles $ do
  r <- sample $ rvar (Normal m0 bigP)
  let x1 = fst $ headTail r
      x2 = fst $ headTail $ snd $ headTail r
  return $ SystemState { x1 = x1, x2 = x2}

runFilter :: Particles (SystemObs Double) -> Vector (Particles (SystemState Double))
runFilter pendulumSamples = evalState action (pureMT 19)
  where
    action = do
      xs <- initParticles
      scanMapM
        (runPF (stateUpdateNoisy bigQ) obsUpdate (weight f bigR))
        return
        xs
        pendulumSamples

f :: SystemObs Double -> R 1
f = vector . pure . y1

h :: SystemState Double -> R 2
h u = vector [x1 u , x2 u]

bigQ :: Sym 2
bigQ = sym $ matrix bigQl

qc1 :: Double
qc1 = 0.01

bigQl :: [Double]
bigQl = [ qc1 * deltaT^3 / 3, qc1 * deltaT^2 / 2,
          qc1 * deltaT^2 / 2,       qc1 * deltaT
         ]

bigR :: Sym 1
bigR  = sym $ matrix [0.1]

m0 :: PendulumState
m0 = vector [1.6, 0]

testSmoothing :: Particles (SystemObs Double) -> Int -> [Double]
testSmoothing ss n = V.toList $ evalState action (pureMT 23)
  where
    action = do
      xss <- V.replicateM n $ oneSmoothingPath (stateUpdateNoisy bigQ) (weight h bigQ) nParticles (runFilter ss)
      let yss = V.fromList $ map V.fromList $
                transpose $
                V.toList $ V.map (V.toList) $
                xss
      return $ V.map (/ (fromIntegral n)) $ V.map V.sum $ V.map (V.map x1) yss

chartEstimated :: String ->
              [(Double, Double)] ->
              [(Double, Double)] ->
              [(Double, Double)] ->
              C.Renderable ()
chartEstimated title acts obs ests = C.toRenderable layout
  where

    actuals = C.plot_lines_values .~ [acts]
            $ C.plot_lines_style  . C.line_color .~ opaque red
            $ C.plot_lines_title .~ "Actual Trajectory"
            $ C.plot_lines_style  . C.line_width .~ 1.0
            $ def

    measurements = C.plot_points_values .~ obs
                 $ C.plot_points_style  . C.point_color .~ opaque blue
                 $ C.plot_points_title .~ "Measurements"
                 $ def

    estimas = C.plot_lines_values .~ [ests]
            $ C.plot_lines_style  . C.line_color .~ opaque black
            $ C.plot_lines_title .~ "Inferred Trajectory"
            $ C.plot_lines_style  . C.line_width .~ 1.0
            $ def

    layout = C.layout_title .~ title
           $ C.layout_plots .~ [C.toPlot actuals, C.toPlot measurements, C.toPlot estimas]
           $ C.layout_y_axis . C.laxis_title .~ "Angle / Horizontal Displacement"
           $ C.layout_y_axis . C.laxis_override .~ C.axisGridHide
           $ C.layout_x_axis . C.laxis_title .~ "Time"
           $ C.layout_x_axis . C.laxis_override .~ C.axisGridHide
           $ def

nObs :: Int
nObs = 200

diagU :: IO (Diagram Cairo)
diagU = do
  h <- openFile "matlabRNGs.csv" ReadMode
  cs <- hGetContents h
  let df = (decode NoHeader cs) :: Either String (V.Vector (Double, Double))
  case df of
    Left _ -> error "Whatever"
    Right generatedSamples -> do
      let preObs = V.take nObs $ V.map fst generatedSamples
      let obs = V.toList preObs
      let acts = V.toList $ V.take nObs $ V.map snd generatedSamples
      let nus = take nObs (testSmoothing (V.map SystemObs preObs) 50)
      denv <- defaultEnv C.vectorAlignmentFns 600 500
      let charte = chartEstimated "Particle Smoother"
                                  (zip [0,1..] acts)
                                  (zip [0,1..] obs)
                                  (zip [0,1..] nus)
      return $ fst $ runBackend denv (C.render charte (600, 500))

displayHeader :: FilePath -> Diagram B -> IO ()
displayHeader fn =
  mainRender ( DiagramOpts (Just 900) (Just 700) fn
             , DiagramLoopOpts False Nothing 0
             )

main :: IO ()
main = do
  du <- diagU
  displayHeader "diagrams/Smooth3.png" du

max_stars_repo_name: idontgetoutmuch/Kalman

max_issues_repo_name: f-o-a-m/Kalman

max_forks_repo_name: f-o-a-m/Kalman


text:
{-# LANGUAGE Strict #-}
module FourierPinwheel.Multiplication where

import           Control.Concurrent.Async
import           Data.Array.Repa          as R
import           Data.Complex
import           Data.List                as L
import           Data.Vector.Storable     as VS
import           DFT.Plan
import           FourierPinwheel.Array
import           Utils.Parallel
import Filter.Utils
import Utils.Distribution

{-# INLINE multiplyBias #-}
multiplyBias ::
     DFTPlan
  -> VS.Vector (Complex Double)
  -> FPArray (VS.Vector (Complex Double))
  -> IO (FPArray (VS.Vector (Complex Double)))
multiplyBias plan biasF (FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq vecs2) = do
  let planIDForward =
        DFTPlanID DFT1DG [numThetaFreq, numXFreq, numYFreq] [0, 1, 2]
      planIDBackward =
        DFTPlanID IDFT1DG [numThetaFreq, numXFreq, numYFreq] [0, 1, 2]
  vecs2F <- dftExecuteBatchP plan planIDForward vecs2
  let vecs3F = parMap rdeepseq (VS.zipWith (*) biasF) vecs2F
  FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq <$>
    dftExecuteBatchP plan planIDBackward vecs3F

{-# INLINE multiplyBias4D #-}
multiplyBias4D ::
     DFTPlan
  -> VS.Vector (Complex Double)
  -> FPArray (VS.Vector (Complex Double))
  -> IO (FPArray (VS.Vector (Complex Double)))
multiplyBias4D plan biasF (FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq vecs2) = do
  let planIDForward =
        DFTPlanID
          DFT1DG
          [numRFreq, numThetaFreq, numXFreq, numYFreq]
          [0, 1, 2, 3]
      planIDBackward =
        DFTPlanID
          IDFT1DG
          [numRFreq, numThetaFreq, numXFreq, numYFreq]
          [0, 1, 2, 3]
  vecs2F <- dftExecute plan planIDForward . VS.concat $ vecs2
  let vecs3F = VS.zipWith (*) biasF vecs2F
  arr <-
    fromUnboxed (Z :. numRFreq :. numThetaFreq :. numXFreq :. numYFreq) .
    VS.convert <$>
    dftExecute plan planIDBackward vecs3F
  return .
    FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq .
    parMap
      rdeepseq
      (\rFreq ->
         VS.convert . toUnboxed . computeS . R.slice arr $ (Z :. rFreq :. All :. All :. All)) $
    [0 .. numRFreq - 1]

{-# INLINE multiplyBiasDiscrete #-}
multiplyBiasDiscrete ::
     DFTPlan
  -> VS.Vector (Complex Double)
  -> FPArray (VS.Vector (Complex Double))
  -> IO (FPArray (VS.Vector (Complex Double)))
multiplyBiasDiscrete plan bias (FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq vecs2F) = do
  let planIDForward = DFTPlanID DFT1DG [numThetaFreq, numXFreq, numYFreq] [1, 2]
      planIDBackward =
        DFTPlanID IDFT1DG [numThetaFreq, numXFreq, numYFreq] [1, 2]
  vecs2 <-
    parMap rdeepseq (VS.zipWith (*) bias) <$>
    dftExecuteBatchP plan planIDBackward vecs2F
  FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq <$>
    dftExecuteBatchP plan planIDForward vecs2

{-# INLINE multiplyRFunction #-}
multiplyRFunction ::
     DFTPlan
  -> Double
  -> FPArray (VS.Vector (Complex Double))
  -> IO (FPArray (VS.Vector (Complex Double)))
multiplyRFunction plan periodEnv (FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq vecs) = do
  let freqConst = 2 * pi / log periodEnv
      filterVec =
        computeUnboxedS . makeFilter1D . fromFunction (Z :. numRFreq) $ \(Z :. i') ->
          let i = fromIntegral (i' - div numRFreq 2)
           in 1 / (1 :+ freqConst * fromIntegral i) -- gaussian1D i 10 :+ 0 --1 / (1 :+ (freqConst * fromIntegral i)^2)
      vec = VS.convert . VS.concat $ vecs
  filterF <-
    dftExecute plan (DFTPlanID DFT1DG [numRFreq] [0]) . VS.convert . toUnboxed $
    filterVec
  vecF <-
    dftExecute
      plan
      (DFTPlanID DFT1DG [numRFreq, numThetaFreq, numXFreq, numYFreq] [0])
      vec
  let arrF =
        fromUnboxed (Z :. numRFreq :. numThetaFreq :. numXFreq :. numYFreq) .
        VS.convert $
        vecF
      convolvedArrFR =
        R.traverse2
          arrF
          (fromUnboxed (Z :. numRFreq) . VS.convert $ filterF)
          const $ \fArr fVec idx@(Z :. r :. _ :. _ :. _) ->
          fArr idx * fVec (Z :. r)
  convolvedArrF <- computeUnboxedP convolvedArrFR
  convolvedVec <-
    dftExecute
      plan
      (DFTPlanID IDFT1DG [numRFreq, numThetaFreq, numXFreq, numYFreq] [0]) .
    VS.convert . toUnboxed $
    convolvedArrF
  let convolvedArr =
        fromUnboxed (Z :. numRFreq :. numThetaFreq :. numXFreq :. numYFreq) .
        VS.convert $
        convolvedVec
      convolvedVecs =
        parMap
          rdeepseq
          (\i ->
             VS.convert . toUnboxed . computeS . R.slice convolvedArr $
             (Z :. i :. All :. All :. All))
          [0 .. numRFreq - 1]
  return
    (FPArray
       numXFreq
       numYFreq
       numRFreq
       numThetaFreq
       numRhoFreq
       numPhiFreq
       convolvedVecs)

-- {-# INLINE multiplyRFunction #-}
-- multiplyRFunction :: FPArray (VS.Vector (Complex Double)) -> FPArray (VS.Vector (Complex Double))
-- multiplyRFunction (FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq vecs') =
--   let vecs = L.reverse vecs'
--       zeroVec = VS.replicate (numThetaFreq * numXFreq * numYFreq) 0
--       convolvedSGNPositive = L.init . L.scanl' (VS.zipWith (+)) zeroVec $ vecs
--       convolvedSGNNegative = L.tail . L.scanr (VS.zipWith (+)) zeroVec $ vecs
--       convolvedSGN =
--         parZipWith
--           rdeepseq
--           (VS.zipWith (\x y -> (x - y) * (0 :+ (-pi))))
--           convolvedSGNPositive
--           convolvedSGNNegative
--    in FPArray numXFreq numYFreq numRFreq numThetaFreq numRhoFreq numPhiFreq .
--       L.reverse $
--       convolvedSGN

max_stars_repo_name: XinhuaZhang/Stochastic-Completion-Field

max_issues_repo_name: XinhuaZhang/Stochastic-Completion-Field

max_forks_repo_name: XinhuaZhang/Stochastic-Completion-Field