LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dlatm5.f
Go to the documentation of this file.
1*> \brief \b DLATM5
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* SUBROUTINE DLATM5( PRTYPE, M, N, A, LDA, B, LDB, C, LDC, D, LDD,
12* E, LDE, F, LDF, R, LDR, L, LDL, ALPHA, QBLCKA,
13* QBLCKB )
14*
15* .. Scalar Arguments ..
16* INTEGER LDA, LDB, LDC, LDD, LDE, LDF, LDL, LDR, M, N,
17* $ PRTYPE, QBLCKA, QBLCKB
18* DOUBLE PRECISION ALPHA
19* ..
20* .. Array Arguments ..
21* DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ),
22* $ D( LDD, * ), E( LDE, * ), F( LDF, * ),
23* $ L( LDL, * ), R( LDR, * )
24* ..
25*
26*
27*> \par Purpose:
28* =============
29*>
30*> \verbatim
31*>
32*> DLATM5 generates matrices involved in the Generalized Sylvester
33*> equation:
34*>
35*> A * R - L * B = C
36*> D * R - L * E = F
37*>
38*> They also satisfy (the diagonalization condition)
39*>
40*> [ I -L ] ( [ A -C ], [ D -F ] ) [ I R ] = ( [ A ], [ D ] )
41*> [ I ] ( [ B ] [ E ] ) [ I ] ( [ B ] [ E ] )
42*>
43*> \endverbatim
44*
45* Arguments:
46* ==========
47*
48*> \param[in] PRTYPE
49*> \verbatim
50*> PRTYPE is INTEGER
51*> "Points" to a certain type of the matrices to generate
52*> (see further details).
53*> \endverbatim
54*>
55*> \param[in] M
56*> \verbatim
57*> M is INTEGER
58*> Specifies the order of A and D and the number of rows in
59*> C, F, R and L.
60*> \endverbatim
61*>
62*> \param[in] N
63*> \verbatim
64*> N is INTEGER
65*> Specifies the order of B and E and the number of columns in
66*> C, F, R and L.
67*> \endverbatim
68*>
69*> \param[out] A
70*> \verbatim
71*> A is DOUBLE PRECISION array, dimension (LDA, M).
72*> On exit A M-by-M is initialized according to PRTYPE.
73*> \endverbatim
74*>
75*> \param[in] LDA
76*> \verbatim
77*> LDA is INTEGER
78*> The leading dimension of A.
79*> \endverbatim
80*>
81*> \param[out] B
82*> \verbatim
83*> B is DOUBLE PRECISION array, dimension (LDB, N).
84*> On exit B N-by-N is initialized according to PRTYPE.
85*> \endverbatim
86*>
87*> \param[in] LDB
88*> \verbatim
89*> LDB is INTEGER
90*> The leading dimension of B.
91*> \endverbatim
92*>
93*> \param[out] C
94*> \verbatim
95*> C is DOUBLE PRECISION array, dimension (LDC, N).
96*> On exit C M-by-N is initialized according to PRTYPE.
97*> \endverbatim
98*>
99*> \param[in] LDC
100*> \verbatim
101*> LDC is INTEGER
102*> The leading dimension of C.
103*> \endverbatim
104*>
105*> \param[out] D
106*> \verbatim
107*> D is DOUBLE PRECISION array, dimension (LDD, M).
108*> On exit D M-by-M is initialized according to PRTYPE.
109*> \endverbatim
110*>
111*> \param[in] LDD
112*> \verbatim
113*> LDD is INTEGER
114*> The leading dimension of D.
115*> \endverbatim
116*>
117*> \param[out] E
118*> \verbatim
119*> E is DOUBLE PRECISION array, dimension (LDE, N).
120*> On exit E N-by-N is initialized according to PRTYPE.
121*> \endverbatim
122*>
123*> \param[in] LDE
124*> \verbatim
125*> LDE is INTEGER
126*> The leading dimension of E.
127*> \endverbatim
128*>
129*> \param[out] F
130*> \verbatim
131*> F is DOUBLE PRECISION array, dimension (LDF, N).
132*> On exit F M-by-N is initialized according to PRTYPE.
133*> \endverbatim
134*>
135*> \param[in] LDF
136*> \verbatim
137*> LDF is INTEGER
138*> The leading dimension of F.
139*> \endverbatim
140*>
141*> \param[out] R
142*> \verbatim
143*> R is DOUBLE PRECISION array, dimension (LDR, N).
144*> On exit R M-by-N is initialized according to PRTYPE.
145*> \endverbatim
146*>
147*> \param[in] LDR
148*> \verbatim
149*> LDR is INTEGER
150*> The leading dimension of R.
151*> \endverbatim
152*>
153*> \param[out] L
154*> \verbatim
155*> L is DOUBLE PRECISION array, dimension (LDL, N).
156*> On exit L M-by-N is initialized according to PRTYPE.
157*> \endverbatim
158*>
159*> \param[in] LDL
160*> \verbatim
161*> LDL is INTEGER
162*> The leading dimension of L.
163*> \endverbatim
164*>
165*> \param[in] ALPHA
166*> \verbatim
167*> ALPHA is DOUBLE PRECISION
168*> Parameter used in generating PRTYPE = 1 and 5 matrices.
169*> \endverbatim
170*>
171*> \param[in] QBLCKA
172*> \verbatim
173*> QBLCKA is INTEGER
174*> When PRTYPE = 3, specifies the distance between 2-by-2
175*> blocks on the diagonal in A. Otherwise, QBLCKA is not
176*> referenced. QBLCKA > 1.
177*> \endverbatim
178*>
179*> \param[in] QBLCKB
180*> \verbatim
181*> QBLCKB is INTEGER
182*> When PRTYPE = 3, specifies the distance between 2-by-2
183*> blocks on the diagonal in B. Otherwise, QBLCKB is not
184*> referenced. QBLCKB > 1.
185*> \endverbatim
186*
187* Authors:
188* ========
189*
190*> \author Univ. of Tennessee
191*> \author Univ. of California Berkeley
192*> \author Univ. of Colorado Denver
193*> \author NAG Ltd.
194*
195*> \ingroup double_matgen
196*
197*> \par Further Details:
198* =====================
199*>
200*> \verbatim
201*>
202*> PRTYPE = 1: A and B are Jordan blocks, D and E are identity matrices
203*>
204*> A : if (i == j) then A(i, j) = 1.0
205*> if (j == i + 1) then A(i, j) = -1.0
206*> else A(i, j) = 0.0, i, j = 1...M
207*>
208*> B : if (i == j) then B(i, j) = 1.0 - ALPHA
209*> if (j == i + 1) then B(i, j) = 1.0
210*> else B(i, j) = 0.0, i, j = 1...N
211*>
212*> D : if (i == j) then D(i, j) = 1.0
213*> else D(i, j) = 0.0, i, j = 1...M
214*>
215*> E : if (i == j) then E(i, j) = 1.0
216*> else E(i, j) = 0.0, i, j = 1...N
217*>
218*> L = R are chosen from [-10...10],
219*> which specifies the right hand sides (C, F).
220*>
221*> PRTYPE = 2 or 3: Triangular and/or quasi- triangular.
222*>
223*> A : if (i <= j) then A(i, j) = [-1...1]
224*> else A(i, j) = 0.0, i, j = 1...M
225*>
226*> if (PRTYPE = 3) then
227*> A(k + 1, k + 1) = A(k, k)
228*> A(k + 1, k) = [-1...1]
229*> sign(A(k, k + 1) = -(sin(A(k + 1, k))
230*> k = 1, M - 1, QBLCKA
231*>
232*> B : if (i <= j) then B(i, j) = [-1...1]
233*> else B(i, j) = 0.0, i, j = 1...N
234*>
235*> if (PRTYPE = 3) then
236*> B(k + 1, k + 1) = B(k, k)
237*> B(k + 1, k) = [-1...1]
238*> sign(B(k, k + 1) = -(sign(B(k + 1, k))
239*> k = 1, N - 1, QBLCKB
240*>
241*> D : if (i <= j) then D(i, j) = [-1...1].
242*> else D(i, j) = 0.0, i, j = 1...M
243*>
244*>
245*> E : if (i <= j) then D(i, j) = [-1...1]
246*> else E(i, j) = 0.0, i, j = 1...N
247*>
248*> L, R are chosen from [-10...10],
249*> which specifies the right hand sides (C, F).
250*>
251*> PRTYPE = 4 Full
252*> A(i, j) = [-10...10]
253*> D(i, j) = [-1...1] i,j = 1...M
254*> B(i, j) = [-10...10]
255*> E(i, j) = [-1...1] i,j = 1...N
256*> R(i, j) = [-10...10]
257*> L(i, j) = [-1...1] i = 1..M ,j = 1...N
258*>
259*> L, R specifies the right hand sides (C, F).
260*>
261*> PRTYPE = 5 special case common and/or close eigs.
262*> \endverbatim
263*>
264* =====================================================================
265 SUBROUTINE dlatm5( PRTYPE, M, N, A, LDA, B, LDB, C, LDC, D,
266 $ LDD,
267 $ E, LDE, F, LDF, R, LDR, L, LDL, ALPHA, QBLCKA,
268 $ QBLCKB )
269*
270* -- LAPACK computational routine --
271* -- LAPACK is a software package provided by Univ. of Tennessee, --
272* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
273*
274* .. Scalar Arguments ..
275 INTEGER LDA, LDB, LDC, LDD, LDE, LDF, LDL, LDR, M, N,
276 $ PRTYPE, QBLCKA, QBLCKB
277 DOUBLE PRECISION ALPHA
278* ..
279* .. Array Arguments ..
280 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ),
281 $ D( LDD, * ), E( LDE, * ), F( LDF, * ),
282 $ L( LDL, * ), R( LDR, * )
283* ..
284*
285* =====================================================================
286*
287* .. Parameters ..
288 DOUBLE PRECISION ONE, ZERO, TWENTY, HALF, TWO
289 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0, twenty = 2.0d+1,
290 $ half = 0.5d+0, two = 2.0d+0 )
291* ..
292* .. Local Scalars ..
293 INTEGER I, J, K
294 DOUBLE PRECISION IMEPS, REEPS
295* ..
296* .. Intrinsic Functions ..
297 INTRINSIC dble, mod, sin
298* ..
299* .. External Subroutines ..
300 EXTERNAL dgemm
301* ..
302* .. Executable Statements ..
303*
304 IF( prtype.EQ.1 ) THEN
305 DO 20 i = 1, m
306 DO 10 j = 1, m
307 IF( i.EQ.j ) THEN
308 a( i, j ) = one
309 d( i, j ) = one
310 ELSE IF( i.EQ.j-1 ) THEN
311 a( i, j ) = -one
312 d( i, j ) = zero
313 ELSE
314 a( i, j ) = zero
315 d( i, j ) = zero
316 END IF
317 10 CONTINUE
318 20 CONTINUE
319*
320 DO 40 i = 1, n
321 DO 30 j = 1, n
322 IF( i.EQ.j ) THEN
323 b( i, j ) = one - alpha
324 e( i, j ) = one
325 ELSE IF( i.EQ.j-1 ) THEN
326 b( i, j ) = one
327 e( i, j ) = zero
328 ELSE
329 b( i, j ) = zero
330 e( i, j ) = zero
331 END IF
332 30 CONTINUE
333 40 CONTINUE
334*
335 DO 60 i = 1, m
336 DO 50 j = 1, n
337 r( i, j ) = ( half-sin( dble( i / j ) ) )*twenty
338 l( i, j ) = r( i, j )
339 50 CONTINUE
340 60 CONTINUE
341*
342 ELSE IF( prtype.EQ.2 .OR. prtype.EQ.3 ) THEN
343 DO 80 i = 1, m
344 DO 70 j = 1, m
345 IF( i.LE.j ) THEN
346 a( i, j ) = ( half-sin( dble( i ) ) )*two
347 d( i, j ) = ( half-sin( dble( i*j ) ) )*two
348 ELSE
349 a( i, j ) = zero
350 d( i, j ) = zero
351 END IF
352 70 CONTINUE
353 80 CONTINUE
354*
355 DO 100 i = 1, n
356 DO 90 j = 1, n
357 IF( i.LE.j ) THEN
358 b( i, j ) = ( half-sin( dble( i+j ) ) )*two
359 e( i, j ) = ( half-sin( dble( j ) ) )*two
360 ELSE
361 b( i, j ) = zero
362 e( i, j ) = zero
363 END IF
364 90 CONTINUE
365 100 CONTINUE
366*
367 DO 120 i = 1, m
368 DO 110 j = 1, n
369 r( i, j ) = ( half-sin( dble( i*j ) ) )*twenty
370 l( i, j ) = ( half-sin( dble( i+j ) ) )*twenty
371 110 CONTINUE
372 120 CONTINUE
373*
374 IF( prtype.EQ.3 ) THEN
375 IF( qblcka.LE.1 )
376 $ qblcka = 2
377 DO 130 k = 1, m - 1, qblcka
378 a( k+1, k+1 ) = a( k, k )
379 a( k+1, k ) = -sin( a( k, k+1 ) )
380 130 CONTINUE
381*
382 IF( qblckb.LE.1 )
383 $ qblckb = 2
384 DO 140 k = 1, n - 1, qblckb
385 b( k+1, k+1 ) = b( k, k )
386 b( k+1, k ) = -sin( b( k, k+1 ) )
387 140 CONTINUE
388 END IF
389*
390 ELSE IF( prtype.EQ.4 ) THEN
391 DO 160 i = 1, m
392 DO 150 j = 1, m
393 a( i, j ) = ( half-sin( dble( i*j ) ) )*twenty
394 d( i, j ) = ( half-sin( dble( i+j ) ) )*two
395 150 CONTINUE
396 160 CONTINUE
397*
398 DO 180 i = 1, n
399 DO 170 j = 1, n
400 b( i, j ) = ( half-sin( dble( i+j ) ) )*twenty
401 e( i, j ) = ( half-sin( dble( i*j ) ) )*two
402 170 CONTINUE
403 180 CONTINUE
404*
405 DO 200 i = 1, m
406 DO 190 j = 1, n
407 r( i, j ) = ( half-sin( dble( j / i ) ) )*twenty
408 l( i, j ) = ( half-sin( dble( i*j ) ) )*two
409 190 CONTINUE
410 200 CONTINUE
411*
412 ELSE IF( prtype.GE.5 ) THEN
413 reeps = half*two*twenty / alpha
414 imeps = ( half-two ) / alpha
415 DO 220 i = 1, m
416 DO 210 j = 1, n
417 r( i, j ) = ( half-sin( dble( i*j ) ) )*alpha / twenty
418 l( i, j ) = ( half-sin( dble( i+j ) ) )*alpha / twenty
419 210 CONTINUE
420 220 CONTINUE
421*
422 DO 230 i = 1, m
423 d( i, i ) = one
424 230 CONTINUE
425*
426 DO 240 i = 1, m
427 IF( i.LE.4 ) THEN
428 a( i, i ) = one
429 IF( i.GT.2 )
430 $ a( i, i ) = one + reeps
431 IF( mod( i, 2 ).NE.0 .AND. i.LT.m ) THEN
432 a( i, i+1 ) = imeps
433 ELSE IF( i.GT.1 ) THEN
434 a( i, i-1 ) = -imeps
435 END IF
436 ELSE IF( i.LE.8 ) THEN
437 IF( i.LE.6 ) THEN
438 a( i, i ) = reeps
439 ELSE
440 a( i, i ) = -reeps
441 END IF
442 IF( mod( i, 2 ).NE.0 .AND. i.LT.m ) THEN
443 a( i, i+1 ) = one
444 ELSE IF( i.GT.1 ) THEN
445 a( i, i-1 ) = -one
446 END IF
447 ELSE
448 a( i, i ) = one
449 IF( mod( i, 2 ).NE.0 .AND. i.LT.m ) THEN
450 a( i, i+1 ) = imeps*2
451 ELSE IF( i.GT.1 ) THEN
452 a( i, i-1 ) = -imeps*2
453 END IF
454 END IF
455 240 CONTINUE
456*
457 DO 250 i = 1, n
458 e( i, i ) = one
459 IF( i.LE.4 ) THEN
460 b( i, i ) = -one
461 IF( i.GT.2 )
462 $ b( i, i ) = one - reeps
463 IF( mod( i, 2 ).NE.0 .AND. i.LT.n ) THEN
464 b( i, i+1 ) = imeps
465 ELSE IF( i.GT.1 ) THEN
466 b( i, i-1 ) = -imeps
467 END IF
468 ELSE IF( i.LE.8 ) THEN
469 IF( i.LE.6 ) THEN
470 b( i, i ) = reeps
471 ELSE
472 b( i, i ) = -reeps
473 END IF
474 IF( mod( i, 2 ).NE.0 .AND. i.LT.n ) THEN
475 b( i, i+1 ) = one + imeps
476 ELSE IF( i.GT.1 ) THEN
477 b( i, i-1 ) = -one - imeps
478 END IF
479 ELSE
480 b( i, i ) = one - reeps
481 IF( mod( i, 2 ).NE.0 .AND. i.LT.n ) THEN
482 b( i, i+1 ) = imeps*2
483 ELSE IF( i.GT.1 ) THEN
484 b( i, i-1 ) = -imeps*2
485 END IF
486 END IF
487 250 CONTINUE
488 END IF
489*
490* Compute rhs (C, F)
491*
492 CALL dgemm( 'N', 'N', m, n, m, one, a, lda, r, ldr, zero, c, ldc )
493 CALL dgemm( 'N', 'N', m, n, n, -one, l, ldl, b, ldb, one, c, ldc )
494 CALL dgemm( 'N', 'N', m, n, m, one, d, ldd, r, ldr, zero, f, ldf )
495 CALL dgemm( 'N', 'N', m, n, n, -one, l, ldl, e, lde, one, f, ldf )
496*
497* End of DLATM5
498*
499 END
subroutine dlatm5(prtype, m, n, a, lda, b, ldb, c, ldc, d, ldd, e, lde, f, ldf, r, ldr, l, ldl, alpha, qblcka, qblckb)
DLATM5
Definition dlatm5.f:269
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
Definition dgemm.f:188