saxpy.c
Go to the documentation of this file.
1 /* constant times a vector plus a vector.
2  uses unrolled loop for increments equal to one.
3  Ver.1.0, May,26,1988. */
4 
5 #include "arith.h"
6 
7 saxpy(n,sa,sx,isx,jsx,incx,sy,isy,jsy,incy)
8 int n,isx,jsx,incx,isy,jsy,incy;
9 REAL sa;
10 MATRIX sx,sy;
11 {
12  int i,m;
13 
14  if(n <= 0)
15  return;
16  if(sa == 0.0e0)
17  return;
18 
19  /* code for both increments equal to 1 */
20 
21  /* clean-up loop */
22 
23  m=n%4;
24  if(m != 0){
25  for(i=0; i<m; i++)
26  sy[isy+i][jsy] += sa*sx[isx+i][jsx];
27  if(n < 4)
28  return;
29  }
30 
31  for(i=m; i<n; i += 4){
32  sy[isy+i][jsy] += sa*sx[isx+i][jsx];
33  sy[isy+i+1][jsy] += sa*sx[isx+i+1][jsx];
34  sy[isy+i+2][jsy] += sa*sx[isx+i+2][jsx];
35  sy[isy+i+3][jsy] += sa*sx[isx+i+3][jsx];
36  }
37 }
38 
39 
40 
41 
arith.h
saxpy
saxpy(int n, REAL sa, MATRIX sx, int isx, int jsx, int incx, MATRIX sy, int isy, int jsy, int incy)
Definition: saxpy.c:7
REAL
double REAL
Definition: arith.h:25
MATRIX
VECTOR MATRIX[MAX]
Definition: arith.h:27
n
GLfloat n[6][3]
Definition: cube.c:15


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43