Volume of simples

simplex_volume(data, indices = seq_len(nrow(data)), factorial = TRUE)

Arguments

data

matrix with coordinates in rows

indices

indices of the ncol(data) + 1 vertex points. Defaults to all rows.

factorial

logical indicating whether proper volumes (i.e. not only the determinant, but actually taking into account the proper 1 / n! prefactor)

Value

volume of the simplex

Examples

data <- prcomp(laser)$x[, 1:2]
plot(data, pch = 19, col = matlab.dark.palette(nrow(data)))
lines(data[c(1, 84, 50, 1), ])


simplex_volume(data, indices = c(1, 84, 50))
#> [1] 212839039