- SEE ALSO
Algorithm::QuineMcCluskey::Util - provide utility functions to Algorithm::QuineMcCluskey
This module provides various utilities designed for (but not limited to) use in Algorithm::QuineMcCluskey.
The prime implicant and essentials "tables" are in the form of a hash of array refs, and are manipulated with the functions columns(), find_essentials(), least_covered(), purge_elements(), remels(), row_dominance(), and uniqels().
Returns the count of a search string Y found in the source string X.
my $str = "d10d11d1d"; matchcount($str, "d"); # returns 4 matchcount($str, "d1"); # returns 3
To search for only the string without a regular expression accidentally interfering, enclose the search string between '\Q' and '\E'. E.g.:
# # We don't know what's in $looking, so de-magic it. # matchcount($str, '\E' . $looking . '\Q]);
Returns the terms that match a mask made up of zeros, ones, and don't-care characters.
my @rterms = maskedmatch("010-0", @terms);
Find the essential prime implicants in a primes table, filtered by a list of terms.
my $ess = find_essentials(\%primes, @terms);
Row dominance checking.
@dominated_rows = row_dominance(\%primes, 0); @dominant_rows = row_dominance(\%primes, 1);
A row (column) i of a PI chart dominates row (column) j if row (column) i contains an x in each column (row) dominated by it.
Return those rows (columns are handled by rotating the primes hash before calling this function).
Find the term with the fewest implicant covers.
my $t = least_covered(\%primes, @terms);
Given a table of prime implicants, delete the list of elements (usually the essential prime implicants) from the table, both row-wise and column-wise.
Given a value and a reference to a hash of arrayrefs, remove the value from the individual arrayrefs if the value matches the masks.
Deletes the entire arrayref from the hash if the last element of the array is removed.
Returns the number of removals made.
Returns a count of all elements in the array ref that are equal to $el.
my $c = countels($el, \@array);
Returns the unique arrays from an array of arrays (i.e., we're ensuring non-duplicate answers).
my @uels = uniqels(@els);
Rotates 90 degrees a hashtable of the type used for %primes, using only @columms.
my %table90 = columns(\%table, @columns)
Very specialized Hamming distance and position function.
Our calling code is only interested in Hamming distances of 1. In those cases return the string position where the two values differ. In all the other cases where the distance isn't one, return a -1.
$idx = hammingd1pos($val1, $val2);
Darren M. Kulp
John M. Gamble firstname.lastname@example.org (current maintainer)