User Tools

Site Tools


jvs:cigal:manual:chapter3:max

CIGAL Reference Manual, Chapter 3 (Functions): MAX

MAX -- Find the maximum value in a variable, or between 2 variables

usage: result = max(varb)
or result = max(varb1,varb2)
or result = max(varb,0)

The function MAX returns the largest value of its arguments. The function can take 3 forms as indicated above:

  1) If there is only 1 argument, then MAX returns the largest value in that
     argument.
  2) If there are 2 arguments each having N elements (e.g., 2 arrays) then the
     result will also contain N elements. Each element's value is the maximum
     value of the 2 input elements in the corresponding position.
  3) If there are 2 arguments and the first has more than 1 element but the
     second has only 1 element (e.g., 0 -- a constant), then MAX finds the
     largest value in the first argument, but the returned value is the
     position of the maximum value (remembering that CIGAL considers the first
     element to be in position 0).  If there is more than 1 element with the
     maximum value, the position of the first is returned.

Examples:

    Assuming you have 2 arrays with values:
         A1:  {  40  20  30  20  10  55  10 }
         A2:  {  20  22  24  26  28  30  32 }
    Then:
           max(100,200)     -->         200
           max(a1)          -->         55
           max(a1,a2)       -->         { 40 22 30 26 28 55 32 }
           max(a1,0)        -->         5         (addresses start at 0)

See Also:
MIN(3), STATS(3)

CIGAL Home, CIGAL Manual, Functions List, Manual Help

jvs/cigal/manual/chapter3/max.txt · Last modified: 2023/02/23 18:43 (external edit)