1
# Copyright (C) 2006, 2007 Michael Creel <michael.creel@uab.es>
2
# under the terms of the GNU General Public License.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; If not, see <http://www.gnu.org/licenses/>.
17
# kernel_density_nodes: for internal use by kernel_density - does calculations on nodes
19
function z = kernel_density_nodes(eval_points, data, do_cv, kernel, points_per_node, nslaves, debug)
23
[info, myrank] = MPI_Comm_rank(NEWORLD);
24
else myrank = 0; # if not parallel then do all on master node
27
if myrank == 0 # Do this if I'm master
28
startblock = nslaves*points_per_node + 1;
29
endblock = rows(eval_points);
30
else # this is for the slaves
31
startblock = myrank*points_per_node - points_per_node + 1;
32
endblock = myrank*points_per_node;
35
# the block of eval_points this node does
36
myeval = eval_points(startblock:endblock,:);
40
W = __kernel_weights(data, myeval, kernel);
42
W = W - diag(diag(W));
49
printf("z on node %d: \n", myrank);