Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d737d59

Browse files
jayviusjayvius
authored andcommitted
code cleanup
1 parent 66b20fe commit d737d59

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

npytypes/rational/rational.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
#include <stdint.h>
66
#include <math.h>
7-
//#include <Python/Python.h>
8-
//#include <Python/structmember.h>
9-
#include <Python.h>
10-
#include <structmember.h>
7+
#include <Python/Python.h>
8+
#include <Python/structmember.h>
119
#include <numpy/arrayobject.h>
1210
#include <numpy/ufuncobject.h>
1311

@@ -957,39 +955,42 @@ UNARY_UFUNC(denominator,int64_t,d(x))
957955
static NPY_INLINE void
958956
rational_matrix_multiply(char **args, npy_intp *dimensions, npy_intp *steps)
959957
{
960-
// pointers to data for input and output arrays
958+
/* pointers to data for input and output arrays */
961959
char *ip1 = args[0];
962960
char *ip2 = args[1];
963961
char *op = args[2];
964962

965-
// lengths of core dimensions
963+
/* lengths of core dimensions */
966964
npy_intp dm = dimensions[0];
967965
npy_intp dn = dimensions[1];
968966
npy_intp dp = dimensions[2];
969967

970-
// striding over core dimensions
968+
/* striding over core dimensions */
971969
npy_intp is1_m = steps[0];
972970
npy_intp is1_n = steps[1];
973971
npy_intp is2_n = steps[2];
974972
npy_intp is2_p = steps[3];
975973
npy_intp os_m = steps[4];
976974
npy_intp os_p = steps[5];
977975

978-
// core dimensions counters
976+
/* core dimensions counters */
979977
npy_intp m, n, p;
980978

981-
// calculate dot product for each row/column vector pair
979+
/* calculate dot product for each row/column vector pair */
982980
for (m = 0; m < dm; m++) {
983981
for (p = 0; p < dp; p++) {
984982
npyrational_dot(ip1, is1_n, ip2, is2_n, op, dn, NULL);
985983

984+
/* advance to next column of 2nd input array and output array */
986985
ip2 += is2_p;
987986
op += os_p;
988987
}
989988

989+
/* reset to first column of 2nd input array and output array */
990990
ip2 -= is2_p * p;
991991
op -= os_p * p;
992992

993+
/* advance to next row of 1st input array and output array */
993994
ip1 += is1_m;
994995
op += os_m;
995996
}
@@ -999,18 +1000,18 @@ rational_matrix_multiply(char **args, npy_intp *dimensions, npy_intp *steps)
9991000
static void
10001001
rational_gufunc_matrix_multiply(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func))
10011002
{
1002-
// outer dimensions counter
1003+
/* outer dimensions counter */
10031004
npy_intp N_;
10041005

1005-
// length of flattened outer dimensions
1006+
/* length of flattened outer dimensions */
10061007
npy_intp dN = dimensions[0];
10071008

1008-
// striding over flattened outer dimensions for input and output arrays
1009+
/* striding over flattened outer dimensions for input and output arrays */
10091010
npy_intp s0 = steps[0];
10101011
npy_intp s1 = steps[1];
10111012
npy_intp s2 = steps[2];
10121013

1013-
// loop through outer dimensions, performing matrix multiply on core dimensions for each loop
1014+
/* loop through outer dimensions, performing matrix multiply on core dimensions for each loop */
10141015
for (N_ = 0; N_ < dN; N_++, args[0] += s0, args[1] += s1, args[2] += s2) {
10151016
rational_matrix_multiply(args, dimensions+1, steps+3);
10161017
}

0 commit comments

Comments
 (0)