LU decomposition: Difference between revisions
m
→{{header|Perl 6}}: Named matrices more appropriately
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: minor tweaks, remove some superstitious parentheses) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Named matrices more appropriately) |
||
Line 1,868:
)
-> @test {
say-it '
say-it( $_[0], @($_[1]) ) for 'P Matrix', '
}
Line 1,876:
my $n = +@a;
my @P = pivotize @a;
my @
my @L = matrix-ident $n;
my @U = matrix-zero $n;
Line 1,882:
for ^$n -> $j {
if $j >= $i {
@U[$i][$j] = @
} else {
@L[$i][$j] = (@
}
}
}
return @P, @
}
Line 1,936:
}</lang>
{{out}}
<pre>
1 3 5
2 4 7
Line 1,946:
0 0 1
2 4 7
1 3 5
Line 1,961:
0 0 -2
11 9 24 2
1 5 2 6
Line 1,973:
0 0 0 1
11 9 24 2
3 17 18 1
|