#include #include #include #include "libnumarray.h" #ifdef MS_WIN32 #pragma warning(once : 4244) #endif #define logical_and(arg1, arg2) (arg1 != 0) & (arg2 != 0) #define logical_or(arg1, arg2) (arg1 != 0) | (arg2 != 0) #define logical_xor(arg1, arg2) ((arg1 != 0) ^ (arg2 != 0)) & 1 #define ufmaximum(arg1, arg2) (((temp1=arg1) > (temp2=arg2)) ? temp1 : temp2) #define ufminimum(arg1, arg2) (((temp1=arg1) < (temp2=arg2)) ? temp1 : temp2) #define distance3d(x,y,z) sqrt(x*x + y*y + z*z) /********************* _distance3d *********************/ /********************* minus *********************/ static int minus_NxN_vxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin0 = (Int64 *) buffers[0]; Int64 *tout0 = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; i tin1; ++tin0; ++tout0; } END_THREADS return 0; } static CfuncDescriptor greater_NNxB_vsxv_descr = { "greater_NNxB_vsxv", (void *) greater_NNxB_vsxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Bool) }, { 0, 1, 0, 0 } }; static int greater_NNxB_vvxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin0 = (Int64 *) buffers[0]; Int64 *tin1 = (Int64 *) buffers[1]; Bool *tout0 = (Bool *) buffers[2]; BEGIN_THREADS for (i=0; i *tin1; ++tin0; ++tin1; ++tout0; } END_THREADS return 0; } static CfuncDescriptor greater_NNxB_vvxv_descr = { "greater_NNxB_vvxv", (void *) greater_NNxB_vvxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Bool) }, { 0, 0, 0, 0 } }; static int greater_NNxB_svxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 tin0 = *(Int64 *) buffers[0]; Int64 *tin1 = (Int64 *) buffers[1]; Bool *tout0 = (Bool *) buffers[2]; BEGIN_THREADS for (i=0; i *tin1; ++tin1; ++tout0; } END_THREADS return 0; } static CfuncDescriptor greater_NNxB_svxv_descr = { "greater_NNxB_svxv", (void *) greater_NNxB_svxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Bool) }, { 1, 0, 0, 0 } }; /********************* greater_equal *********************/ static int greater_equal_NNxB_vsxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin0 = (Int64 *) buffers[0]; Int64 tin1 = *(Int64 *) buffers[1]; Bool *tout0 = (Bool *) buffers[2]; BEGIN_THREADS for (i=0; i= tin1; ++tin0; ++tout0; } END_THREADS return 0; } static CfuncDescriptor greater_equal_NNxB_vsxv_descr = { "greater_equal_NNxB_vsxv", (void *) greater_equal_NNxB_vsxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Bool) }, { 0, 1, 0, 0 } }; static int greater_equal_NNxB_vvxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin0 = (Int64 *) buffers[0]; Int64 *tin1 = (Int64 *) buffers[1]; Bool *tout0 = (Bool *) buffers[2]; BEGIN_THREADS for (i=0; i= *tin1; ++tin0; ++tin1; ++tout0; } END_THREADS return 0; } static CfuncDescriptor greater_equal_NNxB_vvxv_descr = { "greater_equal_NNxB_vvxv", (void *) greater_equal_NNxB_vvxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Bool) }, { 0, 0, 0, 0 } }; static int greater_equal_NNxB_svxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 tin0 = *(Int64 *) buffers[0]; Int64 *tin1 = (Int64 *) buffers[1]; Bool *tout0 = (Bool *) buffers[2]; BEGIN_THREADS for (i=0; i= *tin1; ++tin1; ++tout0; } END_THREADS return 0; } static CfuncDescriptor greater_equal_NNxB_svxv_descr = { "greater_equal_NNxB_svxv", (void *) greater_equal_NNxB_svxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Bool) }, { 1, 0, 0, 0 } }; /********************* less *********************/ static int less_NNxB_vsxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin0 = (Int64 *) buffers[0]; Int64 tin1 = *(Int64 *) buffers[1]; Bool *tout0 = (Bool *) buffers[2]; BEGIN_THREADS for (i=0; i> tin1; ++tin0; ++tout0; } END_THREADS return 0; } static CfuncDescriptor rshift_NNxN_vsxv_descr = { "rshift_NNxN_vsxv", (void *) rshift_NNxN_vsxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Int64) }, { 0, 1, 0, 0 } }; static int rshift_NNxN_vvxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin0 = (Int64 *) buffers[0]; Int64 *tin1 = (Int64 *) buffers[1]; Int64 *tout0 = (Int64 *) buffers[2]; BEGIN_THREADS for (i=0; i> *tin1; ++tin0; ++tin1; ++tout0; } END_THREADS return 0; } static CfuncDescriptor rshift_NNxN_vvxv_descr = { "rshift_NNxN_vvxv", (void *) rshift_NNxN_vvxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Int64) }, { 0, 0, 0, 0 } }; static int rshift_NNxN_svxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 tin0 = *(Int64 *) buffers[0]; Int64 *tin1 = (Int64 *) buffers[1]; Int64 *tout0 = (Int64 *) buffers[2]; BEGIN_THREADS for (i=0; i> *tin1; ++tin1; ++tout0; } END_THREADS return 0; } static CfuncDescriptor rshift_NNxN_svxv_descr = { "rshift_NNxN_svxv", (void *) rshift_NNxN_svxv, CFUNC_UFUNC, 0, CHECK_ALIGN, 2, 1, { sizeof(Int64), sizeof(Int64), sizeof(Int64) }, { 1, 0, 0, 0 } }; /********************* lshift *********************/ static int lshift_NNxN_vsxv(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin0 = (Int64 *) buffers[0]; Int64 tin1 = *(Int64 *) buffers[1]; Int64 *tout0 = (Int64 *) buffers[2]; BEGIN_THREADS for (i=0; i