Element-wise multiplication where 'elements' are matrices and vectors

4 Ansichten (letzte 30 Tage)
Daniel Lyddy
Daniel Lyddy am 20 Feb. 2011
I have a 'stack' of K n-by-1 vectors x that I would like to multiply by a 'stack' of K n-by-n vectors A, to form a 'stack' of K n-by-1 output vectors y such that
y((k-1)*n+1:k*n) = A((k-1)*n+1:k*n, 1:n) * x((k-1)*n+1:k*n)
where k runs from 1 to K.
I would like to do this without looping through k. I thought of using the 'blockproc' function, but it only seems to be able to blockify one argument, and I need to blockify two (both A and x). I thought of trying to turn A into a Kn-by-Kn block diagonal matrix, then multiplying it directly by x (which is Kn-by-1), but K could be quite large and there does not seem to be a sparse version of blkdiag. Finally, bsxfun does not seem to fit this problem.
Any ideas?

Antworten (1)

Bruno Luong
Bruno Luong am 20 Feb. 2011

Kategorien

Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by