Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

VEC_$ADD_CONSTANT_I               Domain/OS                VEC_$ADD_CONSTANT_I


NAME
     vec_$add_constant_i - add a scalar to a vector in a single-precision
     matrix

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

     void vec_$add_constant_i(
          float *start_vec,
          long int &inc1,
          long int &length,
          float &constant,
          float *result_vec,
          long int &inc2)

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

     procedure vec_$add_constant_i(
          in start_vec: univ vec_$real_vector;
          in inc1: integer32;
          in length: integer32;
          in constant: real;
          out result_vec: univ vec_$real_vector;
          in inc2: integer32);

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

           parameter (nvec = 10)

           real start_vec(nvec), result_vec(nvec), constant
           integer*4 length, inc1, inc2

           call vec_$add_constant_i(start_vec, inc1, length,
          &                         constant, result_vec, inc2)

DESCRIPTION
     Vec_$add_constant_i adds the scalar constant to elements of the single-
     precision array start_vec selected by inc1, and puts the sums in elements
     of the array result_vec selected by inc2.

     Through appropriate choice of inc1 and inc2, a program can use
     vec_$add_constant_i to operate on individual vectors in a matrix.  To add
     constant to the Mth vector in a matrix, choose inc1 equal to the number
     of vectors in the matrix, and place the Mth element of the matrix array
     at the beginning of start_vec.  To place the result of the operation in
     the Nth vector of a matrix, choose inc2 equal to the number of vectors in
     the resultant matrix, and place the Nth element of the matrix array at
     the beginning of result_vec.

     In C, the resulting operation is

          j = 0;
          k = 0;
          for (i = 0; i < length; ++i) {
               result_vec[k] = constant + start_vec[j];
               k += inc2;
               j += inc1;
          }

     In Pascal, the resulting operation is

          j := 1;
          k := 1;
          for i := 1 to length do
               begin
               result_vec[k] := constant + start_vec[j];
               k := k + inc2;
               j := j + inc1;
               end

     In FORTRAN, the resulting operation is

           j = 1
           k = 1
           do 10 i = 1, length
               result_vec(k) = constant + start_vec(j)
               k = k + inc2
               j = j + inc1
       10 continue

     start_vec
          The operand array whose elements will be summed with constant.

     inc1 Increment for the index of start_vec used to select the elements of
          start_vec that will be summed with constant.

     length
          The number of elements in start_vec that constant will be added to.

     constant
          The scalar value to be summed with elements of start_vec.

     result_vec
          The array resulting from summing constant with elements of
          start_vec.

     inc2 Increment for the index of result_vec used to select the elements of
          result_vec that will receive the sums of constant with the elements
          of start_vec selected by inc1.

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

SEE ALSO
     vec_$add_constant, vec_$dadd_constant_i, vec_$iadd_constant_i,
     vec_$iadd_constant16_i.

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