# Numba supporting numpy.dot

**URL:** <https://numba.discourse.group/t/numba-supporting-numpy-dot/2315>\
**Category:** Support: How do I do ...?\
**Created:** [December 8, 2023, 5:03am UTC](https://numba.discourse.group/t/numba-supporting-numpy-dot/2315 "2023-12-08T05:03:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aeyou](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/aeyou/32/1041_2.png) [@aeyou](https://numba.discourse.group/u/aeyou)\
**Post date:** [December 8, 2023, 5:03am UTC](https://numba.discourse.group/t/numba-supporting-numpy-dot/2315/1 "2023-12-08T05:03:20Z")

</div>

Hey guys,

In the documentation, Supported Numpy Features → Functions → Linear algebra, it supports numpy.dot(). However, in Other methods, it says it support dot() (only the 1-argument form), which GPT tells me is dot product of two same vector. This is a bit confusing. Does Numba support dot product of two different np arrays? Many thanks.

---

<div class="post-metadata">

**Author:** ![nelson2005](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/nelson2005/32/47_2.png) [@nelson2005](https://numba.discourse.group/u/nelson2005)\
**Post date:** [December 8, 2023, 3:38pm UTC](https://numba.discourse.group/t/numba-supporting-numpy-dot/2315/3 "2023-12-08T15:38:35Z")

</div>

It does. Can you supply a simple sample demo program?

---

<div class="post-metadata">

**Author:** ![Oyibo](https://avatars.discourse-cdn.com/v4/letter/o/4af34b/32.png) [@Oyibo](https://numba.discourse.group/u/Oyibo)\
**Post date:** [December 8, 2023, 7:43pm UTC](https://numba.discourse.group/t/numba-supporting-numpy-dot/2315/4 "2023-12-08T19:43:56Z")

</div>

Hey @aeyou ,

In the documentation, when it mentions “dot() (only the 1-argument form),” it is likely referring to the `dot` method of a NumPy array. The `dot` method, when used as a class method of a NumPy array, takes only one argument.

However, this does not mean that Numba does not support dot products between different arrays. Both `np.dot` and the `ndarray.dot` method can handle dot products between different arrays.

You can use either `np.dot` or the `ndarray.dot` method of a NumPy array for dot products between different arrays in Numba.

```auto
import numpy as np
import numba as nb

@nb.njit
def dot_function(arrA, arrB):
    """numpy.dot as function takes 2 arguments."""
    return np.dot(arrA, arrB)

@nb.njit
def dot_method(arrA, arrB):
    """np.ndarray.dot as class method takes 1 argument."""
    return arrA.dot(arrB)

arrA = np.arange(6.).reshape((3,2))
arrB = np.arange(6.).reshape((2,3))

print('dot_function')
print(dot_function(arrA, arrB))
print('dot_method')
print(dot_method(arrA, arrB))
# dot_function
# [[3. 4. 5.]
# [9. 14. 19.]
# [15. 24. 33.]]
# dot_method
# [[3. 4. 5.]
# [9. 14. 19.]
# [15. 24. 33.]]

```

---

<div class="post-metadata">

**Author:** ![aeyou](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/aeyou/32/1041_2.png) [@aeyou](https://numba.discourse.group/u/aeyou)\
**Post date:** [December 13, 2023, 3:15am UTC](https://numba.discourse.group/t/numba-supporting-numpy-dot/2315/5 "2023-12-13T03:15:44Z")

</div>

Ah, I understand. Thank you very much for your reply.
