# Functions of the elements of a matrix

I have a matrix say

M=[[10,12],[25,2]]

And I would like to create a function of the type

$f_1(M,i)=2*M[i][0]+3*M[i][1]$

I perfectly understand that neither `M[i][0]`

nor `M[i][1]`

are declared variable. Is there a solution to my problem ? Or should I explore an other way ?