Findn() function not found in Julia

I am trying to run the code:
ai, aj = findn(triu(NA, 1))

But it throws an error of undefined variable. I don’t know which package has this function.

UndefVarError: findn not defined

Stacktrace:
[1] top-level scope
@ In[10]:1
[2] eval
@ .\boot.jl:368 [inlined]
[3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base .\loading.jl:1428

What do you want the findn function to do?

It looks like findn(A) was a function in quite old versions of Julia, which was deprecated in Julia 0.7 in favor of findall(!iszero, A).

So, you should update your code to

aij = findall(!iszero, triu(NA,1))

where aij is now an array of CartesianIndex, essentially a kind of multi-component index for indexing multidimensional arrays.

1 Like

Thanks.