HP Forums
(49g 50g) WEIGH Transform - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (49g 50g) WEIGH Transform (/thread-14044.html)



(49g 50g) WEIGH Transform - John Keith - 11-24-2019 10:12 PM

This program computes the WEIGH transform of a sequence of integers. Some information here.

The program requires the ListExt Library and must be run in exact mode.

Code:

\<< 1 OVER HEAD 2. \->LIST OVER SIZE R\->I \-> a n
  \<< DUP HEAD SWAP 2 n
    FOR k k DIVIS DUP2 LPICK OVER * SWAP REV 1.
      \<< I\->R 2. MOD { 1 } { -1 } IFTE
      \>> DOLIST * LSUM SWAP
    NEXT DROP n \->LIST a 2 n
    FOR j OVER 1 j SUB OVER REV * LSUM j / +
    NEXT NIP
  \>>
\>>



RE: (49g 50g) WEIGH Transform - John Keith - 01-21-2020 07:00 PM

Program in first post has been replaced with a new version which is substantially faster. It now runs at a speed comparable to other transforms. Please delete and replace the older version.