VEC_$ADD_CONSTANT Domain/OS VEC_$ADD_CONSTANT
NAME
vec_$add_constant - add a scalar to a single-precision vector
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
void vec_$add_constant(
float *start_vec,
long int &length,
float &constant,
float *result_vec)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
procedure vec_$add_constant(
in start_vec: univ vec_$real_vector;
in length: integer32;
in constant: real;
out result_vec: univ vec_$real_vector);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 256)
real start_vec(nvec), result_vec(nvec), constant
integer*4 length
call vec_$add_constant(start_vec, length, constant, result_vec)
DESCRIPTION
Vec_$add_constant adds the scalar constant to the single-precision vector
start_vec, and supplies the result in result_vec.
In C, the resulting operation is
for (i = 0; i < length; ++i)
result_vec[i] = constant + start_vec[i];
In Pascal, the resulting operation is
for i := 1 to length do
begin
result_vec[i] := constant + start_vec[i];
end
In FORTRAN, the resulting operation is
do 10 i = 1, length
result_vec(i) = constant + start_vec(i)
10 continue
start_vec
The operand vector that constant will be added to.
length
The number of elements in start_vec that constant will be added to.
constant
A scalar constant to be added to start_vec.
result_vec
The vector resulting from adding constant to start_vec.
NOTES
When vec_$add_constant is used to operate on matrixes in C and Pascal,
start_vec and result_vec are row vectors; whereas in FORTRAN, they are
column vectors.
SEE ALSO
vec_$add_constant_i, vec_$dadd_constant, vec_$iadd_constant,
vec_$iadd_constant16.