https://github.com/cran/pracma
Raw File
Tip revision: 03698027c2d84118bd0c53c4a9a5b5d23676f388 authored by HwB on 01 October 2012, 00:00:00 UTC
version 1.2.0
Tip revision: 0369802
diag.R
##
##  m t r a c e . R  Test suite
##

Diag <- pracma::Diag

all.equal(Diag(matrix(1:12,3,4),  1), c(4,8,12))
all.equal(Diag(matrix(1:12,3,4), -1), c(2,6))
identical(Diag(Diag(c(1,5,9)), 0), c(1,5,9))
back to top