view release on metacpan or search on metacpan
ENTER;
SAVETMPS;
PUSHMARK(sp);
PUTBACK;
count = call_sv(findFreeVarPerlFunc, G_SCALAR);
SPAGAIN;
ret = -1;
if (count <= 0) {
PUSHMARK(sp);
XPUSHs(sv_2mortal(newSViv(index)));
XPUSHs(sv_2mortal(newSViv(val)));
PUTBACK;
count = call_sv(criteriaPerlFunc, G_SCALAR);
SPAGAIN;
ret = -1;
if (count == 0) {
ENTER;
SAVETMPS;
PUSHMARK(sp);
PUTBACK;
call_sv(foundPerlFunc, G_VOID);
SPAGAIN;
FREETMPS;
LEAVE;
PUSHMARK(sp);
/* index is pointing to context in perl code */
XPUSHs(sv_2mortal(newSViv(index)));
PUTBACK;
call_sv(backtrackPerlFunc, G_VOID);
SPAGAIN;
FREETMPS;
LEAVE;
ENTER;
SAVETMPS;
PUSHMARK(sp);
PUTBACK;
count = call_sv((SV*)ext, G_SCALAR);
SPAGAIN;
ret = -1;
if (count == 0) {
PUSHMARK(sp);
XPUSHs(sv_2mortal(newSViv(val)));
XPUSHs(sv_2mortal(newSViv(index)));
PUTBACK;
count = call_sv((SV*)ext, G_SCALAR);
SPAGAIN;
ret = -1;
if (count == 0) {
PUSHMARK(sp);
XPUSHs(sv_2mortal(newSViv(index)));
XPUSHs(sv_2mortal(newSViv(oldValue)));
PUTBACK;
count = call_sv((SV*)ext, G_SCALAR);
SPAGAIN;
ret = -1;
if (count == 0) {
paramVar = sv_newmortal();
sv_setiv(newSVrv(paramVar, PACKAGE_INT), PTR2IV(vars[index]));
XPUSHs(paramVar);
XPUSHs(sv_2mortal(newSViv(index)));
PUTBACK;
if (vsSimpleArray[index].init)
count = call_sv(vsSimpleArray[index].init, G_ARRAY);
else
count = 0;
SPAGAIN;
if (count > 0) {
obj = POPs;
SvREFCNT_inc(obj);
PUTBACK;
}
FREETMPS;
LEAVE;
}
sv_setiv(newSVrv(paramVar, PACKAGE_INT), PTR2IV(vars[index]));
XPUSHs(obj);
XPUSHs(paramVar);
XPUSHs(sv_2mortal(newSViv(index)));
PUTBACK;
count = call_method("next", G_ARRAY);
SPAGAIN;
if (count >= 2) {
SV *v = POPs;
}
else {
ret = FALSE;
}
PUTBACK;
FREETMPS;
LEAVE;
}
ENTER;
SAVETMPS;
PUSHMARK(sp);
PUTBACK;
count = call_sv(maxFailPerlFunc, G_SCALAR);
SPAGAIN;
ret = -1;
if (count <= 0) {
}
r = newRV_noinc((SV*)elements);
XPUSHs(sv_2mortal((SV*)r));
PUTBACK;
{
int count = call_method(meth, G_ARRAY);
SPAGAIN;
if (count > 0) {
ret = sv_true(POPs);
PUSHMARK(SP);
XPUSHs(sv_2mortal((SV*)newRV(ext)));
XPUSHs(sv_2mortal((SV*)newSViv(maxFails)));
PUTBACK;
call_method("search_start", G_DISCARD);
FREETMPS;
LEAVE;
}
XPUSHs(sv_2mortal((SV*)newRV(ext)));
XPUSHs(sv_2mortal((SV*)newSViv(result)));
XPUSHs(sv_2mortal((SV*)newSViv(nbFails)));
XPUSHs(sv_2mortal((SV*)newSViv(maxFails)));
PUTBACK;
call_method("search_end", G_DISCARD);
FREETMPS;
LEAVE;
}
XPUSHs(sv_2mortal((SV*)newSViv(depth)));
XPUSHs(sv_2mortal((SV*)newSViv(index)));
XPUSHs(sv_2mortal((SV*)newSViv(vs->method)));
XPUSHs(sv_2mortal((SV*)newSViv(vs->value)));
PUTBACK;
call_method("before_value_selection", G_DISCARD);
FREETMPS;
LEAVE;
}
XPUSHs(sv_2mortal((SV*)newSViv(depth)));
XPUSHs(sv_2mortal((SV*)newSViv(index)));
XPUSHs(sv_2mortal((SV*)newSViv(vs->method)));
XPUSHs(sv_2mortal((SV*)newSViv(vs->value)));
PUTBACK;
call_method("after_value_selection", G_DISCARD);
FREETMPS;
LEAVE;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal((SV*)newRV(ext)));
XPUSHs(sv_2mortal((SV*)newSViv(depth)));
XPUSHs(sv_2mortal((SV*)newSViv(index)));
PUTBACK;
call_method("enter", G_DISCARD);
FREETMPS;
LEAVE;
}
PUSHMARK(SP);
XPUSHs(sv_2mortal((SV*)newRV(ext)));
XPUSHs(sv_2mortal((SV*)newSViv(depth)));
XPUSHs(sv_2mortal((SV*)newSViv(index)));
PUTBACK;
call_method("leave", G_DISCARD);
FREETMPS;
LEAVE;
}
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal((SV*)newRV(ext)));
XPUSHs(sv_2mortal((SV*)newSViv(depth)));
PUTBACK;
count = call_method("found", G_SCALAR);
SPAGAIN;
ret = 0;
if (count > 0) {
for (i = 0; i<alen; i++) {
SV** pptr = av_fetch(av, i, 0);
array[i] = INT2PTR(CSint*, SvIV(*pptr));
}
OUTPUT:
RETVAL
void*
alloc_int_array(av)
AV *av;
for (i = 0; i<alen; i++) {
SV** pptr = av_fetch(av, i, 0);
array[i] = SvIV(*pptr);
}
OUTPUT:
RETVAL
void
free_array(ptr)
int
cs_saveContext()
CODE:
RETVAL = cs_saveContext();
OUTPUT:
RETVAL
void
cs_restoreContext()
CODE:
int get_nb_fails(iz)
void* iz
CODE:
RETVAL = cs_getNbFails();
OUTPUT:
RETVAL
void
cs_forgetSaveContext()
CODE:
int get_nb_choice_points(iz)
void* iz
CODE:
RETVAL = cs_getNbChoicePoints();
OUTPUT:
RETVAL
void*
cs_createCSint(min, max)
int min
int max
CODE:
RETVAL = cs_createCSint(min, max);
OUTPUT:
RETVAL
void*
cs_createCSintFromDomain(parray, size)
void* parray
CODE:
if (size <= 0)
RETVAL = 0;
else
RETVAL = cs_createCSintFromDomain(parray, size);
OUTPUT:
RETVAL
int
cs_search(av, func_id, func_ref, max_fail)
AV *av
max_fail = INT_MAX;
RETVAL = cs_searchFail(array,
(int)alen, findFreeVarWrapper, max_fail);
Safefree(array);
OUTPUT:
RETVAL
int
cs_searchCriteria(av, findvar_id, findvar_ref, criteria_ref, max_fail)
AV *av
(int)alen,
currentArray2IndexFunc,
criteriaPerlWrapper,
max_fail);
Safefree(array);
OUTPUT:
RETVAL
int
cs_findAll(av, findvar_id, findvar_ref, found_ref)
AV *av
}
RETVAL = cs_findAll(array, (int)alen,
findFreeVarWrapper, foundPerlWrapper);
Safefree(array);
OUTPUT:
RETVAL
void
cs_backtrack(vint, index, handler)
void* vint
int size
SV* handler
CODE:
RETVAL = cs_eventAllKnown(tint, size,
eventAllKnownPerlWrapper, SvRV(handler));
OUTPUT:
RETVAL
int
cs_eventKnown(tint, size, handler)
void* tint
int size
SV* handler
CODE:
RETVAL = cs_eventKnown(tint, size,
eventKnownPerlWrapper, SvRV(handler));
OUTPUT:
RETVAL
void
cs_eventNewMin(tint, size, handler)
void* tint
int
cs_getNbElements(vint)
void* vint
CODE:
RETVAL = cs_getNbElements(vint);
OUTPUT:
RETVAL
int
cs_getMin(vint)
void* vint
CODE:
RETVAL = cs_getMin(vint);
OUTPUT:
RETVAL
int
cs_getMax(vint)
void* vint
CODE:
RETVAL = cs_getMax(vint);
OUTPUT:
RETVAL
int
cs_getValue(vint)
void* vint
CODE:
if (cs_isFree(vint))
croak("variable is not unstantiated.");
RETVAL = cs_getValue(vint);
OUTPUT:
RETVAL
void
cs_domain(vint, av)
void* vint
cs_getNextValue(vint, val)
void* vint
int val
CODE:
RETVAL = cs_getNextValue(vint, val);
OUTPUT:
RETVAL
int
cs_getPreviousValue(vint, val)
void* vint
int val
CODE:
RETVAL = cs_getPreviousValue(vint, val);
OUTPUT:
RETVAL
int
cs_AllNeq(tint, size)
void* tint
int size
CODE:
RETVAL = cs_AllNeq(tint, size);
OUTPUT:
RETVAL
int
cs_InArray(vint, array, size)
void* vint
void* array
int size
CODE:
RETVAL = cs_InArray(vint, array, size);
OUTPUT:
RETVAL
int
cs_NotInArray(vint, array, size)
void* vint
void* array
int size
CODE:
RETVAL = cs_NotInArray(vint, array, size);
OUTPUT:
RETVAL
int
cs_InInterval(vint, minVal, maxVal)
void* vint
int minVal
int maxVal
CODE:
RETVAL = cs_InInterval(vint, minVal, maxVal);
OUTPUT:
RETVAL
int
cs_NotInInterval(vint, minVal, maxVal)
void* vint
int minVal
int maxVal
CODE:
RETVAL = cs_NotInInterval(vint, minVal, maxVal);
OUTPUT:
RETVAL
void*
cs_Add(vint1, vint2)
void* vint1
void* vint2
CODE:
RETVAL = cs_Add(vint1, vint2);
OUTPUT:
RETVAL
void*
cs_Mul(vint1, vint2)
void* vint1
void* vint2
CODE:
RETVAL = cs_Mul(vint1, vint2);
OUTPUT:
RETVAL
void*
cs_Sub(vint1, vint2)
void* vint1
void* vint2
CODE:
RETVAL = cs_Sub(vint1, vint2);
OUTPUT:
RETVAL
void*
cs_Div(vint1, vint2)
void* vint1
void* vint2
CODE:
RETVAL = cs_Div(vint1, vint2);
OUTPUT:
RETVAL
void*
cs_Sigma(tint, size)
void* tint
int size
CODE:
RETVAL = cs_Sigma(tint, size);
OUTPUT:
RETVAL
void*
cs_ScalProd(vars, coeffs, n)
void* vars
void* coeffs
int n
CODE:
RETVAL = cs_ScalProd(vars, coeffs, n);
OUTPUT:
RETVAL
void*
cs_Abs(vint)
void* vint
CODE:
RETVAL = cs_Abs(vint);
OUTPUT:
RETVAL
void*
cs_Min(tint, size)
void* tint
int size
CODE:
RETVAL = cs_Min(tint, size);
OUTPUT:
RETVAL
void*
cs_Max(tint, size)
void* tint
int size
CODE:
RETVAL = cs_Max(tint, size);
OUTPUT:
RETVAL
int
cs_IfEq(vint1, vint2, val1, val2)
void* vint1
void* vint2
int val1
int val2
CODE:
RETVAL = cs_IfEq(vint1, vint2, val1, val2);
OUTPUT:
RETVAL
int
cs_IfNeq(vint1, vint2, val1, val2)
void* vint1
void* vint2
int val1
int val2
CODE:
RETVAL = cs_IfNeq(vint1, vint2, val1, val2);
OUTPUT:
RETVAL
void*
cs_OccurDomain(val, array, size)
int val
void* array
int size
CODE:
RETVAL = cs_OccurDomain(val, array, size);
OUTPUT:
RETVAL
int
cs_OccurConstraints(vint, val, array, size)
void* vint
int val
void* array
int size
CODE:
RETVAL = cs_OccurConstraints(vint, val, array, size);
OUTPUT:
RETVAL
void*
cs_Index(array, size, val)
void* array
int size
int val
CODE:
RETVAL = cs_Index(array, size, val);
OUTPUT:
RETVAL
void*
cs_Element(index, values, size)
void* index
void* values
int size
CODE:
RETVAL = cs_Element(index, values, size);
OUTPUT:
RETVAL
void*
cs_VarElement(index, values, size)
void* index
void* values
int size
CODE:
RETVAL = cs_VarElement(index, values, size);
OUTPUT:
RETVAL
#if (IZ_VERSION_MAJOR == 3 && IZ_VERSION_MINOR >= 6)
void*
void* index
void* values
int size
CODE:
RETVAL = cs_VarElementRange(index, values, size);
OUTPUT:
RETVAL
int
cs_Cumulative(s, d, r, size, limit)
void* s
void* r
int size
void* limit
CODE:
RETVAL = cs_Cumulative(s, d, r, size, limit);
OUTPUT:
RETVAL
int
cs_Disjunctive(s, d, size)
void* s
void* d
int size
CODE:
RETVAL = cs_Disjunctive(s, d, size);
OUTPUT:
RETVAL
#endif /* (IZ_VERSION_MAJOR == 3 && IZ_VERSION_MINOR >= 6) */
#if (IZ_VERSION_MAJOR == 3 && IZ_VERSION_MINOR >= 7)
int q0
void* farray
int fsize
CODE:
RETVAL = cs_Regular(tint, size, darray, Q, S, q0, farray, fsize);
OUTPUT:
RETVAL
#endif /* (IZ_VERSION_MAJOR == 3 && IZ_VERSION_MINOR >= 6) */
int
}
}
else {
RETVAL = cs_getNextValue(vint, val);
}
OUTPUT:
RETVAL
#if (IZ_VERSION_MAJOR == 3 && IZ_VERSION_MINOR >= 6)
void
void*
cs_getValueSelector(vs)
int vs
CODE:
RETVAL = (void*)cs_getValueSelector(vs);
OUTPUT:
RETVAL
void*
valueSelector_init(vs, index, array, size)
void* vs;
Newx(ext, 1, int);
if (ext) {
cs_initValueSelector(vs, index, array, size, ext);
}
RETVAL = ext;
OUTPUT:
RETVAL
void
cs_selectNextValue(vs, index, array, size, ext)
void* vs
int rc;
CODE:
rc = cs_endValueSelector(vs, index, array, size, ext);
Safefree(ext);
RETVAL = rc;
OUTPUT:
RETVAL
void*
createSimpleValueSelector()
CODE:
if (vsSimpleObjRef == 0) {
vsSimpleObj = cs_createValueSelector(vsSimpleInit, vsSimpleNext, vsSimpleEnd);
}
vsSimpleObjRef++;
RETVAL = vsSimpleObj;
OUTPUT:
RETVAL
void
deleteSimpleValueSelector()
CODE:
RETVAL = TRUE;
}
else {
RETVAL = FALSE;
}
OUTPUT:
RETVAL
void*
cs_createNoGoodSet(av, size, prefilter_is_defined, max_no_good, ngsObj)
void* av
RETVAL = cs_createNoGoodSet(av, size,
(prefilter_is_defined
? noGoodSetPrefilterPerlWrapper : NULL),
max_no_good,
noGoodSetDestoryPerlWrapper, ngsObj);
OUTPUT:
RETVAL
void
cs_filterNoGood(ngs)
void* ngs
void* ngs
CODE:
if (!ngs)
croak("cs_getNbNoGoods: not initialized.");
RETVAL = cs_getNbNoGoods(ngs);
OUTPUT:
RETVAL
int
cs_searchValueSelectorFail(av, vs, findvar_id, findvar_ref, max_fail, nf_ref)
AV *av
currentArray2IndexFunc,
max_fail,
(nf_ref ? INT2PTR(CSsearchNotify*, SvIV(nf_ref)) : NULL));
Safefree(array);
Safefree(vs_array);
OUTPUT:
RETVAL
int
cs_searchValueSelectorRestartNG(av, vs, findvar_id, findvar_ref, max_fail_func, max_fail, ngs, nf_ref)
AV *av
max_fail,
INT2PTR(CSnoGoodSet*, SvIV(ngs)),
(nf_ref ? INT2PTR(CSsearchNotify*, SvIV(nf_ref)) : NULL));
Safefree(array);
Safefree(vs_array);
OUTPUT:
RETVAL
int
cs_selectValue(rv, method, value)
CSvalueSelection vs;
CODE:
vs.method = method;
vs.value = value;
RETVAL = cs_selectValue(INT2PTR(CSint*, SvIV(SvRV(rv))), &vs);
OUTPUT:
RETVAL
void*
cs_createSearchNotify(obj)
SV* obj
CODE:
RETVAL = cs_createSearchNotify(SvRV(obj));
OUTPUT:
RETVAL
void
searchNotify_set_search_start(notify)
SV* notify
int
nb_elements(rv)
SV* rv;
CODE:
RETVAL = cs_getNbElements(INT2PTR(CSint*, SvIV(SvRV(rv))));
OUTPUT:
RETVAL
int
nb_constraints(rv)
SV* rv;
CODE:
RETVAL = cs_getNbConstraints(INT2PTR(CSint*, SvIV(SvRV(rv))));
OUTPUT:
RETVAL
int
min(rv)
SV* rv;
CODE:
RETVAL = cs_getMin(INT2PTR(CSint*, SvIV(SvRV(rv))));
OUTPUT:
RETVAL
int
max(rv)
SV* rv;
CODE:
RETVAL = cs_getMax(INT2PTR(CSint*, SvIV(SvRV(rv))));
OUTPUT:
RETVAL
int
value(rv)
SV* rv;
CODE:
RETVAL = cs_getValue(INT2PTR(CSint*, SvIV(SvRV(rv))));
OUTPUT:
RETVAL
int
is_free(rv)
SV* rv;
CODE:
RETVAL = cs_isFree(INT2PTR(CSint*, SvIV(SvRV(rv))));
OUTPUT:
RETVAL
int
is_instantiated(rv)
SV* rv;
CODE:
RETVAL = cs_isInstantiated(INT2PTR(CSint*, SvIV(SvRV(rv))));
OUTPUT:
RETVAL
int
get_next_value(rv, val)
SV* rv;
int val;
CODE:
RETVAL = cs_getNextValue(INT2PTR(CSint*, SvIV(SvRV(rv))), val);
OUTPUT:
RETVAL
int
get_previous_value(rv, val)
SV* rv;
int val;
CODE:
RETVAL = cs_getPreviousValue(INT2PTR(CSint*, SvIV(SvRV(rv))), val);
OUTPUT:
RETVAL
int
is_in(rv, val)
SV* rv;
int val;
CODE:
RETVAL = cs_isIn(INT2PTR(CSint*, SvIV(SvRV(rv))), val);
OUTPUT:
RETVAL
int
Eq(rv, val)
SV* rv;
RETVAL = cs_Eq(vint1, vint2);
}
else {
RETVAL = cs_EQ(vint1, (int)SvIV(val));
}
OUTPUT:
RETVAL
int
Neq(rv, val)
SV* rv;
RETVAL = cs_Neq(vint1, vint2);
}
else {
RETVAL = cs_NEQ(vint1, (int)SvIV(val));
}
OUTPUT:
RETVAL
int
Le(rv, val)
SV* rv;
RETVAL = cs_Le(vint1, vint2);
}
else {
RETVAL = cs_LE(vint1, (int)SvIV(val));
}
OUTPUT:
RETVAL
int
Lt(rv, val)
SV* rv;
RETVAL = cs_Lt(vint1, vint2);
}
else {
RETVAL = cs_LT(vint1, (int)SvIV(val));
}
OUTPUT:
RETVAL
int
Ge(rv, val)
SV* rv;
RETVAL = cs_Ge(vint1, vint2);
}
else {
RETVAL = cs_GE(vint1, (int)SvIV(val));
}
OUTPUT:
RETVAL
int
Gt(rv, val)
SV* rv;
RETVAL = cs_Gt(vint1, vint2);
}
else {
RETVAL = cs_GT(vint1, (int)SvIV(val));
}
OUTPUT:
RETVAL
AV *
domain(rv)
SV* rv;
i = 0;
for (val = cs_getMin(vint); val <= maxVal; val++) {
if (!cs_isIn(vint, val)) continue;
av_store(RETVAL, i++, newSViv(val));
}
OUTPUT:
RETVAL
void
set_name(rv, s)
SV* rv;
vint = INT2PTR(CSint*, SvIV(SvRV(rv)));
cstr = cs_getName(vint);
if (!cstr) XSRETURN_UNDEF;
RETVAL = newSVpv(cstr, strlen(cstr));
SvUTF8_on(RETVAL);
OUTPUT:
RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
fprintf (stderr,"%s\n",encoder.what());
RETVAL = -1;
} else
RETVAL = 0;
}
OUTPUT:
RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
perl/Record.pm view on Meta::CPAN
else {
$extension = 'atr';
$keyword = 'ARRY';
}
my $nnodes = $tree->length;
open OUTPUT, ">$jobname.$extension" or die 'Error: Unable to open output file';
my @nodeID = ('') x $nnodes;
my @nodedist;
my $i;
for ($i = 0; $i < $nnodes; $i++) {
my $node = $tree->get($i);
perl/Record.pm view on Meta::CPAN
}
for (my $nodeindex = 0; $nodeindex < $nnodes; $nodeindex++) {
my $min1 = $tree->get($nodeindex)->left;
my $min2 = $tree->get($nodeindex)->right;
$nodeID[$nodeindex] = "NODE" . ($nodeindex+1) . "X";
print OUTPUT $nodeID[$nodeindex];
print OUTPUT "\t";
if ($min1 < 0) {
my $index1 = -$min1-1;
print OUTPUT $nodeID[$index1];
print OUTPUT "\t";
if ($nodedist[$index1] > $nodedist[$nodeindex]) {
$nodedist[$nodeindex] = $nodedist[$index1];
}
}
else {
print OUTPUT $keyword . $min1 . "X\t";
}
if ($min2 < 0) {
my $index2 = -$min2-1;
print OUTPUT $nodeID[$index2];
print OUTPUT "\t";
if ($nodedist[$index2] > $nodedist[$nodeindex]) {
$nodedist[$nodeindex] = $nodedist[$index2];
}
}
else {
print OUTPUT $keyword . $min2 . "X\t";
}
print OUTPUT 1.0-$nodedist[$nodeindex];
print OUTPUT "\n";
}
close(OUTPUT);
# Now set up order based on the tree structure
return $tree->sort(\@order);
}
sub _savekmeans {
perl/Record.pm view on Meta::CPAN
}
else {
$label = 'ARRAY';
@names = @{$self->{expid}};
}
open OUTPUT, ">$filename" or die 'Error: Unable to open output file';
print OUTPUT "$label\tGROUP\n";
my $n = scalar @names;
my @result = sort { $order[$a] <=> $order[$b] } (0..$n-1);
my @sortedindex;
my $cluster = 0;
while (scalar @sortedindex < $n) {
foreach (@result) {
my $j = $_;
my $cid = $clusterids[$j];
if ($clusterids[$j]==$cluster) {
print OUTPUT $names[$j] . "\t$cluster\n";
push (@sortedindex, $j);
}
}
$cluster++;
}
close(OUTPUT);
return @sortedindex;
}
sub _savedata {
my ($self, %param) = @_;
perl/Record.pm view on Meta::CPAN
else {
@genename = @{$self->{geneid}};
}
my $ngenes = scalar @{$self->{geneid}};
my $nexps = scalar @{$self->{expid}};
open OUTPUT, ">$jobname.cdt" or die 'Error: Unable to open output file';
my @mask;
if (defined $self->{mask}) {
@mask = @{$self->{mask}};
}
else {
perl/Record.pm view on Meta::CPAN
}
else {
@eweight = (1) x $nexps;
}
if ($gid) {
print OUTPUT "GID\t";
}
print OUTPUT $self->{uniqid};
print OUTPUT "\tNAME\tGWEIGHT";
# Now add headers for data columns
foreach (@expindex) {
print OUTPUT "\t" . $self->{expid}[$_];
}
print OUTPUT "\n";
if ($aid) {
print OUTPUT "AID";
if ($gid) {
print OUTPUT "\t";
}
print OUTPUT "\t\t";
foreach (@expindex) {
print OUTPUT "\tARRY" . $_ . 'X';
}
print OUTPUT "\n";
}
print OUTPUT "EWEIGHT";
if ($gid) {
print OUTPUT "\t";
}
print OUTPUT "\t\t";
foreach (@expindex) {
print OUTPUT "\t" . $eweight[$_];
}
print OUTPUT "\n";
foreach (@geneindex) {
my $i = $_;
if ($gid) {
print OUTPUT "GENE" . $i . "X\t";
}
print OUTPUT $self->{geneid}[$i] . "\t" . $genename[$i] . "\t" . $gweight[$i];
foreach (@expindex) {
my $j = $_;
print OUTPUT "\t";
if ($mask[$i][$j]) {
print OUTPUT $self->{data}[$i][$j];
}
}
print OUTPUT "\n";
}
close(OUTPUT);
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
MODULE = Algorithm::ConsistentHash::CHash PACKAGE = Algorithm::ConsistentHash::CHash
TYPEMAP: <<HERE
struct chash_t * O_OBJECT
OUTPUT
O_OBJECT
sv_setref_pv( $arg, CLASS, (void*)$var );
INPUT
O_OBJECT
if ( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
$var = INT2PTR($type, SvIV((SV*)SvRV( $arg )));
else
/* fprintf(stderr, "nkeys => %u, replicas => %u\n", nkeys, replicas); */
RETVAL = chash_create(keys, lens, nkeys, replicas);
if (RETVAL == NULL)
croak("Unknown error");
OUTPUT: RETVAL
void
DESTROY(self)
struct chash_t *self
STRLEN key_len;
CODE:
key_str = SvPVbyte(key, key_len);
chash_lookup(self, key_str, key_len, &out_str, &out_str_len);
RETVAL = newSVpvn(out_str, out_str_len);
OUTPUT: RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
JumpHash.xs view on Meta::CPAN
int32_t
jumphash_numeric(uint64_t key, int32_t num_buckets)
CODE:
RETVAL = JumpConsistentHash(key, num_buckets);
OUTPUT: RETVAL
int32_t
jumphash_siphash(SV *str, uint64_t num_buckets)
CODE:
{
JumpHash.xs view on Meta::CPAN
/* FIXME */
const char * strval = SvPVbyte(str, len);
const uint64_t hashval = siphash_2_4_from_perl(strval, len);
RETVAL = JumpConsistentHash(hashval, num_buckets);
}
OUTPUT: RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
xs/Ketama.xs view on Meta::CPAN
mXPUSHp( "Algorithm::ConsistentHash::Ketama::Bucket", 41 );
mXPUSHp( "label", 5 );
mXPUSHp( s.label, strlen(s.label) );
mXPUSHp( "weight", 6 );
mXPUSHi( s.weight );
PUTBACK;
call_method("new", G_SCALAR);
SPAGAIN;
sv = POPs;
SvREFCNT_inc(sv);
PUTBACK;
FREETMPS;
LEAVE;
}
XPUSHs( sv );
}
view all matches for this distribution
view release on metacpan or search on metacpan
ConstructDFA.xs view on Meta::CPAN
for (auto i = s.begin(); i != s.end(); ++i) {
mXPUSHs(newSVuv(*i));
}
PUTBACK;
I32 count = call_sv(accept_sv, G_SCALAR);
SPAGAIN;
ConstructDFA.xs view on Meta::CPAN
result = (bool)POPi;
} else {
warn("bad accept");
}
PUTBACK;
FREETMPS;
LEAVE;
return result;
}
ConstructDFA.xs view on Meta::CPAN
PREINIT:
AV* args;
PPCODE:
args = (AV*)SvRV(args_sv);
PUTBACK;
auto dfa = build_dfa(accepts_sv, args);
SPAGAIN;
for (auto i = dfa.begin(); i != dfa.end(); ++i) {
mXPUSHs(newSVuv(i->first));
view all matches for this distribution
view release on metacpan or search on metacpan
Examples/classify_test_data_in_a_file.pl view on Meta::CPAN
my (@all_class_names, @feature_names, %class_for_sample_hash, %feature_values_for_samples_hash,
%features_and_values_hash, %features_and_unique_values_hash,
%numeric_features_valuerange_hash, %feature_values_how_many_uniques_hash);
get_test_data_from_csv();
open OUTPUTHANDLE, ">$outputfile"
or die "Unable to open the file $outputfile for writing out the classification results: $!";
if ($show_hard_classifications && ($outputfile !~ /\.csv$/i)) {
print OUTPUTHANDLE "\nOnly the most probable class shown for each test sample\n\n";
} elsif (!$show_hard_classifications && ($outputfile !~ /\.csv$/i)) {
print OUTPUTHANDLE "\nThe classification result for each sample ordered in decreasing order of probability\n\n";
}
if ($outputfile =~ /\.csv$/i) {
my $class_names_csv = join ',', sort @{$dt->{_class_names}};
my $output_string = "sample_index,$class_names_csv\n";
print OUTPUTHANDLE "$output_string";
foreach my $sample (sort {sample_index($a) <=> sample_index($b)}
keys %feature_values_for_samples_hash) {
my @test_sample = @{$feature_values_for_samples_hash{$sample}};
my %classification = %{$dt->classify($root_node, \@test_sample)};
my $sample_index = sample_index($sample);
Examples/classify_test_data_in_a_file.pl view on Meta::CPAN
$which_class =~ /=(.*)/;
my $class_name = $1;
my $valuestring = $classification{$which_class};
$output_string .= ",$valuestring";
}
print OUTPUTHANDLE "$output_string\n";
}
} else {
foreach my $sample (sort {sample_index($a) <=> sample_index($b)}
keys %feature_values_for_samples_hash) {
my @test_sample = @{$feature_values_for_samples_hash{$sample}};
Examples/classify_test_data_in_a_file.pl view on Meta::CPAN
my $which_class = $which_classes[0];
$which_class =~ /=(.*)/;
my $class_name = $1;
my $valuestring = sprintf("%-20s", $classification{$which_class});
$result_string .= "$class_name => $valuestring ";
print OUTPUTHANDLE "$result_string\n";
} else {
foreach my $which_class (@which_classes) {
$which_class =~ /=(.*)/;
my $class_name = $1;
my $valuestring = sprintf("%-20s", $classification{$which_class});
$result_string .= "$class_name => $valuestring ";
}
print OUTPUTHANDLE "$result_string\n";
}
}
}
sub get_test_data_from_csv {
view all matches for this distribution
view release on metacpan or search on metacpan
PUSHmortal|5.009002||p
PUSHn|||
PUSHp|||
PUSHs|||
PUSHu|5.004000||p
PUTBACK|||
PerlIO_clearerr||5.007003|
PerlIO_close||5.007003|
PerlIO_eof||5.007003|
PerlIO_error||5.007003|
PerlIO_fileno||5.007003|
eval_sv(sv, G_SCALAR);
SvREFCNT_dec(sv);
SPAGAIN;
sv = POPs;
PUTBACK;
if (croak_on_error && SvTRUE(GvSV(errgv)))
croak(SvPVx(GvSV(errgv), na));
return sv;
view all matches for this distribution
view release on metacpan or search on metacpan
unshift (@{$hunk->{"blocks"}}, @{$oldhunk->{"blocks"}});
}
# DIFF OUTPUT ROUTINES. THESE ROUTINES CONTAIN DIFF FORMATTING INFO...
sub output_diff {
if (defined $main::opt_u) {&output_unified_diff(@_)}
elsif (defined $main::opt_c) {&output_context_diff(@_)}
else {die "unknown diff"}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
my $mask = $self->{_mask};
my @mask = split //, $mask;
$self->{_data_dimensions} = scalar grep {$_ eq '1'} @mask;
print "data dimensionality: $self->{_data_dimensions} \n"
if $self->{_terminal_output};
open INPUT, $datafile
or die "unable to open file $datafile: $!";
chomp( my @raw_data = <INPUT> );
close INPUT;
# Transform strings into number data
foreach my $record (@raw_data) {
next unless $record;
next if $record =~ /^#/;
my @data_fields;
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
}
my $K = scalar @{$self->{_clusters}};
my $filename = basename($master_datafile);
my $temp_file = "__temp_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!";
foreach my $cluster (@{$self->{_clusters}}) {
foreach my $item (@$cluster) {
print OUTPUT "@{$visualization_data{$item}}";
print OUTPUT "\n";
}
print OUTPUT "\n\n";
}
close OUTPUT;
my $plot;
if (!defined $pause_time) {
$plot = Graphics::GnuplotIF->new( persist => 1 );
} else {
$plot = Graphics::GnuplotIF->new();
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$arg_string .= "\"$temp_file\" index $i using 1:2 title \"Cluster (naive Bayes) $i\" with points lt $j pt $j, ";
my $ellipse_filename = "__contour_" . $i . ".dat";
$arg_string .= "\"$ellipse_filename\" with line lt $j title \"\", ";
}
} elsif ($visualization_data_field_width == 1 ) {
open INPUT, "$temp_file" or die "Unable to open a temp file in this directory: $!";
my @all_data = <INPUT>;
close INPUT;
@all_data = map {chomp $_; $_ =~ /\d/ ? $_ : "SEPERATOR" } @all_data;
my $all_joined_data = join ':', @all_data;
my @separated = split /:SEPERATOR:SEPERATOR/, $all_joined_data;
my (@all_clusters_for_hist, @all_minvals, @all_maxvals, @all_minmaxvals);
foreach my $i (0..@separated-1) {
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$plot->gnuplot_cmd("set xtics rotate by 90 offset 0,-5 out nomirror");
foreach my $cindex (0..@all_clusters_for_hist-1) {
my $filename = basename($master_datafile);
my $temp_file = "__temp1dhist_" . "$cindex" . "_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file" or die "Unable to open a temp file in this directory: $!";
print OUTPUT "Xstep histval\n";
my @histogram = (0) x 100;
foreach my $i (0..@{$all_clusters_for_hist[$cindex]}-1) {
$histogram[int( ($all_clusters_for_hist[$cindex][$i] - $abs_minval) / $delta )]++;
}
foreach my $i (0..@histogram-1) {
print OUTPUT "$i $histogram[$i]\n";
}
$arg_string .= "\"$temp_file\" using 2:xtic(1) ti col smooth frequency with boxes lc $cindex, ";
close OUTPUT;
}
}
$arg_string = $arg_string =~ /^(.*),[ ]+$/;
$arg_string = $1;
if ($visualization_data_field_width > 2) {
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
}
my $K = scalar @{$self->{_clusters}};
my $filename = basename($master_datafile);
my $temp_file = "__temp_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!";
foreach my $cluster (@{$self->{_clusters}}) {
foreach my $item (@$cluster) {
print OUTPUT "@{$visualization_data{$item}}";
print OUTPUT "\n";
}
print OUTPUT "\n\n";
}
close OUTPUT;
my $plot;
if (!defined $pause_time) {
$plot = Graphics::GnuplotIF->new( persist => 1 );
} else {
$plot = Graphics::GnuplotIF->new();
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$arg_string .= "\"$temp_file\" index $i using 1:2 title \"Cluster (naive Bayes) $i\" with points lt $j pt $j, ";
my $ellipse_filename = "__contour_" . $i . ".dat";
$arg_string .= "\"$ellipse_filename\" with line lt $j title \"\", ";
}
} elsif ($visualization_data_field_width == 1 ) {
open INPUT, "$temp_file" or die "Unable to open a temp file in this directory: $!";
my @all_data = <INPUT>;
close INPUT;
@all_data = map {chomp $_; $_ =~ /\d/ ? $_ : "SEPERATOR" } @all_data;
my $all_joined_data = join ':', @all_data;
my @separated = split /:SEPERATOR:SEPERATOR/, $all_joined_data;
my (@all_clusters_for_hist, @all_minvals, @all_maxvals, @all_minmaxvals);
foreach my $i (0..@separated-1) {
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$plot->gnuplot_cmd("set xtics rotate by 90 offset 0,-5 out nomirror");
foreach my $cindex (0..@all_clusters_for_hist-1) {
my $filename = basename($master_datafile);
my $temp_file = "__temp1dhist_" . "$cindex" . "_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file" or die "Unable to open a temp file in this directory: $!";
print OUTPUT "Xstep histval\n";
my @histogram = (0) x 100;
foreach my $i (0..@{$all_clusters_for_hist[$cindex]}-1) {
$histogram[int( ($all_clusters_for_hist[$cindex][$i] - $abs_minval) / $delta )]++;
}
foreach my $i (0..@histogram-1) {
print OUTPUT "$i $histogram[$i]\n";
}
# $arg_string .= "\"$temp_file\" using 1:2 ti col smooth frequency with boxes lc $cindex, ";
$arg_string .= "\"$temp_file\" using 2:xtic(1) ti col smooth frequency with boxes lc $cindex, ";
close OUTPUT;
}
}
$arg_string = $arg_string =~ /^(.*),[ ]+$/;
$arg_string = $1;
if ($visualization_data_field_width > 2) {
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$visualization_data{ $record_id } = \@data_fields;
}
my $filename = basename($self->{_datafile});
my $temp_file = "__temp2_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!";
my @class_distributions;
foreach my $cluster_index (0..$self->{_K}-1) {
push @class_distributions, [];
}
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
if $self->{_expected_class_probs}->{$data_tag}->[$cluster_index] > 0.2;
}
}
foreach my $distribution (@class_distributions) {
foreach my $item (@$distribution) {
print OUTPUT "@$item";
print OUTPUT "\n";
}
print OUTPUT "\n\n";
}
close OUTPUT;
my $plot;
if (!defined $pause_time) {
$plot = Graphics::GnuplotIF->new( persist => 1 );
} else {
$plot = Graphics::GnuplotIF->new();
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$arg_string .= "\"$temp_file\" index $i using 1:2 title \"Cluster $i (based on posterior probs)\" with points lt $j pt $j, ";
my $ellipse_filename = "__contour2_" . $i . ".dat";
$arg_string .= "\"$ellipse_filename\" with line lt $j title \"\", ";
}
} elsif ($visualization_data_field_width == 1 ) {
open INPUT, "$temp_file" or die "Unable to open a temp file in this directory: $!";
my @all_data = <INPUT>;
close INPUT;
@all_data = map {chomp $_; $_ =~ /\d/ ? $_ : "SEPERATOR" } @all_data;
my $all_joined_data = join ':', @all_data;
my @separated = split /:SEPERATOR:SEPERATOR/, $all_joined_data;
my (@all_clusters_for_hist, @all_minvals, @all_maxvals, @all_minmaxvals);
foreach my $i (0..@separated-1) {
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$plot->gnuplot_cmd("set xtics rotate by 90 offset 0,-5 out nomirror");
foreach my $cindex (0..@all_clusters_for_hist-1) {
my $localfilename = basename($filename);
my $temp_file = "__temp1dhist_" . "$cindex" . "_" . $localfilename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file" or die "Unable to open a temp file in this directory: $!";
print OUTPUT "Xstep histval\n";
my @histogram = (0) x 100;
foreach my $i (0..@{$all_clusters_for_hist[$cindex]}-1) {
$histogram[int( ($all_clusters_for_hist[$cindex][$i] - $abs_minval) / $delta )]++;
}
foreach my $i (0..@histogram-1) {
print OUTPUT "$i $histogram[$i]\n";
}
# $arg_string .= "\"$temp_file\" using 1:2 ti col smooth frequency with boxes lc $cindex, ";
$arg_string .= "\"$temp_file\" using 2:xtic(1) ti col smooth frequency with boxes lc $cindex, ";
close OUTPUT;
}
}
$arg_string = $arg_string =~ /^(.*),[ ]+$/;
$arg_string = $1;
if ($visualization_data_field_width > 2) {
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$visualization_data{ $record_id } = \@data_fields;
}
my $filename = basename($self->{_datafile});
my $temp_file = "__temp2_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!";
my @class_distributions;
foreach my $cluster_index (0..$self->{_K}-1) {
push @class_distributions, [];
}
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
if $self->{_expected_class_probs}->{$data_tag}->[$cluster_index] > 0.2;
}
}
foreach my $distribution (@class_distributions) {
foreach my $item (@$distribution) {
print OUTPUT "@$item";
print OUTPUT "\n";
}
print OUTPUT "\n\n";
}
close OUTPUT;
my $plot;
if (!defined $pause_time) {
$plot = Graphics::GnuplotIF->new( persist => 1 );
} else {
$plot = Graphics::GnuplotIF->new();
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$arg_string .= "\"$temp_file\" index $i using 1:2 title \"Cluster $i (based on posterior probs)\" with points lt $j pt $j, ";
my $ellipse_filename = "__contour2_" . $i . ".dat";
$arg_string .= "\"$ellipse_filename\" with line lt $j title \"\", ";
}
} elsif ($visualization_data_field_width == 1 ) {
open INPUT, "$temp_file" or die "Unable to open a temp file in this directory: $!";
my @all_data = <INPUT>;
close INPUT;
@all_data = map {chomp $_; $_ =~ /\d/ ? $_ : "SEPERATOR" } @all_data;
my $all_joined_data = join ':', @all_data;
my @separated = split /:SEPERATOR:SEPERATOR/, $all_joined_data;
my (@all_clusters_for_hist, @all_minvals, @all_maxvals, @all_minmaxvals);
foreach my $i (0..@separated-1) {
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$plot->gnuplot_cmd("set xtics rotate by 90 offset 0,-5 out nomirror");
foreach my $cindex (0..@all_clusters_for_hist-1) {
my $localfilename = basename($filename);
my $temp_file = "__temp1dhist_" . "$cindex" . "_" . $localfilename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file" or die "Unable to open a temp file in this directory: $!";
print OUTPUT "Xstep histval\n";
my @histogram = (0) x 100;
foreach my $i (0..@{$all_clusters_for_hist[$cindex]}-1) {
$histogram[int( ($all_clusters_for_hist[$cindex][$i] - $abs_minval) / $delta )]++;
}
foreach my $i (0..@histogram-1) {
print OUTPUT "$i $histogram[$i]\n";
}
$arg_string .= "\"$temp_file\" using 2:xtic(1) ti col smooth frequency with boxes lc $cindex, ";
close OUTPUT;
}
}
$arg_string = $arg_string =~ /^(.*),[ ]+$/;
$arg_string = $1;
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
}
my $filename = basename($master_datafile);
my $temp_file;
$temp_file = "__temp_data_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!";
foreach my $datapoint (values %visualization_data) {
print OUTPUT "@$datapoint";
print OUTPUT "\n";
}
close OUTPUT;
my $plot = Graphics::GnuplotIF->new( persist => 1 );
$plot->gnuplot_cmd( "set noclip" );
$plot->gnuplot_cmd( "set pointsize 2" );
my $plot_title = '"original data provided for EM"';
my $arg_string ;
if ($visualization_data_field_width > 2) {
$arg_string = "\"$temp_file\" using 1:2:3 title $plot_title with points lt -1 pt 1";
} elsif ($visualization_data_field_width == 2) {
$arg_string = "\"$temp_file\" using 1:2 title $plot_title with points lt -1 pt 1";
} elsif ($visualization_data_field_width == 1 ) {
open INPUT, "$temp_file" or die "Unable to open a temp file in this directory: $!";
my @all_data = <INPUT>;
close INPUT;
@all_data = map {chomp $_; $_} @all_data;
@all_data = grep $_, @all_data;
my ($minval,$maxval) = minmax(\@all_data);
my $delta = ($maxval - $minval) / 100.0;
$plot->gnuplot_cmd("set boxwidth 3");
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$plot->gnuplot_cmd("set title 'Overall distribution of 1D data'");
$plot->gnuplot_cmd("set xtics rotate by 90 offset 0,-5 out nomirror");
my $localfilename = basename($filename);
my $temp_file = "__temp1dhist_" . $localfilename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file" or die "Unable to open a temp file in this directory: $!";
print OUTPUT "Xstep histval\n";
my @histogram = (0) x 100;
foreach my $i (0..@all_data-1) {
$histogram[int( ($all_data[$i] - $minval) / $delta )]++;
}
foreach my $i (0..@histogram-1) {
print OUTPUT "$i $histogram[$i]\n";
}
$arg_string = "\"$temp_file\" using 2:xtic(1) ti col smooth frequency with boxes lc rgb 'green'";
close OUTPUT;
}
if ($visualization_data_field_width > 2) {
$plot->gnuplot_cmd( "splot $arg_string" );
} elsif ($visualization_data_field_width == 2) {
$plot->gnuplot_cmd( "plot $arg_string" );
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
}
my $filename = basename($master_datafile);
my $temp_file;
$temp_file = "__temp_data_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!";
foreach my $datapoint (values %visualization_data) {
print OUTPUT "@$datapoint";
print OUTPUT "\n";
}
close OUTPUT;
my $plot = Graphics::GnuplotIF->new( persist => 1 );
$plot->gnuplot_cmd( "set noclip" );
$plot->gnuplot_cmd( "set pointsize 2" );
my $plot_title = '"original data provided for EM"';
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
if ($visualization_data_field_width > 2) {
$arg_string = "\"$temp_file\" using 1:2:3 title $plot_title with points lt -1 pt 1";
} elsif ($visualization_data_field_width == 2) {
$arg_string = "\"$temp_file\" using 1:2 title $plot_title with points lt -1 pt 1";
} elsif ($visualization_data_field_width == 1 ) {
open INPUT, "$temp_file" or die "Unable to open a temp file in this directory: $!";
my @all_data = <INPUT>;
close INPUT;
@all_data = map {chomp $_; $_} @all_data;
@all_data = grep $_, @all_data;
my ($minval,$maxval) = minmax(\@all_data);
my $delta = ($maxval - $minval) / 100.0;
$plot->gnuplot_cmd("set boxwidth 3");
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
$plot->gnuplot_cmd("set title 'Overall distribution of 1D data'");
$plot->gnuplot_cmd("set xtics rotate by 90 offset 0,-5 out nomirror");
my $localfilename = basename($filename);
my $temp_file = "__temp1dhist_" . $localfilename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file" or die "Unable to open a temp file in this directory: $!";
print OUTPUT "Xstep histval\n";
my @histogram = (0) x 100;
foreach my $i (0..@all_data-1) {
$histogram[int( ($all_data[$i] - $minval) / $delta )]++;
}
foreach my $i (0..@histogram-1) {
print OUTPUT "$i $histogram[$i]\n";
}
$arg_string = "\"$temp_file\" using 2:xtic(1) ti col smooth frequency with boxes lc rgb 'green'";
close OUTPUT;
}
if ($visualization_data_field_width > 2) {
$plot->gnuplot_cmd( 'set terminal png',
'set output "data_scatter_plot.png"');
$plot->gnuplot_cmd( "splot $arg_string" );
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
my $output_file = $args{output_datafile};
my $N = $args{total_number_of_data_points};
my @all_params;
my $param_string;
if (defined $input_parameter_file) {
open INPUT, $input_parameter_file || "unable to open parameter file: $!";
@all_params = <INPUT>;
@all_params = grep { $_ !~ /^[ ]*#/ } @all_params;
chomp @all_params;
$param_string = join ' ', @all_params;
} else {
# Just for testing. Used in t/test.t
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
my $label = $point_labels[$i];
@new_data = map {unshift @$_, $label.$i; $i++; $_} @new_data;
push @data_dump, @new_data;
}
fisher_yates_shuffle( \@data_dump );
open OUTPUT, ">$output_file";
print OUTPUT "\#Data generated from the parameter file: $input_parameter_file\n"
if $input_parameter_file;
print OUTPUT "\#Total number of data points in this file: $N\n";
print OUTPUT "\#Prior class probabilities for this data: @priors\n";
foreach my $ele (@data_dump) {
foreach my $coord ( @$ele ) {
print OUTPUT "$coord ";
}
print OUTPUT "\n";
}
print "Data written out to file $output_file\n";
close OUTPUT;
}
sub add_point_coords {
my $self = shift;
my @arr_of_ids = @{shift @_}; # array of data element names
lib/Algorithm/ExpectationMaximization.pm view on Meta::CPAN
the data space. The visualization mask is used to select the
subspace for the PNG image.
=back
=head1 HOW THE CLUSTERS ARE OUTPUT
This module produces two different types of clusters: the "hard" clusters and the
"soft" clusters. The hard clusters correspond to the naive Bayes' classification of
the data points on the basis of the Gaussian distributions and the class priors
estimated by the EM algorithm. Such clusters partition the data into disjoint
view all matches for this distribution
view release on metacpan or search on metacpan
RETVAL->imp = imp;
RETVAL->code = code;
RETVAL->sz = blocksize;
RETVAL->dp = data_packets;
RETVAL->ep = encoded_packets;
OUTPUT:
RETVAL
void
set_encode_blocks (self, blocks)
Algorithm::FEC self
SvCUR_set (RETVAL, self->sz);
self->imp->fec_encode (self->code, self->b_addr,
SvPVX (RETVAL), block_index, self->sz);
OUTPUT:
RETVAL
void
set_decode_blocks (self, blocks, indices)
Algorithm::FEC self
view all matches for this distribution
view release on metacpan or search on metacpan
GDiffDelta.xs view on Meta::CPAN
XPUSHs(f);
/* TODO - possibly use newSVpvn_share to avoid the memcpy
* and extra allocation for buf? */
XPUSHs(sv_2mortal(buf = newSVpvn("", 0)));
XPUSHs(sv_2mortal(newSVuv(size)));
PUTBACK;
n = call_method("read", G_SCALAR);
assert(n == 0 || n == 1);
SPAGAIN;
ret = n ? POPs : &PL_sv_undef;
if (!SvOK(ret))
GDiffDelta.xs view on Meta::CPAN
if (!SvPOK(buf) || SvCUR(buf) != size)
croak("'read' method left buffer badly set up", from);
str = SvPV(buf, len);
assert(len == size);
memcpy(ptr, str, size);
PUTBACK;
FREETMPS;
LEAVE;
}
else {
int r = PerlIO_read(IoIFP(sv_2io(f)), ptr, size);
GDiffDelta.xs view on Meta::CPAN
SAVETMPS;
PUSHMARK(SP);
XPUSHs(f);
XPUSHs(sv_2mortal(newSVpvn(ptr, size)));
XPUSHs(sv_2mortal(newSVuv(size)));
PUTBACK;
n = call_method("write", G_SCALAR);
assert(n == 0 || n == 1);
SPAGAIN;
ret = n ? POPs : &PL_sv_no;
n = SvTRUE(ret);
PUTBACK;
FREETMPS;
LEAVE;
if (!n)
croak("error writing to %s: %s", to,
SvPV_nolen(get_sv("!", FALSE)));
GDiffDelta.xs view on Meta::CPAN
SAVETMPS;
PUSHMARK(SP);
XPUSHs(f);
XPUSHs(sv_2mortal(newSVuv(offset)));
XPUSHs(sv_2mortal(newSVuv(whence)));
PUTBACK;
n = call_method("seek", G_SCALAR);
assert(n == 0 || n == 1);
SPAGAIN;
ret = n ? POPs : &PL_sv_undef;
n = SvTRUE(ret);
PUTBACK;
FREETMPS;
LEAVE;
if (!n)
croak("error seeking in %s: %s", from,
SvPV_nolen(get_sv("!", FALSE)));
GDiffDelta.xs view on Meta::CPAN
dSP;
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(f);
PUTBACK;
n = call_method("tell", G_SCALAR);
assert(n == 0 || n == 1);
SPAGAIN;
offset = (Off_t) -1;
if (n) {
ret = POPs;
if (SvOK(ret))
offset = SvUV(ret);
}
PUTBACK;
FREETMPS;
LEAVE;
if (offset == (Off_t) -1)
croak("error getting position in %s: %s", from,
SvPV_nolen(get_sv("!", FALSE)));
GDiffDelta.xs view on Meta::CPAN
if (size <= 246)
buf[headsz++] = size;
else if (size <= QEF_USHORT_MAX) {
buf[headsz++] = 247;
QEF_BE16_PUT(buf, headsz, size);
}
else {
buf[headsz++] = 248;
QEF_BE32_PUT(buf, headsz, size);
}
/* Write the opcode and size argument (if any). */
careful_fwrite(buf, headsz, delta, "delta");
GDiffDelta.xs view on Meta::CPAN
assert(size > 0);
if (offset <= QEF_USHORT_MAX) {
if (size <= QEF_UBYTE_MAX) {
buf[headsz++] = 249;
QEF_BE16_PUT(buf, headsz, offset);
buf[headsz++] = size;
}
else if (size <= QEF_USHORT_MAX) {
buf[headsz++] = 250;
QEF_BE16_PUT(buf, headsz, offset);
QEF_BE16_PUT(buf, headsz, size);
}
else if (size <= QEF_INT_MAX) {
buf[headsz++] = 251;
QEF_BE16_PUT(buf, headsz, offset);
QEF_BE32_PUT(buf, headsz, size);
}
else {
/* TODO - break copy ops for bigger than 2Gb into smaller ones */
assert(0);
}
}
else if (offset <= QEF_INT_MAX) {
if (size <= QEF_UBYTE_MAX) {
buf[headsz++] = 252;
QEF_BE32_PUT(buf, headsz, offset);
buf[headsz++] = size;
}
else if (size <= QEF_USHORT_MAX) {
buf[headsz++] = 253;
QEF_BE32_PUT(buf, headsz, offset);
QEF_BE16_PUT(buf, headsz, size);
}
else if (size <= QEF_INT_MAX) {
buf[headsz++] = 254;
QEF_BE32_PUT(buf, headsz, offset);
QEF_BE32_PUT(buf, headsz, size);
}
else {
/* TODO - break copy ops for bigger than 2Gb into smaller ones */
assert(0);
}
GDiffDelta.xs view on Meta::CPAN
STRLEN len;
const unsigned char *buf;
CODE:
buf = (unsigned char *) SvPV(s, len);
RETVAL = adler32(init, buf, len);
OUTPUT:
RETVAL
void
qefgdiff_gdiff_delta (SV *orig, SV *changed, SV *delta)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/HITS.pm view on Meta::CPAN
2 => 1,
]
);
=head2 ITERATE THROUGH COMPUTATION
Iterate 1000 times.
$h->iterate(1000);
view all matches for this distribution
view release on metacpan or search on metacpan
PUSHmortal|5.009002||p
PUSHn|||
PUSHp|||
PUSHs|||
PUSHu|5.004000||p
PUTBACK|||
PerlIO_clearerr||5.007003|
PerlIO_close||5.007003|
PerlIO_context_layers||5.009004|
PerlIO_eof||5.007003|
PerlIO_error||5.007003|
eval_sv(sv, G_SCALAR);
SvREFCNT_dec(sv);
SPAGAIN;
sv = POPs;
PUTBACK;
if (croak_on_error && SvTRUE(GvSV(errgv)))
croak(SvPVx(GvSV(errgv), na));
return sv;
view all matches for this distribution
view release on metacpan or search on metacpan
misc/make_manifest.pl view on Meta::CPAN
font-size : 9.0pt;
list-style-type : disc;
margin-left : 16.0pt;
margin-top : -14.0pt;
}
INPUT {
font: bold small verdana, arial, helvetica, sans-serif;
color: black;
background-color: white;
}
TEXTAREA {
view all matches for this distribution
view release on metacpan or search on metacpan
HLL T_PTROBJ_HLL
uint32_t T_UV
################################################################
INPUT
T_PTROBJ_HLL
$var = GET_HLLPTR($arg);
OUTPUT
T_PTROBJ_HLL
sv_setref_pv($arg, klass, (void*)$var);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/KMeans.pm view on Meta::CPAN
my $datafile = $self->{_datafile};
my $mask = $self->{_mask};
my @mask = split //, $mask;
$self->{_data_dimensions} = scalar grep {$_ eq '1'} @mask;
print "data dimensionality: $self->{_data_dimensions} \n"if $self->{_terminal_output};
open INPUT, $datafile or die "unable to open file $datafile: $!\n";
chomp( my @raw_data = <INPUT> );
close INPUT;
# Transform strings into number data
foreach my $record (@raw_data) {
next unless $record;
next if $record =~ /^#/;
my @data_fields;
lib/Algorithm/KMeans.pm view on Meta::CPAN
my @all_data_ids = @{$self->{_data_id_tags}};
my $K = scalar @{$self->{_clusters}};
my $filename = basename($master_datafile);
my $temp_file = "__temp_" . $filename;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!\n";
foreach my $cluster (@{$self->{_clusters}}) {
foreach my $item (@$cluster) {
print OUTPUT "@{$visualization_data{$item}}";
print OUTPUT "\n";
}
print OUTPUT "\n\n";
}
close OUTPUT;
my $plot;
my $hardcopy_plot;
if (!defined $pause_time) {
$plot = Graphics::GnuplotIF->new( persist => 1 );
$hardcopy_plot = Graphics::GnuplotIF->new();
lib/Algorithm/KMeans.pm view on Meta::CPAN
$temp_file = "__temp_normed_data_" . $filename;
} else {
croak "ABORTED: Improper call to visualize_data()";
}
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!\n";
foreach my $datapoint (values %visualization_data) {
print OUTPUT "@$datapoint";
print OUTPUT "\n";
}
close OUTPUT;
my $plot = Graphics::GnuplotIF->new( persist => 1 );
$plot->gnuplot_cmd( "set noclip" );
$plot->gnuplot_cmd( "set pointsize 2" );
my $plot_title = $datatype eq 'original' ? '"data"' : '"normed data"';
my $arg_string ;
lib/Algorithm/KMeans.pm view on Meta::CPAN
my $output_file = $args{output_datafile};
my $N = $args{number_data_points_per_cluster};
my @all_params;
my $param_string;
if (defined $input_parameter_file) {
open INPUT, $input_parameter_file || "unable to open parameter file: $!";
@all_params = <INPUT>;
@all_params = grep { $_ !~ /^[ ]*#/ } @all_params;
chomp @all_params;
$param_string = join ' ', @all_params;
} else {
# Just for testing. Used in t/test.t
lib/Algorithm/KMeans.pm view on Meta::CPAN
my $label = $point_labels[$i];
@new_data = map {unshift @$_, $label.$i; $i++; $_} @new_data;
push @data_dump, @new_data;
}
fisher_yates_shuffle( \@data_dump );
open OUTPUT, ">$output_file";
foreach my $ele (@data_dump) {
foreach my $coord ( @$ele ) {
print OUTPUT "$coord ";
}
print OUTPUT "\n";
}
print "Data written out to file $output_file\n";
close OUTPUT;
}
sub add_point_coords {
my $self = shift;
my @arr_of_ids = @{shift @_}; # array of data element names
lib/Algorithm/KMeans.pm view on Meta::CPAN
definite. Should the covariances in your parameter file not obey this condition, the
C<Math::Random> module will let you know.
=back
=head1 HOW THE CLUSTERS ARE OUTPUT
When the option C<terminal_output> is set in the call to the constructor, the
clusters are displayed on the terminal screen.
When the option C<write_clusters_to_files> is set in the call to the constructor, the
view all matches for this distribution
view release on metacpan or search on metacpan
perlobject.map view on Meta::CPAN
# TYPEMAPs
#
# HV * -> unblessed Perl HV object.
# AV * -> unblessed Perl AV object.
#
# INPUT/OUTPUT maps
#
# O_* -> opaque blessed objects
# T_* -> opaque blessed or unblessed objects
#
# O_OBJECT -> link an opaque C or C++ object to a blessed Perl object.
perlobject.map view on Meta::CPAN
HV * T_HvRV
AV * T_AvRV
######################################################################
OUTPUT
# The Perl object is blessed into 'CLASS', which should be a
# char* having the name of the package for the blessing.
O_OBJECT
sv_setref_pv( $arg, CLASS, (void*)$var );
perlobject.map view on Meta::CPAN
T_AvRV
$arg = newRV((SV*)$var);
######################################################################
INPUT
O_OBJECT
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
$var = ($type)SvIV((SV*)SvRV( $arg ));
else{
view all matches for this distribution
view release on metacpan or search on metacpan
Algorithm-LBFGS.xs view on Meta::CPAN
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal(newRV_noinc((SV*)av_x)));
XPUSHs(sv_2mortal(newSVnv(step)));
XPUSHs(user_data);
PUTBACK;
TRACE("lbfgs_evaluation_cb: finish arguments preparation");
call_sv(lbfgs_eval, G_ARRAY);
TRACE("lbfgs_evaluation_cb: finish calling");
SPAGAIN;
av_g = (AV*)SvRV(POPs);
sv_f = POPs;
f = SvNV(sv_f);
for (i = 0; i < n; i++)
g[i] = SvNV(*av_fetch(av_g, i, 0));
PUTBACK;
FREETMPS;
LEAVE;
/* clean up (for non-mortal return values) */
if (SvREFCNT(av_g) > 0) av_undef(av_g);
if (SvREFCNT(sv_f) > 0) SvREFCNT_dec(sv_f);
Algorithm-LBFGS.xs view on Meta::CPAN
XPUSHs(sv_2mortal(newSVnv(gnorm)));
XPUSHs(sv_2mortal(newSVnv(step)));
XPUSHs(sv_2mortal(newSViv(k)));
XPUSHs(sv_2mortal(newSViv(ls)));
XPUSHs(user_data);
PUTBACK;
TRACE("lbfgs_progress_cb: finish arguments preparation");
call_sv(lbfgs_prgr, G_ARRAY);
TRACE("lbfgs_progress_cb: finish calling");
SPAGAIN;
sv_r = POPs;
r = SvIV(sv_r);
PUTBACK;
FREETMPS;
LEAVE;
/* clean up (for non-mortal return values) */
if (SvREFCNT(sv_r) > 0) SvREFCNT_dec(sv_r);
TRACE("lbfgs_progress_cb: leave");
Algorithm-LBFGS.xs view on Meta::CPAN
CODE:
((SV**)instance)[0] = lbfgs_eval; /* ref to Perl eval callback */
((SV**)instance)[1] = lbfgs_prgr; /* ref to Perl monitor callback */
((SV**)instance)[2] = user_data; /* ref to Perl user data */
RETVAL = instance;
OUTPUT:
RETVAL
void
destroy_lbfgs_instance(li)
void* li
Algorithm-LBFGS.xs view on Meta::CPAN
PREINIT:
void* lp = malloc(sizeof(lbfgs_parameter_t));
CODE:
lbfgs_parameter_init((lbfgs_parameter_t*)lp);
RETVAL = lp;
OUTPUT:
RETVAL
void
destroy_lbfgs_param(lp)
void* lp
Algorithm-LBFGS.xs view on Meta::CPAN
else if (strcmp(name, "orthantwise_c") == 0) {
if (SvNOK(val)) p->orthantwise_c = SvNV(val);
r = newSVnv(p->orthantwise_c);
}
RETVAL = r;
OUTPUT:
RETVAL
SV*
do_lbfgs(param, instance, x0)
void* param
Algorithm-LBFGS.xs view on Meta::CPAN
/* store the result back to the Perl array ref x0 */
for (i = 0; i < n; i++) av_store(av_x0, i, newSVnv(carr_x0[i]));
/* release the C array */
free(carr_x0);
RETVAL = newSViv(s);
OUTPUT:
RETVAL
SV*
status_2pv(status)
int status
Algorithm-LBFGS.xs view on Meta::CPAN
case LBFGSERR_INCREASEGRADIENT:
RETVAL = newSVpv_("LBFGSERR_INCREASEGRADIENT"); break;
default:
RETVAL = newSVpv_(""); break;
}
OUTPUT:
RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
misc/make_manifest.pl view on Meta::CPAN
font-size : 9.0pt;
list-style-type : disc;
margin-left : 16.0pt;
margin-top : -14.0pt;
}
INPUT {
font: bold small verdana, arial, helvetica, sans-serif;
color: black;
background-color: white;
}
TEXTAREA {
view all matches for this distribution
view release on metacpan or search on metacpan
=head1 USAGE
Usage: lda.pl DIR
=head1 INPUT
=head2 DIR
The directory of text documents
view all matches for this distribution
view release on metacpan or search on metacpan
src/liblinear.xs view on Meta::CPAN
struct parameter * T_LIBLINEAR_TRAINING_PARAMETER
struct problem * T_LIBLINEAR_PROBLEM
INPUT
T_LIBLINEAR_MODEL
if (SvROK($arg) &&
sv_derived_from($arg, \"Algorithm::LibLinear::Model::Raw\")) {
IV tmp = SvIV((SV*)SvRV($arg));
$var = INT2PTR($type,tmp);
src/liblinear.xs view on Meta::CPAN
Perl_croak(aTHX_ \"%s: %s is not of type %s\",
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
\"$var\", \"$ntype\");
}
OUTPUT
T_LIBLINEAR_MODEL
sv_setref_pv($arg, \"Algorithm::LibLinear::Model::Raw\", (void*)$var);
T_LIBLINEAR_TRAINING_PARAMETER
sv_setref_pv(
src/liblinear.xs view on Meta::CPAN
struct problem *problem_;
struct parameter *parameter_;
CODE:
validate_parameter(aTHX_ problem_, parameter_);
RETVAL = train(problem_, parameter_);
OUTPUT:
RETVAL
struct model *
ll_load(klass, filename)
const char *filename;
CODE:
RETVAL = load_model(filename);
if (!RETVAL) {
Perl_croak(aTHX_ "Failed to load a model from file: %s.", filename);
}
OUTPUT:
RETVAL
double
ll_bias(self, label)
struct model *self;
int label;
CODE:
RETVAL = get_decfun_bias(self, label);
OUTPUT:
RETVAL
AV *
ll_class_labels(self)
struct model *self;
src/liblinear.xs view on Meta::CPAN
RETVAL = newAV();
av_extend(RETVAL, self->nr_class - 1);
for (int i = 0; i < self->nr_class; ++i) {
av_push(RETVAL, newSViv(self->label[i]));
}
OUTPUT:
RETVAL
double
ll_coefficient(self, feature, label)
struct model *self;
int feature;
int label;
CODE:
RETVAL = get_decfun_coef(self, feature, label);
OUTPUT:
RETVAL
bool
ll_is_oneclass_model(self)
struct model* self;
CODE:
RETVAL = check_oneclass_model(self);
OUTPUT:
RETVAL
bool
ll_is_probability_model(self)
struct model *self;
CODE:
RETVAL = check_probability_model(self);
OUTPUT:
RETVAL
bool
ll_is_regression_model(self)
struct model *self;
CODE:
RETVAL = check_regression_model(self);
OUTPUT:
RETVAL
int
ll_num_classes(self)
struct model *self;
CODE:
RETVAL = get_nr_class(self);
OUTPUT:
RETVAL
int
ll_num_features(self)
struct model *self;
CODE:
RETVAL = get_nr_feature(self);
OUTPUT:
RETVAL
SV *
ll_predict(self, feature_hash)
struct model *self;
src/liblinear.xs view on Meta::CPAN
struct feature_node *feature_vector = hv2feature(aTHX_ feature_hash);
double prediction = predict(self, feature_vector);
Safefree(feature_vector);
RETVAL = is_regression_solver(&self->param) ?
newSVnv(prediction) : newSViv((int)prediction);
OUTPUT:
RETVAL
AV *
ll_predict_probability(self, feature_hash)
struct model *self;
src/liblinear.xs view on Meta::CPAN
av_push(RETVAL, newSVnv(estimated_probabilities[i]));
}
Safefree(feature_vector);
Safefree(estimated_probabilities);
}
OUTPUT:
RETVAL
AV *
ll_predict_values(self, feature_hash)
struct model *self;
src/liblinear.xs view on Meta::CPAN
for (int i = 0; i < num_decision_values; ++i) {
av_push(RETVAL, newSVnv(decision_values[i]));
}
Safefree(decision_values);
Safefree(feature_vector);
OUTPUT:
RETVAL
double
ll_rho(self)
struct model *self;
CODE:
RETVAL = get_decfun_rho(self);
OUTPUT:
RETVAL
void
ll_save(self, filename)
struct model *self;
src/liblinear.xs view on Meta::CPAN
} XCPT_TRY_END
XCPT_CATCH {
free_parameter(aTHX_ RETVAL);
XCPT_RETHROW;
}
OUTPUT:
RETVAL
AV *
ll_cross_validation(self, problem_, num_folds)
struct parameter *self;
src/liblinear.xs view on Meta::CPAN
av_extend(RETVAL, problem_->l - 1);
for (int i = 0; i < problem_->l; ++i) {
av_push(RETVAL, newSVnv(targets[i]));
}
Safefree(targets);
OUTPUT:
RETVAL
AV *
ll_find_parameters(self, problem_, num_folds, initial_C, initial_p, update)
struct parameter *self;
src/liblinear.xs view on Meta::CPAN
av_push(RETVAL, newSVnv(best_C));
av_push(
RETVAL,
is_regression_model ? newSVnv(best_p) : newSVsv(&PL_sv_undef));
av_push(RETVAL, newSVnv(accuracy));
OUTPUT:
RETVAL
bool
ll_is_regression_solver(self)
struct parameter *self;
CODE:
RETVAL = is_regression_solver(self);
OUTPUT:
RETVAL
double
ll_cost(self)
struct parameter *self;
CODE:
RETVAL = self->C;
OUTPUT:
RETVAL
double
ll_epsilon(self)
struct parameter *self;
CODE:
RETVAL = self->eps;
OUTPUT:
RETVAL
double
ll_loss_sensitivity(self)
struct parameter *self;
CODE:
RETVAL = self->p;
OUTPUT:
RETVAL
int
ll_solver_type(self)
struct parameter *self;
CODE:
RETVAL = self->solver_type;
OUTPUT:
RETVAL
AV *
ll_weights(self)
struct parameter *self;
src/liblinear.xs view on Meta::CPAN
RETVAL = newAV();
av_extend(RETVAL, self->nr_weight - 1);
for (int i = 0; i < self->nr_weight; ++i) {
av_push(RETVAL, newSVnv(self->weight[i]));
}
OUTPUT:
RETVAL
AV *
ll_weight_labels(self)
struct parameter *self;
src/liblinear.xs view on Meta::CPAN
RETVAL = newAV();
av_extend(RETVAL, self->nr_weight - 1);
for (int i = 0; i < self->nr_weight; ++i) {
av_push(RETVAL, newSViv(self->weight_label[i]));
}
OUTPUT:
RETVAL
void
ll_DESTROY(self)
struct parameter *self;
src/liblinear.xs view on Meta::CPAN
} XCPT_TRY_END
XCPT_CATCH {
free_problem(aTHX_ RETVAL);
XCPT_RETHROW;
}
OUTPUT:
RETVAL
double
ll_bias(self)
struct problem *self;
CODE:
RETVAL = self->bias;
OUTPUT:
RETVAL
int
ll_data_set_size(self)
struct problem *self;
CODE:
RETVAL = self->l;
OUTPUT:
RETVAL
int
ll_num_features(self)
struct problem *self;
CODE:
RETVAL = self->n;
OUTPUT:
RETVAL
void
ll_DESTROY(self)
struct problem *self;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Line/Lerp.xs view on Meta::CPAN
err += dx;
y0 += sy;
}
}
RETVAL = newRV_noinc((SV*)theline);
OUTPUT:
RETVAL
SV *
line(SV* sp1, SV* sp2)
PROTOTYPE: $$
lib/Algorithm/Line/Lerp.xs view on Meta::CPAN
av_push(point, newSViv(lround(y)));
av_push(theline, newRV_noinc((SV*)point));
}
}
RETVAL = newRV_noinc((SV*)theline);
OUTPUT:
RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
examples/data_visualizer.pl view on Meta::CPAN
my $datafile = shift;
my $filename = File::Basename::basename($datafile);
my $temp_file = "__temp_" . $filename;
$temp_file =~ s/\.\w+$/\.txt/;
unlink $temp_file if -e $temp_file;
open OUTPUT, ">$temp_file"
or die "Unable to open a temp file in this directory: $!";
open INPUT, "< $filename" or die "Unable to open $filename: $!";
local $/ = undef;
my @all_records = split /\s+/, <INPUT>;
my %clusters;
foreach my $record (@all_records) {
my @splits = split /,/, $record;
my $record_name = shift @splits;
$record_name =~ /(\w+?)_.*/;
my $primary_cluster_label = $1;
push @{$clusters{$primary_cluster_label}}, \@splits;
}
foreach my $key (sort {"\L$a" cmp "\L$b"} keys %clusters) {
map {print OUTPUT "$_"} map {"@$_\n"} @{$clusters{$key}};
print OUTPUT "\n\n";
}
my @sorted_cluster_keys = sort {"\L$a" cmp "\L$b"} keys %clusters;
close OUTPUT;
my $plot = Graphics::GnuplotIF->new( persist => 1 );
my $arg_string = "";
$plot->gnuplot_cmd( "set noclip" );
$plot->gnuplot_cmd( "set hidden3d" );
view all matches for this distribution
view release on metacpan or search on metacpan
im->dictionary = g_hash_table_new(g_str_hash, g_str_equal);
im->chains = g_hash_table_new(g_str_hash, g_str_equal);
SvREADONLY_on(obj);
RETVAL = obj;
OUTPUT:
RETVAL
void
_c_destroy (obj)
SV* obj;
CODE:
IM* im = (IM*) SvIV(phash_value(SvRV(obj), "_cstuff"));
RETVAL = im->longest;
OUTPUT:
RETVAL
int
sequence_known (obj, stub)
SV* obj;
char *stub;
CODE:
IM* im = (IM*) SvIV(phash_value(SvRV(obj), "_cstuff"));
RETVAL = (int) g_hash_table_lookup(im->chains, stub);
OUTPUT:
RETVAL
char*
random_sequence (obj)
g_hash_table_foreach(im->chains, get_keys, keys);
nkeys = (1.0 * nkeys * rand()) / (1.0*RAND_MAX);
RETVAL = keys[nkeys];
g_free(keys);
OUTPUT:
RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
PUSHmortal|5.009002||p
PUSHn|||
PUSHp|||
PUSHs|||
PUSHu|5.004000||p
PUTBACK|||
PerlIO_clearerr||5.007003|
PerlIO_close||5.007003|
PerlIO_context_layers||5.009004|
PerlIO_eof||5.007003|
PerlIO_error||5.007003|
eval_sv(sv, G_SCALAR);
SvREFCNT_dec(sv);
SPAGAIN;
sv = POPs;
PUTBACK;
if (croak_on_error && SvTRUE(GvSV(errgv)))
croak(SvPVx(GvSV(errgv), na));
return sv;
view all matches for this distribution
view release on metacpan or search on metacpan
MinPerfHashTwoLevel.xs view on Meta::CPAN
if (state_len != MPH_STATE_BYTES) {
croak("Error: state vector must be at exactly %d bytes",(int)MPH_SEED_BYTES);
}
RETVAL= mph_hash_with_state(state_pv,str_pv,str_len);
}
OUTPUT:
RETVAL
SV *
seed_state(base_seed_sv)
MinPerfHashTwoLevel.xs view on Meta::CPAN
SvCUR_set(RETVAL,MPH_STATE_BYTES);
SvPOK_on(RETVAL);
state_pv= (U8 *)SvPV(RETVAL,state_len);
mph_seed_state(seed_pv,state_pv);
}
OUTPUT:
RETVAL
UV
compute_xs(self_hv)
MinPerfHashTwoLevel.xs view on Meta::CPAN
variant= SvUV(HeVAL(he));
} else {
croak("panic: no variant in self?");
}
he= hv_fetch_ent_with_keysv(self_hv,MPH_KEYSV_COMPUTE_FLAGS,0);
if (he) {
compute_flags= SvUV(HeVAL(he));
} else {
croak("panic: no compute_flags in self?");
}
MinPerfHashTwoLevel.xs view on Meta::CPAN
by_length_av= idx_by_length(aTHX_ keybuckets_av);
RETVAL= solve_collisions_by_length(aTHX_ bucket_count, max_xor_val, by_length_av, h2_packed_av, keybuckets_av,
variant, buckets_av);
}
OUTPUT:
RETVAL
MODULE = Algorithm::MinPerfHashTwoLevel PACKAGE = Tie::Hash::MinPerfHashTwoLevel::OnDisk
MinPerfHashTwoLevel.xs view on Meta::CPAN
SvCUR_set(sv_buf, str_buf_pos - start);
SvPOK_on(sv_buf);
RETVAL= sv_buf;
}
OUTPUT:
RETVAL
SV*
mount_file(file_sv,error_sv,flags)
SV* file_sv
MinPerfHashTwoLevel.xs view on Meta::CPAN
/* copy obj into a new SV which we can return */
RETVAL= newSVpvn((char *)&obj,sizeof(struct mph_obj));
SvPOK_on(RETVAL);
SvREADONLY_on(RETVAL);
}
OUTPUT:
RETVAL
void
unmount_file(mount_sv)
SV* mount_sv
MinPerfHashTwoLevel.xs view on Meta::CPAN
if (items > 4)
croak("Error: passed too many arguments to "
"Tie::Hash::MinPerfHashTwoLevel::OnDisk::fetch_by_index(mount_sv, index, key_sv, val_sv)");
RETVAL= lookup_bucket(aTHX_ obj->header,index,key_sv,val_sv);
}
OUTPUT:
RETVAL
int
fetch_by_key(mount_sv,key_sv,...)
SV* mount_sv
MinPerfHashTwoLevel.xs view on Meta::CPAN
if (items > 3)
croak("Error: passed too many arguments to "
"Tie::Hash::MinPerfHashTwoLevel::OnDisk::fetch_by_key(mount_sv, index, key_sv)");
RETVAL= lookup_key(aTHX_ obj->header,key_sv,val_sv);
}
OUTPUT:
RETVAL
SV *
get_comment(self_hv)
MinPerfHashTwoLevel.xs view on Meta::CPAN
case 9: RETVAL= newSVuv(obj->header->table_checksum); break;
case 10: RETVAL= newSVuv(obj->header->str_buf_checksum); break;
case 11: RETVAL= newSVpvn(start + obj->header->state_ofs, MPH_STATE_BYTES); break;
}
}
OUTPUT:
RETVAL
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Algorithm/Munkres.pm view on Meta::CPAN
=head1 EXPORT
"assign" function by default.
=head1 INPUT
The input matrix should be in a two dimensional array(array of
array) and the 'assign' subroutine expects a reference to this
array and not the complete array.
eg:assign(\@inp_mat, \@out_mat);
The second argument to the assign subroutine is the reference
to the output array.
=head1 OUTPUT
The assign subroutine expects references to two arrays as its
input paramenters. The second parameter is the reference to the
output array. This array is populated by assign subroutine. This
array is single dimensional Nx1 matrix.
view all matches for this distribution
view release on metacpan or search on metacpan
p->dim_map = newHV();
p->rev_map = newHV();
p->main_table = table_init();
SvREFCNT_inc(RETVAL);
OUTPUT:
RETVAL
void
add_arc(pagerank p, ...)
hv_store(results, reskey, len, curval, 0);
}
array_delete(result);
RETVAL = newRV((SV *)results);
clear(aTHX_ p);
OUTPUT:
RETVAL
void
DESTROY(pagerank p)
PREINIT:
view all matches for this distribution