Skip to content

Commit

Permalink
Use maxViewWithKey, don't crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ekmett committed Nov 10, 2015
1 parent 74c1ee0 commit 24c43b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Numeric/AD/Internal/Sparse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ mul f@(Sparse _ am) g@(Sparse _ bm) = Sparse (primal f * primal g) (derivs 0 emp
derVal (bin,mif,mig) = (isZero fder || isZero gder, fromIntegral bin * primal fder * primal gder) where
fder = partialS (indices mif) f
gder = partialS (indices mig) g
kMax = fst (IntMap.findMax am) `max` fst (IntMap.findMax bm)
kMax = maybe (-1) (fst.fst) (IntMap.maxViewWithKey am) `max` maybe (-1) (fst.fst) (IntMap.maxViewWithKey bm)

0 comments on commit 24c43b8

Please sign in to comment.