Function trx::write_positions_as_dtype

Function Documentation

void trx::write_positions_as_dtype(const AnyTrxFile &source, TrxScalarType target_dtype, const std::string &out_path, size_t chunk_bytes = 64 * 1024 * 1024)

Convert and write positions from source to out_path in target_dtype.

Reads positions chunk-by-chunk (each chunk at most chunk_bytes bytes of source data) and writes converted raw bytes to out_path. Peak transient memory is bounded to roughly one source chunk plus one destination chunk — independent of file size.

Parameters:
  • source – TRX file whose positions will be converted.

  • target_dtype – Desired output scalar type.

  • out_path – Path to write the raw converted positions binary.

  • chunk_bytes – Bytes of source data per conversion pass (default 64 MiB).