Deconvolution/1D: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: bug in 'trim_system', omit) |
|||
Line 662: | Line 662: | ||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
{{works with|Rakudo 2015-09-07}} |
{{works with|Rakudo 2015-09-07}} |
||
<!-- SqrtNegInf: 'trim_system' was causing the calc. to fail, so skip for now --> |
|||
Translation of Python, using a modified version of the Reduced Row Echelon Form subroutine <code>rref()</code> from [[Reduced row echelon form#Perl 6|here]]. |
Translation of Python, using a modified version of the Reduced Row Echelon Form subroutine <code>rref()</code> from [[Reduced row echelon form#Perl 6|here]]. |
||
Line 686: | Line 687: | ||
return unless $m; |
return unless $m; |
||
my ($lead, $rows, $cols) = 0, +$m, +$m[0]; |
my ($lead, $rows, $cols) = 0, +$m, +$m[0]; |
||
# Trim off over specified rows if they exist. |
# Trim off over specified rows if they exist. |
||
# Not strictly necessary, but can save a lot of |
# Not strictly necessary, but can save a lot of |
||
# redundant calculations. |
# redundant calculations. [remove until debugged] |
||
if $rows >= $cols { |
# if $rows >= $cols { |
||
$m = trim_system($m); |
# $m = trim_system($m); |
||
$rows = +$m; |
# $rows = +$m; |
||
} |
# } |
||
for ^$rows -> $r { |
for ^$rows -> $r { |
||
$lead < $cols or return $m; |
$lead < $cols or return $m; |