VEC_$DP_SP_I Domain/AEGIS VEC_$DP_SP_I
NAME
vec_$dp_sp_i - copy a vector from a double-precision matrix into a
single-precision matrix
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
void vec_$dp_sp_i(
double *dp_vec,
long int &inc1,
float *sp_vec,
long int &inc2,
long int &length)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
procedure vec_$dp_sp_i(
in dp_vec: univ vec_$double_vector;
in inc1: integer32;
in sp_vec: univ vec_$real_vector;
in inc2: integer32;
in length: integer32);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
real sp_vec(nvec)
double precision dp_vec(nvec)
integer*4 length, inc1, inc2
call vec_$dp_sp_i(dp_vec, inc1, sp_vec, inc2, length)
DESCRIPTION
Vec_$dp_sp_i copies elements from a double-precision array dp_vec
selected by inc1 to elements of a single-precision array sp_vec selected
by inc2.
Through appropriate choice of inc1 and inc2, a program can use
vec_$dp_sp_i to copy a vector from one matrix to another. To copy 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
dp_vec. To place the copy into 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 sp_vec.
In C, the resulting operation is
j = 0;
k = 0;
for (i = 0; i < length; ++i) {
sp_vec[i] = (float)dp_vec[i];
j += inc1;
k += inc2;
}
In Pascal, the resulting operation is
j := 1;
k := 1;
for i := 1 to length do
begin
sp_vec[i] := dp_vec[i];
j := j + inc1;
k := k + inc2;
end
In FORTRAN, the resulting operation is
j = 1
k = 1
do 10 i = 1, length
sp_vec(k) = sngl(dp_vec(j))
j = j + inc1
k = k + inc2
10 continue
dp_vec
The double-precision array to copy from.
inc1 An increment for the index of dp_vec that selects the elements to
copy from.
sp_vec
The single-precision array to copy to.
inc2 An increment for the index of sp_vec that selects the elements to
copy to.
length
The number of elements to copy from dp_vec to sp_vec.
NOTES
In C and Pascal, vec_$dp_sp_i copies a column vector; whereas in FORTRAN,
it copies a row vector.
SEE ALSO
vec_$dp_sp, vec_$sp_dp_i.