Navigation

Operators and Keywords

Function List:

C++ API

Function File: [n_received] = montecarlo (f, f_args, reps, outfile, n_pooled, n_returns, usempi, verbose)

Generate a specified number of replications of a function's output and write them to a user-specified output file.

IMPORTANT: f should return a row vector of output from feval (f, f_args)

For normal evaluation on one core, only the first 4 arguments are required.

  • Arg 1: (required) the function that generates a row vector of output
  • Arg 2: (required) the arguments of the function, in a cell
  • Arg 3: (required) the number of replications to generate
  • Arg 4: (required) the output file name
  • Arg 5 (optional) number of replications to be pooled together between writes
  • Arg 6 (optional) verbose: 1 for on, 0 for off

If using MPI, you should run using ranks equal to number of cores plus 1, and should make sure that the core running the frontend is also the one that has the second rank. That way the core the frontend is on will also do work.

Package: mpi