dscal.c
Go to the documentation of this file.
00001 /* dscal.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 dscal_(integer *n, doublereal *da, doublereal *dx, 
00017         integer *incx)
00018 {
00019     /* System generated locals */
00020     integer i__1, i__2;
00021 
00022     /* Local variables */
00023     integer i__, m, mp1, nincx;
00024 
00025 /*     .. Scalar Arguments .. */
00026 /*     .. */
00027 /*     .. Array Arguments .. */
00028 /*     .. */
00029 
00030 /*  Purpose */
00031 /*  ======= */
00032 /* * */
00033 /*     scales a vector by a constant. */
00034 /*     uses unrolled loops for increment equal to one. */
00035 /*     jack dongarra, linpack, 3/11/78. */
00036 /*     modified 3/93 to return if incx .le. 0. */
00037 /*     modified 12/3/93, array(1) declarations changed to array(*) */
00038 
00039 
00040 /*     .. Local Scalars .. */
00041 /*     .. */
00042 /*     .. Intrinsic Functions .. */
00043 /*     .. */
00044     /* Parameter adjustments */
00045     --dx;
00046 
00047     /* Function Body */
00048     if (*n <= 0 || *incx <= 0) {
00049         return 0;
00050     }
00051     if (*incx == 1) {
00052         goto L20;
00053     }
00054 
00055 /*        code for increment not equal to 1 */
00056 
00057     nincx = *n * *incx;
00058     i__1 = nincx;
00059     i__2 = *incx;
00060     for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00061         dx[i__] = *da * dx[i__];
00062 /* L10: */
00063     }
00064     return 0;
00065 
00066 /*        code for increment equal to 1 */
00067 
00068 
00069 /*        clean-up loop */
00070 
00071 L20:
00072     m = *n % 5;
00073     if (m == 0) {
00074         goto L40;
00075     }
00076     i__2 = m;
00077     for (i__ = 1; i__ <= i__2; ++i__) {
00078         dx[i__] = *da * dx[i__];
00079 /* L30: */
00080     }
00081     if (*n < 5) {
00082         return 0;
00083     }
00084 L40:
00085     mp1 = m + 1;
00086     i__2 = *n;
00087     for (i__ = mp1; i__ <= i__2; i__ += 5) {
00088         dx[i__] = *da * dx[i__];
00089         dx[i__ + 1] = *da * dx[i__ + 1];
00090         dx[i__ + 2] = *da * dx[i__ + 2];
00091         dx[i__ + 3] = *da * dx[i__ + 3];
00092         dx[i__ + 4] = *da * dx[i__ + 4];
00093 /* L50: */
00094     }
00095     return 0;
00096 } /* dscal_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:48