.. index:: rsamplers.rsampler.sample .. _rsamplers_sample: rsamplers.rsampler.sample is the function that runs the sampling for different chains on an rsamplers.rsampler object to get a sample. The syntax is :: results = sample(obj,varargin) Args: - obj is a member of one of the following classes: - rsamplers.rwmh : Random-Walk Metropolis-Hastings - rsamplers.imh : Independent Metropolis-Hastings - rsamplers.apt : Adaptive parallel tempering - rsamplers.slice : slice sampler - rsamplers.usrsmplr : user-defined sampler - \*varargin\* are class-specific extra arguments .. hint:: After sampling, RISE has functions for thinning, burnin, etc. through subsetting. See e.g. help on **mdd** (constructor for marginal data density objects). .. warning:: please check the sign of the target function and make sure the algorithm used conforms with that sign. Of course, changing the sign of the target function is easy :: newtarget=@(varargin)-target(varargin{:}) .. hint:: For your convenience, some shortcuts are available so that you do not have to first create an object and then do the sampling. Moreover **you do not have to create a new target if the problem is already a minimization problem**. Those shortcuts are : **sampler_rwmh, sampler_imh, sampler_apt, sampler_slice**. They can be called using one of the following syntaxes (for the details for the inputs, see the base functions): - results = sampler_XXXX(target,x0,lb,ub) - results = sampler_XXXX(target,x0,lb,ub,opts)