Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

VEC_$MAX                          Domain/OS                           VEC_$MAX


NAME
     vec_$max - find the maximum absolute value in a single-precision vector

SYNOPSIS (C)
     #include <apollo/base.h>
     #include <apollo/vec.h>

     void vec_$max(
          float *vector,
          long int &length,
          float *result,
          long int *location)

SYNOPSIS (Pascal)
     %include '/sys/ins/base.ins.pas';
     %include '/sys/ins/vec.ins.pas';

     procedure vec_$max(
          in vector: univ vec_$real_vector;
          in length: integer32;
          out result: real;
          out location: integer32);

SYNOPSIS (FORTRAN)
     %include '/sys/ins/base.ins.ftn'
     %include '/sys/ins/vec.ins.ftn'

           parameter (nvec = 10)

           real vector(nvec), result
           integer*4 length, location

           call vec_$max(vector, length, result, location)

DESCRIPTION
     Vec_$max searches through length elements of vector, and supplies the
     value and location of the element with the greatest absolute value.

     As of SR10.3, this routine is obsolete; use vec_$rmax or vec_$amax
     instead.

     In C, the resulting operation is

          result = (float)fabs(vector[0]);
          location = 1;
          for (i = 1; i < length; ++i)
               if ((float)fabs(vector[i]) > result) {
                    location = i + 1;
                    result = (float)fabs(vector[i]);
               }

     In Pascal, the resulting operation is

          result := abs(vector[1]);
          location = 1;
          for 10 i := 2 to length do
               if (abs(vector[i]) > result) then
                    begin
                    location := i;
                    result := abs(vector[i]);
                    end

     In FORTRAN, the resulting operation is

           result = abs(vector(1))
           location = 1
           do 10 i = 2, length
               if (abs(vector(i)) .gt. result) then
                    location = i
                    result = abs(vector(i))
               endif
       10  continue

     vector
          The vector to search.

     length
          The number of elements to search.

     result
          The maximum absolute value of all the elements searched.

     location
          The location of the element with the greatest absolute value.  The
          location supplied in location is just the index of the element with
          the greatest absolute value in FORTRAN or Pascal (if vector is
          declared to begin with index 1).  In C, location - 1 is the index of
          the element.

NOTES
     This call is obsolete; use vec_$rmax or vec_$amax.

     In C and Pascal, vec_$max searches a row vector; in FORTRAN, it searches
     a column vector.

SEE ALSO
     vec_$rmax, vec_$amax, vec_$dmax, vec_$imax, vec_$imax16, vec_$max_i.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026