Revision 03698027c2d84118bd0c53c4a9a5b5d23676f388 authored by HwB on 01 October 2012, 00:00:00 UTC, committed by Gabor Csardi on 01 October 2012, 00:00:00 UTC
1 parent 9fdea5d
Raw File
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