VEC_$SWAP Domain/OS VEC_$SWAP
NAME
vec_$swap - swap two single-precision vectors
SYNOPSIS (C)
#include <apollo/base.h>
#include <apollo/vec.h>
void vec_$swap(
float *vec1,
float *vec2,
long int &length)
SYNOPSIS (Pascal)
%include '/sys/ins/base.ins.pas';
%include '/sys/ins/vec.ins.pas';
procedure vec_$swap(
var vec1: univ vec_$real_vector;
var vec2: univ vec_$real_vector;
in length: integer32);
SYNOPSIS (FORTRAN)
%include '/sys/ins/base.ins.ftn'
%include '/sys/ins/vec.ins.ftn'
parameter (nvec = 10)
real vec1(nvec), vec2(nvec)
integer*4 length
call vec_$swap(vec1, vec2, length)
DESCRIPTION
Vec_$swap swaps length elements between the single-precision vectors vec1
and vec2.
In C, the resulting operation is
for (i = 0; i < length, ++i) {
temp = vec1[i];
vec1[i] = vec2[i];
vec2[i] = temp;
}
In Pascal, the resulting operation is
for i := 1 to length do
begin
temp := vec1[i];
vec1[i] := vec2[i];
vec2[i] := temp;
end
In FORTRAN, the resulting operation is
do 10 i = 1, length
temp = vec1(i)
vec1(i) = vec2(i)
vec2(i) = temp
10 continue
vec1 The vector to be swapped with vec2.
vec2 The vector to be swapped with vec1.
length
The number of elements to swap.
NOTES
When vec_$swap is used to operate on matrixes in C and Pascal, vec1 and
vec2 are row vectors; whereas in FORTRAN, they are column vectors.
SEE ALSO
vec_$dswap, vec_$iswap, vec_$iswap16, vec_$swap_i.