sscal.c
Go to the documentation of this file.
1 /* scales a vector by a constant.
2  uses unrolled loops for increment equal to 1
3  Ver.1.0, May,26,1988. */
4 
5 #include "arith.h"
6 
7 sscal(n,sa,sx,isx,jsx,incx)
8 int n,isx,jsx,incx;
9 REAL sa;
10 MATRIX sx;
11 {
12  int i,m,nincx;
13 
14  if(n <= 0)
15  return;
16 
17  if(incx != 1){
18 
19  /* code for increment not equal to 1 */
20 
21  nincx= n*incx;
22  for(i=0; i<nincx; i += incx)
23  sx[isx+i][jsx]= sa*sx[isx+i][jsx];
24  }
25 
26  else{
27 
28  /* code for increment equal to 1 */
29 
30  /* clean-up loop */
31 
32  m=n%5;
33  if(m != 0){
34  for(i=0; i<m; i++)
35  sx[isx+i][jsx]= sa*sx[isx+i][jsx];
36  if(n < 5)
37  return;
38  }
39 
40  for(i=m; i<n; i += 5){
41  sx[isx+i][jsx] = sa*sx[isx+i][jsx];
42  sx[isx+i+1][jsx] = sa*sx[isx+i+1][jsx];
43  sx[isx+i+2][jsx] = sa*sx[isx+i+2][jsx];
44  sx[isx+i+3][jsx] = sa*sx[isx+i+3][jsx];
45  sx[isx+i+4][jsx] = sa*sx[isx+i+4][jsx];
46  }
47  }
48 }
GLfloat n[6][3]
Definition: cube.c:15
double REAL
Definition: arith.h:25
sscal(int n, REAL sa, MATRIX sx, int isx, int jsx, int incx)
Definition: sscal.c:7
VECTOR MATRIX[MAX]
Definition: arith.h:27


euslisp
Author(s): Toshihiro Matsui
autogenerated on Fri Feb 21 2020 03:20:54