On Sat, May 24, 2008 at 11:29 PM, <[EMAIL PROTECTED]> wrote:

> Hi all,
>
> I'm trying to write a Gauss-Seidel function in C++. The function works
> however it is too slow because I'm not using any acceleration for the
> vector multiplication. I'm not really sure how to access the dot function
> in my extension, nor what all the arguments are for.
>
> Is this the right function to use (found in ndarrayobject.h):
>
> typedef void (PyArray_DotFunc)(void *, npy_intp, void *, npy_intp, void *,
>                               npy_intp, void *);
>
> I guess the voids are array objects, the two to be dotted and the output.
> What's the fourth?
>

It's ignored, so 0 (C++) should do.

static void
@[EMAIL PROTECTED](char *ip1, intp is1, char *ip2, intp is2, char *op, intp n,
           void *ignore)
{
    register @out@ tmp=(@out@)0;
    register intp i;
    for(i=0;i<n;i++,ip1+=is1,ip2+=is2) {
        tmp += (@out@)(*((@type@ *)ip1)) * \
               (@out@)(*((@type@ *)ip2));
    }
    *((@type@ *)op) = (@type@) tmp;
}

Note that the function may call BLAS in practice, but you can figure the use
of the arguments from the above. Ignore the @type@ sort of stuff, it's
replaced by real types by the code generator.

Chuck
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to