Learn R Programming

ribiosUtils (version 1.5-6)

identicalMatrixValue: Test whether two matrices have the same numerica values given certain accuracy

Description

Test whether two matrices have the same numerica values given certain accuracy

Usage

identicalMatrixValue(x, y, epsilon = 1e-12)

Arguments

x

a matrix

y

another matrix

epsilon

accuracy threshold: absolute differences below this threshold is ignored

Value

Logical

Examples

Run this code
# NOT RUN {
set.seed(1887); x <- matrix(rnorm(1000), nrow=10)
set.seed(1887); y <- matrix(rnorm(1000), nrow=10)
set.seed(1882); z <- matrix(rnorm(1000), nrow=10)
stopifnot(identicalMatrixValue(x,y))
stopifnot(!identicalMatrixValue(x,y+1E-5))
stopifnot(!identicalMatrixValue(x,y-1E-5))
stopifnot(!identicalMatrixValue(x,z))

# }

Run the code above in your browser using DataLab