I would like to multiply an array by each element of another array, and am having a lot of trouble finding a built-in or automated method of doing.
Here is an example of what I'd like to achieve:
a = 0.5;
b = 4.0;
mat = {{0, 1}, {a, b}};
Rmat = RandomInteger[10, {4, 4}]
m11 = mat[[1, 1]]*Rmat;
m12 = mat[[1, 2]]*Rmat;
m21 = mat[[2, 1]]*Rmat;
m22 = mat[[2, 2]]*Rmat;
fmat = ArrayFlatten[{{m11, m12}, {m21, m22}}]
As you can see, the first matrix mat
is multiplied by each individual element of Rmat
.
I feel like this should be easy, but I'm not finding a built-in function that works?
Thanks!