<SYSTEM_TASK:>
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
<END_TASK>
<USER_TASK:>
Problem:
I'm looking for a fast solution to MATLAB's accumarray in numpy. The accumarray accumulates the elements of an array which belong to the same index.
<ASSISTANT_TASK:>
Python Code:
import numpy as np
a = np.arange(1,11)
accmap = np.array([0,1,0,0,0,-1,-1,2,2,1])
add = np.max(accmap)
mask = accmap < 0
accmap[mask] += add+1
result = np.bincount(accmap, weights = a)
<END_TASK>