ScaLAPACK 2.1  2.1 ScaLAPACK: Scalable Linear Algebra PACKage
drshft.f
Go to the documentation of this file.
1  SUBROUTINE drshft( M, N, OFFSET, A, LDA )
2 *
3 * -- PBLAS auxiliary routine (version 2.0) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * April 1, 1998
7 *
8 * .. Scalar Arguments ..
9  INTEGER LDA, M, N, OFFSET
10 * ..
11 * .. Array Arguments ..
12  DOUBLE PRECISION A( LDA, * )
13 * ..
14 *
15 * Purpose
16 * =======
17 *
18 * DRSHFT shifts rows of an m by n array A by OFFSET.
19 *
20 * Arguments
21 * =========
22 *
23 * M (local input) INTEGER
24 * On entry, M specifies the number of rows of A to be shifted.
25 * M must be at least zero.
26 *
27 * N (local input) INTEGER
28 * On entry, N specifies the number of columns of A. N must be
29 * at least zero.
30 *
31 * OFFSET (local input) INTEGER
32 * On entry, OFFSET specifies the offset by which the rows of
33 * A should be shifted. OFFSET can be positive or negative (see
34 * below for further details). When OFFSET is positive, the rows
35 * are shifted to the bottom. When OFFSET is negative, the rows
36 * of A are shifted to the top.
37 *
38 * A (local input/local output) DOUBLE PRECISION array
39 * On entry, A is an array of dimension ( LDA, N ). On exit, A
40 * contains the shifted array.
41 *
42 * LDA (local input) INTEGER
43 * On entry, LDA specifies the leading dimension of the array A.
44 * LDA must be at least max( 1, M+ABS(OFFSET) ).
45 *
46 * Further Details
47 * ===============
48 *
49 * N N N N
50 * --- --- --- ---
51 * | 1 | | 1 | | 1 | | 7 |
52 * | 2 | M = 3 | 2 | | 2 | M = 3 | 8 |
53 * | 3 | | 3 | | 3 | | 9 |
54 * | 4 | | 4 | | 4 | | 4 |
55 * | 5 | becomes | 5 | | 5 | becomes | 5 |
56 * | 6 | | 6 | | 6 | | 6 |
57 * | 7 | | 1 | | 7 | | 7 |
58 * | 8 | OFFSET = 6 | 2 | | 8 | OFFSET = -6 | 8 |
59 * | 9 | | 3 | | 9 | | 9 |
60 * --- --- --- ---
61 * OFFSET >= 0 OFFSET <= 0
62 *
63 * -- Written on April 1, 1998 by
64 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
65 *
66 * =====================================================================
67 *
68 * .. Local Scalars ..
69  INTEGER I, J
70 * ..
71 * .. Executable Statements ..
72 *
73  IF( ( offset.EQ.0 ).OR.( m.LE.0 ).OR.( n.LE.0 ) )
74  \$ RETURN
75 *
76  IF( offset.GT.0 ) THEN
77  DO 20 j = 1, n
78  DO 10 i = m, 1, -1
79  a( i+offset, j ) = a( i, j )
80  10 CONTINUE
81  20 CONTINUE
82  ELSE
83  DO 40 j = 1, n
84  DO 30 i = 1, m
85  a( i, j ) = a( i-offset, j )
86  30 CONTINUE
87  40 CONTINUE
88  END IF
89 *
90  RETURN
91 *
92 * End of DRSHFT
93 *
94  END
drshft
subroutine drshft(M, N, OFFSET, A, LDA)
Definition: drshft.f:2