ActiveSubspaceMethods

Documentation for ActiveSubspaceMethods.

ActiveSubspaceMethods.ADFunctionWrapperMethod
ActiveSubspaceMethods.ADFunctionWrapper(fcn, d, backend; [init_space])

Wraps the evaluation of a pure Julia function fcn to use automatic differentiation.

Arguments

  • fcn(z::AbstractVector)::Float64 function we want to reduce dimension of
  • d::Int dimension of input
  • backend::ADTypes.AbstractADType Backend for autodiff (e.g., ReverseDiff, Enzyme, etc.). Must be explicitly installed!
  • init_space::Vector values to prepare the memory spaces for autodiff, default zeros(d).
source
ActiveSubspaceMethods.GaussianizedUniformInputFunctionType
GaussianizedUniformInputFunction([f0], f1!, bounds; [test_eval])

Take a function that we wish to minimize L2 error w.r.t. uniform measure and transform it to be w.r.t. GaussianizedUniformInputFunction

Arguments

  • f0(z)::Float64 Returns function eval at z. Will default to using f1! if not provided
  • f1!(grad, z)::Float64 Returns same function eval at z and puts function gradient at z into grad
  • bounds::AbstractVector{<:NTuple{2}} A sequence of (lower, upper) bounds that is as long as the number of inputs.
  • test_eval::Bool Whether to test function eval when constructing this functor, default true.
source
ActiveSubspaceMethods.MCActiveSubspacesInputMethod
MCActiveSubspacesInput(eval_grad_fcn!, d, N; [rand_fcn, rng, corrected])

Construct input for an active subspace method from a function (with inplace gradient) and Monte Carlo integration.

Arguments

  • eval_grad_fcn!(grad, z) Returns real-valued function and puts gradient of this function in grad
  • d::Int dimension
  • N::Int number of samples
  • rand_fcn(rng, d, N) function to sample random numbers using rng, default randn
  • rng::AbstractRNG Random number generator
  • corrected::Bool Use corrected Monte Carlo estimators downstream, default true
source
ActiveSubspaceMethods.QuadratureActiveSubspacesInputMethod
QuadratureActiveSubspacesInput(eval_grad_fcn!, d, tensor_order, [quad_fcn1d, verbose])

Construct input for an active subspace method from a function (with inplace gradient) and Monte Carlo integration.

Arguments

  • eval_grad_fcn!(grad, z) Returns real-valued function and puts gradient of this function in grad
  • d::Int dimension
  • tensor_order::Int number of one-dimensional quadrature points, will give tensor_order^d quadrature points
  • quad_fcn1d(order)::Tuple{Vector,Vector} One-dimensional quadrature, defaults to normalized Gauss-Hermite
  • verbose::Bool Whether to print the number of quadrature points.
source
ActiveSubspaceMethods.QuadratureActiveSubspacesInputMethod
QuadratureActiveSubspacesInput(eval_grad_fcn!, d, tensor_order, [quad_fcn1d, verbose])

Construct input for an active subspace method from a function (with inplace gradient) and Monte Carlo integration.

Arguments

  • eval_grad_fcn!(grad, z) Returns real-valued function and puts gradient of this function in grad
  • tensor_orders::NTuple{d,Int} number of one-dimensional quadrature points for each dimension, will give number of quad points as product of these orders
  • quad_fcn1d(order)::Tuple{Vector,Vector} One-dimensional quadrature, defaults to normalized Gauss-Hermite
  • verbose::Bool Whether to print the number of quadrature points.
source
ActiveSubspaceMethods.nested_MC_errMethod
nested_MC_err(fcn_eval, U_r, U_perp, N_inner, N_outer; [rand_fcn, rng])

Calculates the conditional variance of subspaces using a pick-and-freeze nested MC method.

Arguments

  • fcn_eval(z::Vector)::Float64 Evaluation of function taking in length-d vector
  • U_r a size (d,r) orthogonal matrix
  • U_perp a size (d,d-r) orthogonal matrix
  • N_inner::Int number of inner Monte Carlo samples
  • N_outer::Int number of outer Monte Carlo samples
  • rand_fcn(rng,k)::Vector{Float64} sampler of random numbers, default randn
  • rng::AbstractRNG random number generator
source