Conjugate transpose: Difference between revisions

Updated D entry
(Updated D entry)
Line 325:
/// some bits of mantissa.
bool areEqual(T)(in Complex!T[][][] matrices, in size_t nBits=20)
/*pure nothrow*/ {
static bool allSame(U)(in U[] v) pure nothrow {
return v[1 .. $].all!(c => c == v[0]);
Line 336:
}
 
/*immutable*/ const x = matrices.map!(m => m.length).array;
if (!allSame(x))
return false;
/*immutable*/ const y = matrices.map!(m => m[0].length).array;
if (!allSame(y))
return false;
Line 350:
 
bool isHermitian(T)(in Complex!T[][] m, in Complex!T[][] ct)
/*pure nothrow*/ {
return [m, ct].areEqual;
}
Line 359:
}
 
auto complexIdentitymatrix(in size_t side) /*pure nothrow*/ {
return iota(side)
.map!(r => side.iota.map!(c => complex(r == c)).array)