numpy  2.0.0
src/umath/umath_tests.c.src File Reference
#include "Python.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "npy_pycompat.h"
#include "npy_config.h"

Defines

#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define INIT_OUTER_LOOP_1
#define INIT_OUTER_LOOP_2
#define INIT_OUTER_LOOP_3
#define INIT_OUTER_LOOP_4
#define BEGIN_OUTER_LOOP_3   for (N_ = 0; N_ < dN; N_++, args[0] += s0, args[1] += s1, args[2] += s2) {
#define BEGIN_OUTER_LOOP_4   for (N_ = 0; N_ < dN; N_++, args[0] += s0, args[1] += s1, args[2] += s2, args[3] += s3) {
#define END_OUTER_LOOP   }
#define RETVAL

Functions

static void TYPE _inner1d (char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func))
static void TYPE _innerwt (char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func))
static void TYPE _matrix_multiply (char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED(func))
static void addUfuncs (PyObject *dictionary)
static PyObject * UMath_Tests_test_signature (PyObject *NPY_UNUSED(dummy), PyObject *args)
PyMODINIT_FUNC initumath_tests (void)

Variables

char * inner1d_signature = "(i),(i)->()"
char * innerwt_signature = "(i),(i),(i)->()"
char * matrix_multiply_signature = "(m,n),(n,p)->(m,p)"
static PyUFuncGenericFunction inner1d_functions [] = { LONG_inner1d, DOUBLE_inner1d }
static void * inner1d_data [] = { (void *)NULL, (void *)NULL }
static char inner1d_signatures [] = { NPY_LONG, NPY_LONG, NPY_LONG, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE }
static PyUFuncGenericFunction innerwt_functions [] = { LONG_innerwt, DOUBLE_innerwt }
static void * innerwt_data [] = { (void *)NULL, (void *)NULL }
static char innerwt_signatures [] = { NPY_LONG, NPY_LONG, NPY_LONG, NPY_LONG, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE }
static PyUFuncGenericFunction matrix_multiply_functions [] = { LONG_matrix_multiply, FLOAT_matrix_multiply, DOUBLE_matrix_multiply }
static void * matrix_multiply_data [] = { (void *)NULL, (void *)NULL, (void *)NULL }
static char matrix_multiply_signatures [] = { NPY_LONG, NPY_LONG, NPY_LONG, NPY_FLOAT, NPY_FLOAT, NPY_FLOAT, NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE }
static PyMethodDef UMath_TestsMethods []

Define Documentation

#define BEGIN_OUTER_LOOP_3   for (N_ = 0; N_ < dN; N_++, args[0] += s0, args[1] += s1, args[2] += s2) {
#define BEGIN_OUTER_LOOP_4   for (N_ = 0; N_ < dN; N_++, args[0] += s0, args[1] += s1, args[2] += s2, args[3] += s3) {
#define END_OUTER_LOOP   }
Value:
npy_intp dN = *dimensions++;\
    npy_intp N_;                \
    npy_intp s0 = *steps++;

* BASICS **

Value:
INIT_OUTER_LOOP_1           \
    npy_intp s1 = *steps++;
Value:
INIT_OUTER_LOOP_2           \
    npy_intp s2 = *steps++;
Value:
INIT_OUTER_LOOP_3           \
    npy_intp s3 = *steps++;
#define NPY_NO_DEPRECATED_API   NPY_API_VERSION

* INCLUDES **

#define RETVAL

Function Documentation

static void TYPE _inner1d ( char **  args,
npy_intp dimensions,
npy_intp steps,
void *  NPY_UNUSEDfunc 
) [static]
begin repeat <blockquote> TYPE=LONG,DOUBLE# #typ=npy_long, npy_double#</blockquote>
This implements the function
out[n] = sum_i { in1[n, i] * in2[n, i] }.
static void TYPE _innerwt ( char **  args,
npy_intp dimensions,
npy_intp steps,
void *  NPY_UNUSEDfunc 
) [static]
begin repeat <blockquote> TYPE=LONG,DOUBLE# #typ=npy_long, npy_double#</blockquote>
This implements the function
out[n] = sum_i { in1[n, i] * in2[n, i] * in3[n, i] }.
static void TYPE _matrix_multiply ( char **  args,
npy_intp dimensions,
npy_intp steps,
void *  NPY_UNUSEDfunc 
) [static]
begin repeat <blockquote> TYPE=FLOAT,DOUBLE,LONG# #typ=npy_float, npy_double,npy_long#</blockquote>
This implements the function
out[k, m, p] = sum_n { in1[k, m, n] * in2[k, n, p] }.
no BLAS is available
static void addUfuncs ( PyObject *  dictionary) [static]
PyMODINIT_FUNC initumath_tests ( void  )
Load the ufunc operators into the module's namespace
static PyObject* UMath_Tests_test_signature ( PyObject *  NPY_UNUSEDdummy,
PyObject *  args 
) [static]
End of auto-generated code.

References addUfuncs(), import_array, and RETVAL.


Variable Documentation

void* inner1d_data[] = { (void *)NULL, (void *)NULL } [static]
PyUFuncGenericFunction inner1d_functions[] = { LONG_inner1d, DOUBLE_inner1d } [static]
end repeat*
<blockquote>

The following lines were generated using a slightly modified
version of code_generators/generate_umath.py and adding these lines to defdict:

</blockquote>

defdict = { 'inner1d' :

System Message: ERROR/3 (<string>, line 7) Unexpected indentation.

<blockquote>

Ufunc(2, 1, None_,

r'''inner on the last dimension and broadcast on the rest n" " "(i),(i)->()" n''',

System Message: ERROR/3 (<string>, line 10) Unexpected indentation.

<blockquote class="last"> TD('ld'), ),</blockquote>

</blockquote>

System Message: WARNING/2 (<string>, line 12) Block quote ends without a blank line; unexpected unindent.
'innerwt' :
Ufunc(3, 1, None_,
r'''inner1d with a weight argument n" " "(i),(i),(i)->()" n''', TD('ld'), ),
System Message: WARNING/2 (<string>, line 18) Definition list ends without a blank line; unexpected unindent.
}

Docutils System Messages

System Message: ERROR/3 (<string>, line 10); backlink Unknown target name: "none".
System Message: ERROR/3 (<string>, line 16); backlink Unknown target name: "none".
char* inner1d_signature = "(i),(i)->()"

* UFUNC LOOPS **

void* innerwt_data[] = { (void *)NULL, (void *)NULL } [static]
PyUFuncGenericFunction innerwt_functions[] = { LONG_innerwt, DOUBLE_innerwt } [static]
char* innerwt_signature = "(i),(i),(i)->()"
end repeat*
void* matrix_multiply_data[] = { (void *)NULL, (void *)NULL, (void *)NULL } [static]
PyUFuncGenericFunction matrix_multiply_functions[] = { LONG_matrix_multiply, FLOAT_matrix_multiply, DOUBLE_matrix_multiply } [static]
char* matrix_multiply_signature = "(m,n),(n,p)->(m,p)"
end repeat*
PyMethodDef UMath_TestsMethods[] [static]
Initial value:
 {
    {"test_signature",  UMath_Tests_test_signature, METH_VARARGS,
     "Test signature parsing of ufunc. \n"
     "Arguments: nin nout signature \n"
     "If fails, it returns NULL. Otherwise it will returns 0 for scalar ufunc "
     "and 1 for generalized ufunc. \n",
     },
    {NULL, NULL, 0, NULL}        
}