File: crshft.f

package info (click to toggle)
scalapack 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 37,012 kB
  • sloc: fortran: 339,113; ansic: 74,517; makefile: 1,494; sh: 34
file content (94 lines) | stat: -rw-r--r-- 3,192 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
      SUBROUTINE CRSHFT( M, N, OFFSET, A, LDA )
*
*  -- PBLAS auxiliary routine (version 2.0) --
*     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
*     and University of California, Berkeley.
*     April 1, 1998
*
*     .. Scalar Arguments ..
      INTEGER            LDA, M, N, OFFSET
*     ..
*     .. Array Arguments ..
      COMPLEX            A( LDA, * )
*     ..
*
*  Purpose
*  =======
*
*  CRSHFT shifts rows of an m by n array A by OFFSET.
*
*  Arguments
*  =========
*
*  M       (local input) INTEGER
*          On entry, M  specifies the number of rows of A to be shifted.
*          M must be at least zero.
*
*  N       (local input) INTEGER
*          On entry,  N  specifies the number of columns of A. N must be
*          at least zero.
*
*  OFFSET  (local input) INTEGER
*          On entry, OFFSET  specifies  the  offset by which the rows of
*          A should be shifted. OFFSET  can be positive or negative (see
*          below for further details). When OFFSET is positive, the rows
*          are shifted to the  bottom. When OFFSET is negative, the rows
*          of A are shifted to the top.
*
*  A       (local input/local output) COMPLEX array
*          On entry,  A  is an array of dimension ( LDA, N ). On exit, A
*          contains the shifted array.
*
*  LDA     (local input) INTEGER
*          On entry, LDA specifies the leading dimension of the array A.
*          LDA must be at least max( 1, M+ABS(OFFSET) ).
*
*  Further Details
*  ===============
*
*            N                 N                   N                 N
*           ---               ---                 ---               ---
*          | 1 |             | 1 |               | 1 |             | 7 |
*          | 2 |    M = 3    | 2 |               | 2 |    M = 3    | 8 |
*          | 3 |             | 3 |               | 3 |             | 9 |
*          | 4 |             | 4 |               | 4 |             | 4 |
*          | 5 |   becomes   | 5 |               | 5 |   becomes   | 5 |
*          | 6 |             | 6 |               | 6 |             | 6 |
*          | 7 |             | 1 |               | 7 |             | 7 |
*          | 8 | OFFSET =  6 | 2 |               | 8 | OFFSET = -6 | 8 |
*          | 9 |             | 3 |               | 9 |             | 9 |
*           ---               ---                 ---               ---
*                OFFSET >= 0                           OFFSET <= 0
*
*  -- Written on April 1, 1998 by
*     Antoine Petitet, University  of  Tennessee, Knoxville 37996, USA.
*
*  =====================================================================
*
*     .. Local Scalars ..
      INTEGER            I, J
*     ..
*     .. Executable Statements ..
*
      IF( ( OFFSET.EQ.0 ).OR.( M.LE.0 ).OR.( N.LE.0 ) )
     $   RETURN
*
      IF( OFFSET.GT.0 ) THEN
         DO 20 J = 1, N
            DO 10 I = M, 1, -1
               A( I+OFFSET, J ) = A( I, J )
   10       CONTINUE
   20    CONTINUE
      ELSE
         DO 40 J = 1, N
            DO 30 I = 1, M
               A( I, J ) = A( I-OFFSET, J )
   30       CONTINUE
   40    CONTINUE
      END IF
*
      RETURN
*
*     End of CRSHFT
*
      END