User Tools

Site Tools


jvs:cigal:manual:chapter3:min

CIGAL Reference Manual, Chapter 3 (Functions): MIN

MIN -- Find the minimum value in a variable, or between 2 variables

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

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

  1) If there is only 1 argument, then MIN returns the smallest 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; the value of each element is
     the minimum 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 MIN finds the
     smallest value in the first argument, but the returned value is the
     POSITION of the minimum value (remembering that CIGAL considers the first
     element to be in position 0).  If there is more than 1 element with the
     minimum 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:
           min(100,200)     -->         100
           min(a1)          -->         10
           min(a1,a2)       -->         { 20 20 24 20 10 30 10 }
           min(a1,0)        -->         4         (addresses start at 0)

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

CIGAL Home, CIGAL Manual, Functions List, Manual Help

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