File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1029,17 +1029,20 @@ def _sort_sub_list(
1029
1029
1030
1030
"""
1031
1031
ix = np .zeros (indices .size , dtype = int )
1032
- # Loop over all rows (if the matrix is CSR) or columns (if the matrix is CSC).
1032
+ # NOTE: Comments below are given for a CSR matrix. If the matrix is CSC, the roles
1033
+ # of rows and columns are reversed.
1034
+ # Loop over all rows.
1033
1035
for i in range (indptr .size - 1 ):
1034
- # Indices of the current row/column (will be respectively colunms/rows) .
1036
+ # Indices in the sparse storage associated with the current row .
1035
1037
sub_ind = slice (indptr [i ], indptr [i + 1 ])
1036
- # Find the sorting indices of the current row/column. This will be 0-offset.
1038
+ # Find the sorting indices of the columns that are non-zero for this row. This
1039
+ # will be a 0-offset array.
1037
1040
loc_ix = np .argsort (indices [sub_ind ])
1038
1041
# Update the global index array. Adding indptr[i] ensures that the indices have
1039
1042
# the right offset (i.e., they start at the right place in the global index
1040
1043
# array, and not on 0).
1041
1044
ix [sub_ind ] = loc_ix + indptr [i ]
1042
- # Rearrange the indices to be sorted in each row (column) .
1045
+ # Rearrange the indices to be sorted in each row.
1043
1046
indices = indices [ix ]
1044
1047
# Create a mapping from the sorted indices to the original indices.
1045
1048
iv = np .zeros (indices .size , dtype = int )
Original file line number Diff line number Diff line change @@ -130,8 +130,9 @@ def is_ccw_polyline(
130
130
p3 = p3 .reshape ((- 1 , 1 ))
131
131
num_points = p3 .shape [1 ]
132
132
133
- # Compute cross product between p1-p2 and p1-p3. The right-hand rule implies that p3
134
- # is to the left if the cross product is positive.
133
+ # Compute cross product between the vectors running from p1 to, respectively, p2 and
134
+ # p3. The right-hand rule implies that if the cross product is positive, p3 is to
135
+ # the left of the line p1-p2.
135
136
cross_product = (p2 [0 ] - p1 [0 ]) * (p3 [1 ] - p1 [1 ]) - (p2 [1 ] - p1 [1 ]) * (
136
137
p3 [0 ] - p1 [0 ]
137
138
)
You can’t perform that action at this time.
0 commit comments