First commit
This commit is contained in:
52
liblinear-2.49/blas/dscal.c
Normal file
52
liblinear-2.49/blas/dscal.c
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "blas.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int dscal_(int *n, double *sa, double *sx, int *incx)
|
||||
{
|
||||
long int i, m, nincx, nn, iincx;
|
||||
double ssa;
|
||||
|
||||
/* scales a vector by a constant.
|
||||
uses unrolled loops for increment equal to 1.
|
||||
jack dongarra, linpack, 3/11/78.
|
||||
modified 3/93 to return if incx .le. 0.
|
||||
modified 12/3/93, array(1) declarations changed to array(*) */
|
||||
|
||||
/* Dereference inputs */
|
||||
nn = *n;
|
||||
iincx = *incx;
|
||||
ssa = *sa;
|
||||
|
||||
if (nn > 0 && iincx > 0)
|
||||
{
|
||||
if (iincx == 1) /* code for increment equal to 1 */
|
||||
{
|
||||
m = nn-4;
|
||||
for (i = 0; i < m; i += 5)
|
||||
{
|
||||
sx[i] = ssa * sx[i];
|
||||
sx[i+1] = ssa * sx[i+1];
|
||||
sx[i+2] = ssa * sx[i+2];
|
||||
sx[i+3] = ssa * sx[i+3];
|
||||
sx[i+4] = ssa * sx[i+4];
|
||||
}
|
||||
for ( ; i < nn; ++i) /* clean-up loop */
|
||||
sx[i] = ssa * sx[i];
|
||||
}
|
||||
else /* code for increment not equal to 1 */
|
||||
{
|
||||
nincx = nn * iincx;
|
||||
for (i = 0; i < nincx; i += iincx)
|
||||
sx[i] = ssa * sx[i];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* dscal_ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user