File tree 1 file changed +25
-2
lines changed
simple-packaging/src/rosen
1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 2
2
import numpy as np
3
3
4
4
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' )
6
18
return sum (100.0 * (x [1 :] - x [:- 1 ]** 2.0 )** 2.0 + (1 - x [:- 1 ])** 2.0 )
7
19
8
20
9
21
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
+ """
11
34
xm = x [1 :- 1 ]
12
35
xm_m1 = x [:- 2 ]
13
36
xm_p1 = x [2 :]
You can’t perform that action at this time.
0 commit comments