sscal.c
Go to the documentation of this file.
00001 /* sscal.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int sscal_(integer *n, real *sa, real *sx, integer *incx)
00017 {
00018     /* System generated locals */
00019     integer i__1, i__2;
00020 
00021     /* Local variables */
00022     integer i__, m, mp1, nincx;
00023 
00024 /*     .. Scalar Arguments .. */
00025 /*     .. */
00026 /*     .. Array Arguments .. */
00027 /*     .. */
00028 
00029 /*  Purpose */
00030 /*  ======= */
00031 
00032 /*     scales a vector by a constant. */
00033 /*     uses unrolled loops for increment equal to 1. */
00034 /*     jack dongarra, linpack, 3/11/78. */
00035 /*     modified 3/93 to return if incx .le. 0. */
00036 /*     modified 12/3/93, array(1) declarations changed to array(*) */
00037 
00038 
00039 /*     .. Local Scalars .. */
00040 /*     .. */
00041 /*     .. Intrinsic Functions .. */
00042 /*     .. */
00043     /* Parameter adjustments */
00044     --sx;
00045 
00046     /* Function Body */
00047     if (*n <= 0 || *incx <= 0) {
00048         return 0;
00049     }
00050     if (*incx == 1) {
00051         goto L20;
00052     }
00053 
00054 /*        code for increment not equal to 1 */
00055 
00056     nincx = *n * *incx;
00057     i__1 = nincx;
00058     i__2 = *incx;
00059     for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00060         sx[i__] = *sa * sx[i__];
00061 /* L10: */
00062     }
00063     return 0;
00064 
00065 /*        code for increment equal to 1 */
00066 
00067 
00068 /*        clean-up loop */
00069 
00070 L20:
00071     m = *n % 5;
00072     if (m == 0) {
00073         goto L40;
00074     }
00075     i__2 = m;
00076     for (i__ = 1; i__ <= i__2; ++i__) {
00077         sx[i__] = *sa * sx[i__];
00078 /* L30: */
00079     }
00080     if (*n < 5) {
00081         return 0;
00082     }
00083 L40:
00084     mp1 = m + 1;
00085     i__2 = *n;
00086     for (i__ = mp1; i__ <= i__2; i__ += 5) {
00087         sx[i__] = *sa * sx[i__];
00088         sx[i__ + 1] = *sa * sx[i__ + 1];
00089         sx[i__ + 2] = *sa * sx[i__ + 2];
00090         sx[i__ + 3] = *sa * sx[i__ + 3];
00091         sx[i__ + 4] = *sa * sx[i__ + 4];
00092 /* L50: */
00093     }
00094     return 0;
00095 } /* sscal_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:13