June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -20,13 +20,11 @@ sub rref ($m is copy) {
return unless $m;
my ($lead, $rows, $cols) = 0, +$m, +$m[0];
# Trim off over specified rows if they exist.
# Not strictly necessary, but can save a lot of
# redundant calculations. [remove until debugged]
# if $rows >= $cols {
# $m = trim_system($m);
# $rows = +$m;
# }
# Trim off over specified rows if they exist, for efficiency
if $rows >= $cols {
$m = trim_system($m);
$rows = +$m;
}
for ^$rows -> $r {
$lead < $cols or return $m;
@ -58,10 +56,10 @@ sub rref ($m is copy) {
my ($vars, @t) = +$m[0]-1, ();
for ^$vars -> $lead {
for ^$m -> $row {
@t.push( $m.splice( $row, 1 ) ) and last if $m[$row][$lead];
@t.push: | $m.splice( $row, 1 ) and last if $m[$row][$lead];
}
}
while (+@t < $vars) and +$m { @t.push( $m.splice( 0, 1 ) ) };
while (+@t < $vars) and +$m { @t.push: $m.splice( 0, 1 ) };
return @t;
}
}