Coverage Report

Created: 2023-09-25 06:04

/src/igraph/vendor/lapack/dlarf.c
Line
Count
Source (jump to first uncovered line)
1
/*  -- translated by f2c (version 20191129).
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 "f2c.h"
14
15
/* Table of constant values */
16
17
static doublereal c_b4 = 1.;
18
static doublereal c_b5 = 0.;
19
static integer c__1 = 1;
20
21
/* > \brief \b DLARF applies an elementary reflector to a general rectangular matrix.   
22
23
    =========== DOCUMENTATION ===========   
24
25
   Online html documentation available at   
26
              http://www.netlib.org/lapack/explore-html/   
27
28
   > \htmlonly   
29
   > Download DLARF + dependencies   
30
   > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlarf.f
31
">   
32
   > [TGZ]</a>   
33
   > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlarf.f
34
">   
35
   > [ZIP]</a>   
36
   > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlarf.f
37
">   
38
   > [TXT]</a>   
39
   > \endhtmlonly   
40
41
    Definition:   
42
    ===========   
43
44
         SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )   
45
46
         CHARACTER          SIDE   
47
         INTEGER            INCV, LDC, M, N   
48
         DOUBLE PRECISION   TAU   
49
         DOUBLE PRECISION   C( LDC, * ), V( * ), WORK( * )   
50
51
52
   > \par Purpose:   
53
    =============   
54
   >   
55
   > \verbatim   
56
   >   
57
   > DLARF applies a real elementary reflector H to a real m by n matrix   
58
   > C, from either the left or the right. H is represented in the form   
59
   >   
60
   >       H = I - tau * v * v**T   
61
   >   
62
   > where tau is a real scalar and v is a real vector.   
63
   >   
64
   > If tau = 0, then H is taken to be the unit matrix.   
65
   > \endverbatim   
66
67
    Arguments:   
68
    ==========   
69
70
   > \param[in] SIDE   
71
   > \verbatim   
72
   >          SIDE is CHARACTER*1   
73
   >          = 'L': form  H * C   
74
   >          = 'R': form  C * H   
75
   > \endverbatim   
76
   >   
77
   > \param[in] M   
78
   > \verbatim   
79
   >          M is INTEGER   
80
   >          The number of rows of the matrix C.   
81
   > \endverbatim   
82
   >   
83
   > \param[in] N   
84
   > \verbatim   
85
   >          N is INTEGER   
86
   >          The number of columns of the matrix C.   
87
   > \endverbatim   
88
   >   
89
   > \param[in] V   
90
   > \verbatim   
91
   >          V is DOUBLE PRECISION array, dimension   
92
   >                     (1 + (M-1)*abs(INCV)) if SIDE = 'L'   
93
   >                  or (1 + (N-1)*abs(INCV)) if SIDE = 'R'   
94
   >          The vector v in the representation of H. V is not used if   
95
   >          TAU = 0.   
96
   > \endverbatim   
97
   >   
98
   > \param[in] INCV   
99
   > \verbatim   
100
   >          INCV is INTEGER   
101
   >          The increment between elements of v. INCV <> 0.   
102
   > \endverbatim   
103
   >   
104
   > \param[in] TAU   
105
   > \verbatim   
106
   >          TAU is DOUBLE PRECISION   
107
   >          The value tau in the representation of H.   
108
   > \endverbatim   
109
   >   
110
   > \param[in,out] C   
111
   > \verbatim   
112
   >          C is DOUBLE PRECISION array, dimension (LDC,N)   
113
   >          On entry, the m by n matrix C.   
114
   >          On exit, C is overwritten by the matrix H * C if SIDE = 'L',   
115
   >          or C * H if SIDE = 'R'.   
116
   > \endverbatim   
117
   >   
118
   > \param[in] LDC   
119
   > \verbatim   
120
   >          LDC is INTEGER   
121
   >          The leading dimension of the array C. LDC >= max(1,M).   
122
   > \endverbatim   
123
   >   
124
   > \param[out] WORK   
125
   > \verbatim   
126
   >          WORK is DOUBLE PRECISION array, dimension   
127
   >                         (N) if SIDE = 'L'   
128
   >                      or (M) if SIDE = 'R'   
129
   > \endverbatim   
130
131
    Authors:   
132
    ========   
133
134
   > \author Univ. of Tennessee   
135
   > \author Univ. of California Berkeley   
136
   > \author Univ. of Colorado Denver   
137
   > \author NAG Ltd.   
138
139
   > \date September 2012   
140
141
   > \ingroup doubleOTHERauxiliary   
142
143
    =====================================================================   
144
   Subroutine */ int igraphdlarf_(char *side, integer *m, integer *n, doublereal *v,
145
   integer *incv, doublereal *tau, doublereal *c__, integer *ldc, 
146
  doublereal *work)
147
0
{
148
    /* System generated locals */
149
0
    integer c_dim1, c_offset;
150
0
    doublereal d__1;
151
152
    /* Local variables */
153
0
    integer i__;
154
0
    logical applyleft;
155
0
    extern /* Subroutine */ int igraphdger_(integer *, integer *, doublereal *, 
156
0
      doublereal *, integer *, doublereal *, integer *, doublereal *, 
157
0
      integer *);
158
0
    extern logical igraphlsame_(char *, char *);
159
0
    extern /* Subroutine */ int igraphdgemv_(char *, integer *, integer *, 
160
0
      doublereal *, doublereal *, integer *, doublereal *, integer *, 
161
0
      doublereal *, doublereal *, integer *);
162
0
    integer lastc, lastv;
163
0
    extern integer igraphiladlc_(integer *, integer *, doublereal *, integer *), 
164
0
      igraphiladlr_(integer *, integer *, doublereal *, integer *);
165
166
167
/*  -- LAPACK auxiliary routine (version 3.4.2) --   
168
    -- LAPACK is a software package provided by Univ. of Tennessee,    --   
169
    -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--   
170
       September 2012   
171
172
173
    =====================================================================   
174
175
176
       Parameter adjustments */
177
0
    --v;
178
0
    c_dim1 = *ldc;
179
0
    c_offset = 1 + c_dim1;
180
0
    c__ -= c_offset;
181
0
    --work;
182
183
    /* Function Body */
184
0
    applyleft = igraphlsame_(side, "L");
185
0
    lastv = 0;
186
0
    lastc = 0;
187
0
    if (*tau != 0.) {
188
/*     Set up variables for scanning V.  LASTV begins pointing to the end   
189
       of V. */
190
0
  if (applyleft) {
191
0
      lastv = *m;
192
0
  } else {
193
0
      lastv = *n;
194
0
  }
195
0
  if (*incv > 0) {
196
0
      i__ = (lastv - 1) * *incv + 1;
197
0
  } else {
198
0
      i__ = 1;
199
0
  }
200
/*     Look for the last non-zero row in V. */
201
0
  while(lastv > 0 && v[i__] == 0.) {
202
0
      --lastv;
203
0
      i__ -= *incv;
204
0
  }
205
0
  if (applyleft) {
206
/*     Scan for the last non-zero column in C(1:lastv,:). */
207
0
      lastc = igraphiladlc_(&lastv, n, &c__[c_offset], ldc);
208
0
  } else {
209
/*     Scan for the last non-zero row in C(:,1:lastv). */
210
0
      lastc = igraphiladlr_(m, &lastv, &c__[c_offset], ldc);
211
0
  }
212
0
    }
213
/*     Note that lastc.eq.0 renders the BLAS operations null; no special   
214
       case is needed at this level. */
215
0
    if (applyleft) {
216
217
/*        Form  H * C */
218
219
0
  if (lastv > 0) {
220
221
/*           w(1:lastc,1) := C(1:lastv,1:lastc)**T * v(1:lastv,1) */
222
223
0
      igraphdgemv_("Transpose", &lastv, &lastc, &c_b4, &c__[c_offset], ldc, &
224
0
        v[1], incv, &c_b5, &work[1], &c__1);
225
226
/*           C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**T */
227
228
0
      d__1 = -(*tau);
229
0
      igraphdger_(&lastv, &lastc, &d__1, &v[1], incv, &work[1], &c__1, &c__[
230
0
        c_offset], ldc);
231
0
  }
232
0
    } else {
233
234
/*        Form  C * H */
235
236
0
  if (lastv > 0) {
237
238
/*           w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1) */
239
240
0
      igraphdgemv_("No transpose", &lastc, &lastv, &c_b4, &c__[c_offset], ldc,
241
0
         &v[1], incv, &c_b5, &work[1], &c__1);
242
243
/*           C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**T */
244
245
0
      d__1 = -(*tau);
246
0
      igraphdger_(&lastc, &lastv, &d__1, &work[1], &c__1, &v[1], incv, &c__[
247
0
        c_offset], ldc);
248
0
  }
249
0
    }
250
0
    return 0;
251
252
/*     End of DLARF */
253
254
0
} /* igraphdlarf_ */
255