Enlarge

Matrix.Enlarge($M$,$n$) takes a Matrix $M$ and replaces every entry with a diagonal matrix of size $n$ and entries equal to the original entry.

Compare Matrix.AddSpin().

Example

Input

Example.Quanty
M ={{3,5},
    {-2,I}}
print(Matrix.Enlarge(M,3))

Result

{ { 3 , 0 , 0 , 5 , 0 , 0 } , 
  { 0 , 3 , 0 , 0 , 5 , 0 } , 
  { 0 , 0 , 3 , 0 , 0 , 5 } , 
  { -2 , 0 , 0 , (0 + 1 I) , 0 , 0 } , 
  { 0 , -2 , 0 , 0 , (0 + 1 I) , 0 } , 
  { 0 , 0 , -2 , 0 , 0 , (0 + 1 I) } }

Table of contents

Print/export