removed lapack 3.6.0

This commit is contained in:
Werner Saar
2017-01-06 11:44:57 +01:00
parent 8f9975e013
commit 8cd46acebb
5835 changed files with 0 additions and 1612856 deletions

View File

@@ -1,223 +0,0 @@
C> \brief \b CGETRF VARIANT: Crout Level 3 BLAS version of the algorithm.
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE CGETRF ( M, N, A, LDA, IPIV, INFO)
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* COMPLEX A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> CGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This is the Crout Level 3 BLAS version of the algorithm.
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is COMPLEX array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE CGETRF ( M, N, A, LDA, IPIV, INFO)
*
* -- LAPACK computational routine (version 3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
COMPLEX A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
COMPLEX ONE
PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ) )
* ..
* .. Local Scalars ..
INTEGER I, IINFO, J, JB, NB
* ..
* .. External Subroutines ..
EXTERNAL CGEMM, CGETF2, CLASWP, CTRSM, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Determine the block size for this environment.
*
NB = ILAENV( 1, 'CGETRF', ' ', M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
*
* Use unblocked code.
*
CALL CGETF2( M, N, A, LDA, IPIV, INFO )
ELSE
*
* Use blocked code.
*
DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
*
* Update current block.
*
CALL CGEMM( 'No transpose', 'No transpose',
$ M-J+1, JB, J-1, -ONE,
$ A( J, 1 ), LDA, A( 1, J ), LDA, ONE,
$ A( J, J ), LDA )
*
* Factor diagonal and subdiagonal blocks and test for exact
* singularity.
*
CALL CGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
*
* Adjust INFO and the pivot indices.
*
IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
*
* Apply interchanges to column 1:J-1
*
CALL CLASWP( J-1, A, LDA, J, J+JB-1, IPIV, 1 )
*
IF ( J+JB.LE.N ) THEN
*
* Apply interchanges to column J+JB:N
*
CALL CLASWP( N-J-JB+1, A( 1, J+JB ), LDA, J, J+JB-1,
$ IPIV, 1 )
*
CALL CGEMM( 'No transpose', 'No transpose',
$ JB, N-J-JB+1, J-1, -ONE,
$ A( J, 1 ), LDA, A( 1, J+JB ), LDA, ONE,
$ A( J, J+JB ), LDA )
*
* Compute block row of U.
*
CALL CTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ JB, N-J-JB+1, ONE, A( J, J ), LDA,
$ A( J, J+JB ), LDA )
END IF
20 CONTINUE
END IF
RETURN
*
* End of CGETRF
*
END

View File

@@ -1,223 +0,0 @@
C> \brief \b DGETRF VARIANT: Crout Level 3 BLAS version of the algorithm.
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE DGETRF ( M, N, A, LDA, IPIV, INFO)
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* DOUBLE PRECISION A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> DGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This is the Crout Level 3 BLAS version of the algorithm.
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is DOUBLE PRECISION array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE DGETRF ( M, N, A, LDA, IPIV, INFO)
*
* -- LAPACK computational routine (version 3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
DOUBLE PRECISION A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
DOUBLE PRECISION ONE
PARAMETER ( ONE = 1.0D+0 )
* ..
* .. Local Scalars ..
INTEGER I, IINFO, J, JB, NB
* ..
* .. External Subroutines ..
EXTERNAL DGEMM, DGETF2, DLASWP, DTRSM, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'DGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Determine the block size for this environment.
*
NB = ILAENV( 1, 'DGETRF', ' ', M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
*
* Use unblocked code.
*
CALL DGETF2( M, N, A, LDA, IPIV, INFO )
ELSE
*
* Use blocked code.
*
DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
*
* Update current block.
*
CALL DGEMM( 'No transpose', 'No transpose',
$ M-J+1, JB, J-1, -ONE,
$ A( J, 1 ), LDA, A( 1, J ), LDA, ONE,
$ A( J, J ), LDA )
*
* Factor diagonal and subdiagonal blocks and test for exact
* singularity.
*
CALL DGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
*
* Adjust INFO and the pivot indices.
*
IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
*
* Apply interchanges to column 1:J-1
*
CALL DLASWP( J-1, A, LDA, J, J+JB-1, IPIV, 1 )
*
IF ( J+JB.LE.N ) THEN
*
* Apply interchanges to column J+JB:N
*
CALL DLASWP( N-J-JB+1, A( 1, J+JB ), LDA, J, J+JB-1,
$ IPIV, 1 )
*
CALL DGEMM( 'No transpose', 'No transpose',
$ JB, N-J-JB+1, J-1, -ONE,
$ A( J, 1 ), LDA, A( 1, J+JB ), LDA, ONE,
$ A( J, J+JB ), LDA )
*
* Compute block row of U.
*
CALL DTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ JB, N-J-JB+1, ONE, A( J, J ), LDA,
$ A( J, J+JB ), LDA )
END IF
20 CONTINUE
END IF
RETURN
*
* End of DGETRF
*
END

View File

@@ -1,223 +0,0 @@
C> \brief \b SGETRF VARIANT: Crout Level 3 BLAS version of the algorithm.
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE SGETRF ( M, N, A, LDA, IPIV, INFO)
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* REAL A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> SGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This is the Crout Level 3 BLAS version of the algorithm.
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is REAL array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE SGETRF ( M, N, A, LDA, IPIV, INFO)
*
* -- LAPACK computational routine (version 3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
REAL A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
REAL ONE
PARAMETER ( ONE = 1.0E+0 )
* ..
* .. Local Scalars ..
INTEGER I, IINFO, J, JB, NB
* ..
* .. External Subroutines ..
EXTERNAL SGEMM, SGETF2, SLASWP, STRSM, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'SGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Determine the block size for this environment.
*
NB = ILAENV( 1, 'SGETRF', ' ', M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
*
* Use unblocked code.
*
CALL SGETF2( M, N, A, LDA, IPIV, INFO )
ELSE
*
* Use blocked code.
*
DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
*
* Update current block.
*
CALL SGEMM( 'No transpose', 'No transpose',
$ M-J+1, JB, J-1, -ONE,
$ A( J, 1 ), LDA, A( 1, J ), LDA, ONE,
$ A( J, J ), LDA )
*
* Factor diagonal and subdiagonal blocks and test for exact
* singularity.
*
CALL SGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
*
* Adjust INFO and the pivot indices.
*
IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
*
* Apply interchanges to column 1:J-1
*
CALL SLASWP( J-1, A, LDA, J, J+JB-1, IPIV, 1 )
*
IF ( J+JB.LE.N ) THEN
*
* Apply interchanges to column J+JB:N
*
CALL SLASWP( N-J-JB+1, A( 1, J+JB ), LDA, J, J+JB-1,
$ IPIV, 1 )
*
CALL SGEMM( 'No transpose', 'No transpose',
$ JB, N-J-JB+1, J-1, -ONE,
$ A( J, 1 ), LDA, A( 1, J+JB ), LDA, ONE,
$ A( J, J+JB ), LDA )
*
* Compute block row of U.
*
CALL STRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ JB, N-J-JB+1, ONE, A( J, J ), LDA,
$ A( J, J+JB ), LDA )
END IF
20 CONTINUE
END IF
RETURN
*
* End of SGETRF
*
END

View File

@@ -1,223 +0,0 @@
C> \brief \b ZGETRF VARIANT: Crout Level 3 BLAS version of the algorithm.
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE ZGETRF ( M, N, A, LDA, IPIV, INFO)
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* COMPLEX*16 A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> ZGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This is the Crout Level 3 BLAS version of the algorithm.
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is COMPLEX*16 array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE ZGETRF ( M, N, A, LDA, IPIV, INFO)
*
* -- LAPACK computational routine (version 3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
COMPLEX*16 A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
COMPLEX*16 ONE
PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )
* ..
* .. Local Scalars ..
INTEGER I, IINFO, J, JB, NB
* ..
* .. External Subroutines ..
EXTERNAL ZGEMM, ZGETF2, ZLASWP, ZTRSM, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'ZGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Determine the block size for this environment.
*
NB = ILAENV( 1, 'ZGETRF', ' ', M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
*
* Use unblocked code.
*
CALL ZGETF2( M, N, A, LDA, IPIV, INFO )
ELSE
*
* Use blocked code.
*
DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
*
* Update current block.
*
CALL ZGEMM( 'No transpose', 'No transpose',
$ M-J+1, JB, J-1, -ONE,
$ A( J, 1 ), LDA, A( 1, J ), LDA, ONE,
$ A( J, J ), LDA )
*
* Factor diagonal and subdiagonal blocks and test for exact
* singularity.
*
CALL ZGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
*
* Adjust INFO and the pivot indices.
*
IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
*
* Apply interchanges to column 1:J-1
*
CALL ZLASWP( J-1, A, LDA, J, J+JB-1, IPIV, 1 )
*
IF ( J+JB.LE.N ) THEN
*
* Apply interchanges to column J+JB:N
*
CALL ZLASWP( N-J-JB+1, A( 1, J+JB ), LDA, J, J+JB-1,
$ IPIV, 1 )
*
CALL ZGEMM( 'No transpose', 'No transpose',
$ JB, N-J-JB+1, J-1, -ONE,
$ A( J, 1 ), LDA, A( 1, J+JB ), LDA, ONE,
$ A( J, J+JB ), LDA )
*
* Compute block row of U.
*
CALL ZTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ JB, N-J-JB+1, ONE, A( J, J ), LDA,
$ A( J, J+JB ), LDA )
END IF
20 CONTINUE
END IF
RETURN
*
* End of ZGETRF
*
END

View File

@@ -1,248 +0,0 @@
C> \brief \b CGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE CGETRF ( M, N, A, LDA, IPIV, INFO)
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* COMPLEX A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> CGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This is the left-looking Level 3 BLAS version of the algorithm.
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is COMPLEX array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE CGETRF ( M, N, A, LDA, IPIV, INFO)
*
* -- LAPACK computational routine (version 3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
COMPLEX A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
COMPLEX ONE
PARAMETER ( ONE = (1.0E+0, 0.0E+0) )
* ..
* .. Local Scalars ..
INTEGER I, IINFO, J, JB, K, NB
* ..
* .. External Subroutines ..
EXTERNAL CGEMM, CGETF2, CLASWP, CTRSM, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Determine the block size for this environment.
*
NB = ILAENV( 1, 'CGETRF', ' ', M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
*
* Use unblocked code.
*
CALL CGETF2( M, N, A, LDA, IPIV, INFO )
ELSE
*
* Use blocked code.
*
DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
*
*
* Update before factoring the current panel
*
DO 30 K = 1, J-NB, NB
*
* Apply interchanges to rows K:K+NB-1.
*
CALL CLASWP( JB, A(1, J), LDA, K, K+NB-1, IPIV, 1 )
*
* Compute block row of U.
*
CALL CTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ NB, JB, ONE, A( K, K ), LDA,
$ A( K, J ), LDA )
*
* Update trailing submatrix.
*
CALL CGEMM( 'No transpose', 'No transpose',
$ M-K-NB+1, JB, NB, -ONE,
$ A( K+NB, K ), LDA, A( K, J ), LDA, ONE,
$ A( K+NB, J ), LDA )
30 CONTINUE
*
* Factor diagonal and subdiagonal blocks and test for exact
* singularity.
*
CALL CGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
*
* Adjust INFO and the pivot indices.
*
IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
*
20 CONTINUE
*
* Apply interchanges to the left-overs
*
DO 40 K = 1, MIN( M, N ), NB
CALL CLASWP( K-1, A( 1, 1 ), LDA, K,
$ MIN (K+NB-1, MIN ( M, N )), IPIV, 1 )
40 CONTINUE
*
* Apply update to the M+1:N columns when N > M
*
IF ( N.GT.M ) THEN
CALL CLASWP( N-M, A(1, M+1), LDA, 1, M, IPIV, 1 )
DO 50 K = 1, M, NB
JB = MIN( M-K+1, NB )
*
CALL CTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ JB, N-M, ONE, A( K, K ), LDA,
$ A( K, M+1 ), LDA )
*
IF ( K+NB.LE.M ) THEN
CALL CGEMM( 'No transpose', 'No transpose',
$ M-K-NB+1, N-M, NB, -ONE,
$ A( K+NB, K ), LDA, A( K, M+1 ), LDA, ONE,
$ A( K+NB, M+1 ), LDA )
END IF
50 CONTINUE
END IF
*
END IF
RETURN
*
* End of CGETRF
*
END

View File

@@ -1,247 +0,0 @@
C> \brief \b DGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE DGETRF ( M, N, A, LDA, IPIV, INFO)
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* DOUBLE PRECISION A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> DGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This is the left-looking Level 3 BLAS version of the algorithm.
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is DOUBLE PRECISION array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE DGETRF ( M, N, A, LDA, IPIV, INFO)
*
* -- LAPACK computational routine (version 3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
DOUBLE PRECISION A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
DOUBLE PRECISION ONE
PARAMETER ( ONE = 1.0D+0 )
* ..
* .. Local Scalars ..
INTEGER I, IINFO, J, JB, K, NB
* ..
* .. External Subroutines ..
EXTERNAL DGEMM, DGETF2, DLASWP, DTRSM, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'DGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Determine the block size for this environment.
*
NB = ILAENV( 1, 'DGETRF', ' ', M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
*
* Use unblocked code.
*
CALL DGETF2( M, N, A, LDA, IPIV, INFO )
ELSE
*
* Use blocked code.
*
DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
*
* Update before factoring the current panel
*
DO 30 K = 1, J-NB, NB
*
* Apply interchanges to rows K:K+NB-1.
*
CALL DLASWP( JB, A(1, J), LDA, K, K+NB-1, IPIV, 1 )
*
* Compute block row of U.
*
CALL DTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ NB, JB, ONE, A( K, K ), LDA,
$ A( K, J ), LDA )
*
* Update trailing submatrix.
*
CALL DGEMM( 'No transpose', 'No transpose',
$ M-K-NB+1, JB, NB, -ONE,
$ A( K+NB, K ), LDA, A( K, J ), LDA, ONE,
$ A( K+NB, J ), LDA )
30 CONTINUE
*
* Factor diagonal and subdiagonal blocks and test for exact
* singularity.
*
CALL DGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
*
* Adjust INFO and the pivot indices.
*
IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
*
20 CONTINUE
*
* Apply interchanges to the left-overs
*
DO 40 K = 1, MIN( M, N ), NB
CALL DLASWP( K-1, A( 1, 1 ), LDA, K,
$ MIN (K+NB-1, MIN ( M, N )), IPIV, 1 )
40 CONTINUE
*
* Apply update to the M+1:N columns when N > M
*
IF ( N.GT.M ) THEN
CALL DLASWP( N-M, A(1, M+1), LDA, 1, M, IPIV, 1 )
DO 50 K = 1, M, NB
JB = MIN( M-K+1, NB )
*
CALL DTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ JB, N-M, ONE, A( K, K ), LDA,
$ A( K, M+1 ), LDA )
*
IF ( K+NB.LE.M ) THEN
CALL DGEMM( 'No transpose', 'No transpose',
$ M-K-NB+1, N-M, NB, -ONE,
$ A( K+NB, K ), LDA, A( K, M+1 ), LDA, ONE,
$ A( K+NB, M+1 ), LDA )
END IF
50 CONTINUE
END IF
*
END IF
RETURN
*
* End of DGETRF
*
END

View File

@@ -1,248 +0,0 @@
C> \brief \b SGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE SGETRF ( M, N, A, LDA, IPIV, INFO)
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* REAL A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> SGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This is the left-looking Level 3 BLAS version of the algorithm.
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is REAL array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE SGETRF ( M, N, A, LDA, IPIV, INFO)
*
* -- LAPACK computational routine (version 3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
REAL A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
REAL ONE
PARAMETER ( ONE = 1.0E+0 )
* ..
* .. Local Scalars ..
INTEGER I, IINFO, J, JB, K, NB
* ..
* .. External Subroutines ..
EXTERNAL SGEMM, SGETF2, SLASWP, STRSM, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'SGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Determine the block size for this environment.
*
NB = ILAENV( 1, 'SGETRF', ' ', M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
*
* Use unblocked code.
*
CALL SGETF2( M, N, A, LDA, IPIV, INFO )
ELSE
*
* Use blocked code.
*
DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
*
*
* Update before factoring the current panel
*
DO 30 K = 1, J-NB, NB
*
* Apply interchanges to rows K:K+NB-1.
*
CALL SLASWP( JB, A(1, J), LDA, K, K+NB-1, IPIV, 1 )
*
* Compute block row of U.
*
CALL STRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ NB, JB, ONE, A( K, K ), LDA,
$ A( K, J ), LDA )
*
* Update trailing submatrix.
*
CALL SGEMM( 'No transpose', 'No transpose',
$ M-K-NB+1, JB, NB, -ONE,
$ A( K+NB, K ), LDA, A( K, J ), LDA, ONE,
$ A( K+NB, J ), LDA )
30 CONTINUE
*
* Factor diagonal and subdiagonal blocks and test for exact
* singularity.
*
CALL SGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
*
* Adjust INFO and the pivot indices.
*
IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
*
20 CONTINUE
*
* Apply interchanges to the left-overs
*
DO 40 K = 1, MIN( M, N ), NB
CALL SLASWP( K-1, A( 1, 1 ), LDA, K,
$ MIN (K+NB-1, MIN ( M, N )), IPIV, 1 )
40 CONTINUE
*
* Apply update to the M+1:N columns when N > M
*
IF ( N.GT.M ) THEN
CALL SLASWP( N-M, A(1, M+1), LDA, 1, M, IPIV, 1 )
DO 50 K = 1, M, NB
JB = MIN( M-K+1, NB )
*
CALL STRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ JB, N-M, ONE, A( K, K ), LDA,
$ A( K, M+1 ), LDA )
*
IF ( K+NB.LE.M ) THEN
CALL SGEMM( 'No transpose', 'No transpose',
$ M-K-NB+1, N-M, NB, -ONE,
$ A( K+NB, K ), LDA, A( K, M+1 ), LDA, ONE,
$ A( K+NB, M+1 ), LDA )
END IF
50 CONTINUE
END IF
*
END IF
RETURN
*
* End of SGETRF
*
END

View File

@@ -1,248 +0,0 @@
C> \brief \b ZGETRF VARIANT: left-looking Level 3 BLAS version of the algorithm.
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE ZGETRF ( M, N, A, LDA, IPIV, INFO)
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* COMPLEX*16 A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> ZGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This is the left-looking Level 3 BLAS version of the algorithm.
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is COMPLEX*16 array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE ZGETRF ( M, N, A, LDA, IPIV, INFO)
*
* -- LAPACK computational routine (version 3.1) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
COMPLEX*16 A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
COMPLEX*16 ONE
PARAMETER ( ONE = (1.0D+0, 0.0D+0) )
* ..
* .. Local Scalars ..
INTEGER I, IINFO, J, JB, K, NB
* ..
* .. External Subroutines ..
EXTERNAL ZGEMM, ZGETF2, ZLASWP, ZTRSM, XERBLA
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'ZGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Determine the block size for this environment.
*
NB = ILAENV( 1, 'ZGETRF', ' ', M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
*
* Use unblocked code.
*
CALL ZGETF2( M, N, A, LDA, IPIV, INFO )
ELSE
*
* Use blocked code.
*
DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
*
*
* Update before factoring the current panel
*
DO 30 K = 1, J-NB, NB
*
* Apply interchanges to rows K:K+NB-1.
*
CALL ZLASWP( JB, A(1, J), LDA, K, K+NB-1, IPIV, 1 )
*
* Compute block row of U.
*
CALL ZTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ NB, JB, ONE, A( K, K ), LDA,
$ A( K, J ), LDA )
*
* Update trailing submatrix.
*
CALL ZGEMM( 'No transpose', 'No transpose',
$ M-K-NB+1, JB, NB, -ONE,
$ A( K+NB, K ), LDA, A( K, J ), LDA, ONE,
$ A( K+NB, J ), LDA )
30 CONTINUE
*
* Factor diagonal and subdiagonal blocks and test for exact
* singularity.
*
CALL ZGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
*
* Adjust INFO and the pivot indices.
*
IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
*
20 CONTINUE
*
* Apply interchanges to the left-overs
*
DO 40 K = 1, MIN( M, N ), NB
CALL ZLASWP( K-1, A( 1, 1 ), LDA, K,
$ MIN (K+NB-1, MIN ( M, N )), IPIV, 1 )
40 CONTINUE
*
* Apply update to the M+1:N columns when N > M
*
IF ( N.GT.M ) THEN
CALL ZLASWP( N-M, A(1, M+1), LDA, 1, M, IPIV, 1 )
DO 50 K = 1, M, NB
JB = MIN( M-K+1, NB )
*
CALL ZTRSM( 'Left', 'Lower', 'No transpose', 'Unit',
$ JB, N-M, ONE, A( K, K ), LDA,
$ A( K, M+1 ), LDA )
*
IF ( K+NB.LE.M ) THEN
CALL ZGEMM( 'No transpose', 'No transpose',
$ M-K-NB+1, N-M, NB, -ONE,
$ A( K+NB, K ), LDA, A( K, M+1 ), LDA, ONE,
$ A( K+NB, M+1 ), LDA )
END IF
50 CONTINUE
END IF
*
END IF
RETURN
*
* End of ZGETRF
*
END

View File

@@ -1,281 +0,0 @@
C> \brief \b CGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE CGETRF( M, N, A, LDA, IPIV, INFO )
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* COMPLEX A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> CGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This code implements an iterative version of Sivan Toledo's recursive
C> LU algorithm[1]. For square matrices, this iterative versions should
C> be within a factor of two of the optimum number of memory transfers.
C>
C> The pattern is as follows, with the large blocks of U being updated
C> in one call to DTRSM, and the dotted lines denoting sections that
C> have had all pending permutations applied:
C>
C> 1 2 3 4 5 6 7 8
C> +-+-+---+-------+------
C> | |1| | |
C> |.+-+ 2 | |
C> | | | | |
C> |.|.+-+-+ 4 |
C> | | | |1| |
C> | | |.+-+ |
C> | | | | | |
C> |.|.|.|.+-+-+---+ 8
C> | | | | | |1| |
C> | | | | |.+-+ 2 |
C> | | | | | | | |
C> | | | | |.|.+-+-+
C> | | | | | | | |1|
C> | | | | | | |.+-+
C> | | | | | | | | |
C> |.|.|.|.|.|.|.|.+-----
C> | | | | | | | | |
C>
C> The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in
C> the binary expansion of the current column. Each Schur update is
C> applied as soon as the necessary portion of U is available.
C>
C> [1] Toledo, S. 1997. Locality of Reference in LU Decomposition with
C> Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997),
C> 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is COMPLEX array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE CGETRF( M, N, A, LDA, IPIV, INFO )
*
* -- LAPACK computational routine (version 3.X) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
COMPLEX A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
COMPLEX ONE, NEGONE
REAL ZERO
PARAMETER ( ONE = (1.0E+0, 0.0E+0) )
PARAMETER ( NEGONE = (-1.0E+0, 0.0E+0) )
PARAMETER ( ZERO = 0.0E+0 )
* ..
* .. Local Scalars ..
REAL SFMIN, PIVMAG
COMPLEX TMP
INTEGER I, J, JP, NSTEP, NTOPIV, NPIVED, KAHEAD
INTEGER KSTART, IPIVSTART, JPIVSTART, KCOLS
* ..
* .. External Functions ..
REAL SLAMCH
INTEGER ICAMAX
LOGICAL SISNAN
EXTERNAL SLAMCH, ICAMAX, SISNAN
* ..
* .. External Subroutines ..
EXTERNAL CTRSM, CSCAL, XERBLA, CLASWP
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN, IAND, ABS
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'CGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Compute machine safe minimum
*
SFMIN = SLAMCH( 'S' )
*
NSTEP = MIN( M, N )
DO J = 1, NSTEP
KAHEAD = IAND( J, -J )
KSTART = J + 1 - KAHEAD
KCOLS = MIN( KAHEAD, M-J )
*
* Find pivot.
*
JP = J - 1 + ICAMAX( M-J+1, A( J, J ), 1 )
IPIV( J ) = JP
* Permute just this column.
IF (JP .NE. J) THEN
TMP = A( J, J )
A( J, J ) = A( JP, J )
A( JP, J ) = TMP
END IF
* Apply pending permutations to L
NTOPIV = 1
IPIVSTART = J
JPIVSTART = J - NTOPIV
DO WHILE ( NTOPIV .LT. KAHEAD )
CALL CLASWP( NTOPIV, A( 1, JPIVSTART ), LDA, IPIVSTART, J,
$ IPIV, 1 )
IPIVSTART = IPIVSTART - NTOPIV;
NTOPIV = NTOPIV * 2;
JPIVSTART = JPIVSTART - NTOPIV;
END DO
* Permute U block to match L
CALL CLASWP( KCOLS, A( 1,J+1 ), LDA, KSTART, J, IPIV, 1 )
* Factor the current column
PIVMAG = ABS( A( J, J ) )
IF( PIVMAG.NE.ZERO .AND. .NOT.SISNAN( PIVMAG ) ) THEN
IF( PIVMAG .GE. SFMIN ) THEN
CALL CSCAL( M-J, ONE / A( J, J ), A( J+1, J ), 1 )
ELSE
DO I = 1, M-J
A( J+I, J ) = A( J+I, J ) / A( J, J )
END DO
END IF
ELSE IF( PIVMAG .EQ. ZERO .AND. INFO .EQ. 0 ) THEN
INFO = J
END IF
* Solve for U block.
CALL CTRSM( 'Left', 'Lower', 'No transpose', 'Unit', KAHEAD,
$ KCOLS, ONE, A( KSTART, KSTART ), LDA,
$ A( KSTART, J+1 ), LDA )
* Schur complement.
CALL CGEMM( 'No transpose', 'No transpose', M-J,
$ KCOLS, KAHEAD, NEGONE, A( J+1, KSTART ), LDA,
$ A( KSTART, J+1 ), LDA, ONE, A( J+1, J+1 ), LDA )
END DO
* Handle pivot permutations on the way out of the recursion
NPIVED = IAND( NSTEP, -NSTEP )
J = NSTEP - NPIVED
DO WHILE ( J .GT. 0 )
NTOPIV = IAND( J, -J )
CALL CLASWP( NTOPIV, A( 1, J-NTOPIV+1 ), LDA, J+1, NSTEP,
$ IPIV, 1 )
J = J - NTOPIV
END DO
* If short and wide, handle the rest of the columns.
IF ( M .LT. N ) THEN
CALL CLASWP( N-M, A( 1, M+KCOLS+1 ), LDA, 1, M, IPIV, 1 )
CALL CTRSM( 'Left', 'Lower', 'No transpose', 'Unit', M,
$ N-M, ONE, A, LDA, A( 1,M+KCOLS+1 ), LDA )
END IF
RETURN
*
* End of CGETRF
*
END

View File

@@ -1,277 +0,0 @@
C> \brief \b DGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE DGETRF( M, N, A, LDA, IPIV, INFO )
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* DOUBLE PRECISION A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> DGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This code implements an iterative version of Sivan Toledo's recursive
C> LU algorithm[1]. For square matrices, this iterative versions should
C> be within a factor of two of the optimum number of memory transfers.
C>
C> The pattern is as follows, with the large blocks of U being updated
C> in one call to DTRSM, and the dotted lines denoting sections that
C> have had all pending permutations applied:
C>
C> 1 2 3 4 5 6 7 8
C> +-+-+---+-------+------
C> | |1| | |
C> |.+-+ 2 | |
C> | | | | |
C> |.|.+-+-+ 4 |
C> | | | |1| |
C> | | |.+-+ |
C> | | | | | |
C> |.|.|.|.+-+-+---+ 8
C> | | | | | |1| |
C> | | | | |.+-+ 2 |
C> | | | | | | | |
C> | | | | |.|.+-+-+
C> | | | | | | | |1|
C> | | | | | | |.+-+
C> | | | | | | | | |
C> |.|.|.|.|.|.|.|.+-----
C> | | | | | | | | |
C>
C> The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in
C> the binary expansion of the current column. Each Schur update is
C> applied as soon as the necessary portion of U is available.
C>
C> [1] Toledo, S. 1997. Locality of Reference in LU Decomposition with
C> Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997),
C> 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is DOUBLE PRECISION array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE DGETRF( M, N, A, LDA, IPIV, INFO )
*
* -- LAPACK computational routine (version 3.X) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
DOUBLE PRECISION A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
DOUBLE PRECISION ONE, ZERO, NEGONE
PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
PARAMETER ( NEGONE = -1.0D+0 )
* ..
* .. Local Scalars ..
DOUBLE PRECISION SFMIN, TMP
INTEGER I, J, JP, NSTEP, NTOPIV, NPIVED, KAHEAD
INTEGER KSTART, IPIVSTART, JPIVSTART, KCOLS
* ..
* .. External Functions ..
DOUBLE PRECISION DLAMCH
INTEGER IDAMAX
LOGICAL DISNAN
EXTERNAL DLAMCH, IDAMAX, DISNAN
* ..
* .. External Subroutines ..
EXTERNAL DTRSM, DSCAL, XERBLA, DLASWP
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN, IAND
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'DGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Compute machine safe minimum
*
SFMIN = DLAMCH( 'S' )
*
NSTEP = MIN( M, N )
DO J = 1, NSTEP
KAHEAD = IAND( J, -J )
KSTART = J + 1 - KAHEAD
KCOLS = MIN( KAHEAD, M-J )
*
* Find pivot.
*
JP = J - 1 + IDAMAX( M-J+1, A( J, J ), 1 )
IPIV( J ) = JP
* Permute just this column.
IF (JP .NE. J) THEN
TMP = A( J, J )
A( J, J ) = A( JP, J )
A( JP, J ) = TMP
END IF
* Apply pending permutations to L
NTOPIV = 1
IPIVSTART = J
JPIVSTART = J - NTOPIV
DO WHILE ( NTOPIV .LT. KAHEAD )
CALL DLASWP( NTOPIV, A( 1, JPIVSTART ), LDA, IPIVSTART, J,
$ IPIV, 1 )
IPIVSTART = IPIVSTART - NTOPIV;
NTOPIV = NTOPIV * 2;
JPIVSTART = JPIVSTART - NTOPIV;
END DO
* Permute U block to match L
CALL DLASWP( KCOLS, A( 1,J+1 ), LDA, KSTART, J, IPIV, 1 )
* Factor the current column
IF( A( J, J ).NE.ZERO .AND. .NOT.DISNAN( A( J, J ) ) ) THEN
IF( ABS(A( J, J )) .GE. SFMIN ) THEN
CALL DSCAL( M-J, ONE / A( J, J ), A( J+1, J ), 1 )
ELSE
DO I = 1, M-J
A( J+I, J ) = A( J+I, J ) / A( J, J )
END DO
END IF
ELSE IF( A( J,J ) .EQ. ZERO .AND. INFO .EQ. 0 ) THEN
INFO = J
END IF
* Solve for U block.
CALL DTRSM( 'Left', 'Lower', 'No transpose', 'Unit', KAHEAD,
$ KCOLS, ONE, A( KSTART, KSTART ), LDA,
$ A( KSTART, J+1 ), LDA )
* Schur complement.
CALL DGEMM( 'No transpose', 'No transpose', M-J,
$ KCOLS, KAHEAD, NEGONE, A( J+1, KSTART ), LDA,
$ A( KSTART, J+1 ), LDA, ONE, A( J+1, J+1 ), LDA )
END DO
* Handle pivot permutations on the way out of the recursion
NPIVED = IAND( NSTEP, -NSTEP )
J = NSTEP - NPIVED
DO WHILE ( J .GT. 0 )
NTOPIV = IAND( J, -J )
CALL DLASWP( NTOPIV, A( 1, J-NTOPIV+1 ), LDA, J+1, NSTEP,
$ IPIV, 1 )
J = J - NTOPIV
END DO
* If short and wide, handle the rest of the columns.
IF ( M .LT. N ) THEN
CALL DLASWP( N-M, A( 1, M+KCOLS+1 ), LDA, 1, M, IPIV, 1 )
CALL DTRSM( 'Left', 'Lower', 'No transpose', 'Unit', M,
$ N-M, ONE, A, LDA, A( 1,M+KCOLS+1 ), LDA )
END IF
RETURN
*
* End of DGETRF
*
END

View File

@@ -1,277 +0,0 @@
C> \brief \b SGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE SGETRF( M, N, A, LDA, IPIV, INFO )
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* REAL A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> SGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This code implements an iterative version of Sivan Toledo's recursive
C> LU algorithm[1]. For square matrices, this iterative versions should
C> be within a factor of two of the optimum number of memory transfers.
C>
C> The pattern is as follows, with the large blocks of U being updated
C> in one call to STRSM, and the dotted lines denoting sections that
C> have had all pending permutations applied:
C>
C> 1 2 3 4 5 6 7 8
C> +-+-+---+-------+------
C> | |1| | |
C> |.+-+ 2 | |
C> | | | | |
C> |.|.+-+-+ 4 |
C> | | | |1| |
C> | | |.+-+ |
C> | | | | | |
C> |.|.|.|.+-+-+---+ 8
C> | | | | | |1| |
C> | | | | |.+-+ 2 |
C> | | | | | | | |
C> | | | | |.|.+-+-+
C> | | | | | | | |1|
C> | | | | | | |.+-+
C> | | | | | | | | |
C> |.|.|.|.|.|.|.|.+-----
C> | | | | | | | | |
C>
C> The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in
C> the binary expansion of the current column. Each Schur update is
C> applied as soon as the necessary portion of U is available.
C>
C> [1] Toledo, S. 1997. Locality of Reference in LU Decomposition with
C> Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997),
C> 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is REAL array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE SGETRF( M, N, A, LDA, IPIV, INFO )
*
* -- LAPACK computational routine (version 3.X) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
REAL A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
REAL ONE, ZERO, NEGONE
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
PARAMETER ( NEGONE = -1.0E+0 )
* ..
* .. Local Scalars ..
REAL SFMIN, TMP
INTEGER I, J, JP, NSTEP, NTOPIV, NPIVED, KAHEAD
INTEGER KSTART, IPIVSTART, JPIVSTART, KCOLS
* ..
* .. External Functions ..
REAL SLAMCH
INTEGER ISAMAX
LOGICAL SISNAN
EXTERNAL SLAMCH, ISAMAX, SISNAN
* ..
* .. External Subroutines ..
EXTERNAL STRSM, SSCAL, XERBLA, SLASWP
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN, IAND
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'SGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Compute machine safe minimum
*
SFMIN = SLAMCH( 'S' )
*
NSTEP = MIN( M, N )
DO J = 1, NSTEP
KAHEAD = IAND( J, -J )
KSTART = J + 1 - KAHEAD
KCOLS = MIN( KAHEAD, M-J )
*
* Find pivot.
*
JP = J - 1 + ISAMAX( M-J+1, A( J, J ), 1 )
IPIV( J ) = JP
! Permute just this column.
IF (JP .NE. J) THEN
TMP = A( J, J )
A( J, J ) = A( JP, J )
A( JP, J ) = TMP
END IF
! Apply pending permutations to L
NTOPIV = 1
IPIVSTART = J
JPIVSTART = J - NTOPIV
DO WHILE ( NTOPIV .LT. KAHEAD )
CALL SLASWP( NTOPIV, A( 1, JPIVSTART ), LDA, IPIVSTART, J,
$ IPIV, 1 )
IPIVSTART = IPIVSTART - NTOPIV;
NTOPIV = NTOPIV * 2;
JPIVSTART = JPIVSTART - NTOPIV;
END DO
! Permute U block to match L
CALL SLASWP( KCOLS, A( 1,J+1 ), LDA, KSTART, J, IPIV, 1 )
! Factor the current column
IF( A( J, J ).NE.ZERO .AND. .NOT.SISNAN( A( J, J ) ) ) THEN
IF( ABS(A( J, J )) .GE. SFMIN ) THEN
CALL SSCAL( M-J, ONE / A( J, J ), A( J+1, J ), 1 )
ELSE
DO I = 1, M-J
A( J+I, J ) = A( J+I, J ) / A( J, J )
END DO
END IF
ELSE IF( A( J,J ) .EQ. ZERO .AND. INFO .EQ. 0 ) THEN
INFO = J
END IF
! Solve for U block.
CALL STRSM( 'Left', 'Lower', 'No transpose', 'Unit', KAHEAD,
$ KCOLS, ONE, A( KSTART, KSTART ), LDA,
$ A( KSTART, J+1 ), LDA )
! Schur complement.
CALL SGEMM( 'No transpose', 'No transpose', M-J,
$ KCOLS, KAHEAD, NEGONE, A( J+1, KSTART ), LDA,
$ A( KSTART, J+1 ), LDA, ONE, A( J+1, J+1 ), LDA )
END DO
! Handle pivot permutations on the way out of the recursion
NPIVED = IAND( NSTEP, -NSTEP )
J = NSTEP - NPIVED
DO WHILE ( J .GT. 0 )
NTOPIV = IAND( J, -J )
CALL SLASWP( NTOPIV, A( 1, J-NTOPIV+1 ), LDA, J+1, NSTEP,
$ IPIV, 1 )
J = J - NTOPIV
END DO
! If short and wide, handle the rest of the columns.
IF ( M .LT. N ) THEN
CALL SLASWP( N-M, A( 1, M+KCOLS+1 ), LDA, 1, M, IPIV, 1 )
CALL STRSM( 'Left', 'Lower', 'No transpose', 'Unit', M,
$ N-M, ONE, A, LDA, A( 1,M+KCOLS+1 ), LDA )
END IF
RETURN
*
* End of SGETRF
*
END

View File

@@ -1,281 +0,0 @@
C> \brief \b ZGETRF VARIANT: iterative version of Sivan Toledo's recursive LU algorithm
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO )
*
* .. Scalar Arguments ..
* INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
* INTEGER IPIV( * )
* COMPLEX*16 A( LDA, * )
* ..
*
* Purpose
* =======
*
C>\details \b Purpose:
C>\verbatim
C>
C> ZGETRF computes an LU factorization of a general M-by-N matrix A
C> using partial pivoting with row interchanges.
C>
C> The factorization has the form
C> A = P * L * U
C> where P is a permutation matrix, L is lower triangular with unit
C> diagonal elements (lower trapezoidal if m > n), and U is upper
C> triangular (upper trapezoidal if m < n).
C>
C> This code implements an iterative version of Sivan Toledo's recursive
C> LU algorithm[1]. For square matrices, this iterative versions should
C> be within a factor of two of the optimum number of memory transfers.
C>
C> The pattern is as follows, with the large blocks of U being updated
C> in one call to DTRSM, and the dotted lines denoting sections that
C> have had all pending permutations applied:
C>
C> 1 2 3 4 5 6 7 8
C> +-+-+---+-------+------
C> | |1| | |
C> |.+-+ 2 | |
C> | | | | |
C> |.|.+-+-+ 4 |
C> | | | |1| |
C> | | |.+-+ |
C> | | | | | |
C> |.|.|.|.+-+-+---+ 8
C> | | | | | |1| |
C> | | | | |.+-+ 2 |
C> | | | | | | | |
C> | | | | |.|.+-+-+
C> | | | | | | | |1|
C> | | | | | | |.+-+
C> | | | | | | | | |
C> |.|.|.|.|.|.|.|.+-----
C> | | | | | | | | |
C>
C> The 1-2-1-4-1-2-1-8-... pattern is the position of the last 1 bit in
C> the binary expansion of the current column. Each Schur update is
C> applied as soon as the necessary portion of U is available.
C>
C> [1] Toledo, S. 1997. Locality of Reference in LU Decomposition with
C> Partial Pivoting. SIAM J. Matrix Anal. Appl. 18, 4 (Oct. 1997),
C> 1065-1081. http://dx.doi.org/10.1137/S0895479896297744
C>
C>\endverbatim
*
* Arguments:
* ==========
*
C> \param[in] M
C> \verbatim
C> M is INTEGER
C> The number of rows of the matrix A. M >= 0.
C> \endverbatim
C>
C> \param[in] N
C> \verbatim
C> N is INTEGER
C> The number of columns of the matrix A. N >= 0.
C> \endverbatim
C>
C> \param[in,out] A
C> \verbatim
C> A is COMPLEX*16 array, dimension (LDA,N)
C> On entry, the M-by-N matrix to be factored.
C> On exit, the factors L and U from the factorization
C> A = P*L*U; the unit diagonal elements of L are not stored.
C> \endverbatim
C>
C> \param[in] LDA
C> \verbatim
C> LDA is INTEGER
C> The leading dimension of the array A. LDA >= max(1,M).
C> \endverbatim
C>
C> \param[out] IPIV
C> \verbatim
C> IPIV is INTEGER array, dimension (min(M,N))
C> The pivot indices; for 1 <= i <= min(M,N), row i of the
C> matrix was interchanged with row IPIV(i).
C> \endverbatim
C>
C> \param[out] INFO
C> \verbatim
C> INFO is INTEGER
C> = 0: successful exit
C> < 0: if INFO = -i, the i-th argument had an illegal value
C> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
C> has been completed, but the factor U is exactly
C> singular, and division by zero will occur if it is used
C> to solve a system of equations.
C> \endverbatim
C>
*
* Authors:
* ========
*
C> \author Univ. of Tennessee
C> \author Univ. of California Berkeley
C> \author Univ. of Colorado Denver
C> \author NAG Ltd.
*
C> \date November 2011
*
C> \ingroup variantsGEcomputational
*
* =====================================================================
SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO )
*
* -- LAPACK computational routine (version 3.X) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
COMPLEX*16 A( LDA, * )
* ..
*
* =====================================================================
*
* .. Parameters ..
COMPLEX*16 ONE, NEGONE
DOUBLE PRECISION ZERO
PARAMETER ( ONE = (1.0D+0, 0.0D+0) )
PARAMETER ( NEGONE = (-1.0D+0, 0.0D+0) )
PARAMETER ( ZERO = 0.0D+0 )
* ..
* .. Local Scalars ..
DOUBLE PRECISION SFMIN, PIVMAG
COMPLEX*16 TMP
INTEGER I, J, JP, NSTEP, NTOPIV, NPIVED, KAHEAD
INTEGER KSTART, IPIVSTART, JPIVSTART, KCOLS
* ..
* .. External Functions ..
DOUBLE PRECISION DLAMCH
INTEGER IZAMAX
LOGICAL DISNAN
EXTERNAL DLAMCH, IZAMAX, DISNAN
* ..
* .. External Subroutines ..
EXTERNAL ZTRSM, ZSCAL, XERBLA, ZLASWP
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN, IAND, ABS
* ..
* .. Executable Statements ..
*
* Test the input parameters.
*
INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'ZGETRF', -INFO )
RETURN
END IF
*
* Quick return if possible
*
IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
*
* Compute machine safe minimum
*
SFMIN = DLAMCH( 'S' )
*
NSTEP = MIN( M, N )
DO J = 1, NSTEP
KAHEAD = IAND( J, -J )
KSTART = J + 1 - KAHEAD
KCOLS = MIN( KAHEAD, M-J )
*
* Find pivot.
*
JP = J - 1 + IZAMAX( M-J+1, A( J, J ), 1 )
IPIV( J ) = JP
! Permute just this column.
IF (JP .NE. J) THEN
TMP = A( J, J )
A( J, J ) = A( JP, J )
A( JP, J ) = TMP
END IF
! Apply pending permutations to L
NTOPIV = 1
IPIVSTART = J
JPIVSTART = J - NTOPIV
DO WHILE ( NTOPIV .LT. KAHEAD )
CALL ZLASWP( NTOPIV, A( 1, JPIVSTART ), LDA, IPIVSTART, J,
$ IPIV, 1 )
IPIVSTART = IPIVSTART - NTOPIV;
NTOPIV = NTOPIV * 2;
JPIVSTART = JPIVSTART - NTOPIV;
END DO
! Permute U block to match L
CALL ZLASWP( KCOLS, A( 1,J+1 ), LDA, KSTART, J, IPIV, 1 )
! Factor the current column
PIVMAG = ABS( A( J, J ) )
IF( PIVMAG.NE.ZERO .AND. .NOT.DISNAN( PIVMAG ) ) THEN
IF( PIVMAG .GE. SFMIN ) THEN
CALL ZSCAL( M-J, ONE / A( J, J ), A( J+1, J ), 1 )
ELSE
DO I = 1, M-J
A( J+I, J ) = A( J+I, J ) / A( J, J )
END DO
END IF
ELSE IF( PIVMAG .EQ. ZERO .AND. INFO .EQ. 0 ) THEN
INFO = J
END IF
! Solve for U block.
CALL ZTRSM( 'Left', 'Lower', 'No transpose', 'Unit', KAHEAD,
$ KCOLS, ONE, A( KSTART, KSTART ), LDA,
$ A( KSTART, J+1 ), LDA )
! Schur complement.
CALL ZGEMM( 'No transpose', 'No transpose', M-J,
$ KCOLS, KAHEAD, NEGONE, A( J+1, KSTART ), LDA,
$ A( KSTART, J+1 ), LDA, ONE, A( J+1, J+1 ), LDA )
END DO
! Handle pivot permutations on the way out of the recursion
NPIVED = IAND( NSTEP, -NSTEP )
J = NSTEP - NPIVED
DO WHILE ( J .GT. 0 )
NTOPIV = IAND( J, -J )
CALL ZLASWP( NTOPIV, A( 1, J-NTOPIV+1 ), LDA, J+1, NSTEP,
$ IPIV, 1 )
J = J - NTOPIV
END DO
! If short and wide, handle the rest of the columns.
IF ( M .LT. N ) THEN
CALL ZLASWP( N-M, A( 1, M+KCOLS+1 ), LDA, 1, M, IPIV, 1 )
CALL ZTRSM( 'Left', 'Lower', 'No transpose', 'Unit', M,
$ N-M, ONE, A, LDA, A( 1,M+KCOLS+1 ), LDA )
END IF
RETURN
*
* End of ZGETRF
*
END