MATLAB Answers

Problem in using bsxfun

5 views (last 30 days)
AP
AP on 31 May 2014
Edited: James Tursa on 31 May 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.

  0 Comments

Sign in to comment.

Answers (1)

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

Sign in to comment.

Sign in to answer this question.

Tags


Translated by