Fri Jan 29 1999

ARMRCALC

Subject: ARMRCALC24

Function: line_or(bits)      line_and(bits)


line_or(bits)

Purpose

Use the line_or function to summarize bit vector data over a specified columnar view. Recall that an ARMR data view of a given set of fields shows us only the unique combinations of the specified fields' values. Redundancies are not shown. Nevertheless, we do track the clones of each displayed line.

For each displayed line, line_or returns the union of a given bit-vector data field over the line's clones. The current function is very much like the line_sum, except that we are dealing here with a vector union rather that a numerical sum!

Example

For our example we continue with the example which was started in the previous document (set_bit example). In the previous example we derived single element bit vectors; i.e. the view we are about to use shows the following clones as a function of row:

      Row subsets for records with flag=x
      -------------------------------------------------
      input: row  bits clones        output: row  bits
             ---  -----------                ---  -----
             r1   01000                      r1   01010
                  00010                           01010

             r2   00100                      r2   00101
                  00001                           00101

             r3   01000                      r3   01000

             r4   00100                      r4   00101
                  00001                           00101

             r5   01000                      r5   01010
                  00010                           01010

The following calc code produces the outputs shown above:

      ;
      ;  form the patterns
      ;
      columns= row

      calc_start= flagX
         line_or(bits)
      calc_end=
      end=

Finally, we add an additional calc cycle in order to derive the grouping index which collects rows with like description combinations:

      ;
      ;       define group
      ;
      columns= bits

      calc_start= flagX
         group=prev(group)+1
      calc_end=
      end=

The above calc process is as follows:

      input: bits   row  clones  output: bits  group   row  clones
             -----  -----------          ----- -----   -----------
             00101  r2                   00101  1      r2
                    r4                                 r4

             01000  r3                   01000  2      r3

             01010  r1                   01010  3      r1
                    r5                                 r5

Note

The final calc produces the desired grouping as described in the previous document.

line_and(bits)

Purpose

Use the line_and function to summarize bit vector data over a specified columnar view.

The line_and is functionally identical to the line_or, except that we form the intersection rather than the union of the bit vectors.

Example

The current function was included in anticipation of future requirements. We do not show you a practical example. Instead we simply show you the result when a series of bit vectors are subjected to the line_and function:

      input bit vectors:        output bit vector:
      ------------------        ------------------
      010110101                 000100100
      000100101
      000101100