Element-wise multiplication of matrices with different dimension
You may Compile
the code into a listable CompiledFunction
as follows:
cf = Compile[{{a, _Integer, 2}, {b, _Integer, 2}},
a b,
RuntimeAttributes -> {Listable},
Parallelization -> True
];
Here is a comparison
n = 100000;
m = 16;
mat1 = RandomInteger[10, {n, m, m}];
mat2 = RandomInteger[10, {m, m}];
Result = Table[mat2*mat1[[i]], {i, 1, Length[mat1]}]; // RepeatedTiming // First
Result2 = cf[mat1, mat2]; // RepeatedTiming // First
Result == Result2
0.342
0.067
True