Dear Community,

Is there any way to return in Julia full permutation matrix instead of vector?

using LinearAlgebra

A = [0 4 2; 10 2 1; 1 1 1]

L,U,P = lu(A)

P is returned as [2,1,3].

However, I would like to have in the following form: [0,1,0;1,0,0;0,0,1]

Is there any way to enforce this in Julia?

Thank you in advance for any help