diagX function

The Other Diagonal Matrix

The Other Diagonal Matrix

Compute the other diagonal identity matrix. The result is basically a fast version of diag(n)[, n:1].

diagX(n)

Arguments

  • n: positive integer.

Returns

a numeric nnn * n matrix with many zeros -- apart from 1s in the other diagonal.

Author(s)

Martin Maechler, 1992.

See Also

diag.

Examples

diagX(4) for(m in 1:5) stopifnot(identical(diagX(m), diag(m)[, m:1, drop = FALSE]))
  • Maintainer: Martin Maechler
  • License: GPL (>= 2)
  • Last published: 2024-11-05