MATLAB Answers

Problem in using bsxfun

1 ビュー (過去 30 日間)
AP 2014 年 5 月 31 日
編集済み: James Tursa 2014 年 5 月 31 日
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.

回答 (1 件)

James Tursa
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).


Community Treasure Hunt

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

Start Hunting!

Translated by