R/genMatrixMult.r

Defines functions genMatrixMult

Documented in genMatrixMult

genMatrixMult<-function(A,B,FUNelement="*", FUNsummary=sum){
	if(dim(A)[2]!=dim(B)[1]) stop("incompatible dimmensions")
	n1<-dim(A)[1]
	n2<-dim(B)[2]
	X<-matrix(NA,nrow=n1,ncol=n2)
	dimnames(X)=list(dimnames(A)[[1]],dimnames(B)[[2]])
	for(i1 in 1:n1){
		for(i2 in 1:n2){
			X[i1,i2]<-FUNsummary(do.call(FUNelement,list(A[i1,],B[,i2])))
		}
	}
	return(X)
}

Try the blockmodeling package in your browser

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

blockmodeling documentation built on May 31, 2017, 4:11 a.m.