Skip to content

Commit

Permalink
Fixed back Ingo's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rojods committed Mar 11, 2021
1 parent 93506ee commit a71f907
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion forsyde-shallow.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: forsyde-shallow
version: 3.4.1.0
cabal-version: >= 1.8
cabal-version: >= 1.10
build-type: Simple
license: BSD3
license-file: LICENSE
Expand Down
18 changes: 4 additions & 14 deletions src/ForSyDe/Shallow/Utility/FIR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,8 @@ sipoSY :: Int -> b -> Signal b -> Vector (Signal b)
sipoSY n s0 = iterateV n tap
where tap = delaySY s0

-- | Multiply an entire numeric signal by a constant.
gainSY :: (Num a) => a -> Signal a -> Signal a
gainSY h = zipWithSY (*) (infiniteS id h)

-- | Multiply a vector of signals so that every signal is amplified by one
-- entry of the given numeric vector.
gainParallelSYV :: (Num a) => Vector a -> Vector (Signal a) -> Vector (Signal a)
gainParallelSYV = zipWithV (gainSY)

-- | Perform an inner product with the heads of a vector of signals.
innerProdSY :: (Num a) => Vector a -> Vector (Signal a) -> Signal a
innerProdSY coeffs sigs = mapSY (sumV) $ zipxSY amplifiedSignals
where amplifiedSignals = gainParallelSYV coeffs sigs
sumV = foldlV (+) 0

innerProdSY coeffs = zipWithxSY (ipV coeffs)
where ipV NullV NullV = 0
ipV (h:>hv) (x:>xv) = h*x + ipV hv xv
ipV _ _ = error "Vector of different length"

0 comments on commit a71f907

Please sign in to comment.