我要评分
获取效率
正确性
完整性
易理解

?rot

Perform rotation of points in the plane.

x and y are vectors that contain n elements, c is the cosine of the rotation angle, and s is the sine of the rotation angle.

Interface Definition

C interface:

void cblas_srot(const BLASINT N, float *X, const BLASINT incX, float *Y, const BLASINT incY, const float c, const float s);

void cblas_drot(const BLASINT N, double *X, const BLASINT incX, double *Y, const BLASINT incY, const double c, const double s);

void cblas_csrot(const BLASINT N, float *X, const BLASINT incX, float *Y, const BLASINT incY, const float c, const float s);

void cblas_zdrot(const BLASINT N, double *X, const BLASINT incX, double *Y, const BLASINT incY, const double c, const double s);

Fortran interface:

CALL SROT(N, SX, INCX, SY, INCY, SC, SS)

CALL DROT(N, SX, INCX, SY, INCY, SC, SS)

CALL CSROT(N, SX, INCX, SY, INCY, SC, SS)

CALL ZDROT(N, SX, INCX, SY, INCY, SC, SS)

Parameters

Parameter

Type

Description

Input/Output

N

Integer

Number of elements in vector X

Input

X

  • For srot, X is of single-precision floating-point type.
  • For drot, X is of double-precision floating-point type.
  • For csrot, X is of single-precision complex number type.
  • For zdrot, X is of double-precision complex number type.

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

Input/Output

incX

Integer

Increment for the elements of vector x

Input

Y

  • For srot, Y is of single-precision floating-point type.
  • For drot, Y is of double-precision floating-point type.
  • For csrot, Y is of single-precision complex number type.
  • For zdrot, Y is of double-precision complex number type.

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

Input/Output

incY

Integer

Increment for elements in vector Y

Input

c

  • For srot or csrot, c is of single-precision floating-point type.
  • For drot or zdrot, c is of double-precision floating-point type.

Cosine of the rotation angle.

Input

s

  • For srot or csrot, s is of single-precision floating-point type.
  • For drot or zdrot, s is of double-precision floating-point type.

Sine of the rotation angle.

Input

Dependencies

#include "kblas.h"

Examples

C interface:

    int n = 5, incx = 1, incy=1; 
    float c = 1, s = 1; 
    /* 
     * C = 1, S = 1 
     * Input X: 0.340188, -0.105617, 0.283099, 0.298440, 0.411647 
     * Input Y: -0.302449, -0.164777, 0.268230, -0.222225, 0.053970 
     **/ 
    float x[5] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647}; 
    float y[5] = {-0.302449, -0.164777, 0.268230, -0.222225, 0.053970}; 
 
    cblas_srot(n, x, incx, y, incy, c, s); 
    /* 
     * Output X: 0.037739, -0.270394, 0.551329, 0.076215, 0.465617 
     * Output Y: -0.642636, -0.059160, -0.014870, -0.520665, -0.357677 
     **/

Fortran interface:

      INTEGER :: N=5 
      INTEGER :: INCX=1 
      INTEGER :: INCY=1 
      REAL(4) :: C=1 
      REAL(4) :: S=1 
      REAL(4) :: X(5) 
      DATA X /0.340188, -0.105617, 0.283099, 0.298440, 0.411647/ 
      REAL(4) :: Y(5) 
      DATA Y /-0.302449, -0.164777, 0.268230, -0.222225, 0.053970/ 
      EXTERNAL SROT 
      CALL SROT(N, X, INCX, Y, INCY, C, S) 
 
*     Output X: 0.037739, -0.270394, 0.551329, 0.076215, 0.465617 
*     Output Y: -0.642636, -0.059160, -0.014870, -0.520665, -0.357677