Community Profile

photo

chen


Active since 2013

Followers: 0   Following: 0

Message

Statistics

All
  • Solver

View badges

Feeds

View by

Question


How to vectorize this "for" loop, or parallel it.
fun = @(x,y) x + x.*y; N = 1e3; K = zeros(N); for i = 1:N for j = i:N K(i,j) = fun(i, j); end end

10 years ago | 2 answers | 0

2

answers

Question


Convert the variables x1, x2,... in an anonymous function to x(1,:) ,x(2,:).....
For example: f = @(x1, x2, ... , x15) x1 .* x2 .* ... .* x15 I want get: f = @(x) x(1,:) .* x(2,:) .* ... .*x(15,:)

11 years ago | 2 answers | 0

2

answers