Element-wise multiplication where 'elements' are matrices and vectors
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
Bruno Luong
2011년 2월 20일
Reshape your matrices and vectors to appropriated form for:
Matlab sparse matrix approach http://www.mathworks.com/matlabcentral/fileexchange/24260-multiple-same-size-linear-solver
or
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!