(s,d,c,z)lasyf.f: introduced from zlahef.f a more efficient version of the code that...
authorigor175 <igor175@8a072113-8704-0410-8d35-dd094bca7971>
Fri, 2 Nov 2012 02:00:52 +0000 (02:00 +0000)
committerigor175 <igor175@8a072113-8704-0410-8d35-dd094bca7971>
Fri, 2 Nov 2012 02:00:52 +0000 (02:00 +0000)
SRC/clasyf.f
SRC/dlasyf.f
SRC/slasyf.f
SRC/zlasyf.f

index 3720f24..5c4e2bc 100644 (file)
 *
             IF( KP.NE.KK ) THEN
 *
-*              Copy non-updated column KK to column KP
+*              Copy non-updated column KK to column KP of submatrix A
+*              at step K. No need to copy element into column K
+*              (or K and K-1) of A, since these columns will be later
+*              overwritten.
 *
-               A( KP, K ) = A( KK, K )
-               CALL CCOPY( K-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
+               A( KP, KP ) = A( KK, KK )
+               CALL CCOPY( KK-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
      $                     LDA )
-               CALL CCOPY( KP, A( 1, KK ), 1, A( 1, KP ), 1 )
+               IF( KP.GT.1 )
+     $            CALL CCOPY( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
 *
-*              Interchange rows KK and KP in last KK columns of A and W
+*              Interchange rows KK and KP in last K+1 to N columns of A
+*              (columns K (or K and K-1) of A will be later overwritten)
+*              and interchange rows KK and KP in last KKW to NB columns
+*              of W
 *
-               CALL CSWAP( N-KK+1, A( KK, KK ), LDA, A( KP, KK ), LDA )
+               IF( K.LT.N )
+     $            CALL CSWAP( N-K, A( KK, K+1 ), LDA, A( KP, K+1 ),
+     $                        LDA )
                CALL CSWAP( N-KK+1, W( KK, KKW ), LDW, W( KP, KKW ),
      $                     LDW )
             END IF
 *
             IF( KP.NE.KK ) THEN
 *
-*              Copy non-updated column KK to column KP
+*              Copy non-updated column KK to column KP of submatrix A
+*              at step K. No need to copy element into column K
+*              (or K and K+1) of A, since these columns will be later
+*              overwritten.
 *
-               A( KP, K ) = A( KK, K )
-               CALL CCOPY( KP-K-1, A( K+1, KK ), 1, A( KP, K+1 ), LDA )
-               CALL CCOPY( N-KP+1, A( KP, KK ), 1, A( KP, KP ), 1 )
+               A( KP, KP ) = A( KK, KK )
+               CALL CCOPY( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
+     $                     LDA )
+               IF( KP.LT.N )
+     $            CALL CCOPY( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
 *
-*              Interchange rows KK and KP in first KK columns of A and W
+*              Interchange rows KK and KP in first K-1 columns of A
+*              (columns K (or K and K+1) of A will be later overwritten)
+*              and interchange rows KK and KP in first KK columns of W
 *
-               CALL CSWAP( KK, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
+               IF( K.GT.1 )
+     $            CALL CSWAP( K-1, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
                CALL CSWAP( KK, W( KK, 1 ), LDW, W( KP, 1 ), LDW )
             END IF
 *
index 4e3f2ab..c02aa1d 100644 (file)
 *
             IF( KP.NE.KK ) THEN
 *
-*              Copy non-updated column KK to column KP
+*              Copy non-updated column KK to column KP of submatrix A
+*              at step K. No need to copy element into column K
+*              (or K and K-1) of A, since these columns will be later
+*              overwritten.
 *
-               A( KP, K ) = A( KK, K )
-               CALL DCOPY( K-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
+               A( KP, KP ) = A( KK, KK )
+               CALL DCOPY( KK-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
      $                     LDA )
-               CALL DCOPY( KP, A( 1, KK ), 1, A( 1, KP ), 1 )
+               IF( KP.GT.1 )
+     $            CALL DCOPY( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
 *
-*              Interchange rows KK and KP in last KK columns of A and W
+*              Interchange rows KK and KP in last K+1 to N columns of A
+*              (columns K (or K and K-1) of A will be later overwritten)
+*              and interchange rows KK and KP in last KKW to NB columns
+*              of W
 *
-               CALL DSWAP( N-KK+1, A( KK, KK ), LDA, A( KP, KK ), LDA )
+               IF( K.LT.N )
+     $            CALL DSWAP( N-K, A( KK, K+1 ), LDA, A( KP, K+1 ),
+     $                        LDA )
                CALL DSWAP( N-KK+1, W( KK, KKW ), LDW, W( KP, KKW ),
      $                     LDW )
             END IF
 *
             IF( KP.NE.KK ) THEN
 *
-*              Copy non-updated column KK to column KP
+*              Copy non-updated column KK to column KP of submatrix A
+*              at step K. No need to copy element into column K
+*              (or K and K+1) of A, since these columns will be later
+*              overwritten.
 *
-               A( KP, K ) = A( KK, K )
-               CALL DCOPY( KP-K-1, A( K+1, KK ), 1, A( KP, K+1 ), LDA )
-               CALL DCOPY( N-KP+1, A( KP, KK ), 1, A( KP, KP ), 1 )
+               A( KP, KP ) = A( KK, KK )
+               CALL DCOPY( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
+     $                     LDA )
+               IF( KP.LT.N )
+     $            CALL DCOPY( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
 *
-*              Interchange rows KK and KP in first KK columns of A and W
+*              Interchange rows KK and KP in first K-1 columns of A
+*              (columns K (or K and K+1) of A will be later overwritten)
+*              and interchange rows KK and KP in first KK columns of W
 *
-               CALL DSWAP( KK, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
+               IF( K.GT.1 )
+     $            CALL DSWAP( K-1, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
                CALL DSWAP( KK, W( KK, 1 ), LDW, W( KP, 1 ), LDW )
             END IF
 *
index f25a1f3..7c0840f 100644 (file)
 *
             IF( KP.NE.KK ) THEN
 *
-*              Copy non-updated column KK to column KP
+*              Copy non-updated column KK to column KP of submatrix A
+*              at step K. No need to copy element into column K
+*              (or K and K-1) of A, since these columns will be later
+*              overwritten.
 *
-               A( KP, K ) = A( KK, K )
-               CALL SCOPY( K-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
+               A( KP, KP ) = A( KK, KK )
+               CALL SCOPY( KK-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
      $                     LDA )
-               CALL SCOPY( KP, A( 1, KK ), 1, A( 1, KP ), 1 )
+               IF( KP.GT.1 )
+     $            CALL SCOPY( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
 *
-*              Interchange rows KK and KP in last KK columns of A and W
+*              Interchange rows KK and KP in last K+1 to N columns of A
+*              (columns K (or K and K-1) of A will be later overwritten)
+*              and interchange rows KK and KP in last KKW to NB columns
+*              of W
 *
-               CALL SSWAP( N-KK+1, A( KK, KK ), LDA, A( KP, KK ), LDA )
+               IF( K.LT.N )
+     $            CALL SSWAP( N-K, A( KK, K+1 ), LDA, A( KP, K+1 ),
+     $                        LDA )
                CALL SSWAP( N-KK+1, W( KK, KKW ), LDW, W( KP, KKW ),
      $                     LDW )
             END IF
 *
             IF( KP.NE.KK ) THEN
 *
-*              Copy non-updated column KK to column KP
+*              Copy non-updated column KK to column KP of submatrix A
+*              at step K. No need to copy element into column K
+*              (or K and K+1) of A, since these columns will be later
+*              overwritten.
 *
-               A( KP, K ) = A( KK, K )
-               CALL SCOPY( KP-K-1, A( K+1, KK ), 1, A( KP, K+1 ), LDA )
-               CALL SCOPY( N-KP+1, A( KP, KK ), 1, A( KP, KP ), 1 )
+               A( KP, KP ) = A( KK, KK )
+               CALL SCOPY( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
+     $                     LDA )
+               IF( KP.LT.N )
+     $            CALL SCOPY( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
 *
-*              Interchange rows KK and KP in first KK columns of A and W
+*              Interchange rows KK and KP in first K-1 columns of A
+*              (columns K (or K and K+1) of A will be later overwritten)
+*              and interchange rows KK and KP in first KK columns of W
 *
-               CALL SSWAP( KK, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
+               IF( K.GT.1 )
+     $            CALL SSWAP( K-1, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
                CALL SSWAP( KK, W( KK, 1 ), LDW, W( KP, 1 ), LDW )
             END IF
 *
index d41a575..3249e64 100644 (file)
 *
             IF( KP.NE.KK ) THEN
 *
-*              Copy non-updated column KK to column KP
+*              Copy non-updated column KK to column KP of submatrix A
+*              at step K. No need to copy element into column K
+*              (or K and K-1) of A, since these columns will be later
+*              overwritten.
 *
-               A( KP, K ) = A( KK, K )
-               CALL ZCOPY( K-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
+               A( KP, KP ) = A( KK, KK )
+               CALL ZCOPY( KK-1-KP, A( KP+1, KK ), 1, A( KP, KP+1 ),
      $                     LDA )
-               CALL ZCOPY( KP, A( 1, KK ), 1, A( 1, KP ), 1 )
+               IF( KP.GT.1 )
+     $            CALL ZCOPY( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
 *
-*              Interchange rows KK and KP in last KK columns of A and W
+*              Interchange rows KK and KP in last K+1 to N columns of A
+*              (columns K (or K and K-1) of A will be later overwritten)
+*              and interchange rows KK and KP in last KKW to NB columns
+*              of W
 *
-               CALL ZSWAP( N-KK+1, A( KK, KK ), LDA, A( KP, KK ), LDA )
+               IF( K.LT.N )
+     $            CALL ZSWAP( N-K, A( KK, K+1 ), LDA, A( KP, K+1 ),
+     $                        LDA )
                CALL ZSWAP( N-KK+1, W( KK, KKW ), LDW, W( KP, KKW ),
      $                     LDW )
             END IF
 *
             IF( KP.NE.KK ) THEN
 *
-*              Copy non-updated column KK to column KP
+*              Copy non-updated column KK to column KP of submatrix A
+*              at step K. No need to copy element into column K
+*              (or K and K+1) of A, since these columns will be later
+*              overwritten.
 *
-               A( KP, K ) = A( KK, K )
-               CALL ZCOPY( KP-K-1, A( K+1, KK ), 1, A( KP, K+1 ), LDA )
-               CALL ZCOPY( N-KP+1, A( KP, KK ), 1, A( KP, KP ), 1 )
+               A( KP, KP ) = A( KK, KK )
+               CALL ZCOPY( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
+     $                     LDA )
+               IF( KP.LT.N )
+     $            CALL ZCOPY( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
 *
-*              Interchange rows KK and KP in first KK columns of A and W
+*              Interchange rows KK and KP in first K-1 columns of A
+*              (columns K (or K and K+1) of A will be later overwritten)
+*              and interchange rows KK and KP in first KK columns of W
 *
-               CALL ZSWAP( KK, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
+               IF( K.GT.1 )
+     $            CALL ZSWAP( K-1, A( KK, 1 ), LDA, A( KP, 1 ), LDA )
                CALL ZSWAP( KK, W( KK, 1 ), LDW, W( KP, 1 ), LDW )
             END IF
 *