Thanks Oscar. Even though I do not understand why determinant is a scalar, but it needs a matrix for output. Anyway, there is any way to remove this allocation as I need to compute det(A) in inner loops.
Sorry, I didn’t mean for computing the output. I meant for workspace. My guess (I’m double checking) is that det is probably found using a LU decomposition (confirmed) or similar, which requires a matrix of workspace. This means that if you can store the matrix in LU form, the det computation would be very fast and non-allocating.