/
__init__.py
49 lines (37 loc) · 994 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import _adolc
from _adolc import *
from wrapped_functions import *
import cgraph
try:
import sparse
except:
print 'adolc Notice: sparse drivers not available'
try:
import colpack
except:
print 'adolc Notice: colpack drivers not available'
# testing
from numpy.testing import Tester
test = Tester().test
__doc__ = """
Adolc: Algorithmic Differentiation Software
see http://www.math.tu-dresden.de/~adol-c/ for documentation of Adolc
http://github.com/b45ch1/pyadolc/tree/master for more information and documentation of this Python extension
return values are always numpy arrays!
Example Session:
from numpy import *
from adolc import *
def vector_f(x):
\tV=vander(x)
\treturn dot(v,x)
x = arange(5,dtype=float)
ax = adouble(x)
trace_on(0)
independent(ax)
ay = vector_f(ax)
dependent(ay)
trace_off()
x = array([1.,4.,0.,0.,0.])
y = function(0,x)
J = jacobian(0,x)
"""