summaryrefslogtreecommitdiff
path: root/docs/examples/userguide/numpy_tutorial/compute_py.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-02-15 20:35:23 +0100
committerStefan Behnel <stefan_ml@behnel.de>2019-02-15 20:47:04 +0100
commitb67e556756c82f99d633b82cc4652d0dfcdce3f7 (patch)
tree2c14538d202c1f8eeaa84a774da0cb7fc2e778a4 /docs/examples/userguide/numpy_tutorial/compute_py.py
parente6a49ace494660793c3e8cd8115277784108dc40 (diff)
downloadcython-b67e556756c82f99d633b82cc4652d0dfcdce3f7.tar.gz
Fix line endings.
Diffstat (limited to 'docs/examples/userguide/numpy_tutorial/compute_py.py')
-rw-r--r--docs/examples/userguide/numpy_tutorial/compute_py.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/docs/examples/userguide/numpy_tutorial/compute_py.py b/docs/examples/userguide/numpy_tutorial/compute_py.py
index 00bcf244c..4a5f90b4d 100644
--- a/docs/examples/userguide/numpy_tutorial/compute_py.py
+++ b/docs/examples/userguide/numpy_tutorial/compute_py.py
@@ -1,28 +1,28 @@
-import numpy as np
-
-
-def clip(a, min_value, max_value):
- return min(max(a, min_value), max_value)
-
-
-def compute(array_1, array_2, a, b, c):
- """
- This function must implement the formula
- np.clip(array_1, 2, 10) * a + array_2 * b + c
-
- array_1 and array_2 are 2D.
- """
- x_max = array_1.shape[0]
- y_max = array_1.shape[1]
-
- assert array_1.shape == array_2.shape
-
- result = np.zeros((x_max, y_max), dtype=array_1.dtype)
-
- for x in range(x_max):
- for y in range(y_max):
- tmp = clip(array_1[x, y], 2, 10)
- tmp = tmp * a + array_2[x, y] * b
- result[x, y] = tmp + c
-
- return result
+import numpy as np
+
+
+def clip(a, min_value, max_value):
+ return min(max(a, min_value), max_value)
+
+
+def compute(array_1, array_2, a, b, c):
+ """
+ This function must implement the formula
+ np.clip(array_1, 2, 10) * a + array_2 * b + c
+
+ array_1 and array_2 are 2D.
+ """
+ x_max = array_1.shape[0]
+ y_max = array_1.shape[1]
+
+ assert array_1.shape == array_2.shape
+
+ result = np.zeros((x_max, y_max), dtype=array_1.dtype)
+
+ for x in range(x_max):
+ for y in range(y_max):
+ tmp = clip(array_1[x, y], 2, 10)
+ tmp = tmp * a + array_2[x, y] * b
+ result[x, y] = tmp + c
+
+ return result