Skip to content

Commit 4ed540f

Browse files
committed
define UsingDense only on ad >=4.5
1 parent 4cd7071 commit 4ed540f

File tree

1 file changed

+13
-1
lines changed
  • numeric-optimization-ad/src/Numeric/Optimization

1 file changed

+13
-1
lines changed

numeric-optimization-ad/src/Numeric/Optimization/AD.hs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE FlexibleContexts #-}
23
{-# LANGUAGE FlexibleInstances #-}
34
{-# LANGUAGE RankNTypes #-}
@@ -45,16 +46,21 @@
4546
module Numeric.Optimization.AD
4647
(
4748
-- * Problem specification
49+
#if MIN_VERSION_ad(4,5,0)
4850
UsingDense (..)
49-
, UsingForward (..)
51+
,
52+
#endif
53+
UsingForward (..)
5054
, UsingKahn (..)
5155
, UsingReverse (..)
5256
, UsingSparse (..)
5357

5458
-- * Utilities and Re-exports
5559
, AD
5660
, auto
61+
#if MIN_VERSION_ad(4,5,0)
5762
, Dense
63+
#endif
5864
, Forward
5965
, Kahn
6066
, Reverse
@@ -74,8 +80,10 @@ import qualified Data.Vector.Generic as VG
7480
import qualified Data.Vector.Generic.Mutable as VGM
7581
import Numeric.AD (AD, auto)
7682
import Numeric.AD.Internal.Reverse (Tape)
83+
#if MIN_VERSION_ad(4,5,0)
7784
import Numeric.AD.Mode.Dense (Dense)
7885
import qualified Numeric.AD.Mode.Dense as Dense
86+
#endif
7987
import Numeric.AD.Mode.Forward (Forward)
8088
import qualified Numeric.AD.Mode.Forward as Forward
8189
import Numeric.AD.Mode.Kahn (Kahn)
@@ -89,6 +97,8 @@ import Numeric.Optimization
8997

9098
-- ------------------------------------------------------------------------
9199

100+
#if MIN_VERSION_ad(4,5,0)
101+
92102
-- | Type for defining function and its gradient using automatic differentiation
93103
-- provided by "Numeric.AD.Mode.Dense".
94104
--
@@ -130,6 +140,8 @@ instance Traversable f => Optionally (HasGrad (UsingDense f)) where
130140
instance Optionally (HasHessian (UsingDense f)) where
131141
optionalDict = Nothing
132142

143+
#endif
144+
133145
-- ------------------------------------------------------------------------
134146

135147
-- | Type for defining function and its gradient using automatic differentiation

0 commit comments

Comments
 (0)