1 SUBROUTINE CCSHFT( 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 COMPLEX A( LDA, * ) 13* .. 14* 15* Purpose 16* ======= 17* 18* CCSHFT 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) COMPLEX 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 CCSHFT 89* 90 END 91