# Error while adding values in jited function

**URL:** <https://numba.discourse.group/t/error-while-adding-values-in-jited-function/972>\
**Category:** Support: What is this error message?\
**Created:** [October 18, 2021, 8:03pm UTC](https://numba.discourse.group/t/error-while-adding-values-in-jited-function/972 "2021-10-18T20:03:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![grafrummelsdorf](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/grafrummelsdorf/32/430_2.png) [@grafrummelsdorf](https://numba.discourse.group/u/grafrummelsdorf)\
**Post date:** [October 18, 2021, 8:03pm UTC](https://numba.discourse.group/t/error-while-adding-values-in-jited-function/972/1 "2021-10-18T20:03:38Z")

</div>

I am new to numba and used it worked quite well so far in speeding up some of my code. But i have hit a dead end in a naive implementation of a vektor-matrix multiplikation.  
I have the matrix A, the vector b and the Produkt Ab. But everytime i try to add the product  
of the matrix A and vector b to a temporary variable, i get the same error:

raise e.with\_traceback(None)  
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)  
No implementation of function Function() found for signature:

> > > iadd(float64, array(float64, 1d, C))

There are 16 candidate implementations:

- Of which 14 did not match due to:  
Overload of function ‘iadd’: File: : Line N/A.  
With argument(s): ‘(float64, array(float64, 1d, C))’:  
No match.
- Of which 2 did not match due to:  
Operator Overload in function ‘iadd’: File: unknown: Line unknown.  
With argument(s): ‘(float64, array(float64, 1d, C))’:  
No match for registered cases:
  - (int64, int64) → int64
  - (int64, uint64) → int64
  - (uint64, int64) → int64
  - (uint64, uint64) → uint64
  - (float32, float32) → float32
  - (float64, float64) → float64
  - (complex64, complex64) → complex64
  - (complex128, complex128) → complex128

File “src/code/eigenvector-centrality/eigenvector\_numba.py”, line 46:  
def mat\_vector\_mul(A, b, Ab):  
  
for j in numba.prange(A.shape[1]):  
tmp += A[i, j] \* b[i]

Code:

@numba.njit(parallel = True)  
def mat\_vector\_mul(A, b, Ab):  
tmp = 0.0  
for i in numba.prange(b.shape[0]):  
for j in numba.prange(A.shape[1]):  
tmp += A[i, j] \* b[i]  
Ab[i] = tmp

I am pretty sure i am overlooking something absolutely obvious, but cannot get a hold of it. Any suggestions or help is highly appreciated! Thanks!

---

<div class="post-metadata">

**Author:** ![gmarkall](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/gmarkall/32/42_2.png) [@gmarkall](https://numba.discourse.group/u/gmarkall)\
**Post date:** [October 19, 2021, 8:26am UTC](https://numba.discourse.group/t/error-while-adding-values-in-jited-function/972/2 "2021-10-19T08:26:37Z")

</div>

In general it’s best to include a complete runnable sample of the code that produces the issue, otherwise it can be difficult for people to replicate and understand the problem. I think you had some mix up with indices - the following, based on your code, executes without errors for me:

```python
import numba
import numpy as np

np.random.seed(1)

@numba.njit(parallel=False)
def mat_vector_mul(A, b, Ab):
    for i in numba.prange(A.shape[0]):
        tmp = 0.0
        for j in numba.prange(b.shape[0]):
            tmp += A[i, j] * b[j]
        Ab[i] = tmp

A = np.random.rand(2, 3)
b = np.random.rand(3)
Ab = np.zeros(A.shape[0])

print(A)
print(b)

mat_vector_mul(A, b, Ab)

np.testing.assert_allclose(A @ b, Ab)

print(A @ b)

```

producing:

```nohighlight
[[4.17022005e-01 7.20324493e-01 1.14374817e-04]
 [3.02332573e-01 1.46755891e-01 9.23385948e-02]]
[0.18626021 0.34556073 0.39676747]
[0.32663584 0.14366255]

```

In general, if you can paste the whole runnable code when seeking advice, then it will help others to diagnose the issue (when you post code, it needs to be enclosed in backticks so that it formats properly - see [How to post code or preformatted text - tips & tricks - Discourse Meta](https://meta.discourse.org/t/how-to-post-code-or-preformatted-text/188910)).

Also, you can check if your code runs without the `@numba.njit` decorator - if you do that, do you get an error from Python that indicates an issue?
