Conjugate transpose: Difference between revisions

Updated both D entries
m (→‎{{header|J}}: format "FORTRAN verification" section)
(Updated both D entries)
Line 316:
}
 
bool isRectangular(T)(in T[][] M) pure nothrow @nogc {
return M.all!(row => row.length == M[0].length);
}
Line 342:
bool areEqual(T)(in Complex!T[][][] matrices, in size_t nBits=20)
pure nothrow {
static bool allSame(U)(in U[] v) pure nothrow @nogc {
return v[1 .. $].all!(c => c == v[0]);
}
 
bool allNearSame(in Complex!T[] v) pure nothrow @nogc {
Complex!Tauto v0 = v[0].Complex!T; // To avoid another cast.
return v[1 .. $].all!(c=> feqrel(v0.re, cast()c.re) >= nBits &&
feqrel(v0.im, cast()c.im) >= nBits);
Line 475:
bool areEqual(T)(in Complex!T[][][] matrices, in size_t nBits=20)
pure nothrow {
static bool allSame(U)(in U[] v) pure nothrow @nogc {
return v[1 .. $].all!(c => c == v[0]);
}
 
bool allNearSame(in Complex!T[] v) pure nothrow @nogc {
Complex!Tauto v0 = v[0].Complex!T; // To avoid another cast.
return v[1 .. $].all!(c=> feqrel(v0.re, cast()c.re) >= nBits &&
feqrel(v0.im, cast()c.im) >= nBits);