Problem in using bsxfun

1 visualizzazione (ultimi 30 giorni)
AP
AP il 31 Mag 2014
Modificato: James Tursa il 31 Mag 2014
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.

Risposte (1)

James Tursa
James Tursa il 31 Mag 2014
Modificato: James Tursa il 31 Mag 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).

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by