Reduced row echelon form: Difference between revisions
m
→Row operations, object-oriented code: house-keeping wrap-up: tidy code, add output
(Reduced row echelon form in Yabasic) |
SqrtNegInf (talk | contribs) m (→Row operations, object-oriented code: house-keeping wrap-up: tidy code, add output) |
||
Line 3,613:
=== Row operations, object-oriented code ===
<lang perl6>class Matrix is Array {
method
method unshear-row ( @M: \scale, \r1, \r2 ) { @M[
method reduce-row ( @M: \row, \col ) { @M.unscale-row( @M[row;col], row ) }
method
@M.unscale_row( @M[$row][$col], $row );▼
method reduced_row_echelon_form ( @M: ) {▼
for @M.keys
▲ return if $current_col == $column_count;
}
}
Line 3,654 ⟶ 3,637:
);
$M.reduced-row-echelon-form;
{{out}}
▲say @($_)».fmt(' %4g') for @($M);</lang>
<pre>[ 1 0 0 -8]
[ 0 1 0 1]
[ 0 0 1 -2]</pre>
=={{header|REXX}}==
|