R/checkers.R

Defines functions check_active_dims

check_active_dims <- function(columns, lengthscales) {
  columns <- as.integer(columns)

  columns_are_positive_int <- all(columns >= 1)
  if (!columns_are_positive_int) {
    cli::cli_abort(
      c(
        "Columns must be a vector of positive integers",
        "But we see columns as {columns}"
      )
    )
  }

  column_length_match_kernel_length <- length(columns) != length(lengthscales)
  if (column_length_match_kernel_length) {
    cli::cli_abort(
      c(
        "Columns has length: {.val {length(columns)}}, but the kernel has \\
         dimension: {.val {length(lengthscales)}}"
      )
    )
  }

  columns - 1L
}

Try the greta.gp package in your browser

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

greta.gp documentation built on April 4, 2025, 2:20 a.m.