Selects endmember candidates by identifying extreme points along coordinate axes. This function implements a deterministic approach to endmember initialization by finding the minimum and maximum values along each coordinate axis. If insufficient unique extreme points are found, it supplements with random projections.

extreme_coordinates(data, p, random = FALSE)

Arguments

data

A numeric matrix where each row represents a data point and each column represents a coordinate/dimension.

p

Number of endmembers to select.

random

A logical value indicating the selection strategy. If TRUE, selects randomly p points from all dimensions simultaneously. If FALSE (default), iteratively selects extreme points dimension by dimension.

Value

A list containing:

indices

An integer vector of length p containing the row indices of the selected endmember candidates from the input data matrix.

Examples

# Create sample data
set.seed(123)
data("demo_data")

# Select 3 endmembers using deterministic approach
result1 <- extreme_coordinates(demo_data, p=3, random=FALSE)
print(result1$indices)
#> [1] 3 1 5

# Select 3 endmembers using random approach
result2 <- extreme_coordinates(demo_data, p=3, random=TRUE)
print(result2$indices)
#> [1] 5 2 4