|
ScaLAPACK
2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
|
00001 SUBROUTINE DRSHFT( M, N, OFFSET, A, LDA ) 00002 * 00003 * -- PBLAS auxiliary routine (version 2.0) -- 00004 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00005 * and University of California, Berkeley. 00006 * April 1, 1998 00007 * 00008 * .. Scalar Arguments .. 00009 INTEGER LDA, M, N, OFFSET 00010 * .. 00011 * .. Array Arguments .. 00012 DOUBLE PRECISION A( LDA, * ) 00013 * .. 00014 * 00015 * Purpose 00016 * ======= 00017 * 00018 * DRSHFT shifts rows of an m by n array A by OFFSET. 00019 * 00020 * Arguments 00021 * ========= 00022 * 00023 * M (local input) INTEGER 00024 * On entry, M specifies the number of rows of A to be shifted. 00025 * M must be at least zero. 00026 * 00027 * N (local input) INTEGER 00028 * On entry, N specifies the number of columns of A. N must be 00029 * at least zero. 00030 * 00031 * OFFSET (local input) INTEGER 00032 * On entry, OFFSET specifies the offset by which the rows of 00033 * A should be shifted. OFFSET can be positive or negative (see 00034 * below for further details). When OFFSET is positive, the rows 00035 * are shifted to the bottom. When OFFSET is negative, the rows 00036 * of A are shifted to the top. 00037 * 00038 * A (local input/local output) DOUBLE PRECISION array 00039 * On entry, A is an array of dimension ( LDA, N ). On exit, A 00040 * contains the shifted array. 00041 * 00042 * LDA (local input) INTEGER 00043 * On entry, LDA specifies the leading dimension of the array A. 00044 * LDA must be at least max( 1, M+ABS(OFFSET) ). 00045 * 00046 * Further Details 00047 * =============== 00048 * 00049 * N N N N 00050 * --- --- --- --- 00051 * | 1 | | 1 | | 1 | | 7 | 00052 * | 2 | M = 3 | 2 | | 2 | M = 3 | 8 | 00053 * | 3 | | 3 | | 3 | | 9 | 00054 * | 4 | | 4 | | 4 | | 4 | 00055 * | 5 | becomes | 5 | | 5 | becomes | 5 | 00056 * | 6 | | 6 | | 6 | | 6 | 00057 * | 7 | | 1 | | 7 | | 7 | 00058 * | 8 | OFFSET = 6 | 2 | | 8 | OFFSET = -6 | 8 | 00059 * | 9 | | 3 | | 9 | | 9 | 00060 * --- --- --- --- 00061 * OFFSET >= 0 OFFSET <= 0 00062 * 00063 * -- Written on April 1, 1998 by 00064 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA. 00065 * 00066 * ===================================================================== 00067 * 00068 * .. Local Scalars .. 00069 INTEGER I, J 00070 * .. 00071 * .. Executable Statements .. 00072 * 00073 IF( ( OFFSET.EQ.0 ).OR.( M.LE.0 ).OR.( N.LE.0 ) ) 00074 $ RETURN 00075 * 00076 IF( OFFSET.GT.0 ) THEN 00077 DO 20 J = 1, N 00078 DO 10 I = M, 1, -1 00079 A( I+OFFSET, J ) = A( I, J ) 00080 10 CONTINUE 00081 20 CONTINUE 00082 ELSE 00083 DO 40 J = 1, N 00084 DO 30 I = 1, M 00085 A( I, J ) = A( I-OFFSET, J ) 00086 30 CONTINUE 00087 40 CONTINUE 00088 END IF 00089 * 00090 RETURN 00091 * 00092 * End of DRSHFT 00093 * 00094 END