File: std.R

package info (click to toggle)
r-cran-matlab 1.0.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 640 kB
  • sloc: sh: 13; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 625 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
###
### $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)