Check whether a matrix is reciprocal. This is, whether the entrywise product of itself with its transpose (Hadamard product) is 1 for all its elements.

is.reciprocal(x)

Arguments

x

square numeric matrix or number

Value

logical

Examples

Xf <- matrix(1:16, 4, 4) Xr <- Xf Xr[upper.tri(Xf)] <- 1/t(Xf)[upper.tri(Xf)] diag(Xr) <- 1 mapMCDA:::is.reciprocal(Xf) # FALSE
#> [1] FALSE
mapMCDA:::is.reciprocal(Xr) # TRUE
#> [1] TRUE