in reply to Re^4: matching pdl elements
in thread matching pdl elements
Maximum is a good choice. Like summation, it folds over a dimension in a way that works like logical or. But the inequality is unnecessary. All non-zero values are true. which already handles this.which( maximum( ($a->dummy == $b) ) != 0)
Thats about as good as any solutions I could give you. You'll still need a comment, but its a little easier on the eyes.which( maximum( $a->dummy == $b ) )
They are no more understandable than your solution (once trimmed).# The one I basically handed you. Catches duplicates. $c = which( $a == $b->dummy ) % $a->dim(0); # Switching up the dims. Basically same as above. $c = which( $a->dummy == $b ) / $b->dim(0); # Using summation. Like yours, ignores duplicates. $c = which( sumover( $a->dummy == $b ) );
|
|---|