Skip to content

Commit 6470395

Browse files
committed
adds docstrings
1 parent de8831a commit 6470395

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

simple-packaging/src/rosen/example.py

+25-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,35 @@
22
import numpy as np
33

44
def rosen(x):
5-
"""The Rosenbrock function"""
5+
"""Calculates the Rosenbrock function.
6+
7+
Parameters
8+
----------
9+
x : numpy.ndarray
10+
Input to the Rosenbrock function
11+
12+
Returns
13+
-------
14+
numpy.float64
15+
The evaluation of the Rosenbrock function
16+
"""
17+
print('this is new')
618
return sum(100.0 * (x[1:] - x[:-1]**2.0)**2.0 + (1 - x[:-1])**2.0)
719

820

921
def rosen_der(x):
10-
"""Gradient of the Rosenbrock function"""
22+
"""Gradient of the Rosenbrock function
23+
24+
Parameters
25+
----------
26+
x : numpy.ndarray
27+
Input to the Rosenbrock function
28+
29+
Returns
30+
-------
31+
numpy.ndarray
32+
The evaluation of the derivatives of the Rosenbrock function
33+
"""
1134
xm = x[1:-1]
1235
xm_m1 = x[:-2]
1336
xm_p1 = x[2:]

0 commit comments

Comments
 (0)