sscal.c
Go to the documentation of this file.
00001 /* scales a vector by a constant.
00002    uses unrolled loops for increment equal to 1
00003    Ver.1.0, May,26,1988.                       */
00004 
00005 #include "arith.h"
00006 
00007 sscal(n,sa,sx,isx,jsx,incx)
00008 int n,isx,jsx,incx;
00009 REAL sa;
00010 MATRIX sx;
00011 {
00012     int i,m,nincx;
00013 
00014     if(n <= 0)
00015         return;
00016 
00017     if(incx != 1){
00018 
00019         /* code for increment not equal to 1 */
00020 
00021         nincx= n*incx;
00022         for(i=0; i<nincx; i += incx)
00023             sx[isx+i][jsx]= sa*sx[isx+i][jsx];
00024     }
00025 
00026     else{
00027 
00028         /* code for increment equal to 1 */
00029 
00030         /* clean-up loop */
00031 
00032         m=n%5;
00033         if(m != 0){
00034             for(i=0; i<m; i++)
00035                 sx[isx+i][jsx]= sa*sx[isx+i][jsx];
00036             if(n < 5)
00037                 return;
00038         }
00039 
00040         for(i=m; i<n; i += 5){
00041             sx[isx+i][jsx] = sa*sx[isx+i][jsx];
00042             sx[isx+i+1][jsx] = sa*sx[isx+i+1][jsx];
00043             sx[isx+i+2][jsx] = sa*sx[isx+i+2][jsx];
00044             sx[isx+i+3][jsx] = sa*sx[isx+i+3][jsx];
00045             sx[isx+i+4][jsx] = sa*sx[isx+i+4][jsx];
00046         }
00047     }
00048 }


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 6 2019 18:05:53