Assuming we have two matrices A and B with dim of P * N and N * Q respectively, what is the more efficient way to get values from multiplication of those two matrices only at specific index? For example, vector of row index at {p1,p3,p6,p1,...} in matrix A multiplied by vector of column index at {q2,q5,q2,q3...} in matrix B, and returns scalar values.
There'a another dataframe storing the mapping of those row indexes and column indexes, for example,
row,column
p1,q2
p3,q5
p6,q2
p1,q3
...
like mentioned before.