VEC_$DSWAP_I Domain/OS VEC_$DSWAP_I
NAME
vec_$dswap_i - swap two vectors in a double-precision matrix
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
void vec_$dswap_i(
double *vec1,
long int &inc1,
double *vec2,
long int &inc2,
long int &length)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
procedure vec_$dswap_i(
var vec1: univ vec_$double_vector;
in inc1: integer32;
var vec1: univ vec_$double_vector;
in inc2: integer32;
in length: integer32);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
double precision vec1(nvec), vec2(nvec)
integer*4 length, inc1, inc2
call vec_$dswap_i(vec1, inc1, vec2, inc2, length)
DESCRIPTION
Vec_$dswap_i swaps the length elements of vec1 selected by inc1 with the
length elements of vec2 selected by inc2.
Through appropriate choice of inc1 and inc2, a program can use
vec_$dswap_i to swap vectors between two matrixes. To select 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
vec1. To swap the selected vector with the Nth vector of the same or
another matrix, choose inc2 equal to the number of vectors in the same or
other matrix, and place the Nth element of the matrix array at the begin-
ning of vec2.
In C, the resulting operation is
j = 0;
k = 0;
for (i = 0; i < length, ++i) {
temp = vec1[i];
vec1[i] = vec2[i];
vec2[i] = temp;
j += inc1;
k += inc2;
}
In Pascal, the resulting operation is
j := 1;
k := 1;
for i := 1 to length do
begin
temp := vec1[i];
vec1[i] := vec2[i];
vec2[i] := temp;
j := j + inc1;
k := k + inc2;
end
In FORTRAN, the resulting operation is
j = 1
k = 1
do 10 i = 1, length
temp = vec1(j)
vec1(j) = vec2(k)
vec2(k) = temp
j = j + inc1
k = k + inc2
10 continue
vec1 The vector to be swapped with vec2.
inc1 The increment for the index of vec1 that selects the elements to be
swapped with vec2.
vec2 The vector to be swapped with vec1.
inc2 The increment for the index of vec2 that selects the elements to be
swapped with vec1.
length
The number of elements to swap.
NOTES
In C and Pascal, vec_$dswap_i swaps column vectors; whereas in FORTRAN,
it swaps row vectors.
SEE ALSO
vec_$dswap, vec_$iswap16_i, vec_$iswap_i, vec_$swap_i.