On 12 November 2010 02:21, David Winsemius <dwinsem...@comcast.net> wrote:
>
>> The fastest and easiest solution is
>>
>>  t(A) %*% A
>
> That is really elegant. (Wish I could remember my linear algebra lessons as
> well from forty years ago.) I checked it against the specified output and
> found that with one exception that the OP had planned for the diagonal to be
> filled with zeroes. So that could be completed by a simple modification:
>
> temp <- t(A) %*% A
> diag(temp) <- 0
> temp
>

Excellent solution ! Small is beautiful :)

Michael

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to