File: eye.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 (24 lines) | stat: -rw-r--r-- 807 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
22
23
24
###
### $Id: eye.R 22 2022-05-30 18:03:47Z proebuck $
###


##-----------------------------------------------------------------------------
test.eye <- function(input, expected) {
    output <- do.call(getFromNamespace("eye", "matlab"), input)
    identical(output, expected)
}

eye.expected.3x3 <- matrix(c(1, 0, 0,
                             0, 1, 0,
                             0, 0, 1), nrow = 3, ncol = 3, byrow = TRUE)
eye.expected.4x2 <- matrix(c(1, 0,
                             0, 1,
                             0, 0,
                             0, 0), nrow = 4, ncol = 2, byrow = TRUE)

test.eye(list(m = 3), eye.expected.3x3)
test.eye(list(m = c(4, 2)), eye.expected.4x2)
test.eye(list(m = 4, n = 2), eye.expected.4x2)
test.eye(list(m = matlab::size(eye.expected.4x2)), eye.expected.4x2)