I try find index of ndarray of PDL
pdl> p $a
[3 4 6 3 2 3 5 6 1 7]
pdl> p $aa = pdl(0,1,2,3,4,5,6,7,8,9)
[0 1 2 3 4 5 6 7 8 9]
pdl> p $b = uniq $a
[1 2 3 4 5 6 7]
pdl> p $c = $a->(*1) == $b
[
[0 0 1 0 0 0 0]
[0 0 0 1 0 0 0]
[0 0 0 0 0 1 0]
[0 0 1 0 0 0 0]
[0 1 0 0 0 0 0]
[0 0 1 0 0 0 0]
[0 0 0 0 1 0 0]
[0 0 0 0 0 1 0]
[1 0 0 0 0 0 0]
[0 0 0 0 0 0 1]
]
but there is no whichover, which is return whole ndarray and I want index of occur value of $a Example for 3 in $a, it occur index 0, 3, 5 so I get 0, 3, 5 of $aa
If I try rle method
pdl> p $a->qsort->rle
[1 1 3 1 1 2 1] [1 2 3 4 5 6 7]
It's return how many time, not index
If I try like this
pdl> map { print which $a == $_ } $b->list
[8][4][0 3 5][1][6][2 7][9]
I Can't figure out how store is value and $a is HUGE, so I don't think map with $b->list is good idea Any help?
Does the following answer your question:
Output: