Пример #1
0
  Function jit(const ParsedFile& file) {
    // Function name
    string name = file.to_string("NAME");

    // Number of inputs (default 1)
    int n_in = file.has("N_IN") ? file.to_int("N_IN") : 1;

    // Number of outputs (default 1)
    int n_out = file.has("N_OUT") ? file.to_int("N_OUT") : 1;

    // Function body
    string body = file.to_text("BODY");

    // Read options
    Dict opts;
    if (file.has("JAC_BODY")) opts["jac"] = file.to_text("JAC_BODY");
    if (file.has("HESS_BODY")) opts["hess"] = file.to_text("HESS_BODY");
    if (file.has("JIT")) opts["jit"] = file.to_int("JIT");

    // Create function object
    return jit(name, n_in, n_out, body, opts);
  }