summaryrefslogtreecommitdiff
path: root/numpy/core/src/umath/loops.c.src
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-03-12 02:33:38 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-12-12 20:58:08 -0800
commit7ab0f15250f5965a1e47e419597ca358e9b31a75 (patch)
tree4ec18b0c07a65bc607360bbb2e7cfc699a136348 /numpy/core/src/umath/loops.c.src
parent356b481bcf8783a4ecca6aaa7d7712e347c16101 (diff)
downloadpython-numpy-7ab0f15250f5965a1e47e419597ca358e9b31a75.tar.gz
python-numpy-7ab0f15250f5965a1e47e419597ca358e9b31a75.tar.bz2
python-numpy-7ab0f15250f5965a1e47e419597ca358e9b31a75.zip
ENH: Add gcd and lcm ufuncs
Fixes #8772
Diffstat (limited to 'numpy/core/src/umath/loops.c.src')
-rw-r--r--numpy/core/src/umath/loops.c.src30
1 files changed, 30 insertions, 0 deletions
diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src
index 789717555..8791788d0 100644
--- a/numpy/core/src/umath/loops.c.src
+++ b/numpy/core/src/umath/loops.c.src
@@ -1041,6 +1041,7 @@ NPY_NO_EXPORT void
/**begin repeat
* #TYPE = BYTE, SHORT, INT, LONG, LONGLONG#
* #type = npy_byte, npy_short, npy_int, npy_long, npy_longlong#
+ * #c = ,,,l,ll#
*/
NPY_NO_EXPORT NPY_GCC_OPT_3 void
@@ -1132,11 +1133,26 @@ NPY_NO_EXPORT void
}
}
+/**begin repeat1
+ * #kind = gcd, lcm#
+ **/
+NPY_NO_EXPORT void
+@TYPE@_@kind@(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func))
+{
+ BINARY_LOOP {
+ const @type@ in1 = *(@type@ *)ip1;
+ const @type@ in2 = *(@type@ *)ip2;
+ *((@type@ *)op1) = npy_@kind@@c@(in1, in2);
+ }
+}
+/**end repeat1**/
+
/**end repeat**/
/**begin repeat
* #TYPE = UBYTE, USHORT, UINT, ULONG, ULONGLONG#
* #type = npy_ubyte, npy_ushort, npy_uint, npy_ulong, npy_ulonglong#
+ * #c = u,u,u,ul,ull#
*/
NPY_NO_EXPORT void
@@ -1204,6 +1220,20 @@ NPY_NO_EXPORT void
}
}
+/**begin repeat1
+ * #kind = gcd, lcm#
+ **/
+NPY_NO_EXPORT void
+@TYPE@_@kind@(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func))
+{
+ BINARY_LOOP {
+ const @type@ in1 = *(@type@ *)ip1;
+ const @type@ in2 = *(@type@ *)ip2;
+ *((@type@ *)op1) = npy_@kind@@c@(in1, in2);
+ }
+}
+/**end repeat1**/
+
/**end repeat**/
/*