Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A_ct = parallel.pool.Constant(A);
- b_ct = parallel.pool.Constant(b);
- future_results(i) = parfeval(p, @hybrid_parallel_function, 3, A_ct, b_ct, x, x_last, buck_bound, n, start_itv, end_itv);
- function [x_par, start_itv, end_itv] = hybrid_parallel_function (A_ct, b_ct, x, x_last, buck_bound, n, start_itv, end_itv)
- x_par = zeros(end_itv - start_itv + 1, 1);
- for i = start_itv:end_itv
- x_par(i-start_itv+1) = b_ct.Value(i);
- x_par(i-start_itv+1) = x_par(i-start_itv+1) - A_ct.Value(i, 1:buck_bound) * x(1:buck_bound);
- x_par(i-start_itv+1) = x_par(i-start_itv+1) - A_ct.Value(i, buck_bound+1:i-1) * x_last(buck_bound+1:i-1);
- x_par(i-start_itv+1) = x_par(i-start_itv+1) - A_ct.Value(i, i+1:n) * x_last(i+1:n);
- x_par(i-start_itv+1) = x_par(i-start_itv+1) / A_ct.Value(i, i);
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement