~ubuntu-branches/ubuntu/lucid/igraph/lucid

« back to all changes in this revision

Viewing changes to src/blas/ddot.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Malaterre
  • Date: 2009-11-16 18:12:42 UTC
  • Revision ID: james.westby@ubuntu.com-20091116181242-mzv9p5fz9uj57xd1
Tags: upstream-0.5.3
ImportĀ upstreamĀ versionĀ 0.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  -- translated by f2c (version 20050501).
 
2
   You must link the resulting object file with libf2c:
 
3
        on Microsoft Windows system, link with libf2c.lib;
 
4
        on Linux or Unix systems, link with .../path/to/libf2c.a -lm
 
5
        or, if you install libf2c.a in a standard place, with -lf2c -lm
 
6
        -- in that order, at the end of the command line, as in
 
7
                cc *.o -lf2c -lm
 
8
        Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
 
9
 
 
10
                http://www.netlib.org/f2c/libf2c.zip
 
11
*/
 
12
 
 
13
#include "config.h"
 
14
#include "arpack_internal.h"
 
15
#include "f2c.h"
 
16
 
 
17
doublereal igraphddot_(integer *n, doublereal *dx, integer *incx, doublereal *dy, 
 
18
        integer *incy)
 
19
{
 
20
    /* System generated locals */
 
21
    integer i__1;
 
22
    doublereal ret_val;
 
23
 
 
24
    /* Local variables */
 
25
    static integer i__, m, ix, iy, mp1;
 
26
    static doublereal dtemp;
 
27
 
 
28
 
 
29
/*     forms the dot product of two vectors. */
 
30
/*     uses unrolled loops for increments equal to one. */
 
31
/*     jack dongarra, linpack, 3/11/78. */
 
32
/*     modified 12/3/93, array(1) declarations changed to array(*) */
 
33
 
 
34
 
 
35
    /* Parameter adjustments */
 
36
    --dy;
 
37
    --dx;
 
38
 
 
39
    /* Function Body */
 
40
    ret_val = 0.;
 
41
    dtemp = 0.;
 
42
    if (*n <= 0) {
 
43
        return ret_val;
 
44
    }
 
45
    if (*incx == 1 && *incy == 1) {
 
46
        goto L20;
 
47
    }
 
48
 
 
49
/*        code for unequal increments or equal increments */
 
50
/*          not equal to 1 */
 
51
 
 
52
    ix = 1;
 
53
    iy = 1;
 
54
    if (*incx < 0) {
 
55
        ix = (-(*n) + 1) * *incx + 1;
 
56
    }
 
57
    if (*incy < 0) {
 
58
        iy = (-(*n) + 1) * *incy + 1;
 
59
    }
 
60
    i__1 = *n;
 
61
    for (i__ = 1; i__ <= i__1; ++i__) {
 
62
        dtemp += dx[ix] * dy[iy];
 
63
        ix += *incx;
 
64
        iy += *incy;
 
65
/* L10: */
 
66
    }
 
67
    ret_val = dtemp;
 
68
    return ret_val;
 
69
 
 
70
/*        code for both increments equal to 1 */
 
71
 
 
72
 
 
73
/*        clean-up loop */
 
74
 
 
75
L20:
 
76
    m = *n % 5;
 
77
    if (m == 0) {
 
78
        goto L40;
 
79
    }
 
80
    i__1 = m;
 
81
    for (i__ = 1; i__ <= i__1; ++i__) {
 
82
        dtemp += dx[i__] * dy[i__];
 
83
/* L30: */
 
84
    }
 
85
    if (*n < 5) {
 
86
        goto L60;
 
87
    }
 
88
L40:
 
89
    mp1 = m + 1;
 
90
    i__1 = *n;
 
91
    for (i__ = mp1; i__ <= i__1; i__ += 5) {
 
92
        dtemp = dtemp + dx[i__] * dy[i__] + dx[i__ + 1] * dy[i__ + 1] + dx[
 
93
                i__ + 2] * dy[i__ + 2] + dx[i__ + 3] * dy[i__ + 3] + dx[i__ + 
 
94
                4] * dy[i__ + 4];
 
95
/* L50: */
 
96
    }
 
97
L60:
 
98
    ret_val = dtemp;
 
99
    return ret_val;
 
100
} /* igraphddot_ */
 
101