view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
unless ( uc($1) eq $1 ) {
unshift @_, ( $self, $1 );
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
my $method = $1;
if ( uc($method) eq $method ) {
view all matches for this distribution
view release on metacpan or search on metacpan
GDiffDelta.xs view on Meta::CPAN
croak("delta contains negative int value");
return buf[0] * 0x1000000 + buf[1] * 0x10000 +
buf[2] * 0x100 + buf[3];
}
/* The buffer is supplied by the parent so that we can avoid allocating
* it on the stack every time this is called, even though that probably
* wouldn't be very expensive in most implementations. */
static void
copy_data (SV *in, SV *out, size_t num_bytes, unsigned char *buf,
const char *from, const char *to)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/GaussianElimination/GF2.pm view on Meta::CPAN
=item $eq->len
Returns the internal length of the coeficients vector.
Note that this value is just a hint as the internal representation
grows transparently when new coeficients are set or inside the
C<solve> method.
=back
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Gutter/Cell.pod view on Meta::CPAN
drains. The reference is called with the cell object, cell index in the
gutter list, how much fluid drained, and an optional I<stash> provided
by the caller.
The caller is responsible for the return value, which will be
accumulated by the parent B<drain> method and returned to the caller as
a list. For example, the B<update> code could return MIDI events, the
amount of fluid drained, both, neither, or other values as need be.
Failing to set an update callback for a cell that triggers will result
in an exception.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
unshift @_, ($self, $1);
goto &{$self->can('call')} unless uc($1) eq $1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Heapify/XS.pm view on Meta::CPAN
# This allows declaration:
# use Algorithm::Heapify::XS ':all';
our %EXPORT_TAGS = (
'all' => [
'heap_parent_idx',
'heap_left_child_idx',
'heap_right_child_idx',
map { ("min_$_", "max_$_","minstr_$_","maxstr_$_") }
(
'heapify',
lib/Algorithm/Heapify/XS.pm view on Meta::CPAN
our $VERSION = '0.04';
require XSLoader;
XSLoader::load('Algorithm::Heapify::XS', $VERSION);
sub heap_parent_idx($) {
die "index must be non-negative" if $_[0] < 0;
return $_[0] ? int(($_[0] - 1) / 2) : undef;
}
sub heap_left_child_idx($) {
lib/Algorithm/Heapify/XS.pm view on Meta::CPAN
=head1 DESCRIPTION
A heap is an array based data structure where the array is treated as a balanced tree
of items where each item obeys a given inequality constraint with its parent and children,
but not with its siblings. This allows it to be put into "nearly" sorted order more
efficiently than an actual sort would.
This data structure has a number of nice properties:
a) the tree does not require "child" pointers, but instead infers parent/child
relationships from their position in the array. The parent of a node i is defined to
reside in position int((i-1)/2), and the left and right children of a node i reside in
position (i*2+1) and (i*2+2) respectively.
b) "heapifying" an array is O(N) as compared to N * log2(N) for a typical sort.
lib/Algorithm/Heapify/XS.pm view on Meta::CPAN
If the weight of a specific item in a heapified array has changed, this function will
adjust its position in the tree, and return the resulting new "top" (min/max) value.
If $idx is outside the array does nothing.
=item $idx= heap_parent_idx($idx)
Returns the defined location for the node residing at index $idx in a heap, or undef if the $idx is 0.
=item $idx= heap_left_child_idx($idx)
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
unshift @_, ($self, $1);
goto &{$self->can('call')} unless uc($1) eq $1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Kademlia.pm view on Meta::CPAN
use v5.42;
use experimental 'class';
#
package Algorithm::Kademlia v1.1.1 {
use parent 'Exporter';
our @EXPORT_OK = qw[xor_distance xor_bucket_index];
#
sub xor_distance ( $id1_bin, $id2_bin ) { $id1_bin^.$id2_bin }
sub xor_bucket_index ( $id1_bin, $id2_bin ) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
unless ($$sym =~ s/([^:]+)$//) {
# XXX: it looks like we can't retrieve the missing function
# via $$sym (usually $main::AUTOLOAD) in this case.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
my $method = $1;
if ( uc($method) eq $method ) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
unshift @_, ($self, $1);
goto &{$self->can('call')} unless uc($1) eq $1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/LDA.pm view on Meta::CPAN
use strict;
use warnings FATAL => 'all';
use constant pi => 4*atan2(1, 1);
use constant e => exp(1);
use parent qw/Class::Accessor::Fast/;
use List::Util qw(shuffle sum max);
use List::MoreUtils qw(uniq first_index);
use JSON::XS;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/LibLinear/Types.pm view on Meta::CPAN
use Types::Standard qw/Dict Int Map Num/;
my $Feature = __PACKAGE__->add_type(
constraint => q!List::MoreUtils::all { $_ > 0 } keys %$_!,
name => 'Feature',
parent => Map[Int, Num],
);
__PACKAGE__->add_type(
name => 'FeatureWithLabel',
parent => Dict[ feature => $Feature, label => Num ],
);
1;
view all matches for this distribution
view release on metacpan or search on metacpan
opmethod_stash|5.021007||Viu
OpMORESIB_set|5.021011|5.003007|p
OP_NAME|5.007003|5.007003|
op_null|5.007002|5.007002|
OPpALLOW_FAKE|5.015006||Viu
op_parent|5.025001|5.025001|n
OPpARG1_MASK|5.021004||Viu
OPpARG2_MASK|5.021004||Viu
OPpARG3_MASK|5.021004||Viu
OPpARG4_MASK|5.021004||Viu
OPpARGELEM_AV|5.025004||Viu
#ifndef OpMORESIB_set
# define OpMORESIB_set(o, sib) ((o)->op_sibling = (sib))
#endif
#ifndef OpLASTSIB_set
# define OpLASTSIB_set(o, parent) ((o)->op_sibling = NULL)
#endif
#ifndef OpMAYBESIB_set
# define OpMAYBESIB_set(o, sib, parent) ((o)->op_sibling = (sib))
#endif
#ifndef HEf_SVKEY
# define HEf_SVKEY -2
#endif
view all matches for this distribution
view release on metacpan or search on metacpan
0.04 March 2013
- https://rt.cpan.org/Ticket/Display.html?id=94055 should be
fixed using Test::Deeply now.
0.03 March 2013
- Floating point number serialisation apparently differs among
platforms, making a test fail; attempt to address that.
0.02 March 2014
- Removed accidental debug print
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Loops.pm view on Meta::CPAN
Note also that by importing Filter via the C<use> statement:
use Algorithm::Loops qw( Filter );
it gets declared before the rest of our code is compiled so we don't have
to use parentheses when calling it. We I<can> if we want to, however:
my @copy= Filter( sub {s/\s/_/g}, @list );
=head3 Note on "Function BLOCK LIST" bugs
lib/Algorithm/Loops.pm view on Meta::CPAN
may give you this error:
Array found where operator expected
which can be fixed by dropping the parentheses:
... Filter {y/aeiou/UAEIO/} @list;
So if you need or want to use parentheses when calling Filter, it is best
to also include the C<sub> keyword and the comma:
# v <--------- These ---------> v
... Filter( sub {y/aeiou/UAEIO/}, @list );
# require ^^^ <--- these ---> ^ (sometimes)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/MOS.pm view on Meta::CPAN
package Algorithm::MOS;
# ABSTRACT: Algorithm::MOS - Calculate MOS (Mean Opinion Score)
use Carp;
use parent 'Exporter';
our @EXPORT = ('calc_mos');
sub mos {
my ( $average, $jitter, $packet_loss ) = @_
or croak 'mos( average, jitter, packet_loss )';
view all matches for this distribution
view release on metacpan or search on metacpan
op_free|||
op_integerize|||
op_linklist||5.013006|
op_lvalue_flags|||
op_null||5.007002|
op_parent|||n
op_prepend_elem||5.013006|
op_refcnt_lock||5.009002|
op_refcnt_unlock||5.009002|
op_relocate_sv|||
op_sibling_splice||5.021002|n
#ifndef OpMORESIB_set
# define OpMORESIB_set(o, sib) ((o)->op_sibling = (sib))
#endif
#ifndef OpLASTSIB_set
# define OpLASTSIB_set(o, parent) ((o)->op_sibling = NULL)
#endif
#ifndef OpMAYBESIB_set
# define OpMAYBESIB_set(o, sib, parent) ((o)->op_sibling = (sib))
#endif
#ifndef HEf_SVKEY
# define HEf_SVKEY -2
#endif
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
use strict;
use warnings;
require 5.006_000; # $VERSION declaration apparently fails on 5.00505
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Algorithm::NeedlemanWunsch',
view all matches for this distribution
view release on metacpan or search on metacpan
t/Algorithm_Odometer_Tiny_Testlib.pm view on Meta::CPAN
L<http://perldoc.perl.org/perlartistic.html>.
=cut
BEGIN {
require Exporter; # "parent" pragma wasn't core until 5.10.1
our @ISA = qw/ Exporter /; ## no critic (ProhibitExplicitISA)
}
our @EXPORT = qw/ $AUTHOR_TESTS exception warns getverbatim /; ## no critic (ProhibitAutomaticExportation)
our $AUTHOR_TESTS;
view all matches for this distribution
view release on metacpan or search on metacpan
op_integerize|||
op_linklist||5.013006|
op_lvalue_flags|||
op_lvalue||5.013007|
op_null||5.007002|
op_parent|||n
op_prepend_elem||5.013006|
op_refcnt_dec|||
op_refcnt_inc|||
op_refcnt_lock||5.009002|
op_refcnt_unlock||5.009002|
#ifndef OpMORESIB_set
# define OpMORESIB_set(o, sib) ((o)->op_sibling = (sib))
#endif
#ifndef OpLASTSIB_set
# define OpLASTSIB_set(o, parent) ((o)->op_sibling = NULL)
#endif
#ifndef OpMAYBESIB_set
# define OpMAYBESIB_set(o, sib, parent) ((o)->op_sibling = (sib))
#endif
#ifndef SvRX
#if defined(NEED_SvRX)
static void * DPPP_(my_SvRX)(pTHX_ SV *rv);
view all matches for this distribution
view release on metacpan or search on metacpan
typedef enum ShapeType ShapeType;
struct QuadTreeNode {
QuadTreeNode *children;
QuadTreeNode *parent;
DynArr *values;
double xmin, ymin, xmax, ymax;
bool has_objects;
};
{
push_array(arr, ptr);
SvREFCNT_inc(ptr);
}
QuadTreeNode* create_nodes(int count, QuadTreeNode *parent)
{
QuadTreeNode *node = malloc(count * sizeof *node);
int i;
for (i = 0; i < count; ++i) {
node[i].values = NULL;
node[i].children = NULL;
node[i].parent = parent;
node[i].has_objects = false;
}
return node;
}
if (node->children[i].has_objects) return;
}
}
node->has_objects = false;
if (node->parent != NULL) {
clear_has_objects(node->parent);
}
}
QuadTreeRootNode* create_root()
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/QuadTree.pm view on Meta::CPAN
non-Tk programs successfully. It is a classic memory/speed trade-off.
Lots of information about QTAs can be found on the web. But, very briefly,
a quadtree is a hierarchical data model that recursively decomposes a map into
smaller regions. Each node in the tree has 4 children nodes, each of which
represents one quarter of the area that the parent represents. So, the root
node represents the complete map. This map is then split into 4 equal quarters,
each of which is represented by one child node. Each of these children is now
treated as a parent, and its area is recursively split up into 4 equal areas,
and so on up to a desired depth.
Here is a somewhat crude diagram:
------------------------------
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Retry/Constant.pm view on Meta::CPAN
our $VERSION = '0.002'; # VERSION
use strict;
use warnings;
use parent qw(Algorithm::Retry);
our %SPEC;
$SPEC{new} = {
v => 1.1,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/SAT/Backtracking/DPLL.pm view on Meta::CPAN
use Data::Dumper;
use strict;
use warnings;
our $VERSION = "0.13";
# this allow to switch the parent implementation (needed for the Ordered alternative)
sub import {
my ( $class, $flag ) = @_;
if ($flag) {
eval "use base '$flag'";
}
view all matches for this distribution
view release on metacpan or search on metacpan
- SVM: Added binding for predict_values, improved memory usage
- DataSet: changed to use sparse format internally
internal format similar to what libsvm uses
added asArray function, improved memory usage
- All changes (except libsvm update which slightly changes the
learned models) are completely transparent to the user. No
changes in programs depending on this should be necessary.
0.13 Tue Jan 22 13:38:00 PDT 2008
- Updated the underlaying libsvm version to 2.85
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $cwd = Cwd::cwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
my $method = $1;
if ( uc($method) eq $method ) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Shape/RandomTree.pm view on Meta::CPAN
$self->create_branch( $stem, $level );
}
} else {
# Get the current level's parent branches
# ( i.e. the previous level's branches )
my @parent_branches = $self->filter_branches(
sub { $_->level = ( $level - 1 ) }
);
foreach my $parent ( @parent_branches ) {
# Number of sub branches
my $sub_branches = int( rand( $self->complexity ) );
# Create sub-branches for the current parent branch
foreach my $idx ( 1 .. $sub_branches ) {
$self->create_branch( $parent, $level );
}
}
}
}
lib/Algorithm/Shape/RandomTree.pm view on Meta::CPAN
return $stem;
}
# Linear algorithm's branch creation sub
sub create_branch {
my ( $self, $parent, $level ) = @_;
my $start_point = $parent->end_point;
my $verb = $self->verbose;
my ( $dx, $dy ) = $self->calc_new_deltas( $parent );
my ( $x_end, $y_end ) = $self->calc_new_endpoints(
$start_point, $dx, $dy
);
my $end_point = Algorithm::Shape::RandomTree::Branch::Point->new(
lib/Algorithm/Shape/RandomTree.pm view on Meta::CPAN
start_point => $start_point,
end_point => $end_point,
dx => $dx,
dy => $dy,
level => $level,
parent => $parent,
# nodulation => ,
# complexity => ,
);
$self->add_branch( $newbranch );
}
# Calculate New Deltas: uses the parent branch's attributes and random factors
# to modify a new branche's dx and dy values, who determin the angle and length
# of the new branch.
sub calc_new_deltas {
my ( $self, $parent ) = @_;
my $verb = $self->verbose;
# Get parent branch's deltas
my $old_dx = $parent->dx;
my $old_dy = $parent->dy;
# Calculate modifiers:
# These slightly change the dx and dy to create variation and randomness
# in branches lengths and angles.
# Modifiers range from -range_value to +range_value
lib/Algorithm/Shape/RandomTree.pm view on Meta::CPAN
);
# If the level is 0, it's the stem's children, so the falloff should be 1.5
# (so that they would still be a bit shorter than the stem).
# otherwise, it should be the level + 1
my $falloff = ( $parent->level == 0 ) ? 1.5 : $parent->level + 1;
# Apply modifiers
my $new_dx = int ( ( $old_dx + $dx_modifier ) / $falloff );
my $new_dy = int ( ( $old_dy + $dy_modifier ) / $falloff );
lib/Algorithm/Shape/RandomTree.pm view on Meta::CPAN
return( $x_end, $y_end );
}
# The recursive algorithm for creating all non-stem branches
sub create_branches_recursive {
my ( $self, $parent ) = @_;
my $verb = $self->verbose;
my $name = $parent->name;
$verb && print "[create_branches_recursive] on parent: $name\n";
# Create a new branch connected to parent
my $branch = $self->make_branch( $parent );
# Create this branche's sub-branches
if ( $branch->nodulation ) {
foreach my $idx ( 1 .. $branch->complexity ) {
$verb && print qq{
lib/Algorithm/Shape/RandomTree.pm view on Meta::CPAN
}
}
# Sub for creating single branches used by the recursive algorithm
sub make_branch {
my ( $self, $parent ) = @_;
my $start_point = $parent->end_point;
my $verb = $self->verbose;
my $name = $parent->name;
$verb && print "[make_branche] on parent: $name\n";
my ( $dx, $dy ) = $self->calc_new_deltas( $parent );
my ( $x_end, $y_end ) = $self->calc_new_endpoints(
$start_point, $dx, $dy
);
my $end_point = Algorithm::Shape::RandomTree::Branch::Point->new(
x => $x_end, y => $y_end
);
my $number = $self->count_branches + 1; # New branch's num (name)
my $nodulation = $self->calc_new_nodulation( $parent );
my $complexity = int( rand( $self->complexity ) ); # Calculate new complexity
# Calculate new width, and prevent a less than 1 width
my $falloff = ( $parent->level == 0 ) ? 1.5 : $parent->level + 1;
my $new_width = int ( $self->tree_width / $falloff );
my $width = $new_width ? $new_width : 1;
my $path_str = $self->create_path( $start_point, $end_point, $dx, $dy );
lib/Algorithm/Shape/RandomTree.pm view on Meta::CPAN
name => $number,
start_point => $start_point,
end_point => $end_point,
dx => $dx,
dy => $dy,
level => $parent->level + 1,
parent => $parent,
nodulation => $nodulation,
complexity => $complexity,
width => $width,
path_string => $path_str,
);
lib/Algorithm/Shape/RandomTree.pm view on Meta::CPAN
return $newbranch;
}
sub calc_new_nodulation {
my ( $self, $parent ) = @_;
my $verb = $self->verbose;
my $old = $parent->nodulation;
# Reduce ebbing factor from the parent's nodulation
my $new = $old - $self->ebbing_factor;
return $new;
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
my $sym = "$caller\::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if (my $code = $sym->{$pwd}) {
goto &$code unless $cwd eq $pwd; # delegate back to parent dirs
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $caller";
unshift @_, ($self, $1);
goto &{$self->can('call')} unless uc($1) eq $1;
};
view all matches for this distribution