This is inefficient and its is not precisely the set of arguments you requested but
its
concise and perhaps its close enough.
> inner = function(a,b,f,g) apply(apply(outer(a,b,FUN=g),c(1,4),diag),2:3,f)
> a=matrix(1:8,2,4)
> b=t(a)
> inner(a,b,sum,"*")
[,1] [,2]
[1,] 84 100
[2,] 100 120
> a%*%b
[,1] [,2]
[1,] 84 100
[2,] 100 120
> inner(a,b,all,"==")
[,1] [,2]
[1,] TRUE FALSE
[2,] FALSE TRUE
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help