Skip to content

Commit 1953d8f

Browse files
committed
full pep8 in the modified function
1 parent c1b7779 commit 1953d8f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/sage/matrix/special.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2552,28 +2552,28 @@ def random_rref_matrix(parent, num_pivots):
25522552
# Keep track of the non-pivot columns by using the pivot_index, start at the first column to
25532553
# the right of the initial pivot column, go until the first column to the left of the next
25542554
# pivot column.
2555-
for pivot_index in range(num_pivots-1):
2556-
for non_pivot_column_index in range(pivots[pivot_index]+1, pivots[pivot_index+1]):
2555+
for pivot_index in range(num_pivots - 1):
2556+
for non_pivot_column_index in range(pivots[pivot_index] + 1, pivots[pivot_index + 1]):
25572557
entry_generator1 = pd.RealDistribution("beta", [6, 4])
25582558
# Experimental distribution used to generate the values.
2559-
for non_pivot_column_entry in range(pivot_index+1):
2560-
sign1 = (2*randint(0,1)-1)
2561-
return_matrix[non_pivot_column_entry,non_pivot_column_index]=sign1*int(entry_generator1.get_random_element()*((1-non_pivot_column_entry/return_matrix.ncols())*7))
2559+
for non_pivot_column_entry in range(pivot_index + 1):
2560+
sign1 = (2 * randint(0, 1) - 1)
2561+
return_matrix[non_pivot_column_entry, non_pivot_column_index] = sign1 * int(entry_generator1.get_random_element() * ((1 - non_pivot_column_entry / return_matrix.ncols()) * 7))
25622562
# Use index to fill entries of the columns to the right of the last pivot column.
2563-
for rest_non_pivot_column in range(pivots[num_pivots-1]+1,num_col):
2564-
entry_generator2=pd.RealDistribution("beta",[2.6,4])
2563+
for rest_non_pivot_column in range(pivots[num_pivots - 1] + 1, num_col):
2564+
entry_generator2 = pd.RealDistribution("beta", [2.6, 4])
25652565
# experimental distribution to generate small values.
25662566
for rest_entries in range(num_pivots):
2567-
sign2=(2*randint(0,1)-1)
2568-
return_matrix[rest_entries,rest_non_pivot_column]=sign2*int(entry_generator2.get_random_element()*5)
2567+
sign2 = (2 * randint(0, 1) - 1)
2568+
return_matrix[rest_entries, rest_non_pivot_column] = sign2 * int(entry_generator2.get_random_element() * 5)
25692569
else:
2570-
for pivot_index in range(num_pivots-1):
2571-
for non_pivot_column_index in range(pivots[pivot_index]+1,pivots[pivot_index+1]):
2572-
for non_pivot_column_entry in range(pivot_index+1):
2573-
return_matrix[non_pivot_column_entry,non_pivot_column_index]=ring.random_element()
2574-
for rest_non_pivot_column in range(pivots[num_pivots-1]+1,num_col):
2570+
for pivot_index in range(num_pivots - 1):
2571+
for non_pivot_column_index in range(pivots[pivot_index] + 1, pivots[pivot_index + 1]):
2572+
for non_pivot_column_entry in range(pivot_index + 1):
2573+
return_matrix[non_pivot_column_entry, non_pivot_column_index] = ring.random_element()
2574+
for rest_non_pivot_column in range(pivots[num_pivots - 1] + 1, num_col):
25752575
for rest_entries in range(num_pivots):
2576-
return_matrix[rest_entries,rest_non_pivot_column]=ring.random_element()
2576+
return_matrix[rest_entries, rest_non_pivot_column] = ring.random_element()
25772577
return return_matrix
25782578

25792579

0 commit comments

Comments
 (0)