# ?swap

Swaps a vector with another vector.

## Syntax

FORTRAN 77:

call sswap(n, x, incx, y, incy )

call dswap(n, x, incx, y, incy )

call cswap(n, x, incx, y, incy )

call zswap(n, x, incx, y, incy )

Fortran 95:

call swap(x, y)

## Description

Given two vectors x and y, the ?swap routines return vectors y and x swapped, each replacing the other.

## Input Parameters

n

  INTEGER. Specifies the number of elements in vectors x and y.

x

  REAL for sswap

  DOUBLE PRECISION for dswap

  COMPLEX for cswap

  DOUBLE COMPLEX for zswap

  Array, DIMENSION at least `(1 + (n-1)*abs(incx))`.

incx

  INTEGER. Specifies the increment for the elements of x.

y

  REAL for sswap

  DOUBLE PRECISION for dswap

  COMPLEX for cswap

  DOUBLE COMPLEX for zswap

  Array, DIMENSION at least `(1 + (n-1)*abs(incy))`.

incy

  INTEGER. Specifies the increment for the elements of y.

## Output Parameters

x

  Contains the resultant vector x, that is, the input vector y.

y

  Contains the resultant vector y, that is, the input vector x.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or reconstructible arguments, see Fortran 95 Interface Conventions.

Specific details for the routine swap interface are the following:

x

  Holds the vector of length(n).

y

  Holds the vector of length(n).

Parent topic: BLAS Level 1 Routines