01:       SUBROUTINE DLAPLL( N, X, INCX, Y, INCY, SSMIN )
02: *
03: *  -- LAPACK auxiliary routine (version 3.2) --
04: *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
05: *     November 2006
06: *
07: *     .. Scalar Arguments ..
08:       INTEGER            INCX, INCY, N
09:       DOUBLE PRECISION   SSMIN
10: *     ..
11: *     .. Array Arguments ..
12:       DOUBLE PRECISION   X( * ), Y( * )
13: *     ..
14: *
15: *  Purpose
16: *  =======
17: *
18: *  Given two column vectors X and Y, let
19: *
20: *                       A = ( X Y ).
21: *
22: *  The subroutine first computes the QR factorization of A = Q*R,
23: *  and then computes the SVD of the 2-by-2 upper triangular matrix R.
24: *  The smaller singular value of R is returned in SSMIN, which is used
25: *  as the measurement of the linear dependency of the vectors X and Y.
26: *
27: *  Arguments
28: *  =========
29: *
30: *  N       (input) INTEGER
31: *          The length of the vectors X and Y.
32: *
33: *  X       (input/output) DOUBLE PRECISION array,
34: *                         dimension (1+(N-1)*INCX)
35: *          On entry, X contains the N-vector X.
36: *          On exit, X is overwritten.
37: *
38: *  INCX    (input) INTEGER
39: *          The increment between successive elements of X. INCX > 0.
40: *
41: *  Y       (input/output) DOUBLE PRECISION array,
42: *                         dimension (1+(N-1)*INCY)
43: *          On entry, Y contains the N-vector Y.
44: *          On exit, Y is overwritten.
45: *
46: *  INCY    (input) INTEGER
47: *          The increment between successive elements of Y. INCY > 0.
48: *
49: *  SSMIN   (output) DOUBLE PRECISION
50: *          The smallest singular value of the N-by-2 matrix A = ( X Y ).
51: *
52: *  =====================================================================
53: *
54: *     .. Parameters ..
55:       DOUBLE PRECISION   ZERO, ONE
56:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
57: *     ..
58: *     .. Local Scalars ..
59:       DOUBLE PRECISION   A11, A12, A22, C, SSMAX, TAU
60: *     ..
61: *     .. External Functions ..
62:       DOUBLE PRECISION   DDOT
63:       EXTERNAL           DDOT
64: *     ..
65: *     .. External Subroutines ..
66:       EXTERNAL           DAXPY, DLARFG, DLAS2
67: *     ..
68: *     .. Executable Statements ..
69: *
70: *     Quick return if possible
71: *
72:       IF( N.LE.1 ) THEN
73:          SSMIN = ZERO
74:          RETURN
75:       END IF
76: *
77: *     Compute the QR factorization of the N-by-2 matrix ( X Y )
78: *
79:       CALL DLARFG( N, X( 1 ), X( 1+INCX ), INCX, TAU )
80:       A11 = X( 1 )
81:       X( 1 ) = ONE
82: *
83:       C = -TAU*DDOT( N, X, INCX, Y, INCY )
84:       CALL DAXPY( N, C, X, INCX, Y, INCY )
85: *
86:       CALL DLARFG( N-1, Y( 1+INCY ), Y( 1+2*INCY ), INCY, TAU )
87: *
88:       A12 = Y( 1 )
89:       A22 = Y( 1+INCY )
90: *
91: *     Compute the SVD of 2-by-2 Upper triangular matrix.
92: *
93:       CALL DLAS2( A11, A12, A22, SSMIN, SSMAX )
94: *
95:       RETURN
96: *
97: *     End of DLAPLL
98: *
99:       END
100: