1\docType{methods}
2\name{getRNG1}
3\alias{.getRNG}
4\alias{getRNG1}
5\alias{getRNG1-methods}
6\alias{getRNG1,NMFfitX1-method}
7\alias{getRNG1,NMFfitX-method}
8\alias{getRNG1,NMFfitXn-method}
9\alias{.getRNG-methods}
10\alias{.getRNG,NMFfitXn-method}
11\title{Extracting RNG Data from NMF Objects}
12\usage{
13  getRNG1(object, ...)
14
15  .getRNG(object, ...)
16}
17\arguments{
18  \item{object}{an R object from which RNG settings can be
19  extracted, e.g. an integer vector containing a suitable
20  value for \code{.Random.seed} or embedded RNG data, e.g.,
21  in S3/S4 slot \code{rng} or \code{rng$noise}.}
22
23  \item{...}{extra arguments to allow extension and passed
24  to a suitable S4 method \code{.getRNG} or
25  \code{.setRNG}.}
26}
27\description{
28  The \code{\link{nmf}} function returns objects that
29  contain embedded RNG data, that can be used to exactly
30  reproduce any computation. These data can be extracted
31  using dedicated methods for the S4 generics
32  \code{\link[rngtools]{getRNG}} and
33  \code{\link[rngtools]{getRNG1}}.
34}
35\section{Methods}{
36  \describe{
37
38  \item{.getRNG}{\code{signature(object = "NMFfitXn")}:
39  Returns the RNG settings used for the best fit.
40
41  This method throws an error if the object is empty. }
42
43  \item{getRNG1}{\code{signature(object = "NMFfitX")}:
44  Returns the RNG settings used for the first NMF run of
45  multiple NMF runs. }
46
47  \item{getRNG1}{\code{signature(object = "NMFfitX1")}:
48  Returns the RNG settings used to compute the first of all
49  NMF runs, amongst which \code{object} was selected as the
50  best fit. }
51
52  \item{getRNG1}{\code{signature(object = "NMFfitXn")}:
53  Returns the RNG settings used for the first run.
54
55  This method throws an error if the object is empty. }
56
57  }
58}
59\examples{
60\dontshow{# roxygen generated flag
61options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
62}
63
64# For multiple NMF runs, the RNG settings used for the first run is also stored
65V <- rmatrix(20,10)
66res <- nmf(V, 3, nrun=4)
67# RNG used for the best fit
68getRNG(res)
69# RNG used for the first of all fits
70getRNG1(res)
71# they may differ if the best fit is not the first one
72rng.equal(res, getRNG1(res))
73}
74\keyword{methods}
75
76