Page 1 of 1

Elementwise multiplication

Posted: Tue Oct 21, 2014 2:51 pm
by ral
I have a TxN matrix A that I want to multiply by a Tx1 vector b elementwise. That is, I want to multiply each of the N columns of length T by the vector b. This would work with the function @emult if the two matrices were of the same dimension (e.g., if A were Tx1 in my case). Is there a workaround for this problem?

Re: Elementwise multiplication

Posted: Tue Oct 21, 2014 3:40 pm
by EViews Gareth
I think you'll have to do it manually in a for loop.

Re: Elementwise multiplication

Posted: Wed Sep 13, 2017 1:26 am
by awatt43
Hi there,
I am looking for the eviews command that would replicate the excel function mmult, this function is described as "Returns the matrix product of two arrays. The result is an array with the same number of rows as array1 and the same number of columns as array2.".

I have been using @inner but this seems to give me different results.

Any help would be much appreciated!

Thanks,
Abi

Re: Elementwise multiplication

Posted: Wed Sep 13, 2017 6:00 am
by EViews Gareth
Just multiply the matrices using *

Re: Elementwise multiplication

Posted: Wed Sep 13, 2017 6:55 am
by awatt43
Hi Gareth

This only works if the matrices are of the same size, in excel the data has to be the same number of columns as rows in the first.

Is there a way to do the matrix product of two matrices of differing sizes?

First matrix is 15x15 and the second is 1x15.

Thanks,
Abi

Re: Elementwise multiplication

Posted: Wed Sep 13, 2017 7:28 am
by EViews Gareth

Re: Elementwise multiplication

Posted: Wed Sep 13, 2017 7:48 am
by awatt43
Oh wow! I was being genuinely moronic... Just needed to transpose one of the matrices. Apologies!