Algorithm-Cluster
view release on metacpan or search on metacpan
perl/examples/ex1_kcluster view on Meta::CPAN
#!/usr/perl/perl580/bin/perl -w
use strict;
use Algorithm::Cluster qw/kcluster/;
my $file = "../../data/cyano.txt";
my $i = 0;
my $j = 0;
my (@orfname,@orfdata,@weight,@mask);
open(DATA,"<$file") or die "Can't open file $file: $!";
#------------------
# Read in the data file, and save the data to @orfdata
# We know that the file is intact and has no holes,
# so just set the mask to 1 for every item.
# We don't check for errors in this case, because the file
# is short and we can spot errors by eye.
#
my $firstline = <DATA>; # Skip the title line
while(<DATA>) {
chomp(my $line = $_);
my @field = split /\t/, $line;
$orfname[$i] = $field[0];
$orfdata[$i] = [ @field[2..5] ];
$mask[$i] = [ 1,1,1,1 ];
++$i;
}
close(DATA);
#------------------
# Make a reverse-lookup index of the @orfnames hash:
#
my %orfname_by_rowid;
$i=0;
$orfname_by_rowid{$i++} = $_, foreach(@orfname);
@weight = (1.0) x 4;
perl/examples/ex8_kmedoids view on Meta::CPAN
#!/usr/perl/perl580/bin/perl -w
use strict;
use Algorithm::Cluster qw/kmedoids distancematrix/;
my $file = "../../data/cyano.txt";
my $i = 0;
my $j = 0;
my (@orfname,@orfdata,@weight,@mask);
open(DATA,"<$file") or die "Can't open file $file: $!";
#------------------
# Read in the data file, and save the data to @orfdata
# We know that the file is intact and has no holes,
# so just set the mask to 1 for every item.
# We don't check for errors in this case, because the file
# is short and we can spot errors by eye.
#
my $firstline = <DATA>; # Skip the title line
while(<DATA>) {
chomp(my $line = $_);
my @field = split /\t/, $line;
$orfname[$i] = $field[0];
$orfdata[$i] = [ @field[2..5] ];
$mask[$i] = [ 1,1,1,1 ];
++$i;
}
close(DATA);
#------------------
# Make a reverse-lookup index of the @orfnames hash:
#
my %orfname_by_rowid;
$i=0;
$orfname_by_rowid{$i++} = $_, foreach(@orfname);
@weight = (1.0) x 4;
src/cluster.c view on Meta::CPAN
* permission notice appear in supporting documentation, and that the
* names of the contributors or copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific prior permission.
*
* THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
* CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
* OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#include <time.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <limits.h>
src/cluster.h view on Meta::CPAN
* permission notice appear in supporting documentation, and that the
* names of the contributors or copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific prior permission.
*
* THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
* CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
* OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifndef min
#define min(x, y) ((x) < (y) ? (x) : (y))
#endif
#ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y))
( run in 0.980 second using v1.01-cache-2.11-cpan-140bd7fdf52 )