Question: Multiplication of entries of a matrix with a matrix

Dear Users!

Hope everyone should fine here. I want to know how to multiple the entries of a matrix with a matrix like If A is matrix as:

A:= Matrix(2, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 2})
I want nonzero entries should multiply with m*m identity matrix and zero entries multiply with null matrix of order m*m. for m=2 the desired results i calculated manually as:

Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 2, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 2});

I want to know the general way. Thanks in advance

 

Please Wait...