Algorithm-Munkres
view release on metacpan or search on metacpan
These changes were contributed by Ken Williams (kwilliams@cpan.org):
1. Prefer foreach(@x){...} rather than for($i=0;$i<@x;$i++){...}
because it tends to be faster and less verbose.
2. Exit early from loops when possible; this is a huge win for
the find_a_zero() function in particular.
3. Increase the minimum required version of perl to 5.006,
because that's when the our() construct was introduced.
4. Don't use a 99999999999 sentinel in find_smallest().
Version 0.07 (Algorithm::Munkres-0.07 Released on 9th Aug 2007)
1. Bug Fix: Added re-initialization code for global variables to the 'assign' subroutine. (Thanks to Gabriel Cardona!)
2. Added a test-case: t/DoubleInvoke.t
Version 0.06 (Algorithm::Munkres-0.06 Released on 14th Sep 2005)
1. Modified Munkres.pm to correct the version number.
Version 0.05 (Algorithm::Munkres-0.05 Released on 30th Nov 2004)
1. Modified Makefile.PL to remove a warning message being displayed during installation of the module.
Version 0.04 (Algorithm::Munkres-0.04 Released on 28th Nov 2004)
1. Modified Munkres.pm and Makefile.PL to support Perl v5.004 and higher.
lib/Algorithm/Munkres.pm view on Meta::CPAN
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw( assign );
our $VERSION = '0.08';
#Variables global to the package
my @mat = ();
my @mask = ();
my @colcov = ();
my @rowcov = ();
my $Z0_row = 0;
my $Z0_col = 0;
my @path = ();
#The exported subroutine.
#Expected Input: Reference to the input matrix (MxN)
#Output: Mx1 matrix, giving the column number of the value assigned to each row. (For more explaination refer perldoc)
sub assign
{
#reference to the input matrix
my $rmat = shift;
my $rsolution_mat = shift;
my ($row, $row_len) = (0,0);
# re-initialize that global variables
@mat = ();
@mask = ();
@colcov = ();
@rowcov = ();
$Z0_row = 0;
$Z0_col = 0;
@path = ();
#variables local to the subroutine
my $step = 0;
( run in 0.612 second using v1.01-cache-2.11-cpan-49f99fa48dc )