-- | Dot product of two `IntMap`s (for internal use)
spDot :: (Num a, Eq a, DIM n) => SparseVector n a -> SparseVector n a -> Maybe a
spDot (SV v) (SV w) = case M.foldl' (+) 0 $ M.intersectionWith (*) v w of
  0 -> Nothing
  x -> Just x
spDot :: (Num a, Eq a, DIM n) => SparseVector n a -> SparseVector n a -> Maybe a
spDot (SV v) (SV w) = case M.foldl' (+) 0 $ M.intersectionWith (*) v w of
  0 -> Nothing
  x -> Just x
spDot (SV v) (SV w) = case M.foldl' (+) 0 $ M.intersectionWith (*) v w of
  0 -> Nothing
  x -> Just x