Flags each row/column index of a square matrix A where the
current index order fails a running dominance test against its
mirror image – TDA's mch (undocumented beyond "check row
and column sum conditions" in its own header; the rule below
is the loop body's, not a named textbook procedure). For each
index i, scanning outward
(j from i+1 to n, then separately from
i-1 down to 1), A[i, j] accumulates into a
running total z and its mirror A[j, i] accumulates
into a running total s; index i is flagged the first
time z falls behind s by more than a small tolerance.
In effect: is A[i, ]'s share of an outward pair always at
least as large, cumulatively, as the corresponding mirrored
entries in A[, i] – a diagnostic for whether the current
1:n ordering already respects that dominance, without
finding a better ordering the way tda_mpz/
tda_mpbl do.
Usage
tda_mch(A, dir = tempfile("tda"))See also
Other matrix algebra:
tda_mcel(),
tda_mcent(),
tda_mcross(),
tda_mdiag(),
tda_mev(),
tda_mevs(),
tda_midf(),
tda_midf1(),
tda_midf2(),
tda_midf3(),
tda_minvs(),
tda_mkmet(),
tda_mkp(),
tda_mmul(),
tda_mnc(),
tda_mnrow(),
tda_mpbl(),
tda_mpfit(),
tda_mpinv(),
tda_mpit(),
tda_mple(),
tda_mpz(),
tda_mscal1(),
tda_msqrtd(),
tda_msvd(),
tda_mwvec()
Examples
# A[i, j] = 5 means i strongly precedes j. Ordered 1 < 2 < 3 the
# rows dominate their columns and every index passes (0); the same
# matrix with the order reversed fails everywhere (1).
A <- matrix(c(0, 5, 5,
1, 0, 5,
1, 1, 0), 3, byrow = TRUE)
tda_mch(A)
#> [1] 0 0 0
tda_mch(A[3:1, 3:1])
#> [1] 1 1 1