AI-ANN

 view release on metacpan or  search on metacpan

examples/_Inline/build/benchmark_pl_03a5/benchmark_pl_03a5.xs  view on Meta::CPAN

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
#include <math.h>
double afunc[4001];	
double dafunc[4001];
void generate_globals() {
	double i;
	for (i=0;i<=4000;i++) {
		afunc[i] = 2 * (erf(i/1000.0-2));
		dafunc[i] = 4 / sqrt(M_PI) * exp(-1 * ((i/1000.0-2) ** 2));
	}
}
double afunc_c (float input) {
	return afunc[(int) floor((input)*1000)];
}
double dafunc_c (float input) {
	return dafunc[(int) floor((input)*1000)];
}

MODULE = benchmark_pl_03a5	PACKAGE = main	

PROTOTYPES: DISABLE


void
generate_globals ()
	PREINIT:
	I32* temp;
	PPCODE:
	temp = PL_markstack_ptr++;
	generate_globals();
	if (PL_markstack_ptr != temp) {
          /* truly void, because dXSARGS not invoked */
	  PL_markstack_ptr = temp;
	  XSRETURN_EMPTY; /* return empty stack */
        }
        /* must have used dXSARGS; list context implied */
	return; /* assume stack size is correct */

double
afunc_c (input)

examples/_Inline/build/benchmark_pl_03a5/out.make  view on Meta::CPAN

/usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp  -typemap /usr/share/perl/5.10/ExtUtils/typemap   benchmark_pl_03a5.xs > benchmark_pl_03a5.xsc && mv benchmark_pl_03a5.xsc benchmark_pl_03a5.c
cc -c  -I/home/st47/sit-bmelab-labview/EANN/ANN/examples -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\...
benchmark_pl_03a5.xs: In function ‘generate_globals’:
benchmark_pl_03a5.xs:11: error: array subscript is not an integer
benchmark_pl_03a5.xs:12: error: array subscript is not an integer
benchmark_pl_03a5.xs:12: error: invalid type argument of ‘unary *’ (have ‘int’)
make: *** [benchmark_pl_03a5.o] Error 1

examples/_Inline/build/benchmark_pl_3d06/benchmark_pl_3d06.xs  view on Meta::CPAN

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
#include <math.h>
double afunc[4001];	
double dafunc[4001];
void generate_globals() {
	int i;
	for (i=0;i<=4000;i++) {
		afunc[i] = 2 * (erf(i/1000.0-2));
		dafunc[i] = 4 / sqrt(M_PI) * exp(-1 * ((i/1000.0-2) ** 2));
	}
}
double afunc_c (float input) {
	return afunc[(int) floor((input)*1000)];
}
double dafunc_c (float input) {
	return dafunc[(int) floor((input)*1000)];
}

MODULE = benchmark_pl_3d06	PACKAGE = main	

PROTOTYPES: DISABLE


void
generate_globals ()
	PREINIT:
	I32* temp;
	PPCODE:
	temp = PL_markstack_ptr++;
	generate_globals();
	if (PL_markstack_ptr != temp) {
          /* truly void, because dXSARGS not invoked */
	  PL_markstack_ptr = temp;
	  XSRETURN_EMPTY; /* return empty stack */
        }
        /* must have used dXSARGS; list context implied */
	return; /* assume stack size is correct */

double
afunc_c (input)

examples/_Inline/build/benchmark_pl_3d06/out.make  view on Meta::CPAN

/usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp  -typemap /usr/share/perl/5.10/ExtUtils/typemap   benchmark_pl_3d06.xs > benchmark_pl_3d06.xsc && mv benchmark_pl_3d06.xsc benchmark_pl_3d06.c
cc -c  -I/home/st47/sit-bmelab-labview/EANN/ANN/examples -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\...
benchmark_pl_3d06.xs: In function ‘generate_globals’:
benchmark_pl_3d06.xs:12: error: invalid type argument of ‘unary *’ (have ‘int’)
make: *** [benchmark_pl_3d06.o] Error 1

examples/_Inline/build/benchmark_pl_6dc1/benchmark_pl_6dc1.xs  view on Meta::CPAN

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
#include <math.h>
double afunc[4001];	
double dafunc[4001];
void generate_globals() {
	int i;
	for (i=0;i<=4000;i++) {
		afunc[i]=2*erf(i/1000.0-2);
		dafunc[i]=4/sqrt(M_PI)*exp(-1*(i/1000.0-2)**2);
	}
}
double afunc_c (float input) {
	return afunc[int((input)*1000)];
}
double dafunc_c (float input) {
	return dafunc[int((input)*1000)];
}

MODULE = benchmark_pl_6dc1	PACKAGE = main	

PROTOTYPES: DISABLE


void
generate_globals ()
	PREINIT:
	I32* temp;
	PPCODE:
	temp = PL_markstack_ptr++;
	generate_globals();
	if (PL_markstack_ptr != temp) {
          /* truly void, because dXSARGS not invoked */
	  PL_markstack_ptr = temp;
	  XSRETURN_EMPTY; /* return empty stack */
        }
        /* must have used dXSARGS; list context implied */
	return; /* assume stack size is correct */

double
afunc_c (input)

examples/_Inline/build/benchmark_pl_6dc1/out.make  view on Meta::CPAN

/usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp  -typemap /usr/share/perl/5.10/ExtUtils/typemap   benchmark_pl_6dc1.xs > benchmark_pl_6dc1.xsc && mv benchmark_pl_6dc1.xsc benchmark_pl_6dc1.c
cc -c  -I/home/st47/sit-bmelab-labview/EANN/ANN/examples -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\...
benchmark_pl_6dc1.xs: In function ‘generate_globals’:
benchmark_pl_6dc1.xs:12: error: invalid type argument of ‘unary *’ (have ‘int’)
benchmark_pl_6dc1.xs: In function ‘afunc_c’:
benchmark_pl_6dc1.xs:16: error: expected expression before ‘int’
benchmark_pl_6dc1.xs: In function ‘dafunc_c’:
benchmark_pl_6dc1.xs:19: error: expected expression before ‘int’
make: *** [benchmark_pl_6dc1.o] Error 1

examples/_Inline/build/benchmark_pl_ac1b/benchmark_pl_ac1b.xs  view on Meta::CPAN

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
#include <math.h>
double afunc[4001];	
double dafunc[4001];
void generate_globals() {
	int i;
	for (i=0;i<=4000;i++) {
		afunc[i] = 2 * erf(i/1000.0-2);
		dafunc[i] = 4 / sqrt(M_PI) * exp(-1 * (i/1000.0-2) ** 2);
	}
}
double afunc_c (float input) {
	return afunc[(int) floor((input)*1000)];
}
double dafunc_c (float input) {
	return dafunc[(int) floor((input)*1000)];
}

MODULE = benchmark_pl_ac1b	PACKAGE = main	

PROTOTYPES: DISABLE


void
generate_globals ()
	PREINIT:
	I32* temp;
	PPCODE:
	temp = PL_markstack_ptr++;
	generate_globals();
	if (PL_markstack_ptr != temp) {
          /* truly void, because dXSARGS not invoked */
	  PL_markstack_ptr = temp;
	  XSRETURN_EMPTY; /* return empty stack */
        }
        /* must have used dXSARGS; list context implied */
	return; /* assume stack size is correct */

double
afunc_c (input)

examples/_Inline/build/benchmark_pl_ac1b/out.make  view on Meta::CPAN

/usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp  -typemap /usr/share/perl/5.10/ExtUtils/typemap   benchmark_pl_ac1b.xs > benchmark_pl_ac1b.xsc && mv benchmark_pl_ac1b.xsc benchmark_pl_ac1b.c
cc -c  -I/home/st47/sit-bmelab-labview/EANN/ANN/examples -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\...
benchmark_pl_ac1b.xs: In function ‘generate_globals’:
benchmark_pl_ac1b.xs:12: error: invalid type argument of ‘unary *’ (have ‘int’)
make: *** [benchmark_pl_ac1b.o] Error 1

examples/_Inline/build/benchmark_pl_b832/benchmark_pl_b832.xs  view on Meta::CPAN

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
#include <libm/math.h>
double afunc[4001];
double dafunc[4001];
void generate_globals() {
	int i;
	for (i=0;i<=4000;i++) {
		afunc[i]=2*erf(i/1000.0-2);
		dafunc[i]=4/sqrt(M_PI)*exp(-1*(i/1000.0-2)**2);
	}
}
double afunc_c (float input) {
	return afunc[int((input)*1000)];
}
double dafunc_c (float input) {
	return dafunc[int((input)*1000)];
}

MODULE = benchmark_pl_b832	PACKAGE = main	

PROTOTYPES: DISABLE


void
generate_globals ()
	PREINIT:
	I32* temp;
	PPCODE:
	temp = PL_markstack_ptr++;
	generate_globals();
	if (PL_markstack_ptr != temp) {
          /* truly void, because dXSARGS not invoked */
	  PL_markstack_ptr = temp;
	  XSRETURN_EMPTY; /* return empty stack */
        }
        /* must have used dXSARGS; list context implied */
	return; /* assume stack size is correct */

double
afunc_c (input)

examples/_Inline/build/benchmark_pl_b905/benchmark_pl_b905.xs  view on Meta::CPAN

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
#include <math.h>
double afunc[4001];	
double dafunc[4001];
void generate_globals() {
	int i;
	for (i=0;i<=4000;i++) {
		afunc[i]= 2 * erf(i/1000.0-2);
		dafunc[i]= 4 / sqrt(M_PI) * exp(-1 * (i/1000.0-2) ** 2);
	}
}
double afunc_c (float input) {
	return afunc[floor((input)*1000)];
}
double dafunc_c (float input) {
	return dafunc[floor((input)*1000)];
}

MODULE = benchmark_pl_b905	PACKAGE = main	

PROTOTYPES: DISABLE


void
generate_globals ()
	PREINIT:
	I32* temp;
	PPCODE:
	temp = PL_markstack_ptr++;
	generate_globals();
	if (PL_markstack_ptr != temp) {
          /* truly void, because dXSARGS not invoked */
	  PL_markstack_ptr = temp;
	  XSRETURN_EMPTY; /* return empty stack */
        }
        /* must have used dXSARGS; list context implied */
	return; /* assume stack size is correct */

double
afunc_c (input)

examples/_Inline/build/benchmark_pl_b905/out.make  view on Meta::CPAN

/usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp  -typemap /usr/share/perl/5.10/ExtUtils/typemap   benchmark_pl_b905.xs > benchmark_pl_b905.xsc && mv benchmark_pl_b905.xsc benchmark_pl_b905.c
cc -c  -I/home/st47/sit-bmelab-labview/EANN/ANN/examples -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\...
benchmark_pl_b905.xs: In function ‘generate_globals’:
benchmark_pl_b905.xs:12: error: invalid type argument of ‘unary *’ (have ‘int’)
benchmark_pl_b905.xs: In function ‘afunc_c’:
benchmark_pl_b905.xs:16: error: array subscript is not an integer
benchmark_pl_b905.xs: In function ‘dafunc_c’:
benchmark_pl_b905.xs:19: error: array subscript is not an integer
make: *** [benchmark_pl_b905.o] Error 1

examples/_Inline/build/benchmark_pl_c51b/benchmark_pl_c51b.xs  view on Meta::CPAN

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
#include <math.h>
double afunc[4001];	
double dafunc[4001];
void generate_globals() {
	int i;
	for (i=0;i<=4000;i++) {
		afunc[i]=2 * erf(i/1000.0-2);
		dafunc[i]=4/sqrt(M_PI) * exp(-1 * (i/1000.0-2) ** 2);
	}
}
double afunc_c (float input) {
	return afunc[int((input)*1000)];
}
double dafunc_c (float input) {
	return dafunc[int((input)*1000)];
}

MODULE = benchmark_pl_c51b	PACKAGE = main	

PROTOTYPES: DISABLE


void
generate_globals ()
	PREINIT:
	I32* temp;
	PPCODE:
	temp = PL_markstack_ptr++;
	generate_globals();
	if (PL_markstack_ptr != temp) {
          /* truly void, because dXSARGS not invoked */
	  PL_markstack_ptr = temp;
	  XSRETURN_EMPTY; /* return empty stack */
        }
        /* must have used dXSARGS; list context implied */
	return; /* assume stack size is correct */

double
afunc_c (input)

examples/_Inline/build/benchmark_pl_c51b/out.make  view on Meta::CPAN

/usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp  -typemap /usr/share/perl/5.10/ExtUtils/typemap   benchmark_pl_c51b.xs > benchmark_pl_c51b.xsc && mv benchmark_pl_c51b.xsc benchmark_pl_c51b.c
cc -c  -I/home/st47/sit-bmelab-labview/EANN/ANN/examples -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\...
benchmark_pl_c51b.xs: In function ‘generate_globals’:
benchmark_pl_c51b.xs:12: error: invalid type argument of ‘unary *’ (have ‘int’)
benchmark_pl_c51b.xs: In function ‘afunc_c’:
benchmark_pl_c51b.xs:16: error: expected expression before ‘int’
benchmark_pl_c51b.xs: In function ‘dafunc_c’:
benchmark_pl_c51b.xs:19: error: expected expression before ‘int’
make: *** [benchmark_pl_c51b.o] Error 1

examples/benchmark.pl  view on Meta::CPAN

my @data = ( [ 4*rand()-2, 4*rand()-2, 4*rand()-2, 4*rand()-2, 4*rand()-2 ],
			 [ 4*rand()-2, 4*rand()-2, 4*rand()-2, 4*rand()-2, 4*rand()-2 ]);
cmpthese( -1, { 'pure_perl' => sub{$object1->execute(@data)},
				'inline_c'  => sub{$object2->execute(@data)} });

use Math::Libm qw(erf M_PI);
use Inline C => <<'END_C';
#include <math.h>
double afunc[4001];	
double dafunc[4001];
void generate_globals() {
	int i;
	for (i=0;i<=4000;i++) {
		afunc[i] = 2 * (erf(i/1000.0-2));
		dafunc[i] = 4 / sqrt(M_PI) * pow(exp(-1 * ((i/1000.0-2))), 2);
	}
}
double afunc_c (float input) {
	return afunc[(int) floor((input)*1000)+2000];
}
double dafunc_c (float input) {
	return dafunc[(int) floor((input)*1000)+2000];
}
END_C

timethis(-1, 'generate_globals()');

sub afunc_pp {
	return 2 * erf(int((shift)*1000)/1000);
}
sub dafunc_pp {
	return 4 / sqrt(M_PI) * exp( -1 * ((int((shift)*1000)/1000) ** 2) );
}

cmpthese( -1, { 'afunc_c'  => sub{afunc_c(4*rand()-2)},
				'afunc_pp' => sub{afunc_pp(4*rand()-2)} });



( run in 1.015 second using v1.01-cache-2.11-cpan-49f99fa48dc )