Test for Triangularity in a Matrix

DESCRIPTION:
Either tests whether or not a Matrix is lower or upper triangular, or else gives a metric by which such a test can be made.

USAGE:
is.LowerTriangular(x, tol)
is.UpperTriangular(x, tol)
LowerTriangular.test(x)
UpperTriangular.test(x)

REQUIRED ARGUMENTS:
x:
an numeric or complex matrix.

OPTIONAL ARGUMENTS:
tol:
tolerance for the maximum modulus of the elements in the upper or lower triangle of the matrix.

VALUE:
For is.LowerTriangular and is.UpperTriangular, a logical value is returned. If tol is missing, this value is equivalent to inherits(x, "LowerTriangular") or inherits(x, "UpperTriangular"). Otherwise the result is TRUE if the maximum modulus for the elements in the upper (repectively, lower) triangle is less than or equal to tol and FALSE otherwise. For LowerTriangular.test and UpperTriangular.test, the maximum modulus for the in the upper (respectively, lower) triangle is returned.

EXAMPLES:
x <- Matrix(1:9,3,3)
x[row(x) > col(x)] <- 0
is.UpperTriangular(x)
# [1] F
is.UpperTriangular(x, tol = 0)
# [1] T
UpperTriangular.test(x)
# [1] 0