cloneMatrix: Creates a deep copy of a matrix

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Useful when calling ERE_step_cycle or GibbsSteps_kcycle to ensure that there are no side effects for the return values.

Usage

1

Arguments

M

A matrix

Value

A deep copy of the matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
lambda <- matrix(0.5,nrow=2,ncol=2)
p <- matrix(0.7, nrow=2,ncol=2)
L <- matrix(rexp(4),nrow=2);
L
Lold <- L
Lcopy <- cloneMatrix(L)
ERE_step_cycle(r=c(0,1),c=c(0,1),L=L,lambda=lambda,p=p)

L     ## new value
Lold  ## equal to L !!!
Lcopy ## still has the original value

systemicrisk documentation built on May 2, 2019, 9:26 a.m.