ScaLAPACK 2.1  2.1 ScaLAPACK: Scalable Linear Algebra PACKage
scshft.f
Go to the documentation of this file.
1  SUBROUTINE scshft( 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  REAL A( LDA, * )
13 * ..
14 *
15 * Purpose
16 * =======
17 *
18 * SCSHFT shifts columns 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. M must be at
25 * least zero.
26 *
27 * N (local input) INTEGER
28 * On entry, N specifies the number of columns of A to be
29 * shifted. N must be at least zero.
30 *
31 * OFFSET (local input) INTEGER
32 * On entry, OFFSET specifies the offset by which the columns of
33 * A should be shifted. OFFSET can be positive or negative (see
34 * below for further details). When OFFSET is positive, the co-
35 * lumns are shifted to the right. When OFFSET is negative, the
36 * columns of A are shifted to the left.
37 *
38 * A (local input/local output) REAL array
39 * On entry, A is an array of dimension ( LDA, N+ABS(OFFSET) ).
40 * On exit, A 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 ).
45 *
46 * Further Details
47 * ===============
48 *
49 * N=3 OFFSET=6 -OFFSET=6 N=3
50 * ------------------- -------------------
51 * | 1 2 3 4 5 6 7 8 9 | M | 1 2 3 4 5 6 7 8 9 |
52 * ------------------- -------------------
53 * V V
54 * ------------------- -------------------
55 * | 1 2 3 4 5 6 1 2 3 | M | 7 8 9 4 5 6 7 8 9 |
56 * ------------------- -------------------
57 * OFFSET >= 0 OFFSET <= 0
58 *
59 * -- Written on April 1, 1998 by
60 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
61 *
62 * =====================================================================
63 *
64 * .. Local Scalars ..
65  INTEGER I, J
66 * ..
67 * .. Executable Statements ..
68 *
69  IF( ( offset.EQ.0 ).OR.( m.LE.0 ).OR.( n.LE.0 ) )
70  \$ RETURN
71 *
72  IF( offset.GT.0 ) THEN
73  DO 20 j = n, 1, -1
74  DO 10 i = 1, m
75  a( i, j+offset ) = a( i, j )
76  10 CONTINUE
77  20 CONTINUE
78  ELSE
79  DO 40 j = 1, n
80  DO 30 i = 1, m
81  a( i, j ) = a( i, j-offset )
82  30 CONTINUE
83  40 CONTINUE
84  END IF
85 *
86  RETURN
87 *
88 * End of SCSHFT
89 *
90  END
scshft
subroutine scshft(M, N, OFFSET, A, LDA)
Definition: scshft.f:2