28 id_ = ComputeEnvironment::instance().context().createInputVariable(v);
32 const std::vector<const ExternalRandomVariable*>& args) {
33 std::vector<std::size_t> argIds(args.size());
34 std::transform(args.begin(), args.end(), argIds.begin(), [](
const ExternalRandomVariable* v) { return v->id(); });
35 id_ = ComputeEnvironment::instance().context().applyOperation(randomVariableOpCode, argIds);
40 QL_REQUIRE(
initialized_,
"ExternalRandomVariable::clear(): not initialized");
41 ComputeEnvironment::instance().context().freeVariable(
id_);
46 QL_REQUIRE(
initialized_,
"ExternalRandomVariable::declareAsOutput(): not initialized");
47 ComputeEnvironment::instance().context().declareOutputVariable(
id_);
51 QL_REQUIRE(
initialized_,
"ExternalRandomVariable::id(): not initialized");
59 std::vector<ExternalRandomVariableOp> ops;
63 QL_FAIL(
"ExternRandomVariable does not support op None");
67 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
72 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
77 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
82 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
87 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
92 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
97 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
102 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
107 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
112 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
117 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
122 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
127 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
132 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
137 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
142 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
147 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
152 ops.push_back([](
const std::vector<const ExternalRandomVariable*>& args) {
static std::function< void(ExternalRandomVariable &)> deleter
void declareAsOutput() const
interface to compute envs
ops for external randomvariables
std::vector< ExternalRandomVariableOp > getExternalRandomVariableOps()
std::vector< ExternalRandomVariableGrad > getExternalRandomVariableGradients()
static constexpr std::size_t Sqrt
static constexpr std::size_t IndicatorEq
static constexpr std::size_t Max
static constexpr std::size_t Add
static constexpr std::size_t Mult
static constexpr std::size_t IndicatorGeq
static constexpr std::size_t Log
static constexpr std::size_t Pow
static constexpr std::size_t Min
static constexpr std::size_t Negative
static constexpr std::size_t Subtract
static constexpr std::size_t NormalCdf
static constexpr std::size_t NormalPdf
static constexpr std::size_t Abs
static constexpr std::size_t ConditionalExpectation
static constexpr std::size_t IndicatorGt
static constexpr std::size_t Div
static constexpr std::size_t Exp