<p dir="ltr">Número da coluna de m1. Fica como tarefa a interpretação do remanescente. B</p>
<div class="gmail_quote">On 11 Jan 2013 14:39, "Junior Beleti" <<a href="mailto:beleti.junior@gmail.com">beleti.junior@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Desculpa Benilton, mas seria esse o código completo:</div><div><br></div><div><pre style="line-height:19px;font-size:14px;white-space:pre-wrap;margin-bottom:0px;font-family:courier,'courier new',monospace;margin-top:0px;word-wrap:break-word">
grid <- expand.grid(i=1:ncol(m2), j=1:nrow(m1))</pre><pre style="line-height:19px;font-size:14px;white-space:pre-wrap;margin-bottom:0px;font-family:courier,'courier new',monospace;margin-top:0px;word-wrap:break-word">
## versao 1
f <- function(idx)
m1[grid[idx, 2],] %*% m2[, grid[idx, 1]]
matrix(unlist(mclapply(1:nrow(grid), f)), nc=ncol(m2), byrow=T)
## versao 2
g <- function(idx){
aux = 0
X = m1[grid[idx, 2], ]
Y = m2[, grid[idx, 1]]
for (i in 1:length(X))
aux = aux + X[i]*Y[i]
aux
}
matrix(unlist(mclapply(1:nrow(grid), g)), nc=ncol(m2), byrow=TRUE)</pre><pre style="line-height:19px;font-size:14px;white-space:pre-wrap;margin-bottom:0px;font-family:courier,'courier new',monospace;margin-top:0px;word-wrap:break-word">
<br></pre><pre style="line-height:19px;font-size:14px;white-space:pre-wrap;margin-bottom:0px;font-family:courier,'courier new',monospace;margin-top:0px;word-wrap:break-word">Obrigado, Junior.</pre>
</div>
<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div>