Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

VEC_$IMULT_ADD_I                  Domain/OS                   VEC_$IMULT_ADD_I


NAME
     vec_$imult_add_i - scale and add 32-bit vectors in matrixes

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

     void vec_$imult_add_i(
          long *add_vec,
          long int &inc1,
          long *mult_vec,
          long int &inc2,
          long int &length,
          long &constant,
          long *result_vec,
          long int &inc3)

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

     procedure vec_$imult_add_i(
          in add_vec: univ vec_$integer32_vector;
          in inc1: integer32;
          in mult_vec: univ vec_$integer32_vector;
          in inc2: integer32;
          in length: integer32;
          in constant: integer32;
          out result_vec: univ vec_$integer32_vector;
          in inc3: integer32);

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

           parameter (nvec = 10)

           integer*4 add_vec(nvec), mult_vec(nvec), result_vec(nvec), constant
           integer*4 length, inc1, inc2, inc3

           call vec_$imult_add_i(add_vec, inc1, mult_vec, inc2, length,
          &                      constant, result_vec, inc3)

DESCRIPTION
     Vec_$imult_add_i multiplies length elements of mult_vec selected by inc2
     by the scalar constant, adds the resulting products to elements of
     add_vec selected by inc1, and supplies the results in elements of
     result_vec selected by inc3.

     Through appropriate choice of inc1, inc2, and inc3, a program can use
     vec_$imult_add_i to scale and sum individual vectors in two matrixes and
     place the result in a vector of another matrix.  To scale and add the Nth
     vector in matrix Y to the Mth vector in matrix X, choose inc2 equal to
     the number of vectors in matrix Y and inc1 equal to the number of vectors
     in matrix X.  Then place the Mth element of matrix X at the beginning of
     add_vec, and place the Nth element of matrix Y at the beginning of
     mult_vec.  To place the result of the operation in the Pth vector of a
     resultant matrix, choose inc3 equal to the number of vectors in the
     resultant matrix, and place the Pth element of the matrix array at the
     beginning of result_vec.

     In C, the resulting operation is

          j = 0;
          k = 0;
          l = 0;
          for (i = 0; i< length; ++i) {
               result_vec[l] = add_vec[j]
                             + constant * mult_vec[k];
               j += inc1;
               k += inc2;
               l += inc3;
          }

     In Pascal, the resulting operation is

          j := 1;
          k := 1;
          l := 1;
          for i := 1 to length do
               begin
               result_vec[l] := add_vec[j]
                             + constant * mult_vec[k];
               j := j + inc1;
               k := k + inc2;
               l := l + inc3;
               end

     In FORTRAN, the resulting operation is

           j = 1
           k = 1
           l = 1
           do 10 i = 1, length
               result(l) = add_vec(j)
          &              + constant * mult_vec(k)
               j = j + inc1
               k = k + inc2
               l = l + inc3
       10  continue

     add_vec
          The vector to add to the product of mult_vec and constant.

     inc1 An increment for the index of add_vec that selects the elements to
          add to the product of mult_vec and constant.

     mult_vec
          The vector to scale by constant and add to add_vec.

     inc2 An increment for the index of mult_vec that selects the elements to
          multiply by constant and add to add_vec.

     length
          The number of elements to use in the calculation.

     constant
          The scalar value used to scale mult_vec.

     result_vec
          The vector resulting from multiplying mult_vec by constant and
          adding the product to add_vec.

     inc3 An increment for the index of result_vec that selects the elements
          to receive the results of multiplying mult_vec by constant and
          adding the product to add_vec.

NOTES
     In C and Pascal, vec_$imult_add_i operates on column vectors; whereas in
     FORTRAN, it operates on row vectors.

SEE ALSO
     vec_$dmult_add_i, vec_$imult_add, vec_$imult_add16_i, vec_$mult_add_i.

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