1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
#include <ulmblas.h>

void
ULMBLAS(drot)(const int      n,
              double         *x,
              const int      incX,
              double         *y,
              const int      incY,
              const double   c,
              const double   s)
{
//
//  Local scalars
//
    int    i;
    double tmp;

//
//  Quick return if possible
//
    if (n==0) {
        return;
    }
    if (incX==1 && incY==1) {
//
//      Code for both increments equal to 1
//
        for (i=0; i<n; ++i) {
            tmp  = c*x[i] + s*y[i];
            y[i] = c*y[i] - s*x[i];
            x[i] = tmp;
        }
    } else {
//
//      Code for unequal increments or equal increments not equal to 1
//
        if (incX<0) {
            x -= incX*(n-1);
        }
        if (incY<0) {
            y -= incY*(n-1);
        }
        for (i=0; i<n; ++i, x+=incX, y+=incY) {
            tmp  = c*(*x) + s*(*y);
            (*y) = c*(*y) - s*(*x);
            (*x) = tmp;
        }
    }
}

void
F77BLAS(drot)(const int      *_n,
              double         *x,
              const int      *_incX,
              double         *y,
              const int      *_incY,
              const double   *_c,
              const double   *_s)
{
//
//  Dereference scalar parameters
//
    int n    = *_n;
    int incX = *_incX;
    int incY = *_incY;
    double c = *_c;
    double s = *_s;

    ULMBLAS(drot)(n, x, incX, y, incY, c, s);
}