tests/std.R

###
### $Id: std.R 22 2022-05-30 18:03:47Z proebuck $
###


##-----------------------------------------------------------------------------
test.std <- function(input, expected) {
    output <- do.call(getFromNamespace("std", "matlab"), input)
    identical(all.equal(output,
                        expected,
                        tolerance = 0.0001),
              TRUE)
}

X.mat <- matrix(c(1, 5, 9, 7, 15, 22), 2, 3, byrow = TRUE)
std.expected.by.col <- c(4.2426, 7.0711, 9.1924)
std.expected.by.row <- c(4.000, 7.5056)

test.std(list(x = X.mat), std.expected.by.col)
test.std(list(x = t(X.mat)), std.expected.by.row)

Try the matlab package in your browser

Any scripts or data that you put into this service are public.

matlab documentation built on July 1, 2024, 5:07 p.m.