mercredi 22 avril 2015

Apply different functions to columns of a matrix

I have a matrix, for example, "A", with size 5 * n, where "n" is a large number. I want to apply functions to the columns of "A", is for loop the best solution?

To be specific, assume

A = randn(5, 10000);
B = randn(5, 5000);
ix = cell(ix_1, ix_2, ...);

and I want to do the following:

for i = 1:10000
    A(:, i) = B(:, ix_i) * B(:, ix_i)' * A(:,i);

Is there faster solution?

Aucun commentaire:

Enregistrer un commentaire