Rate This Document
Findability
Accuracy
Completeness
Readability

?copy

Copy a vector.

That is, . x is the source vector, and y is the target vector.

Interface Definition

C interface:

void cblas_scopy(const BLASINT n, const float *x, const BLASINT incx, float *y, const BLASINT incy);

void cblas_dcopy(const BLASINT n, const double *x, const BLASINT incx, double *y, const BLASINT incy);

void cblas_ccopy(const BLASINT n, const void *x, const BLASINT incx, void *y, const BLASINT incy);

void cblas_zcopy(const BLASINT n, const void *x, const BLASINT incx, void *y, const BLASINT incy);

Fortran interface:

CALL SCOPY(N, X, INCX, Y, INCY)

CALL DCOPY(N, X, INCX, Y, INCY)

CALL CCOPY(N, X, INCX, Y, INCY)

CALL ZCOPY(N, X, INCX, Y, INCY)

Parameters

Parameter

Type

Description

Input/Output

n

Integer

Number of elements in vectors x and y.

Input

x

  • Single-precision floating-point type for scopy
  • Double-precision floating-point type for dcopy
  • Single-precision complex type for ccopy
  • Double-precision complex type for zcopy

Vector x. The vector size is at least (1+(n-1)*abs(incx)).

Input

incx

Integer

Increment for the elements of vector x.

Input

y

  • Single-precision floating-point type for scopy
  • Double-precision floating-point type for dcopy
  • Single-precision complex type for ccopy
  • Double-precision complex type for zcopy

Vector y. The vector size is at least (1+(n-1)*abs(incy)).

Output

incy

Integer

Increment for the elements of vector y.

Input

Dependency

#include "kblas.h"

Examples

C interface:

    double y[5]; 
    int n = 5, incx = 1, incy = 1; 
    /* 
     *   x: 1, 2, 3, 4, 5 
     */ 
    double x[5] = {1, 2, 3, 4, 5}; 
 
    cblas_dcopy(n, x, incx, y, incy); 
    /* 
     * Output  y: 1, 2, 3, 4, 5 
     */

Fortran interface:

      REAL(8) :: Y(5) 
      INTEGER :: N=5 
      INTEGER :: INCX=1 
      INTEGER :: INCY=1 
      REAL(8) :: X(5) 
      DATA X /1, 2, 3, 4, 5/ 
      CALL DCOPY(N, X, INCX, Y, INCY) 
 
*     Output Y : 1, 2, 3, 4, 5