Jump to content

Reduced row echelon form: Difference between revisions

m
ws/minor fixes
m (→‎{{header|REXX}}: whitespace)
m (ws/minor fixes)
Line 40:
 
=={{header|Ada}}==
 
matrices.ads:
<lang Ada>generic
Line 168 ⟶ 167:
=={{header|ALGOL 68}}==
{{trans|Python}}
 
{{works with|ALGOL 68|Standard - no extensions to language used}}
{{works with|ALGOL 68G|Any - tested with release mk15-0.8b.fc9.i386}}
Line 589 ⟶ 587:
-0 -0 1 -2
</pre>
 
=={{header|C sharp|C#}}==
<lang csharp>using System;
 
Line 651 ⟶ 650:
 
=={{header|Common Lisp}}==
 
Direct implementation of the pseudo-code given.
 
<lang lisp>(defun convert-to-row-echelon-form (matrix)
(let* ((dimensions (array-dimensions matrix))
Line 1,463 ⟶ 1,460:
=={{header|JavaScript}}==
{{works with|SpiderMonkey}} for the <code>print()</code> function.
 
Extends the Matrix class defined at [[Matrix Transpose#JavaScript]]
<lang javascript>// modifies the matrix in-place
Line 1,527 ⟶ 1,523:
0,1,0,1.666666666666667
0,0,1,1</pre>
 
=={{header|Lua}}==
<lang lua>function ToReducedRowEchelonForm ( M )
Line 1,771 ⟶ 1,768:
 
=={{header|Octave}}==
 
<lang octave>A = [ 1, 2, -1, -4; 2, 3, -1, -11; -2, 0, -3, 22];
refA = rref(A);
Line 1,795 ⟶ 1,791:
=={{header|Perl}}==
{{trans|Python}}
 
Note that the function defined here takes an array reference, not an array.
<lang perl>sub rref
Line 1,825 ⟶ 1,820:
=={{header|Perl 6}}==
{{trans|Perl}}
 
{{works with|Rakudo|2010.12}}
 
<lang perl6>sub rref (@m is rw) {
@m or return;
Line 2,083 ⟶ 2,076:
 
=={{header|PHP}}==
{{works with|PHP|5.x}}
'''Translation of:''' {{trans|Java}}
 
<lang php><?php
 
Line 2,165 ⟶ 2,157:
=={{header|Python}}==
This closely follows the pseudocode given. If you want accurate results, use the fractions package.
 
<lang python>def ToReducedRowEchelonForm( M):
if not M: return
Line 2,237 ⟶ 2,228:
print(m)
print(rref(m))</lang>
 
 
=={{header|REXX}}==
Line 2,422 ⟶ 2,412:
0.0 1.0 0.0 1.66666666666667
0.0 0.0 1.0 1.0</pre>
 
=={{header|Sage}}==
{{works with|Sage|4.6.2}}
Line 2,607 ⟶ 2,598:
 
=={{header|TI-89 BASIC}}==
 
<lang ti89b>rref([1,2,–1,–4; 2,3,–1,–11; –2,0,–3,22])</lang>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.