Algorithm-Cluster

 view release on metacpan or  search on metacpan

perl/Record.pm  view on Meta::CPAN

    }
    open OUTPUT, ">$filename" or die 'Error: Unable to open output file';
    print OUTPUT "$label\tGROUP\n";
    my $n = scalar @names;
    my @result = sort { $order[$a] <=> $order[$b] } (0..$n-1);
    my @sortedindex;
    my $cluster = 0;
    while (scalar @sortedindex < $n) {
        foreach (@result) {
            my $j = $_;
            my $cid = $clusterids[$j];
            if ($clusterids[$j]==$cluster) {
                print OUTPUT $names[$j] . "\t$cluster\n";
                push (@sortedindex, $j);
            }
        }
        $cluster++;
    }
    close(OUTPUT);
    return @sortedindex;
}

src/cluster.c  view on Meta::CPAN

            while (x[j]>result) j--;
            loop = 0;
            if (i<j) {
                double temp = x[i];
                x[i] = x[j];
                x[j] = temp;
                i++;
                j--;
                if (i<=j) loop = 1;
            }
        } while (loop); /* Decide which half the median is in. */

        if (even) {
            if (j == nl && i == nr) {
                /* Special case, n even, j = n/2 & i = j + 1, so the median is
                 * between the two halves of the series. Find max. of the first
                 * half & min. of the second half, then average.
                 */
                int k;
                double xmax = x[0];
                double xmin = x[n-1];



( run in 0.418 second using v1.01-cache-2.11-cpan-de7293f3b23 )