Anonymous user
LU decomposition: Difference between revisions
Updated D entry
m (Fixed a small error in the pivotize code: initially would keep a zero on the main diagonal in favor of a negative number (I am not very familiar with D syntax but I believe this was done correctly)) |
(Updated D entry) |
||
Line 684:
{{trans|Common Lisp}}
<lang d>import std.stdio, std.algorithm, std.typecons, std.numeric,
std.array, std.conv, std.string, std.range
bool isRectangular(T)(in T[][] m) pure nothrow {
Line 724:
foreach (immutable i; 0 .. n) {
// immutable row = iota(i, n).reduce!(max!(j => m[j][i]));
T maxm =
size_t row = i;
foreach (immutable j; i .. n)
if
maxm = m[j][i];
row = j;
Line 784:
[2.0, 5, 7, 1]];
foreach (m; [a, b])
writefln(f, lu(m).tupleof);
|