You were right matprod will do exactly what I want.
See Also, for matrix cross products, crossprod and tcrossprod are typically preferable.Anyone as an idea on how to handle matrix multiplications?This is required for my loglikelihood and thus should return -infty if not.Examples x - 1:4 (z - x * x) # scalar inner product (1 x 1 matrix) drop(z) # as scalar y - diag(x) z - matrix(1:12, ncol 3, nrow 4) y * z y * x x * z, package base version.5.0 Index.Because of a really cpu demanding likelihood, I had to use a C code within an R function wrapper.Source Code for Matrix Multiplication in C by passing arrays to functions #include stdio.Void display(int mult10, int r1, int c2) int i, j; printf nThe product of the entered matrices is:n for(i0; i r1; i) action games delta force for(j0; j c2; yakitate japan episode 7 sub indo j) printf d multij if(jc2-1) printf.for(i0; i r1; i) for(j0; j c2; j) for(k0; k c1; k) multijaik*bkj; /This function displays the final matrix after multiplication.Void multiplication(int a10,int b10,int mult10,int r1,int c1,int r2,int c2) int i,j,k; Initializing elements of matrix mult.N printf nEnter rows and column for first matrix: scanf d d r1, c1 printf Enter rows and column for second matrix: scanf d d r2, c2 take_data(a,b,r1,c1,r2,c2 display(mult, r1,c2 return 0; /This matrix takes the data of matrices.Value, a double or complex matrix product.This operator is S4 generic but not S3 generic.I'm pretty sure that there is already one good code for matrix multiplication in C - maybe in the R source code itself - but I wasn't able to find.On another point, are you aware about a blas routine to test for semi-definite positive matrix?
Promotion of a vector to a 1-row or 1-column matrix happens when one of the two choices allows x and y to get conformable dimensions.
If one argument is a vector, it will be promoted to either a row or column matrix to make the two arguments conformable.

First, sorry for the delayed reply.Best, Mathieu, prof ls 2013 patch 2.0 serial Brian Ripley a écrit : On Sun, Mathieu Ribatet wrote: Dear list members, I've got a small question on matrix multiplications in a C code. It works best if you have an optimized blas: otherwise it may not be as fast as the simple version used when there are NAs present., institute of Mathematics, ecole Polytechnique Fédérale de Lausanne, sTAT-IMA-FSB-epfl, Station.Use drop to remove dimensions which have only one level.When a vector is promoted to a matrix, its names are not promoted to row or column names, unlike trix.for(i0; i r1; i) for(j0; j c2; j) multij0; Multiplying matrix a and b and storing in array mult.Note, the propagation of NaN/Inf values, precision, and performance of matrix products can be controlled by options matprod.Void take_data(int a10, int b10, int r1,int c1, int r2, int c2) int i,j; printf nEnter elements of matrix 1:n for(i0; i r1; i) for(j0; j c1; j) printf Enter elements add: i1,j1 scanf d aij printf nEnter elements of matrix 2:n for(i0; i r2;.H void take_data(int a10, int b10, int r1,int c1, int r2, int c2 void multiplication(int a10,int b10,int mult10,int r1,int c1,int r2,int c2 void display(int mult10, int r1, int c2 int main int a1010, b1010, mult1010, r1, c1, r2, c2, i, j, k; printf Enter rows.Usage x * y, arguments x, y numeric or complex matrices or vectors.printf nMake the column of the first matrix equal to the row of the second.