Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

RFoptions

Setting control arguments


Description

RFoptions sets and returns control arguments for the analysis and the simulation of random fields

Usage

RFoptions(..., no.readonly = TRUE)

Arguments

...

arguments in tag = value form, or a list of tagged values.

no.readonly

If RFoptions is called without argument then all arguments are returned in a list. If no.readonly=TRUE then only rewritable arguments are returned. Currenlty all arguments are rewritable. So the list is empty.

Details

The subsections below comment on
1. basic: Basic options
2. solve: Options for solving linear systems
3. Reserved words

1. Basic options

asList

logical. Lists of arguments are treated slightly different from non-lists. If asList=FALSE they are treated the same way as non-lists. This options being set to FALSE after calling RFoptions it should be set as first element of a list.

Default: TRUE

cores

Number of cores for multicore algorithms; currently only used for the Cholesky decomposition.

Default : 1

cPrintlevel

cPrintlevel is automatically set to printlevel when printlevel is changed. Standard users will never use a value higher than 3.

0 : no messages
1 : messages and warnings when the user's input looks odd
2 : messages (and internal errors) documenting the choice of the simulation method
3 : further user relevant informations
4 : information on recursive function calls
5 : function flow information of central functions
6 : errors that are internally treated
7 : details on building up the covariance structure
8 : details on taking the square root of the covariance matrix
9 : details on intermediate calculations
10 : further details on intermediate calculations

Note that printlevel works on the R level whereas cPrintlevel works on the C level.

Default: 1

helpinfo

logical. If TRUE then additional information is printed for more efficient programming in R.

kahanCorrection

logical. If TRUE, the Kahan summation algorithm is used for calculating scalar products.

Default: false

printlevel

If printlevel<=0 there is not any output on the screen. The higher the number the more tracing information is given. Standard users will never use a value higher than 3.

0 : no messages
1 : important (error) messages and warnings
2 : less important messages
3 : details, but still for the user
4 : recursive call tracing
5 : function flow information of large functions
6 : errors that are internally treated
7 : details on intermediate calculations
8 : further details on intermediate calculations

Default: 1

seed

integer (currently only used by the package RandomFields). If NULL or NA set.seed is not called. Otherwise, set.seed(seed) is set before any simulations are performed.

If the argument is set locally, i.e., within a function, it has the usual local effect. If it is set globally, i.e. by RFoptions the seed is fixed for all subsequent calls.

If the number of simulations n is greater than one and if RFoptions(seed=seed) is set, the ith simulation is started with the seed ‘seed+i-1’.

skipchecks

logical. If TRUE, several checks whether the given parameter values and the dimension are within the allowed range is skipped. Do not change the value of this variable except you really know what you do.

Default: FALSE $

verbose

logical. If FALSE it identical to printlevel = 1 else to printlevel = 2.

2. solve: Options for solving linear systems

det_as_log
eigen2zero

When the svd or eigen decomposition is calculated, all values with modulus less than or equal to eigen2zero are set to zero.

Default: 1e-12

max_chol

integer. Maximum number of rows of a matrix in a Cholesky decomposition

Default: 16384

max_svd

integer. Maximum number of rows of a matrix in a svd decomposition

Default: 10000

pivot

Type of pivoting for the Cholesky decomposition. Possible values are

PIVOT_NONE

No pivoting.

PIVOT_AUTO

If the matrix has a size greater than 3x3 and Choleskey fails without pivoting, privoting is done. For matrices of size less than 4x4, no pivoting and no checks are performed. See also PIVOT_DO

PIVOT_DO

Do always pivoting. NOTE: privoted Cholesky decomposition yields only very approximately an upper triangular matrix L, but still L^t L = M holds true.

PIVOT_IDX

uses the same pivoting as in the previous pivoted decomposition. This option becomes relevant only when simulations with different parameters or different models shall be performed with the same seed so that also the pivoting must be coupled.

Default: PIVOT_NONE

pivot_actual_size

integer. Genuine dimension of the linear mapping given by a matrix in cholx. This is a very rarely used option when pivoting with pivot=PIVOT_IDX.

pivot_check

logical. Only used in pivoted Cholesky decomposition. If TRUE and a numerically zero diagonal element is detected, it is checked whether the offdiagonal elements are numerically zero as well. (See also pivot_max_deviation and pivot_max_reldeviation.) If NA then only a warning is given.

Default: TRUE

pivot_idx

vector of integer. Sequence of pivoting indices in pivoted Cholesky decomposition. Note that pivot_idx[1] gives the number of indices that will be used. The vector must have at least the length pivot_idx[1] + 1.

Default: NULL

pivot_relerror

positive number. Tolerance for (numerically) negative eigenvalues and for (numerically) overdetermined systems appearing in the pivoted Cholesky decomposition.

Default: 1e-11

pivot_max_deviation

positive number. Together with pivot_max_reldeviation it determines when the rest of the matrix (eigenvalues) in the pivoted Cholesky decomposition are considered as zero.

Default: 1e-10

pivot_max_reldeviation

positive number. Together with pivot_max_deviation it determines when the rest of the matrix (eigenvalues) in the pivoted Cholesky decomposition are considered as zero.

Default: 1e-10

solve_method

vector of at most 3 integers that gives the sequence of methods in order to inverse a matrix or to calculate its square root: "cholesky", "svd", "eigen" "sparse", "method undefined". In the latter case, the algorithm decides which method might suit best.

Note that if use_spam is not false the algorithm checks whether a sparse matrix algorithm should be used and which is then tried first.

Default: "method undefined".

spam_factor

integer. See argument spam_sample_n.

Default: 4294967

spam_min_n

integer. THe minimal size for a matrix to apply a sparse matrix algorithms automatically.

Default: 400

spam_min_p

number in (0,1) giving the proportion of zero about which an sparse matrix algorithm is used.

Default: 0.8

spam_pivot

integer. Pivoting algorithm for sparse matrices:

PIVOT_NONE

No pivoting

PIVOTSPARSE_MMD
PIVOTSPARSE_RCM

See package spam for details.

Default: PIVOTSPARSE_MMD

spam_sample_n

Whether a matrix is sparse or not is tested by a ‘random’ sample of size spam_sample_n; The selection of the sample is iteratively obtained by multiplying the index by spam_factor modulo the size of the matrix.

Default: 500.

spam_tol

largest absolute value being considered as zero. Default: DBL_EPSILON

svdtol

Internal. When the svd decomposition is used for calculating the square root of a matrix then the absolute componentwise difference between this matrix and the square of the square root must be less than svdtol. No check is performed if svdtol is not positive.

Default: 0

use_spam

Should the package spam (sparse matrices) be used for matrix calculations? If TRUE spam is always used. If FALSE, it is never used. If NA its use is determined by the size and the sparsity of the matrix.

Default: NA.

3. Reserved Words

LIST

LIST usually equals the output of RFoptions(). This argument is used to reset the RFoptions. Some of the options behave differently if passed through LIST. E.g. a warning counter is not reset. The argument LIST cannot be combined with any other arguments.

GETOPTIONS

string vector of prefixes that indicate classes of options. In this package they can be "basic" and "solve". (E.g. package RandomFields has many more classes of options.) The given classes of options are then returned by RFoptions(). Note that the values are the previous values.

GETOPTIONS must always be the very first argument.

SAVEOPTIONS

string vector of prefixes. Same as for GETOPTIONS, except that important classes are always returned and thus should not be given. Hence SAVEOPTIONS is often a convenient short cut for GETOPTIONS. The class always included in this package is "basic", in package RandomFields these are the two classes "basic" and "general".

SAVEOPTIONS must always be the very first argument. In particular, it may not given at the same time with GETOPTIONS.

Value

NULL if any argument is given, and the full list of arguments, otherwise.

Author(s)

Examples

if (FALSE) {
  n <- 500
  M <- matrix(rnorm(n * n), nc=n)
  M <- M %*% t(M)
  system.time(chol(M))
  system.time(cholesky(M))
  RFoptions(cores = 2)
  system.time(cholesky(M))
}

RandomFieldsUtils

Utilities for the Simulation and Analysis of Random Fields

v0.5.3
GPL (>= 3)
Authors
Martin Schlather [aut, cre], Reinhard Furrer [ctb], Martin Kroll [ctb], Brian D. Ripley [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.