VEC_$DMULT_CONSTANT_I Domain/OS VEC_$DMULT_CONSTANT_I
NAME
vec_$dmult_constant_i - multiply a vector in a double-precision matrix by
a scalar
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
void vec_$dmult_constant_i(
double *mult_vec,
long int &inc1,
long int &length,
double &constant,
double *result_vec,
long int &inc2)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
procedure vec_$dmult_constant_i(
in mult_vec: univ vec_$double_vector;
in inc1: integer32;
in length: integer32;
in constant: double;
out result_vec: univ vec_$double_vector;
in inc2: integer32);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
double precision mult_vec(nvec), result_vec(nvec), constant
integer*4 length, inc1, inc2
call vec_$dmult_constant_i(mult_vec, inc1, length, constant,
& result_vec, inc2)
DESCRIPTION
Vec_$dmult_constant_i multiplies length elements of the double-precision
array mult_vec selected by inc1 by the scalar value constant, and sup-
plies the result in elements of the array result_vec selected by inc2.
Through appropriate choice of inc1 and inc2, a program can use
vec_$dmult_constant_i to operate on a vector in a matrix. To multiply
Mth vector in a matrix by constant, choose inc1 equal to the number of
vectors in the matrix, and place the Mth element of the matrix array at
the beginning of mult_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 * mult_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 * mult_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(j) = constant * mult_vec(k)
j = j + inc2
k = k + inc1
10 continue
mult_vec
The vector to multiply by constant.
inc1 An increment for the index of the array mult_vec that selects ele-
ments to multiply by constant.
length
The number of products to calculate.
constant
The scalar constant to multiply elements of mult_vec by.
result_vec
An array whose elements receive the product of constant and
mult_vec.
inc2 An increment for the index of the array result_vec that selects ele-
ments to receive the product of constant and mult_vec.
NOTES
In C and Pascal, vec_$dmult_constant_i operates on column vectors;
whereas in FORTRAN, it operates on row vectors.
SEE ALSO
vec_$dmult_constant, vec_$imult_constant16_i, vec_$imult_constant_i,
vec_$mult_constant_i.