view release on metacpan or search on metacpan
lib/Akamai/PropertyFetcher.pm view on Meta::CPAN
my ($class, %args) = @_;
my $self = bless {}, $class;
$self->{agent} = Akamai::Edgegrid->new(
config_file => $args{config_file} || "$ENV{HOME}/.edgerc",
section => $args{section} || "default"
);
$self->{max_processes} = $args{max_processes} || 4;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
helper/README view on Meta::CPAN
shellrun.exe MS Windows autostart helper program. Put this program,
autorun.inf and autorun.inf, both in the root of the CD-ROM.
Inserting the CD-ROM in a Windows system will then
automatically open index.html in a browser.
shellrun.c Source for shellrun.c. No secrets.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/AM/Batch.pm view on Meta::CPAN
if($self->begin_test_hook){
$self->begin_test_hook->($self, $test_item);
}
if($log->is_debug){
my ( $sec, $min, $hour ) = localtime();
$log->info(
sprintf( "Time: %2s:%02s:%02s\n", $hour, $min, $sec) .
$test_item->comment . "\n" .
sprintf( "0/$self->{repeat} %2s:%02s:%02s",
$hour, $min, $sec ) );
}
my $iteration = 1;
while ( $iteration <= $self->repeat ) {
if($self->begin_repeat_hook){
lib/Algorithm/AM/Batch.pm view on Meta::CPAN
_log_result($result)
if($log->is_info);
if($log->is_info){
my ( $sec, $min, $hour ) = localtime();
$log->info(
sprintf(
$iteration . '/' . $self->repeat .
' %2s:%02s:%02s',
$hour, $min, $sec
)
);
}
if($self->end_repeat_hook){
lib/Algorithm/AM/Batch.pm view on Meta::CPAN
push @all_results, @item_results;
}
if($log->is_info){
my ( $sec, $min, $hour ) = localtime();
$log->info(
sprintf( "Time: %2s:%02s:%02s", $hour, $min, $sec ) );
}
if($self->end_hook){
$self->end_hook->($self, @all_results);
}
lib/Algorithm/AM/Batch.pm view on Meta::CPAN
=for Pod::Coverage BUILD
=head2 C<new>
Creates a new object instance. This method takes named parameters
which call the methods described in the relevant documentation sections.
The only required parameter is L</training_set>, which should be an
instance of L<Algorithm::AM::DataSet>, and which provides a pool of
items to be used for training during classification. All of the
accepted parameters are listed below:
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
my $name = shift;
my $features = ( $self->{values}->{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
view all matches for this distribution
view release on metacpan or search on metacpan
builder/MyBuilder.pm view on Meta::CPAN
add_to_cleanup => [
'Algorithm-AdaGrad-*', 'MANIFEST.bak', 'lib/Algorithm/*.o',
],
meta_add => { keywords => [qw/AdaGrad/], },
needs_compiler_cpp => 11,
extra_compiler_flags => [qw/-Wno-format-security -Wno-duplicate-decl-specifier -Wno-reserved-user-defined-literal/],
);
}
1;
__END__
view all matches for this distribution
view release on metacpan or search on metacpan
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
_get_swash_invlist|||
_invlistEQ|||
_invlist_array_init|||n
_invlist_contains_cp|||n
_invlist_dump|||
_invlist_intersection_maybe_complement_2nd|||
_invlist_intersection|||
_invlist_invert|||
_invlist_len|||n
_invlist_populate_swatch|||n
_invlist_search|||n
_invlist_subtract|||
ssc_anything|||
ssc_clear_locale|||n
ssc_cp_and|||
ssc_finalize|||
ssc_init|||
ssc_intersection|||
ssc_is_anything|||n
ssc_is_cp_posixl_init|||n
ssc_or|||
ssc_union|||
stack_grow|||
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/AhoCorasick/SearchMachine.pm view on Meta::CPAN
=head2 feed
Feeds input to the state machine. First (after the instance) argument
of this method is the input text (which can be empty, in which case
the method doesn't do anything), second argument is the callback
invoked on each match. C<feed> calls the callback with 2 arguments:
the position and the matched keyword. The callback can stop further
search by returning a true value, which C<feed> returns. If the search
wasn't stopped, C<feed> returns undef, and can then be called with
another chunk of input text to continue the search (matching all
view all matches for this distribution
view release on metacpan or search on metacpan
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
_get_swash_invlist|||
_invlist_array_init|||n
_invlist_contains_cp|||n
_invlist_contents|||
_invlist_dump|||
_invlist_intersection_maybe_complement_2nd|||
_invlist_intersection|||
_invlist_invert|||
_invlist_len|||n
_invlist_populate_swatch|||n
_invlist_search|||n
_invlist_subtract|||
ssc_anything|||
ssc_clear_locale|||n
ssc_cp_and|||
ssc_finalize|||
ssc_init|||
ssc_intersection|||
ssc_is_anything|||n
ssc_is_cp_posixl_init|||n
ssc_or|||
ssc_union|||
stack_grow|||
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
summary => 'How much of the time left to use in the adjustable timeout',
schema => ['ufloat*', between=>[0, 1]],
default => 0.5,
};
$args->{min_adjust_timeout} = {
summary => 'Minimum adjustable timeout, in seconds',
schema => 'ufloat*',
default => 5,
};
$args->{timeout_jitter_factor} = {
summary => 'How much randomness to add to the adjustable timeout',
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
#pod adjustable timeout will force the attempt to only use a portion of the time. By default,
#pod only 50% of the remaining time will be set as the next timeout value.
#pod
#pod =item * min_adjust_timeout => I<ufloat> (default: 5)
#pod
#pod Minimum timeout value, in seconds.
#pod
#pod This value bypasses any C<max_actual_duration> checks, so the total time spent on
#pod sleeping and attempts may end up exceeding that value by a small amount (up to
#pod C<max_actual_duration + min_adjust_timeout>). In this case, future failures will return
#pod a delay of C<-1> as expected.
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
#pod =head2 delay
#pod
#pod my $delay = $retry_algo->delay;
#pod
#pod Returns the last suggested delay, in seconds.
#pod
#pod The delay will return C<-1> to suggest that the process should give up and fail, if
#pod C<max_attempts> or C<max_actual_duration> have been reached.
#pod
#pod =cut
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
#pod =head2 timeout
#pod
#pod my $timeout = $retry_algo->delay;
#pod
#pod Returns the last suggested timeout, in seconds. If no attempts have been logged,
#pod it will suggest an initial timeout to start with.
#pod
#pod This will be a floating-point number, so you may need to convert it to an integer if your
#pod timeout system doesn't support decimals.
#pod
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
adjustable timeout will force the attempt to only use a portion of the time. By default,
only 50% of the remaining time will be set as the next timeout value.
=item * min_adjust_timeout => I<ufloat> (default: 5)
Minimum timeout value, in seconds.
This value bypasses any C<max_actual_duration> checks, so the total time spent on
sleeping and attempts may end up exceeding that value by a small amount (up to
C<max_actual_duration + min_adjust_timeout>). In this case, future failures will return
a delay of C<-1> as expected.
lib/Algorithm/Backoff/RetryTimeouts.pm view on Meta::CPAN
=head2 delay
my $delay = $retry_algo->delay;
Returns the last suggested delay, in seconds.
The delay will return C<-1> to suggest that the process should give up and fail, if
C<max_attempts> or C<max_actual_duration> have been reached.
=head2 timeout
my $timeout = $retry_algo->delay;
Returns the last suggested timeout, in seconds. If no attempts have been logged,
it will suggest an initial timeout to start with.
This will be a floating-point number, so you may need to convert it to an integer if your
timeout system doesn't support decimals.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Backoff.pm view on Meta::CPAN
description => <<'_',
If set to true, will take into account the actual delay (timestamp difference).
For example, when using the Constant strategy of delay=2, you log failure()
again right after the previous failure() (i.e. specify the same timestamp).
failure() will then return ~2+2 = 4 seconds. On the other hand, if you waited 2
seconds before calling failure() again (i.e. specify the timestamp that is 2
seconds larger than the previous timestamp), failure() will return 2 seconds.
And if you waited 4 seconds or more, failure() will return 0.
_
},
);
our %attr_max_actual_duration = (
max_actual_duration => {
summary => 'Maximum number of seconds for all of the attempts (0 means unlimited)',
schema => ['ufloat*'],
default => 0,
tags => ['common'],
description => <<'_',
If set to a positive number, will limit the number of seconds for all of the
attempts. This setting is used to limit the amount of time you are willing to
spend on a task. For example, when using the Exponential strategy of
initial_delay=3 and max_attempts=10, the delays will be 3, 6, 12, 24, ... If
failures are logged according to the suggested delays, and max_actual_duration
is set to 21 seconds, then the third failure() will return -1 instead of 24
because 3+6+12 >= 21, even though max_attempts has not been exceeded.
_
},
);
our %attr_max_attempts = (
max_attempts => {
summary => 'Maximum number consecutive failures before giving up',
schema => 'uint*',
default => 0,
tags => ['common'],
description => <<'_',
lib/Algorithm/Backoff.pm view on Meta::CPAN
},
);
our %attr_delay_on_success = (
delay_on_success => {
summary => 'Number of seconds to wait after a success',
schema => 'ufloat*',
default => 0,
},
);
our %attr_max_delay = (
max_delay => {
summary => 'Maximum delay time, in seconds',
schema => 'ufloat*',
tags => ['common'],
},
);
our %attr_min_delay = (
min_delay => {
summary => 'Maximum delay time, in seconds',
schema => 'ufloat*',
default => 0,
tags => ['common'],
},
);
our %attr_initial_delay = (
initial_delay => {
summary => 'Initial delay for the first attempt after failure, '.
'in seconds',
schema => 'ufloat*',
req => 1,
},
);
lib/Algorithm/Backoff.pm view on Meta::CPAN
},
);
our %attr_delay_increment_on_failure = (
delay_increment_on_failure => {
summary => 'How much to add to previous delay, in seconds, upon failure (e.g. 5)',
schema => 'float*',
req => 1,
},
);
our %attr_delay_increment_on_success = (
delay_increment_on_success => {
summary => 'How much to add to previous delay, in seconds, upon success (e.g. -5)',
schema => 'float*',
req => 1,
},
);
lib/Algorithm/Backoff.pm view on Meta::CPAN
my $ab = Algorithm::Backoff::Constant->new(
delay => 2, # required
#delay_on_success => 0, # optional, default 0
);
# 2. log success/failure and get a new number of seconds to delay. if you don't
# want to log for the current time, you can pass a timestamp (number of seconds
# passed since some reference value, like a Unix epoch) as the argument, which
# should be monotonically increasing.
my $secs = $ab->failure(); # => 2
my $secs = $ab->success(); # => 0
my $secs = $ab->failure(); # => 2
=head1 DESCRIPTION
This distribution provides several classes that implement various backoff
strategies for setting delay between retry attempts.
lib/Algorithm/Backoff.pm view on Meta::CPAN
The jitter will be applied to delay on failure as well as on success.
=item * B<max_attempts> => I<uint> (default: 0)
Maximum number consecutive failures before giving up.
0 means to retry endlessly without ever giving up. 1 means to give up after a
single failure (i.e. no retry attempts). 2 means to retry once after a failure.
Note that after a success, the number of attempts is reset (as expected). So if
max_attempts is 3, and if you fail twice then succeed, then on the next failure
lib/Algorithm/Backoff.pm view on Meta::CPAN
=head2 success
Usage:
my $secs = $obj->success([ $timestamp ]);
Log a successful attempt. If not specified, C<$timestamp> defaults to current
Unix timestamp. Will return the suggested number of seconds to wait before doing
another attempt.
=head2 failure
Usage:
my $secs = $obj->failure([ $timestamp ]);
Log a failed attempt. If not specified, C<$timestamp> defaults to current Unix
timestamp. Will return the suggested number of seconds to wait before doing
another attempt, or -1 if it suggests that one gives up (e.g. if C<max_attempts>
parameter has been exceeded).
=head1 HOMEPAGE
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Bertsekas.pm view on Meta::CPAN
}
sub delete_multiple_columns { # if the column elements do not change the final result
my ( $matrix_ref, $verbose ) = @_;
my %lower_values;
my %intersection_columns;
my $number_of_columns_deleted = 0;
for my $i ( 0 .. $#{$matrix_ref} ) {
for my $j ( 0 .. $#{$matrix_ref->[$i]} ) {
$lower_values{ $i }{ $matrix_ref->[$i]->[$j] }{ $j }++;
lib/Algorithm/Bertsekas.pm view on Meta::CPAN
foreach my $index_i ( sort { $a <=> $b } keys %lower_values ){
my $num_higher_values = 0;
foreach my $matrix_value ( sort { $b <=> $a } keys %{$lower_values{$index_i}} ){
foreach my $index_j ( sort { $b <=> $a } keys %{$lower_values{$index_i}{$matrix_value}} ){
$intersection_columns{$index_j}++ if ( $num_higher_values++ >= $min_size );
$number_of_columns_deleted++ if ( defined $intersection_columns{$index_j} and $intersection_columns{$index_j} >= $min_size );
}
}
}
if ( $verbose >= 5 ){
print "\n";
for my $i ( 0 .. $#{$matrix_ref} ) {
print " [";
for my $j ( 0 .. $#{$matrix_ref->[$i]} ) {
printf (" %${matrix_spaces}.${decimals}f", $matrix_ref->[$i]->[$j] );
if ( defined $intersection_columns{$j} and $intersection_columns{$j} == $min_size ){ print "**"; } else{ print " "; }
}
print "]\n";
}
print "\n";
}
my $idx = 0;
for my $i ( 0 .. $#{$matrix_ref} ) {
for my $j ( 0 .. $#{$matrix_ref->[$i]} ) {
undef ( $matrix_ref->[$i]->[$j] ) if ( defined $intersection_columns{$j} and $intersection_columns{$j} >= $min_size );
if ( $i == 0 and defined $intersection_columns{$j} and $intersection_columns{$j} >= $min_size ){
printf " N = $min_size ; M = $max_size ; j = %2s ; \$intersection_columns{$j} = $intersection_columns{$j} \n", $j if ( $verbose >= 5 );
}
if ( $i == 0 and ( not defined $intersection_columns{$j} or $intersection_columns{$j} < $min_size ) ){
$index_correlation{$idx} = $j;
printf " N = $min_size ; M = $max_size ; j = %2s ; \$index_correlation{$idx} = $index_correlation{$idx} \n", $j if ( $verbose >= 5 );
$idx++;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/AutoInstall.pm view on Meta::CPAN
$self->makemaker_args( Module::AutoInstall::_make_args() );
my $class = ref($self);
$self->postamble(
"# --- $class section:\n" .
Module::AutoInstall::postamble()
);
}
sub auto_install_now {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/BinPack.pm view on Meta::CPAN
'label' and 'size', but any others can be specified, and will be saved.
An optional 'bin' argument can be used to manually put an item into the
specified bin.
$bp->add_item(label => 'one', size => 1);
$bp->add_item(label => 'two', size => 2, desc => 'The second numeral');
$bp->add_item(label => 'zero', size => 3, bin => 0);
$bp->add_item(qw(label three size 3));
$bp->add_item(qw(label four size 4 random key));
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
%EXPORT_TAGS =
(
api => [qw( vbsearch vbsearch_lb vbsearch_ub),
qw(vabsearch vabsearch_lb vabsearch_ub),
qw(vvbsearch vvbsearch_lb vvbsearch_ub),
qw(vunion vintersect vsetdiff),
],
const => [qw($HAVE_QUAD $KEY_NOT_FOUND)],
debug => [qw(vget vset vec2array)],
);
$EXPORT_TAGS{all} = [map {@$_} @EXPORT_TAGS{qw(api const debug)}];
$cv .= substr($$bvr, $bi*$nbits/8);
return $cv;
}
##--------------------------------------------------------------
## $vintersect = vintersect($av,$bv,$nbits)
sub _vintersect {
my ($avr,$bvr,$nbits) = (\$_[0],\$_[1],$_[2]);
die(__PACKAGE__ , "::_vintersect(): cannot handle nbits < 8, but you requested $nbits") if ($nbits < 8);
##-- ensure smaller set is "a"
($$avr,$$bvr) = ($$bvr,$$avr) if (length($$bvr) < length($$avr));
my $na = length($$avr)*8/$nbits;
##--------------------------------------------------------------
## $vsetdiff = vsetdiff($av,$bv,$nbits)
sub _vsetdiff {
my ($avr,$bvr,$nbits) = (\$_[0],\$_[1],$_[2]);
die(__PACKAGE__ , "::_vintersect(): cannot handle nbits < 8, but you requested $nbits") if ($nbits < 8);
my $na = length($$avr)*8/$nbits;
my $nb = length($$bvr)*8/$nbits;
my $cv = '';
my ($ai,$bi,$ci, $blo,$aval,$bval);
$ixvec = vvbsearch_ub($v,$keyvec,$nbits,$lo,$hi); ##-- upper bound
##-------------------------------------------------------------
## Set Operations
$cv = vunion($av,$bv,$nbits); ##-- set union
$cv = vintersect($av,$bv,$nbits); ##-- set intersection
$cv = vsetdiff($av,$bv,$nbits); ##-- set difference
##-------------------------------------------------------------
## Debugging
$val = vget($vec,$i,$nbits);
=item vunion($av,$bv,$nbits)
Computes the union of two sorted vec()-style sets C<$av> and C<$bv>
and returns the result as a sorted vector-set. Complexity is I<O>(C<$a> + C<$b>)>.
=item vintersect($av,$bv,$nbits)
Computes the intersection of two sorted vec()-style sets C<$av> and C<$bv>
and returns the result as a sorted vector-set. Complexity is I<O>(C<$A> * log C<$B>),
where C<$A> is the shorter and C<$B> the longer of the argument vectors C<$a> and C<$b>.
=item vsetdiff($av,$bv,$nbits)
view all matches for this distribution
view release on metacpan or search on metacpan
Examples/BitVectorDemo.pl view on Meta::CPAN
# Calculate the GCD of two bitvectors using Euclid's algorithm on the integers values:
print "\nTesting Greatest Common Divisor (gcd):\n";
$bv1 = Algorithm::BitVector->new( bitstring => '01100110' );
print "first arg bv: $bv1 of int value: " . int($bv1) . "\n"; #102
$bv2 = Algorithm::BitVector->new( bitstring => '011010' );
print "second arg bv: $bv2 of int value: " . int($bv2) . "\n"; # 26
$bv = $bv1->gcd( $bv2 );
print "gcd bitvec is: $bv of int value: " . int($bv) . "\n"; # 2
# Calculate the multiplicative inverse of a bitvector with respect to a modulus vector:
print "\nTesting multiplicative_inverse:\n";
Examples/BitVectorDemo.pl view on Meta::CPAN
print "Multiplicative inverse of $a in GF(2^8) is $mi\n";
# Experiments with finding ALL multiplicative inverses in a small Galois Field:
print "\nIn the display produced by following statements, you will see " .
"\nthree rows. The first row shows the binary code words, the " .
"\nsecond the multiplicative inverses, and the third the product " .
"\nof a binary word with its multiplicative inverse modulo the " .
"\nprime polynomial:\n";
$mod = Algorithm::BitVector->new( bitstring => '1011' );
$n = 3;
my @bitarrays = map Algorithm::BitVector->new(intVal=>$_, size=>$n), 1 .. 2**3 -1;
Examples/BitVectorDemo.pl view on Meta::CPAN
#UNCOMMENT THE FOLLOWING LINES FOR
#DISPLAYING ALL OF THE MULTIPLICATIVE
#INVERSES IN GF(2^8) WITH THE AES MODULUS:
print "\nMultiplicative inverses in GF(2^8) with modulus polynomial x^8 + x^4 + x^3 + x + 1:\n";
print "\n(This may take a few seconds)\n";
$mod = Algorithm::BitVector->new( bitstring => '100011011' );
$n = 8;
@bitarrays = map Algorithm::BitVector->new(intVal=>$_, size=>$n), 1 .. 2**8 -1;
@mi_list = map $_->gf_MI($mod,$n), @bitarrays;
print "multiplicative inverses: @mi_list\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Bitonic/Sort.pm view on Meta::CPAN
say Dumper $single_bit if DEBUG;
my @num = @_;
my @first = bitonic_sort( 1, @num[0..(@num /2 -1)] );
my @second = bitonic_sort( 0, @num[(@num /2)..(@num -1)] );
return _bitonic_merge( $up, $single_bit, @first, @second );
}
sub _bitonic_merge {
my $up = shift;
say '#### Merge: '.Dumper(@_) if DEBUG;
lib/Algorithm/Bitonic/Sort.pm view on Meta::CPAN
my @num = @_;
@num = _bitonic_compare( $up, @num );
my @first = _bitonic_merge( $up, 'NA', @num[0..(@num /2 -1)] );
my @second = _bitonic_merge( $up, 'NA', @num[(@num /2)..(@num -1)] );
@num = (@first, @second);
@num = _some_sorting_algorithm( $up, $single_bit, @first, @second ) if $single_bit ne 'NA';
@num = _some_sorting_algorithm( $up, $single_bit_2, @first, @second ) if $single_bit_2 ne 'NA';
say "#####\n# Merge Result\n#####\n".Dumper(@num) if DEBUG;
return (@num);
}
lib/Algorithm/Bitonic/Sort.pm view on Meta::CPAN
say "Swapping....." if DEBUG;
($num[$i], $num[$i+$dist]) = ($num[$i+$dist], $num[$i]); #swap
}
}
#~ for my $i (0..(int @$first)) {
#~ if ( ($first->[$i] > $second->[$i]) == $up ) {
#~ ($first->[$i], $second->[$i]) = ($second->[$i], $first->[$i]); #swap
#~ }
#~ }
say 'Compared result:'.Dumper(@num) if DEBUG;
return @num;
#~ return ($first, $second);
}
sub _some_sorting_algorithm {
my $up = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
intuit_more|||
invert|||
invlist_array|||
invlist_destroy|||
invlist_extend|||
invlist_intersection|||
invlist_len|||
invlist_max|||
invlist_set_array|||
invlist_set_len|||
invlist_set_max|||
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
Bucketizer.pm view on Meta::CPAN
does exactly that, simply putting an item into a specified bucket:
$b->prefill_bucket($bucket_idx, $item, $itemsize);
C<$bucket_idx> is the index of the bucket, starting from 0. Non-existing buckets
are automatically created for you. Make sure you have a consecutive number
of buckets at the end of the prefill.
=head2 Optimize
Once you've inserted all items, you might choose to optimize the distribution
Bucketizer.pm view on Meta::CPAN
# Try randomly to improve distribution,
# timing out after 100 rounds
$b->optimize(algorithm => "random", maxrounds => 100);
# Try randomly to improve distribution,
# timing out after 60 secs
$b->optimize(algorithm => "random", maxtime => 60);
# Try to improve distribution by brute_force trying
# all possible combinations (watch out: can take forever)
$b->optimize(algorithm => "brute_force",
Bucketizer.pm view on Meta::CPAN
=item *
$b->optimize(
algorithm => $algorithm,
maxtime => $seconds,
maxrounds => $number_of_rounds
);
Optimize bucket distribution. Currently C<"random"> and C<"brute_force">
are implemented. Both can be (C<"random"> I<must> be) terminated
by either the maximum number of seconds (C<maxtime>) or
iterations (C<maxrounds>).
=back
=head1 EXAMPLE
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/C3.pm view on Meta::CPAN
also be used for things like dependency resolution as well since
it tends to do such a nice job of preserving local precedence
orderings.
Below is a brief explanation of C3 taken from the L<Class::C3>
module. For more detailed information, see the L<SEE ALSO> section
and the links there.
=head2 What is C3?
C3 is the name of an algorithm which aims to provide a sane method
resolution order under multiple inheritance. It was first introduced
in the language Dylan (see links in the L<SEE ALSO> section), and
then later adopted as the preferred MRO (Method Resolution Order)
for the new-style classes in Python 2.3. Most recently it has been
adopted as the 'canonical' MRO for Perl 6 classes, and the default
MRO for Parrot objects as well.
lib/Algorithm/C3.pm view on Meta::CPAN
B<A> appears before B<C>, even though B<C> is the subclass of B<A>.
The C3 MRO algorithm however, produces the following MRO (D, B, C, A),
which does not have this same issue.
This example is fairly trivial, for more complex examples and a deeper
explanation, see the links in the L<SEE ALSO> section.
=head1 FUNCTION
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-c.inc view on Meta::CPAN
static int
constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
/* Initially switch on the length of the name. */
/* When generated this function returned values for the list of names given
in this section of perl code. Rather than manually editing these functions
to add or remove constants, which would result in this comment and section
of code becoming inaccurate, we recommend that you edit this section of
code, and use it to regenerate a new set of constant functions which you
then use to replace the originals.
Regenerate these constant functions by feeding this entire source file to
perl -x
view all matches for this distribution
view release on metacpan or search on metacpan
t/test.data view on Meta::CPAN
old JJ O
, , O
served VBN O
as IN O
defense NN B
secretary NN I
in IN O
the DT B
Reagan NNP I
administration NN I
. . O
t/test.data view on Meta::CPAN
Mike NNP I
Barnicle NNP I
-- : O
in IN O
the DT B
second JJ I
attack NN I
on IN O
his PRP$ B
employer NN I
in IN O
t/test.data view on Meta::CPAN
of IN O
looking VBG O
to TO O
the DT B
private JJ I
sector NN I
to TO O
fill VB O
two CD B
new JJ I
high-level JJ I
t/test.data view on Meta::CPAN
top-notch JJ B
candidates NNS I
from IN O
the DT B
private JJ I
sector NN I
. . O
`` `` O
You PRP B
're VBP O
t/test.data view on Meta::CPAN
when WRB O
he PRP B
was VBD O
in IN O
his PRP$ B
second JJ I
year NN I
at IN O
the DT B
Chorrillos NNP I
Military NNP I
t/test.data view on Meta::CPAN
Noriega NNP I
has VBZ O
since IN O
classified VBN O
as IN O
secret NN O
. . O
He PRP B
flew VBD O
to TO O
t/test.data view on Meta::CPAN
holder NN I
of IN O
all DT B
Panama NNP I
's POS B
secrets NNS I
. . O
Mr. NNP B
Noriega NNP I
, , O
t/test.data view on Meta::CPAN
who WP B
, , O
as IN O
deputy NN B
assistant NN I
secretary NN I
of IN O
state NN B
for IN O
inter-American JJ B
affairs NNS I
t/test.data view on Meta::CPAN
concern NN B
: : O
gun-running JJ B
. . O
Prosecutors NNS B
in IN O
Southern NNP B
Florida NNP I
indicted VBD O
five CD B
t/test.data view on Meta::CPAN
'' '' O
it PRP B
read VBP O
. . O
Prosecutors NNS B
in IN O
Miami NNP B
received VBD O
yet RB B
another DT I
t/test.data view on Meta::CPAN
be VB O
handling VBG O
the DT B
shah NN I
's POS B
security NN I
. . O
It PRP B
would MD O
n't RB O
t/test.data view on Meta::CPAN
less JJR O
Mr. NNP B
Noriega NNP I
, , O
the DT B
prosecutor NN I
was VBD O
told VBN O
. . O
After IN O
t/test.data view on Meta::CPAN
, , O
along IN O
with IN O
a DT B
detailed VBN I
prosecution NN I
memo NN I
, , O
sat VBD O
on IN O
the DT B
t/test.data view on Meta::CPAN
Contras NNPS I
to TO O
set VB O
up IN O
a DT B
secret JJ I
training NN I
center NN I
in IN O
Panama NNP B
. . O
t/test.data view on Meta::CPAN
other JJ B
signs NNS I
that IN O
the DT B
manufacturing NN I
sector NN I
continues VBZ O
its PRP$ B
slowing NN I
trend NN I
. . O
t/test.data view on Meta::CPAN
% NN I
annual JJ I
rate NN I
in IN O
the DT B
second JJ I
quarter NN I
. . O
`` `` O
Capital NNP B
t/test.data view on Meta::CPAN
that WDT B
lasts VBZ O
longer RB O
than IN O
30 CD B
seconds NNS I
, , O
'' '' O
said VBD O
Mr. NNP B
Zipper NNP I
t/test.data view on Meta::CPAN
century NN I
saw VBD O
the DT B
evolution NN I
of IN O
private-sector JJ B
wonder NN I
drugs NNS I
, , O
which WDT B
promulgated VBD O
t/test.data view on Meta::CPAN
costs NNS I
have VBP O
declined VBN O
since IN O
the DT B
second JJ I
quarter NN I
. . O
Incrementally RB B
higher JJR I
t/test.data view on Meta::CPAN
% NN I
methanol NN I
. . O
A DT B
second JJ I
phase NN I
of IN O
research NN B
, , O
which WDT B
t/test.data view on Meta::CPAN
no DT B
cost NN I
estimate NN I
for IN O
the DT B
second JJ I
phase NN I
. . O
`` `` O
The DT B
t/test.data view on Meta::CPAN
Ernst NNP B
& CC I
Young NNP I
and CC O
the DT B
securities NNS I
firm NN I
of IN O
Goldman NNP B
, , I
Sachs NNP I
t/test.data view on Meta::CPAN
pennies NNS B
and CC O
$ $ B
45,000 CD I
of IN O
secret JJ B
gifts NNS I
from IN O
his PRP$ B
remorseful JJ I
father NN I
t/test.data view on Meta::CPAN
Sierra NNP B
has VBZ O
been VBN O
instrumental JJ O
in IN O
securing VBG O
a DT B
number NN I
of IN O
the DT B
California NNP I
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/CheckDigits.pm view on Meta::CPAN
returns a handle with which the registered module can be instantiated.
The first argument C<$module> is the module to be used for this plugin. This
argument is mandatory. Do not register 'Algorithm::CheckDigits'.
The second argument is a short description of the algorithm. If it is omitted,
the string C<algorithm of module $module> will be taken.
The third argument is the preferred key for this algorithm. The C<plug_in()>
function does not guarantee to register the algorithm with this key. Instead
it returns the key under which the algorithm is registered.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/AutoInstall.pm view on Meta::CPAN
$self->makemaker_args( Module::AutoInstall::_make_args() );
my $class = ref($self);
$self->postamble(
"# --- $class section:\n" .
Module::AutoInstall::postamble()
);
}
sub auto_install_now {
view all matches for this distribution
view release on metacpan or search on metacpan
perl/examples/ex3_kcluster view on Meta::CPAN
printf("\n");
printf("Within-cluster sum of distances is %f\n", $error);
printf("\n");
printf("Clustering second data set:\n\n");
($clusters, $error, $found) = kcluster(
%params,
data => $data2,
mask => $mask2,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/ClusterPoints.pm view on Meta::CPAN
Usually, when using dimensional groups, you would also want to use the
C<scales> method to set different scales for every dimension group.
Following with the previous example, supposing X and Y are given in
meters and T in seconds, to find the clusters with radius between
points of 1Km and 2 days, the following scales should be used:
my $spc_scl = 1/1000;
my $tmp_scl = 1/(2 * 24 * 60 * 60);
view all matches for this distribution
view release on metacpan or search on metacpan
Combinatorics.pm view on Meta::CPAN
If you pass the optional parameter C<$k>, the subroutine generates only partitions of size C<$k>. This uses an specific algorithm for partitions of known size, which is more efficient than generating all partitions and filtering them by size.
Note that in that case the subsets themselves may have several sizes, it is the number of elements I<of the partition> which is C<$k>. For instance if C<@data> has 5 elements there are partitions of size 2 that consist of a subset of size 2 and its c...
The number of partitions of size C<k> of a set of C<n> elements are known as Stirling numbers of the second kind, and satisfy the recursion:
S(0, 0) = 1
S(n, 0) = 0 if n > 0
S(n, 1) = S(n, n) = 1
S(n, k) = S(n-1, k-1) + kS(n-1, k)
Combinatorics.pm view on Meta::CPAN
A subroutine was called with no parameters.
=item Missing parameter k
A subroutine that requires a second parameter k was called without one.
=item Parameter data is not an arrayref
The first parameter is not an arrayref (tested with "reftype()" from Scalar::Util.)
view all matches for this distribution
view release on metacpan or search on metacpan
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
* 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
* 2. Declare a typedef named my_cxt_t that is a structure that contains
* all the data that needs to be interpreter-local.
* 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
* 4. Use the MY_CXT_INIT macro such that it is called exactly once
* (typically put in the BOOT: section).
* 5. Use the members of the my_cxt_t structure everywhere as
* MY_CXT.member.
* 6. Use the dMY_CXT macro (a declaration) in all the functions that
* access MY_CXT.
*/
view all matches for this distribution
view release on metacpan or search on metacpan
JumpHash.xs view on Meta::CPAN
#include "fix_inline.h"
#include <stdlib.h>
#include <sys/types.h>
/* This is SipHash by Jean-Philippe Aumasson and Daniel J. Bernstein.
* The authors claim it is relatively secure compared to the alternatives
* and that performance wise it is a suitable hash for languages like Perl.
* See:
*
* https://www.131002.net/siphash/
*
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
my $name = shift;
my $features = ( $self->{values}->{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accomodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
view all matches for this distribution