Je souhaite déterminer le produit scalaire entre la colonne i e dans une matrice et le i ème colonne dans une seconde matrice. Le résultat final sera un tableau contenant les produits i.calcul de produit scalaire-sage colonne entre deux matrices
Voici un exemple reproductible de ce que je veux faire:
#Generate two matrices with 10 columns each with 5 rows (thus i in this case is 10)
m1 <- replicate(10, rnorm(5))
m2 <- replicate(10, rnorm(5))
#Inefficiently calculate dot product of ith column in m1 with ith column in m2
d1 <- t(m1[,1]) %*% m2[,1]
d2 <- t(m1[,2]) %*% m2[,2]
...
d10 <- t(m1[,10]) %*% m2[,10]
#End with all dot products in array
d.final <- c(d1, d2, d10)
Toute aide ici sera appréciée!
Ken
@ user20650 Arh J'ai mal lu son qn. Va supprimer le commentaire – chinsoon12