[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: How to vectorize

**From**: |
Jordi Gutiérrez Hermoso |

**Subject**: |
Re: How to vectorize |

**Date**: |
Wed, 11 Mar 2015 10:16:31 -0400 |

On Tue, 2015-03-10 at 13:22 +0100, Michele Ginesi wrote:
>* To vectorize a summatory like*
>* u(x,y) = \sum_{i,j} c_{i,j} sin(ix) sin(jy)*
Use broadcasting:
i = [1:n]'
j = [1:n]
u = @(x,y) sum( (C.*sin(i*x).*sin(j*y))(:) )
>* Now I have to do a summatory like*
>* u(x,y) = \sum_{i,j} c_{i,j} J_j(\omega_{i,j}*x) cos(j*y)*
j = [1:n]
u = @(x,y) sum( (C.*besselj(omega*x).*cos(j*y))(:) )
HTH,
- Jordi G. H.

**How to vectorize**, *Michele Ginesi*, `2015/03/11`
**Re: How to vectorize**,
*Jordi Gutiérrez Hermoso* **<=**