R/RcppExports.R

Defines functions dmat connectCPP

Documented in connectCPP dmat

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Connect points in a watershed, accumulating a value as we go
#'
#' The values and ds pixels should match; i.e., values[i] is the value for pixel i, 
#' and dsPixel[i] is that pixel's downstream pixel
#'
#' @param dsPixel A vector of downstream pixels, diPixel[i] is downstream from pixel i
#' @param upstream The id of the upstream point
#' @param downstream The id of the downstream point
#' @param value A vector of values to accumulate
#' @return A list, the first entry is the connected pixels, the second the accumulation
#' up to (but excluding) each pixel
connectCPP <- function(dsPixel, upstream, downstream, value) {
    .Call('_WatershedTools_connectCPP', PACKAGE = 'WatershedTools', dsPixel, upstream, downstream, value)
}

#' Construct a distance matrix between one set of points and another
#'
#' @param x  Set of pixels to which to compute distance
#' @param diPixel  A vector of downstream pixels, diPixel[i] is downstream from pixel i
#' @param nx The total number of pixels in the network
#' @param value The value to be added (e.g., length) when computing distance
#' @return A matrix with dimensions `length(x)` by `nrow(ws)`
dmat <- function(x, dsPixel, nx, value) {
    .Call('_WatershedTools_dmat', PACKAGE = 'WatershedTools', x, dsPixel, nx, value)
}
mtalluto/WatershedTools documentation built on May 21, 2022, 7:49 p.m.