R/extendr-wrappers.R

Defines functions core_version_rs allocate_multi_rs cube_rs spatial_balance_rs two_stage_rs dual_frame_rs systematic_replicates_rs hilbert_order_rs allocate_rs srs_variance_rs local_mean_variance_rs ht_total_rs local_pivotal_rs inclusion_probabilities_rs route_rs travel_matrix_rs

# Generated by extendr: Do not edit by hand
# nolint start

#' @usage NULL
#' @useDynLib fieldopt, .registration = TRUE
NULL

#' Travel matrix from coordinates: `method` is "haversine" (lat, lon in
#' degrees, kilometres) or "euclidean". Returns the row-major n x n vector.
#' @noRd
travel_matrix_rs <- function(a, b, method) .Call(wrap__travel_matrix_rs, a, b, method)

#' Routing. `matrix` is the row-major n x n travel matrix; `depots` and
#' `units` are 0-based indices; `routes_available` has one entry per depot (negative for no
#' limit); `fixed_cost` is the cost of a route in travel units; `service` and `demand` have
#' one entry per node (or none).
#' @noRd
route_rs <- function(matrix, n, depots, routes_available, fixed_cost, units, service, demand, max_length, max_stops, capacity, iterations, time_limit, certify, alpha, seed) .Call(wrap__route_rs, matrix, n, depots, routes_available, fixed_cost, units, service, demand, max_length, max_stops, capacity, iterations, time_limit, certify, alpha, seed)

#' Size-proportional inclusion probabilities summing to `n`.
#' @noRd
inclusion_probabilities_rs <- function(size, n) .Call(wrap__inclusion_probabilities_rs, size, n)

#' Local pivotal method 2 on an n x d row-major coordinate matrix.
#' @noRd
local_pivotal_rs <- function(coords, d, pi, seed) .Call(wrap__local_pivotal_rs, coords, d, pi, seed)

#' Horvitz-Thompson total.
#' @noRd
ht_total_rs <- function(y, pi, sampled) .Call(wrap__ht_total_rs, y, pi, sampled)

#' Local-mean variance estimator of the Horvitz-Thompson total.
#' @noRd
local_mean_variance_rs <- function(coords, d, y, pi, sampled, k) .Call(wrap__local_mean_variance_rs, coords, d, y, pi, sampled, k)

#' Simple-random-sampling variance of the total.
#' @noRd
srs_variance_rs <- function(y, sampled, big_n) .Call(wrap__srs_variance_rs, y, sampled, big_n)

#' Cost-aware allocation: `mode` is "variance" (target variance) or "budget".
#' @noRd
allocate_rs <- function(size, sd, cost, target, mode) .Call(wrap__allocate_rs, size, sd, cost, target, mode)

#' Order of the units (0-based) along a Hilbert curve; `coords` is n x 2 row-major.
#' @noRd
hilbert_order_rs <- function(coords, bits) .Call(wrap__hilbert_order_rs, coords, bits)

#' Systematic PPS sampling along `order` (0-based) as independent replicates;
#' returns the n x r indicator matrix, row-major.
#' @noRd
systematic_replicates_rs <- function(order, pi, replicates, seed) .Call(wrap__systematic_replicates_rs, order, pi, replicates, seed)

#' Hartley dual-frame allocation. `theta` < 0 means optimise.
#' @noRd
dual_frame_rs <- function(size, mean, sd, cost_a, cost_b, deff_a, deff_b, theta, target, mode) .Call(wrap__dual_frame_rs, size, mean, sd, cost_a, cost_b, deff_a, deff_b, theta, target, mode)

#' Two-stage allocation; `target` is a variance of the mean ("variance") or a budget.
#' @noRd
two_stage_rs <- function(n_primary, m_secondary, s2_between, s2_within, c1, c2, target, mode) .Call(wrap__two_stage_rs, n_primary, m_secondary, s2_between, s2_within, c1, c2, target, mode)

#' Voronoi measure of spatial balance on an n x d row-major coordinate matrix.
#' @noRd
spatial_balance_rs <- function(coords, d, pi, sampled) .Call(wrap__spatial_balance_rs, coords, d, pi, sampled)

#' Cube sampling balanced on the n x p row-major matrix `x`.
#' @noRd
cube_rs <- function(x, p, pi, seed) .Call(wrap__cube_rs, x, p, pi, seed)

#' Multivariate allocation: `sd` is H x J row-major, `targets` one variance per variable.
#' @noRd
allocate_multi_rs <- function(size, cost, sd, targets) .Call(wrap__allocate_multi_rs, size, cost, sd, targets)

#' Version of the engine crate.
#' @noRd
core_version_rs <- function() .Call(wrap__core_version_rs)

# nolint end

Try the fieldopt package in your browser

Any scripts or data that you put into this service are public.

fieldopt documentation built on Oct. 22, 2026, 1:07 a.m.