Problem in using bsxfun
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
James Tursa
on 31 May 2014
Edited: James Tursa
on 31 May 2014
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 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!