I am wondering best practices for indexing matrices in Julia. The following seems less than ideal, but struggling to find a good way to do, e.g., cor_mat[ - j, -j], as most examples are cor_mat[ j , j ] online. Note that I have both p, the number of variables, and samples, the number of prospective samples. This is a test of one part of a function that will need need at least 5,000 samples.

```
using LinearAlgebra
function timing(p , n, samples)
b = zeros(1, p)
bb = Array{Float64}(b)
cor_mat = Matrix{Float64}(I,p,p)
zstar = Array{Float64}(undef, n, p)
x = ones(n)
m = x * bb
idx = collect(1:1:p)
for j in 1:samples
for i in 1:p
mm = transpose(m[:,1]) + transpose(cor_mat[1 , idx .!= 1 ]) *
inv( cor_mat[idx .!= 1 , idx .!= 1 ]) *
transpose(zstar[:,idx .!= 1] - m[:,idx .!= 1])
ss = cor_mat[1, 1] - transpose(cor_mat[1 , idx .!= 1 ]) *
inv( cor_mat[idx .!= 1 , idx .!= 1 ]) *
cor_mat[1 , idx .!= 1 ]
end
end
end
@time timing(20, 200, 5000)
15.637497 seconds (10.35 M allocations: 14.218 GiB, 8.29% gc time)
```