I have a list:
{{pos_1,val_1},{pos_2,val_2},...}
and would like to generate an array of dimension d, with values val_i at positionspos_i, the rest being filled with 0. I would assume that I shall use SparseArray but this function has a different form of argument:
{pos_1->val_1,pos_2->val_2,...}
Is there any simple way to transform one type of the argument into the other, or completely different approach shall be undertaken?
SparseArray? – drer Feb 28 '18 at 15:36{pos,vals} = Transpose[posval]; SparseArray[pos+1 -> vals , dims]. This adds1onto all positions indices. – Henrik Schumacher Feb 28 '18 at 15:54