https://github.com/cran/pracma
Raw File
Tip revision: 39aca747f500f69985711f7ae5e9969f93ecc860 authored by Hans W. Borchers on 21 June 2017, 07:52:27 UTC
version 2.0.7
Tip revision: 39aca74
wilkinson.R
##
##  w i l k i n s o n . R  Wilkinson matrix
##


wilkinson <- function(n){
	if (length(n) != 1 || n != round(n))
		stop("Argument 'n' must be an integer.")
	if (n <= 0) return(c())

	m <- (n-1)/2.0
	r <- rep(1, n-1)
	Diag(abs(-m:m)) + Diag(r, 1) + Diag(r, -1)
}
back to top