## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 7,
  fig.height = 4
)

## ----minimal-example----------------------------------------------------------
library(VNDesign)

chi <- seq(-1, 1, length.out = 15)
theta <- c(0, 1)
kappa <- 0.99 / length(chi)

grad_fun <- function(x, theta) {
  c(1, x)
}

res <- vndesign_Dopt(
  chi = chi,
  theta = theta,
  grad_fun = grad_fun,
  kappa = kappa,
  max_iter = 10,
  verbose = FALSE,
  cov_type = "exp",
  range = 0.4,
  vn_alt = 3,
  vn_lambda = 2,
  return_components = TRUE
)

head(res$xi)

## ----exact-design-------------------------------------------------------------
exact <- exact_design(
  res = res,
  Xchi = res$Xchi,
  Sigma_chi = res$Sigma_chi,
  chi = chi,
  n = 3,
  method = "quantile"
)

exact$points

## ----examples-location, eval=FALSE--------------------------------------------
# system.file("examples", package = "VNDesign")

## ----run-examples-installed, eval=FALSE---------------------------------------
# source(system.file("examples", "example_pazman2003_ex1.R", package = "VNDesign"))
# source(system.file("examples", "example_pazman2022_ex1.R", package = "VNDesign"))
# source(system.file("examples", "example_2D.R", package = "VNDesign"))

## ----run-examples-source, eval=FALSE------------------------------------------
# source("inst/examples/example_pazman2003_ex1.R")
# source("inst/examples/example_pazman2022_ex1.R")
# source("inst/examples/example_2D.R")

## ----quick-check, eval=FALSE--------------------------------------------------
# Sys.setenv(VNDESIGN_EXAMPLE_MAX_ITER = "40")
# Sys.setenv(VNDESIGN_EXAMPLE_PLOTS = "false")

