📄 dopla.f
字号:
DOUBLE PRECISION FUNCTION DOPLA( SUBNAM, M, N, KL, KU, NB )** -- LAPACK timing routine (version 3.0) --* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,* Courant Institute, Argonne National Lab, and Rice University* June 30, 1999** .. Scalar Arguments .. CHARACTER*6 SUBNAM INTEGER KL, KU, M, N, NB* ..** Purpose* =======** DOPLA computes an approximation of the number of floating point* operations used by the subroutine SUBNAM with the given values* of the parameters M, N, KL, KU, and NB.** This version counts operations for the LAPACK subroutines.** Arguments* =========** SUBNAM (input) CHARACTER*6* The name of the subroutine.** M (input) INTEGER* The number of rows of the coefficient matrix. M >= 0.** N (input) INTEGER* The number of columns of the coefficient matrix.* For solve routine when the matrix is square,* N is the number of right hand sides. N >= 0.** KL (input) INTEGER* The lower band width of the coefficient matrix.* If needed, 0 <= KL <= M-1.* For xGEQRS, KL is the number of right hand sides.** KU (input) INTEGER* The upper band width of the coefficient matrix.* If needed, 0 <= KU <= N-1.** NB (input) INTEGER* The block size. If needed, NB >= 1.** Notes* =====** In the comments below, the association is given between arguments* in the requested subroutine and local arguments. For example,** xGETRS: N, NRHS => M, N** means that arguments N and NRHS in DGETRS are passed to arguments* M and N in this procedure.** =====================================================================** .. Local Scalars .. LOGICAL CORZ, SORD CHARACTER C1 CHARACTER*2 C2 CHARACTER*3 C3 INTEGER I DOUBLE PRECISION ADDFAC, ADDS, EK, EM, EMN, EN, MULFAC, MULTS, $ WL, WU* ..* .. External Functions .. LOGICAL LSAME, LSAMEN EXTERNAL LSAME, LSAMEN* ..* .. Intrinsic Functions .. INTRINSIC MAX, MIN* ..* .. Executable Statements ..** --------------------------------------------------------* Initialize DOPLA to 0 and do a quick return if possible.* --------------------------------------------------------* DOPLA = 0 MULTS = 0 ADDS = 0 C1 = SUBNAM( 1: 1 ) C2 = SUBNAM( 2: 3 ) C3 = SUBNAM( 4: 6 ) SORD = LSAME( C1, 'S' ) .OR. LSAME( C1, 'D' ) CORZ = LSAME( C1, 'C' ) .OR. LSAME( C1, 'Z' ) IF( M.LE.0 .OR. .NOT.( SORD .OR. CORZ ) ) $ RETURN** ---------------------------------------------------------* If the coefficient matrix is real, count each add as 1* operation and each multiply as 1 operation.* If the coefficient matrix is complex, count each add as 2* operations and each multiply as 6 operations.* ---------------------------------------------------------* IF( LSAME( C1, 'S' ) .OR. LSAME( C1, 'D' ) ) THEN ADDFAC = 1 MULFAC = 1 ELSE ADDFAC = 2 MULFAC = 6 END IF EM = M EN = N EK = KL** ---------------------------------* GE: GEneral rectangular matrices* ---------------------------------* IF( LSAMEN( 2, C2, 'GE' ) ) THEN** xGETRF: M, N => M, N* IF( LSAMEN( 3, C3, 'TRF' ) ) THEN EMN = MIN( M, N ) ADDS = EMN*( EM*EN-( EM+EN )*( EMN+1.D0 ) / 2.D0+ $ ( EMN+1.D0 )*( 2.D0*EMN+1.D0 ) / 6.D0 ) MULTS = ADDS + EMN*( EM-( EMN+1.D0 ) / 2.D0 )** xGETRS: N, NRHS => M, N* ELSE IF( LSAMEN( 3, C3, 'TRS' ) ) THEN MULTS = EN*EM*EM ADDS = EN*( EM*( EM-1.D0 ) )** xGETRI: N => M* ELSE IF( LSAMEN( 3, C3, 'TRI' ) ) THEN MULTS = EM*( 5.D0 / 6.D0+EM*( 1.D0 / 2.D0+EM*( 2.D0 / $ 3.D0 ) ) ) ADDS = EM*( 5.D0 / 6.D0+EM*( -3.D0 / 2.D0+EM*( 2.D0 / $ 3.D0 ) ) )** xGEQRF or xGEQLF: M, N => M, N* ELSE IF( LSAMEN( 3, C3, 'QRF' ) .OR. $ LSAMEN( 3, C3, 'QR2' ) .OR. $ LSAMEN( 3, C3, 'QLF' ) .OR. LSAMEN( 3, C3, 'QL2' ) ) $ THEN IF( M.GE.N ) THEN MULTS = EN*( ( ( 23.D0 / 6.D0 )+EM+EN / 2.D0 )+EN* $ ( EM-EN / 3.D0 ) ) ADDS = EN*( ( 5.D0 / 6.D0 )+EN* $ ( 1.D0 / 2.D0+( EM-EN / 3.D0 ) ) ) ELSE MULTS = EM*( ( ( 23.D0 / 6.D0 )+2.D0*EN-EM / 2.D0 )+EM* $ ( EN-EM / 3.D0 ) ) ADDS = EM*( ( 5.D0 / 6.D0 )+EN-EM / 2.D0+EM* $ ( EN-EM / 3.D0 ) ) END IF** xGERQF or xGELQF: M, N => M, N* ELSE IF( LSAMEN( 3, C3, 'RQF' ) .OR. $ LSAMEN( 3, C3, 'RQ2' ) .OR. $ LSAMEN( 3, C3, 'LQF' ) .OR. LSAMEN( 3, C3, 'LQ2' ) ) $ THEN IF( M.GE.N ) THEN MULTS = EN*( ( ( 29.D0 / 6.D0 )+EM+EN / 2.D0 )+EN* $ ( EM-EN / 3.D0 ) ) ADDS = EN*( ( 5.D0 / 6.D0 )+EM+EN* $ ( -1.D0 / 2.D0+( EM-EN / 3.D0 ) ) ) ELSE MULTS = EM*( ( ( 29.D0 / 6.D0 )+2.D0*EN-EM / 2.D0 )+EM* $ ( EN-EM / 3.D0 ) ) ADDS = EM*( ( 5.D0 / 6.D0 )+EM / 2.D0+EM* $ ( EN-EM / 3.D0 ) ) END IF** xGEQPF: M, N => M, N* ELSE IF( LSAMEN( 3, C3, 'QPF' ) ) THEN EMN = MIN( M, N ) MULTS = 2*EN*EN + EMN*( 3*EM+5*EN+2*EM*EN-( EMN+1 )* $ ( 4+EN+EM-( 2*EMN+1 ) / 3 ) ) ADDS = EN*EN + EMN*( 2*EM+EN+2*EM*EN-( EMN+1 )* $ ( 2+EN+EM-( 2*EMN+1 ) / 3 ) )** xGEQRS or xGERQS: M, N, NRHS => M, N, KL* ELSE IF( LSAMEN( 3, C3, 'QRS' ) .OR. LSAMEN( 3, C3, 'RQS' ) ) $ THEN MULTS = EK*( EN*( 2.D0-EK )+EM* $ ( 2.D0*EN+( EM+1.D0 ) / 2.D0 ) ) ADDS = EK*( EN*( 1.D0-EK )+EM* $ ( 2.D0*EN+( EM-1.D0 ) / 2.D0 ) )** xGELQS or xGEQLS: M, N, NRHS => M, N, KL* ELSE IF( LSAMEN( 3, C3, 'LQS' ) .OR. LSAMEN( 3, C3, 'QLS' ) ) $ THEN MULTS = EK*( EM*( 2.D0-EK )+EN* $ ( 2.D0*EM+( EN+1.D0 ) / 2.D0 ) ) ADDS = EK*( EM*( 1.D0-EK )+EN* $ ( 2.D0*EM+( EN-1.D0 ) / 2.D0 ) )** xGEBRD: M, N => M, N* ELSE IF( LSAMEN( 3, C3, 'BRD' ) ) THEN IF( M.GE.N ) THEN MULTS = EN*( 20.D0 / 3.D0+EN* $ ( 2.D0+( 2.D0*EM-( 2.D0 / 3.D0 )*EN ) ) ) ADDS = EN*( 5.D0 / 3.D0+( EN-EM )+EN* $ ( 2.D0*EM-( 2.D0 / 3.D0 )*EN ) ) ELSE MULTS = EM*( 20.D0 / 3.D0+EM* $ ( 2.D0+( 2.D0*EN-( 2.D0 / 3.D0 )*EM ) ) ) ADDS = EM*( 5.D0 / 3.D0+( EM-EN )+EM* $ ( 2.D0*EN-( 2.D0 / 3.D0 )*EM ) ) END IF** xGEHRD: N => M* ELSE IF( LSAMEN( 3, C3, 'HRD' ) ) THEN IF( M.EQ.1 ) THEN MULTS = 0.D0 ADDS = 0.D0 ELSE MULTS = -13.D0 + EM*( -7.D0 / 6.D0+EM* $ ( 0.5D0+EM*( 5.D0 / 3.D0 ) ) ) ADDS = -8.D0 + EM*( -2.D0 / 3.D0+EM* $ ( -1.D0+EM*( 5.D0 / 3.D0 ) ) ) END IF* END IF** ----------------------------* GB: General Banded matrices* ----------------------------* Note: The operation count is overestimated because* it is assumed that the factor U fills in to the maximum* extent, i.e., that its bandwidth goes from KU to KL + KU.* ELSE IF( LSAMEN( 2, C2, 'GB' ) ) THEN** xGBTRF: M, N, KL, KU => M, N, KL, KU*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -