Tom Hawkins skrev:
On Fri, Nov 6, 2009 at 6:28 AM, Emil Axelsson <e...@chalmers.se> wrote:

I'm trying to get realtime signal processing with Haskell for long. I make
progress, but slowly. Has Ericsson ever thought about using Haskell itself
for signal processing? (But I think they already have Erlang?)
No, using Haskell directly is not an option (at least with current compiler
technology). Their performance requirements are very high, and the signal
processors have quite limited memory, so putting a Haskell RTS on them
wouldn't work.

Atom may be another option.  Though it is not intended for high
performance DSP, we do use it for basic signal processing.  Here is an
IIR filter that is used is some fault detection logic on our
application:

-- | IIR filter implemented using direct form 2.
iirFilter :: Name -> Float -> [(Float, Float)] -> E Float -> Atom (E Float)
iirFilter name b0 coeffs x = do
  -- Create the filter taps.
  vs <- mapM (\ i -> float (name ++ show i) 0) [1 .. length coeffs]
  -- Cascade the filter taps together.
  mapM_ (\ (vA, vB) -> vA <== value vB) $ zip (tail vs) vs
  -- Calculate the input to the chain of taps.
  let w0 = sum ( x :  [ (value v) * Const (-a) | (v, (a, _)) <- zip vs coeffs ])
      bs = b0 : (snd $ unzip coeffs)
      ws = w0 : map value vs
      us = [ w * Const b | (w, b) <- zip ws bs ]
  head vs <== w0
  -- Return the output.
  return $ sum us

http://hackage.haskell.org/package/atom

Nice!

One of our project members has been looking at Atom, not for numerical computations, but for real-time scheduling (which Feldspar should deal with eventually).

What kind of code (in terms of efficiency) does the above description compile to?

/ Emil

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to