1
+ {-# LANGUAGE CPP #-}
1
2
{-# LANGUAGE FlexibleContexts #-}
2
3
{-# LANGUAGE FlexibleInstances #-}
3
4
{-# LANGUAGE RankNTypes #-}
45
46
module Numeric.Optimization.AD
46
47
(
47
48
-- * Problem specification
49
+ #if MIN_VERSION_ad(4,5,0)
48
50
UsingDense (.. )
49
- , UsingForward (.. )
51
+ ,
52
+ #endif
53
+ UsingForward (.. )
50
54
, UsingKahn (.. )
51
55
, UsingReverse (.. )
52
56
, UsingSparse (.. )
53
57
54
58
-- * Utilities and Re-exports
55
59
, AD
56
60
, auto
61
+ #if MIN_VERSION_ad(4,5,0)
57
62
, Dense
63
+ #endif
58
64
, Forward
59
65
, Kahn
60
66
, Reverse
@@ -74,8 +80,10 @@ import qualified Data.Vector.Generic as VG
74
80
import qualified Data.Vector.Generic.Mutable as VGM
75
81
import Numeric.AD (AD , auto )
76
82
import Numeric.AD.Internal.Reverse (Tape )
83
+ #if MIN_VERSION_ad(4,5,0)
77
84
import Numeric.AD.Mode.Dense (Dense )
78
85
import qualified Numeric.AD.Mode.Dense as Dense
86
+ #endif
79
87
import Numeric.AD.Mode.Forward (Forward )
80
88
import qualified Numeric.AD.Mode.Forward as Forward
81
89
import Numeric.AD.Mode.Kahn (Kahn )
@@ -89,6 +97,8 @@ import Numeric.Optimization
89
97
90
98
-- ------------------------------------------------------------------------
91
99
100
+ #if MIN_VERSION_ad(4,5,0)
101
+
92
102
-- | Type for defining function and its gradient using automatic differentiation
93
103
-- provided by "Numeric.AD.Mode.Dense".
94
104
--
@@ -130,6 +140,8 @@ instance Traversable f => Optionally (HasGrad (UsingDense f)) where
130
140
instance Optionally (HasHessian (UsingDense f )) where
131
141
optionalDict = Nothing
132
142
143
+ #endif
144
+
133
145
-- ------------------------------------------------------------------------
134
146
135
147
-- | Type for defining function and its gradient using automatic differentiation
0 commit comments