mymkl.c 1017 Bytes
Newer Older
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
#include <stdio.h>
#include <stdlib.h>
#include "mymkl.h"
/**********************************************/

void rcopy (int *n, double *x, int *incx, double *y, int *incy) {
  int i, dim = *n, ix = *incx, iy = *incy;
  double *px = x, *py = y;

  for (i=0; i<dim; i++) {
    *py = *px; px += ix; py += iy;
  }
}

void rscal (int *n, double *alpha, double *x, int *incx) {
  int i, dim = *n, ix = *incx;
  double *px = x, a = *alpha;

  for (i=0; i<dim; i++) {
    *px *= a; px += ix;
  }
}

void raxpy (int *n, double *alpha, double *x, int *incx, double *y, int *incy) {
  int i, dim = *n, ix = *incx, iy = *incy;
  double *px = x, *py = y, a = *alpha;

  for (i=0; i<dim; i++) {
    *py += *px * a; px += ix; py += iy;
  }
}

double rdot (int *n, double *x, int *incx, double *y, int *incy) {
  int i, dim = *n, ix = *incx, iy = *incy;
  double aux = 0.0, *px = x, *py = y;

  for (i=0; i<dim; i++) {
    aux += *py * *px; px += ix; py += iy;
  }

  return aux;
}

/**********************************************/