Evanovich has asked for the wisdom of the Perl Monks concerning the following question:

Hello again. I was wondering if someone might help me with another PDL question. I want to take an inner product between two piddles, but I want to omit indices that contain a null tag (I currently use "999") in my product. In other words, I want an inner product that excludes any index if one of the two entries of that index is 999. Is there an elegant PDL way to do this, or do I need to pass the arrays into C?

Replies are listed 'Best First'.
Re: PDL encore
by Zaxo (Archbishop) on Apr 01, 2003 at 06:45 UTC

    Yes, use zero instead of 999. That's math :)

    After Compline,
    Zaxo

      Setting "bad" values to 0 is mathematically valid for this situation. A more PDL-ish approach however is to use "bad values"; doing $pdl->badvalue(999) would achieve the aim here.