I am trying to make a diagonal block matrix in Julia. I have an nxn array that I want to make P copies of as a block matrix down the diagonal and the rest of the matrix is sparse.
If arr is my array, I know I can use:
blockdiag(sparse(arr),sparse(arr))
to create a block with P=2 copies of the array down the diagonal.
However, for large P, how can I do this in a general way with variable P?
I tried making an array that is (nxnxP), however BlockDiag() does not accept a 3D array.