Skip to contents

Selects rows without loading a file-backed matrix into RAM. Reservoir sampling scans the row count and then reads the source sequentially. Random sampling takes work proportional to the landmark count and reads only sampled rows; use it when random access is efficient. Both write selected rows in source order to a row-major float32 .f32 file. Returned row identifiers are one-based doubles, including above 2^31.

Usage

massive_select_landmarks(
  x,
  landmarks,
  output,
  seed = 42L,
  chunk_rows = NULL,
  memory_limit = "512MB",
  landmark_method = c("reservoir", "random")
)

Arguments

x

A massive_matrix() descriptor.

landmarks

Number of rows to select.

output

New .f32 output path.

seed

Integer random seed.

chunk_rows

Maximum source rows read per block.

memory_limit

Conservative RAM budget for sampling buffers.

landmark_method

"reservoir" or "random".

Value

A list with data, a file-backed landmark matrix descriptor; indices, sorted one-based source rows; and resource metadata.