Map Factory#

namespace MapFactory#

Namespace containing factory methods for constructing triangular maps and map components.

Example usage:

// First, set options defining the paramterization
MapOptions options;
options.basisType = BasisTypes::ProbabilistHermite; // Optional. Default = BasisTypes::ProbabilistHermite
options.posFuncType = PosFuncTypes::SoftPlus;       // Optional. Default = PosFuncTypes::SoftPlus
options.quadType = QuadTypes::AdaptiveSimpson;      // Optional. Default = QuadTypes::AdaptiveSimpson
options.quadAbsTol = 1e-6;                          // Optional. Default = 1e-6
options.quadRelTol = 1e-6;                          // Optional. Default = 1e-6
options.quadMaxSub = 10;                            // Optional. Default = 30
options.contDeriv = true;                           // Optional. Default = true
options.nugget = 1e-4;                              // Optional. Default = 0.0

// Create a triangular map with these options
unsigned int inDim = 4;
unsigned int outDim = 3;
unsigned int totalOrder = 3;
auto map = MapFactory::CreateTriangular<Kokkos::HostSpace>(inDim, outDim, totalOrder, options);

Functions

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateComponent(FixedMultiIndexSet<MemorySpace> const &mset, MapOptions options = MapOptions())#
Parameters:

mset – The multiindex set specifying which terms should be used in the multivariate expansion.

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSingleEntryMap(unsigned int dim, unsigned int activeInd, std::shared_ptr<ConditionalMapBase<MemorySpace>> const &comp)#

Creates a square triangular map that is an identity in all but one output dimension.

Constructs a “Single entry” map, which is an identity for all but one output dimension. The active output dimension is defined by a given component.

Given a dimension \(d\), an active index \(i\), and a real-valued map \(f:\mathbb{R}^d\rightarrow\mathbb{R}\), this function creates a map \(T:\mathbb{R}^d\rightarrow\mathbb{R}^d\) such that \(T_j(x) = x_j\) for all \(j\neq i\) and \(T_i(x) = f(x)\).

Parameters:
  • dim – The dimension of the map.

  • activeInd – The index of the component to be non-identity.

  • comp – The component placed the activeInd.

  • dim – The dimension of the mapping

  • activeInd – Which output dimension is “active”, i.e., not identity

  • comp – The component that will be used for the active output dimension.

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateTriangular(unsigned int inputDim, unsigned int outputDim, unsigned int totalOrder, MapOptions options = MapOptions())#

Constructs a triangular map with MonotoneComponents for each block. A total order multiindex set is used to define the MonotoneComponent.

For more control over the individual components, consider constructing components with MapFactory::CreateComponent function and then manually constructing and instance of the TriangularMap class.

Parameters:
  • inputDim – The dimension of the input to this map. Will be the number of inputs passed to the last component of the triangular map.

  • outputDim – The output dimension of the map. Note that this must be less than or equal to the input dimension.

  • totalOrder – The total order used to define the parameterization of each MonotoneComponent.

  • options – Additional options that will be passed on to CreateComponent to construct each MonotoneComponent.

template<typename MemorySpace>
std::shared_ptr<ParameterizedFunctionBase<MemorySpace>> CreateExpansion(unsigned int outputDim, FixedMultiIndexSet<MemorySpace> const &mset, MapOptions options = MapOptions())#

Constructs a (generally) non-monotone multivariate expansion.

Parameters:
  • outputDim – The output dimension of the expansion. Each output will be defined by the same multiindex set but will have different coefficients.

  • mset – The multiindex set specifying which terms should be used in the multivariate expansion.

  • options – Options specifying the 1d basis functions used in the parameterization.

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidComponent(unsigned int inputDim, unsigned int offDiagOrder, unsigned int crossOrder, StridedVector<const double, MemorySpace> centers, MapOptions opts)#

Create a RectifiedMultivariateExpansion using sigmoids.

Using the parameters described in opts, this function creates a “rectified multivariate expansion” object that uses a collection of sigmoid functions to map the input space to the output space. The pertinent options are

  • opts.basisType : The type of basis function to use in the expansion for the first \(d-1\) inputs

  • opts.posFuncType : The type of positive function to use in the rectified basis MultivariateExpansionWorker

  • opts.edgeWidth : The width of the “edge terms” on the last input Sigmoid1d

  • opts.sigmoidType : The type of sigmoid function to use in the expansion Sigmoid1d

This is only creating a scalar-valued function; to create a map, use TriangularMap function.

Template Parameters:

MemorySpace

Parameters:
  • inputDim – Dimension of the input space to component

  • offDiagOrder – Maximum value of sum(alpha_{1:n-1}) when alpha_n=0. i.e., the total order of terms in the multiindex set that only contain nonzero values for off diagonal inputs.

  • crossOrder – Maximum value of sum(alpha_{1:n-1}) terms when alpha_n>0. This parameter controls the complexity of interactions between off-diagonal components and the diagonal component.

  • centers – Set of centers of the sigmoids. Should be length \(2 + (k_1 + k_2 + ... + k_L)\) where \(L\) is the maximum order of the map component in the last input.

  • opts

Returns:

std::shared_ptr<ConditionalMapBase<MemorySpace>>

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidComponent(unsigned int inputDim, unsigned int totalOrder, StridedVector<const double, MemorySpace> centers, MapOptions opts)#

Same as other CreateSigmoidComponent function, but offDiagOrder and crossOrder are both set to the value of totalOrder.

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidComponent(unsigned int inputDim, unsigned int offDiagOrder, unsigned int crossOrder, Eigen::Ref<const Eigen::RowVectorXd> centers, MapOptions opts)#
template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidComponent(unsigned int inputDim, unsigned int totalOrder, Eigen::Ref<const Eigen::RowVectorXd> centers, MapOptions opts)#
template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidComponent(FixedMultiIndexSet<MemorySpace> mset, StridedVector<const double, MemorySpace> centers, MapOptions opts)#
template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidComponent(FixedMultiIndexSet<MemorySpace> mset, Eigen::Ref<const Eigen::RowVectorXd> centers, MapOptions opts)#
template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidTriangular(unsigned int inputDim, unsigned int outputDim, unsigned int totalOrder, std::vector<StridedVector<const double, MemorySpace>> const &centers, MapOptions opts)#
template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidTriangular(unsigned int inputDim, unsigned int outputDim, unsigned int totalOrder, StridedMatrix<const double, MemorySpace> const &centers, MapOptions opts)#
template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> CreateSigmoidTriangular(unsigned int inputDim, unsigned int outputDim, unsigned int totalOrder, Eigen::Ref<const Eigen::RowMatrixXd> const &centers, MapOptions opts)#
template<typename MemorySpace>
struct CompFactoryImpl#
#include <MapFactory.h>

This struct is used to map the options to functions that can create a map component with types corresponding to the options.

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> mpart::MapFactory::CreateComponent(FixedMultiIndexSet<MemorySpace> const &mset, MapOptions options = MapOptions())
Parameters:

mset – The multiindex set specifying which terms should be used in the multivariate expansion.

template<typename MemorySpace>
std::shared_ptr<ConditionalMapBase<MemorySpace>> mpart::MapFactory::CreateTriangular(unsigned int inputDim, unsigned int outputDim, unsigned int totalOrder, MapOptions options = MapOptions())

Constructs a triangular map with MonotoneComponents for each block. A total order multiindex set is used to define the MonotoneComponent.

For more control over the individual components, consider constructing components with MapFactory::CreateComponent function and then manually constructing and instance of the TriangularMap class.

Parameters:
  • inputDim – The dimension of the input to this map. Will be the number of inputs passed to the last component of the triangular map.

  • outputDim – The output dimension of the map. Note that this must be less than or equal to the input dimension.

  • totalOrder – The total order used to define the parameterization of each MonotoneComponent.

  • options – Additional options that will be passed on to CreateComponent to construct each MonotoneComponent.

struct MapOptions#

struct to hold options used by the MapFactory methods to construct monotone components and triangular maps.

Subclassed by mpart::ATMOptions

Public Functions

inline bool operator==(MapOptions opts2) const#
inline virtual std::string String()#

Public Members

BasisTypes basisType = BasisTypes::ProbabilistHermite#

The type of 1d basis function used to define the multivariate expansion.

SigmoidTypes sigmoidType = SigmoidTypes::Logistic#

The type of sigmoid we want to use to define the diagonal of a rectified multivariate expansion

EdgeTypes edgeType = EdgeTypes::SoftPlus#

The type of edge terms to use with sigmoids

double edgeShape = 1.5#

The “shape” of the edge terms in a sigmoid basis (larger is “sharper” edge terms)

SigmoidSumSizeType sigmoidBasisSumType = SigmoidSumSizeType::Linear#

How arrays of centers should be interpreted in sigmoid basis functions.

double basisLB = -std::numeric_limits<double>::infinity()#

Linearization bounds for the 1d basis function. The basis function is linearized outside [lb,ub]

double basisUB = std::numeric_limits<double>::infinity()#
PosFuncTypes posFuncType = PosFuncTypes::SoftPlus#

The type of positive bijector used inside the monotonicity-guaranteeing integral formulation.

QuadTypes quadType = QuadTypes::AdaptiveSimpson#

The type of quadrature rule to use.

double quadAbsTol = 1e-6#

The absolute tolerance used by adaptive quadrature rules like AdaptiveSimpson and AdaptiveClenshawCurtis.

double quadRelTol = 1e-6#

The relative tolerance used by adaptive quadrature rules like AdaptiveSimpson and AdaptiveClenshawCurtis.

unsigned int quadMaxSub = 30#

The maximum number of subdivisions used in the adaptive quadrature rules.

unsigned int quadMinSub = 0#

The minimum number of subdivisions used in the adaptive quadrature rules.

unsigned int quadPts = 5#

The number of quadrature points used in fixed rules like the Clenshaw Curtis rule. Also defines the base level used in the adaptive Clenshaw-Curtis rule.

bool contDeriv = true#

Specifies whether the derivative of the integral defining a monotone component is used or if the derivative of the quadrature-based approximation of the integral is used. See :ref:diag_deriv_section for more details. If true, the integral is differentiated directly. If false, the numerical approximation to the integral is differentiated.

bool basisNorm = true#

If orthogonal polynomial basis functions should be normalized.

double nugget = 0.0#

The minimum slope of the monotone component. This nugget is added to the g(df) integrand. Must be non-negative.

Public Static Attributes

static const std::string btypes[3] = {"ProbabilistHermite", "PhysicistHermite", "HermiteFunctions"}#
static const std::string pftypes[2] = {"Exp", "SoftPlus"}#
static const std::string qtypes[3] = {"ClenshawCurtis", "AdaptiveSimpson", "AdaptiveClenshawCurtis"}#
static const std::string etypes[1] = {"SoftPlus"}#
static const std::string stypes[1] = {"Logistic"}#
static const std::string sbstypes[2] = {"Linear", "Constant"}#
enum class mpart::BasisTypes#

Values:

enumerator ProbabilistHermite#
enumerator PhysicistHermite#
enumerator HermiteFunctions#
enum class mpart::PosFuncTypes#

Values:

enumerator Exp#
enumerator SoftPlus#
enum class mpart::QuadTypes#

Values:

enumerator ClenshawCurtis#
enumerator AdaptiveSimpson#
enumerator AdaptiveClenshawCurtis#