| 2623 | |
| 2624 | |
| 2625 | static PyObject * |
| 2626 | array_vdot(PyObject *NPY_UNUSED(dummy), PyObject *const *args, Py_ssize_t len_args) |
| 2627 | { |
| 2628 | int typenum; |
| 2629 | char *ip1, *ip2, *op; |
| 2630 | npy_intp n, stride1, stride2; |
| 2631 | PyObject *op1, *op2; |
| 2632 | npy_intp newdimptr[1] = {-1}; |
| 2633 | PyArray_Dims newdims = {newdimptr, 1}; |
| 2634 | PyArrayObject *ap1 = NULL, *ap2 = NULL, *ret = NULL; |
| 2635 | PyArray_Descr *type; |
| 2636 | PyArray_DotFunc *vdot; |
| 2637 | NPY_BEGIN_THREADS_DEF; |
| 2638 | |
| 2639 | NPY_PREPARE_ARGPARSER; |
| 2640 | if (npy_parse_arguments("vdot", args, len_args, NULL, |
| 2641 | "", NULL, &op1, |
| 2642 | "", NULL, &op2, |
| 2643 | NULL, NULL, NULL) < 0) { |
| 2644 | return NULL; |
| 2645 | } |
| 2646 | |
| 2647 | /* |
| 2648 | * Conjugating dot product using the BLAS for vectors. |
| 2649 | * Flattens both op1 and op2 before dotting. |
| 2650 | */ |
| 2651 | typenum = PyArray_ObjectType(op1, NPY_NOTYPE); |
| 2652 | if (typenum == NPY_NOTYPE) { |
| 2653 | return NULL; |
| 2654 | } |
| 2655 | typenum = PyArray_ObjectType(op2, typenum); |
| 2656 | if (typenum == NPY_NOTYPE) { |
| 2657 | return NULL; |
| 2658 | } |
| 2659 | |
| 2660 | type = PyArray_DescrFromType(typenum); |
| 2661 | Py_INCREF(type); |
| 2662 | ap1 = (PyArrayObject *)PyArray_FromAny(op1, type, 0, 0, 0, NULL); |
| 2663 | if (ap1 == NULL) { |
| 2664 | Py_DECREF(type); |
| 2665 | goto fail; |
| 2666 | } |
| 2667 | |
| 2668 | op1 = PyArray_Newshape(ap1, &newdims, NPY_CORDER); |
| 2669 | if (op1 == NULL) { |
| 2670 | Py_DECREF(type); |
| 2671 | goto fail; |
| 2672 | } |
| 2673 | Py_DECREF(ap1); |
| 2674 | ap1 = (PyArrayObject *)op1; |
| 2675 | |
| 2676 | ap2 = (PyArrayObject *)PyArray_FromAny(op2, type, 0, 0, 0, NULL); |
| 2677 | if (ap2 == NULL) { |
| 2678 | goto fail; |
| 2679 | } |
| 2680 | op2 = PyArray_Newshape(ap2, &newdims, NPY_CORDER); |
| 2681 | if (op2 == NULL) { |
| 2682 | goto fail; |
nothing calls this directly
no test coverage detected