R/f.mat.asymp.R

Defines functions f.mat.asymp

f.mat.asymp <- function(b, w, ncells){
	## Sum up diag(b) - b bT
	## Apply weights w[i]
	## Can probably be sped up, cf f.var.covar
	## WARNING!: w should match .orig!!
	.norig <- ncol(b) # equals to .ncells, but may expand later
	if(missing(w)) w <- rep(1, .norig)
	.matsum <- matrix(0, nrow = ncells, ncol = .norig)
	for(i in 1:.norig){
		.b <- b[,i]
		.mat <- diag(.b) - .b %*% t(.b)
		.matsum <- .matsum + w[i]*.mat
	}
	return(.matsum)
}

Try the Haplin package in your browser

Any scripts or data that you put into this service are public.

Haplin documentation built on Sept. 11, 2024, 7:13 p.m.