Problem in using bsxfun
조회 수: 2 (최근 30일)
이전 댓글 표시
I have two arrays in MATLAB:
A; % size(A) = [NX NY NZ 3 3]
b; % size(b) = [NX NY NZ 3 1]
These two arrays are very big. In fact, in the three dimensional domain, I have two arrays defined for each (i, j, k) which are obtained from above-mentioned arrays A and b, respectively and their sizes are [3 3] and [3 1], respectively. Let's for the sake of example, call these arrays m and n.
m; % size(m) = [3 3]
n; % size(n) = [3 1]
How can I solve m\n for each point of the domain in a vectorize fashion? I used bsxfun but I am not successful.
solution = bsxfun( @(A,b) A\b, A, b );
I think the problem is with the expansion of the singleton elements and I don't know how to fix it.
댓글 수: 0
답변 (1개)
James Tursa
2014년 5월 31일
편집: James Tursa
2014년 5월 31일
For a multi-dimensional paged based linear solver, bsxfun is not the correct approach. You will need to either write loops, or use some 3rd party utility software. You might try this package by Bruno Luong:
However, you will need to permute your data so the 2D pages are the first two dimensions (gets each page contiguous in memory).
댓글 수: 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!