>
> I'm happy to do this, but consider my specific use case for a moment: a 
> graph adjacency matrix A of boolean values. Right now, I can call int(A) to 
> turn this into an array where true = 1 and false = 0, which is ideal for 
> determining the Laplacian matrix.
>  
>
If int() isn't the right way to do this, what is? round(), trunc(), 
> parseint() don't work, and creating a separate function that iterates over 
> A and converts the true values to 1 seems redundant.
>
>
Thank you all for the alternatives. Here's feedback on each :)

1) map(Int, array) works perfectly.
2) Array{Int}(array) doesn't work (I know it's coming soon) but seems more 
"julian".
3) array+0 is an interesting one. It has the side effect of turning a 
sparse array (of bool) into a dense array (of int) but otherwise works.

Given that int() appears to be on the way to deprecation, I'll opt for 1) 
until 2) is available. Appreciate the help.


Reply via email to