#340 orover of byte data returns long type

critical
open
nobody
None
3
2013-10-06
2013-09-01
Chris Marshall
No

It appears that the current implementation of orover takes any input and then outputs a result piddle of at least int type. However, this is arguably not needed for the integer data types. This same "feature" is seen with borover which clearly has no need to be promoted to a 4X bigger integer data type:

pdl> $b01 = $b01->byte

pdl> p info($p01->mv(1,0) == $bird(*1))
Loading info.pdl ...Runtime error: PDL AutoLoader: Undefined subroutine info() cannot be autoloaded.
No file `info.pdl' was found in your @PDLLIB path.

pdl> p +($p01->mv(1,0) == $bird(*1))->info
PDL: Byte D [12,190455]

pdl> p +($p01->mv(1,0) == $bird(*1))->orover->info
PDL: Long D [190455]

pdl> $bin = sequence(byte,4)

pdl> p $bin->info
PDL: Byte D [4]

pdl> p $bin->orover->info
PDL: Long D []

pdl> p $bin->borover->info
PDL: Long D []

Discussion

  • Chris Marshall
    Chris Marshall
    2013-10-06

    • Priority: 5 --> 3
     
  • Chris Marshall
    Chris Marshall
    2013-10-06

    Clear and clean type handling should be one of the main goals
    of PDL3. Surprising type promotions should be avoided where
    possible. One possibility here is to investigate what a PDL
    logical type is. Should there be a standard underlying type rather
    (or in addition to) the 0/not-0 one. E.g., bit vectors could provide
    compact and possibly computationally efficient options for mask
    generation and use.