Simrunners

Utilities for running several simulations at different inputs.

class active_subspaces.utils.simrunners.SimulationGradientRunner(dfun)

Evaluates gradients at several input values.

A class for running several simulations at different input values that return the gradients of the quantity of interest.

dfun

function

a function that runs the simulation for a fixed value of the input parameters, given as an ndarray. It returns the gradient of the quantity of interest at the given input.

See also

utils.simrunners.SimulationRunner

Notes

The function dfun should take an ndarray of size 1-by-m and return an ndarray of shape 1-by-m. This ndarray is the gradient of the quantity of interest from the simulation. Often, the function is a wrapper to a larger simulation code.

run(X)

Run at several input values.

Run the simulation at several input values and return the gradients of the quantity of interest.

Parameters:X (ndarray) – contains all input points where one wishes to run the simulation. If the simulation takes m inputs, then X must have shape M-by-m, where M is the number of simulations to run.
Returns:dF – contains the gradient of the quantity of interest at each given input point. The shape of dF is M-by-m.
Return type:ndarray

Notes

In principle, the simulation calls can be executed independently and in parallel. Right now this function uses a sequential for-loop. Future development will take advantage of multicore architectures to parallelize this for-loop.

class active_subspaces.utils.simrunners.SimulationRunner(fun)

A class for running several simulations at different input values.

fun

function

runs the simulation for a fixed value of the input parameters, given as an ndarray

See also

utils.simrunners.SimulationGradientRunner

Notes

The function fun should take an ndarray of size 1-by-m and return a float. This float is the quantity of interest from the simulation. Often, the function is a wrapper to a larger simulation code.

run(X)

Run the simulation at several input values.

Parameters:X (ndarray) – contains all input points where one wishes to run the simulation. If the simulation takes m inputs, then X must have shape M-by-m, where M is the number of simulations to run.
Returns:F – contains the simulation output at each given input point. The shape of F is M-by-1.
Return type:ndarray

Notes

In principle, the simulation calls can be executed independently and in parallel. Right now this function uses a sequential for-loop. Future development will take advantage of multicore architectures to parallelize this for-loop.