This a draft for dgecxx.f.#1161
Draft
scr2016 wants to merge 64 commits into
Draft
Conversation
mgates3
requested changes
Oct 15, 2025
Contributor
Author
|
by mistake 2 branches (one with dgecx.f and one with DGECX.f ) were joined
in a single pull request, the files are identical. DGECX.f can be removed.
…On Wed, Oct 15, 2025 at 11:15 AM Mark Gates ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Some initial comments.
------------------------------
On SRC/DGECX.f
<#1161 (comment)>
:
There is both DGECX.f (incorrect) and dgecx.f (correct) file? This file
should be removed.
------------------------------
In SRC/dgecx.f
<#1161 (comment)>
:
> +*> array as the first K elements.
+*> b) If the flag COMP_X is set, then the routine also explicitly
+*> computes and returns the factor X = pseudoinv(C) * A.
+*>
+*> \endverbatim
+*
+* Arguments:
+* ==========
+*
+*> \param[in] FACT
+*> \verbatim
+*> FACT is CHARACTER*1
+*> Specifies how the factors of CX factorization
+*> are returned.
+*>
+*> = 'P' or 'p' : return only the column permutaion matrix P
Pedantic: LAPACK doesn't normally specify both Uppercase and lowercase.
Cf.:
lapack/SRC> grep "^\*> += '\w'" lapack/SRC/zpotrf.f
*> = 'U': Upper triangle of A is stored;
*> = 'L': Lower triangle of A is stored.
lapack/SRC> grep "^\*> += '\w'" lapack/SRC/*.f`
------------------------------
In SRC/dgecx.f
<#1161 (comment)>
:
> +*>
+*> If LWORK = -1, then a workspace query is assumed; the routine
+*> only calculates the optimal size of the WORK array, returns
+*> this value as the first entry of the WORK array, and no error
+*> message related to LWORK is issued by XERBLA.
+*> \endverbatim
+*>
+*> \param[out] IWORK
+*> \verbatim
+*> IWORK is INTEGER array, dimension (N).
+*> Is a work array. ( IWORK is used by DGEQP3RK to store indices
+*> of "bad" columns for norm downdating in the residual
+*> matrix in the blocked step auxiliary subroutine DLAQP3RK ).
+*> \endverbatim
+*>
+*> \param[out] LIWORK
Input, right? \param[in]
------------------------------
In SRC/dgecx.f
<#1161 (comment)>
:
> +*>
+*> \param[out] IWORK
+*> \verbatim
+*> IWORK is INTEGER array, dimension (N).
+*> Is a work array. ( IWORK is used by DGEQP3RK to store indices
+*> of "bad" columns for norm downdating in the residual
+*> matrix in the blocked step auxiliary subroutine DLAQP3RK ).
+*> \endverbatim
+*>
+*> \param[out] LIWORK
+*> \verbatim
+*> LIWORK is INTEGER
+*> The dimension of the array LIWORK. LIWORK >= N
+*>
+*> If LIWORK = -1, then a workspace query is assumed; the routine
+*> only calculates the optimal size of the WORK array, returns
Typo: IWORK array.
------------------------------
In SRC/dgecx.f
<#1161 (comment)>
:
> +* Copy matrix C into work array WORK.
+*
+ CALL DLACPY( 'F', M, K, C, LDC, WORK, M )
+*
+ CALL DGELS( 'N', M, K, N, WORK, M, X, LDX,
+ $ WORK( M*K+1 ), LWORK,
+ $ IINFO )
+ INFO = IINFO
+*
+ END IF
+*
+ WORK( 1 ) = DBLE( LWKOPT )
+*
+* DGECX
+*
+ END
Files should end with a newline. Notice ⊖ on Github.
------------------------------
In SRC/dgecx.f
<#1161 (comment)>
:
> +* code.
+*
+ IF( INFO.EQ.0 ) THEN
+ MINMN = MIN( M, N )
+ IF( MINMN.EQ.0 ) THEN
+ LWKMIN = 1
+ LWKOPT = 1
+ ELSE
+ LWKMIN = 3*N + 1
+*
+* Assign to NBOPT optimal block size.
+*
+ NBOPT = ILAENV( INB, 'DGEQRF', ' ', M, N, -1, -1 )
+ LWKOPT = 1000
+ END IF
+ WORK( 1 ) = DBLE( LWKOPT )
Add:
LWORK( 1 ) = N
or whatever the formula is. Also elsewhere.
------------------------------
In SRC/dgecx.f
<#1161 (comment)>
:
> +* that uses QR factorization. For that purpose, we store C into
+* WORK array WORK(1:M*K), and the matrix A was copied into
+* the array X at the begining of the routine.
+*
+* Copy matrix C into work array WORK.
+*
+ CALL DLACPY( 'F', M, K, C, LDC, WORK, M )
+*
+ CALL DGELS( 'N', M, K, N, WORK, M, X, LDX,
+ $ WORK( M*K+1 ), LWORK,
+ $ IINFO )
+ INFO = IINFO
+*
+ END IF
+*
+ WORK( 1 ) = DBLE( LWKOPT )
Add:
LWORK( 1 ) = N
as above.
------------------------------
In SRC/dgecx.f
<#1161 (comment)>
:
> +*
+ MNSUB = MIN(MSUB, NSUB)
+ MRESID = MSUB-NSEL
+ NRESID = NSUB-NSEL
+ IF( NSEL.GT.0 ) THEN
+ IF( MSUB.LT.NSEL ) THEN
+* TODO: Move this part to the top of the routine.
+* a) Case MSUB < NSEL.
+* When the number of preselected columns
+* is larger than MSUB, hence the factorization of all NSEL
+* columns cannot be completed. Return from the routine with the
+* error of COL_SEL_DESEL parameter. NSEL cannot be larger than
+* MSUB.
+*
+ INFO = -6
+ WORK( 1 ) = DBLE( LWKOPT )
Add:
LWORK( 1 ) = N
or whatever the formula is. Also elsewhere.
—
Reply to this email directly, view it on GitHub
<#1161 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHYAZG2IG6CWKRVGDULGWT3X2FMPAVCNFSM6AAAAACJHEAYW6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGNBRGUZDGMZSGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
changed the description of DGECX
ilayn
reviewed
Oct 16, 2025
Collaborator
|
We've discussed that this is the expert interface, and we would have a simplified interface (e.g., without all the column selection). Elsewhere in LAPACK, expert interfaces have an extra |
mgates3
reviewed
Nov 12, 2025
mgates3
reviewed
Nov 12, 2025
mgates3
requested changes
Nov 12, 2025
…efined calculation for workspace LWORK and LIWORK
…to include NX crosspver point
…CT = 'X', LDX >= max(1,M) to LDX >= max(1,min(M,N))
… of LDX to now say again If FACT = 'X', LDX >= max(1,M), plus expanded the description of the parameter X.
…em as min|| A - C*X||_F for the unknown X
Quick rfturn if possible for
a) M = 0 or N = 0. There is no matrix A(1:M,1:N).
b) MSUB = 0 or NSUB = 0. There is no matrix A_sub(1:MSUB,1:NSUB).
modified: SRC/dgecxx.f
modified: SRC/dgecxx.f
mgates3
reviewed
Apr 29, 2026
Comment on lines
44
to
47
| *> \par Purpose: | ||
| * ============= | ||
| *> | ||
| *> \verbatim |
Collaborator
There was a problem hiding this comment.
Doing doxygen DOCS/Doxyfile or make html both worked for me. The dgecxx page looks normal. If you don't have dot installed, it won't create a call graph.
…L_DESEL_COLS, since they are modified on output.
1) added 'On exit' parameter descriptions to DESEL_ROWS and SEL_DESEL_COLS, since they are modified on output.
2) For row deselection, changed:
IPIV( I ) = IPIV( MSUB )
IPIV( MSUB ) = I
ITEMP = DESEL_ROWS( I )
DESEL_ROWS( I ) = DESEL_ROWS( MSUB )
DESEL_ROWS( MSUB ) = ITEMP into:
into
IPIV( I ) = IPIV( MSUB )
IPIV( MSUB ) = I
DESEL_ROWS( MSUB ) = DESEL_ROWS( I )
DESEL_ROWS( I ) = -1
2) cleaned up comments in the code dgecxx.f
modified: SRC/dgecxx.f
In case, when we return the matrrix X as well, we use the copy of the origonal matrix A that is stored in X. So that we do not need to save the matrix A into the array C, and do not need to select the columns of A in the array C in place. Instead, we just copy the selected columns of the matrix A into the matrix C. modified: SRC/dgecxx.f
Line 29 was emtied in error while adding at commit ce5b69c index 9980399..7a7c50f 100644 --- a/SRC/lapack_64.h +++ b/SRC/lapack_64.h @@ -26,7 +26,7 @@ #define CGBCON CGBCON_64 #define CGBEQU CGBEQU_64 #define CGBEQUB CGBEQUB_64 - +#define CGBMV CGBMV_64 #define CGBRFS CGBRFS_64 #define CGBRFSX CGBRFSX_64 modified: SRC/lapack_64.h
modified: SRC/dgecxx.f
after NSEL columns and NFREE columns factorization: from update style K = NSEL, and K = NSEL + KFREE to increment style K = K + NSEL, K = K + KFEE modified: SRC/dgecxx.f
since min( M, N) = 0 implies min( MSUB, NSUB) = 0,
changed
From:
IF( MIN( MINMN, MIN( MSUB, NSUB )).EQ.0 ) THEN
K = 0
MAXC2NRMK = ZERO
RELMAXC2NRMK = ZERO
FNRMK = ZERO
RETURN
END IF
To:
IF( MIN( MSUB, NSUB ).EQ.0 ) THEN
K = 0
MAXC2NRMK = ZERO
RELMAXC2NRMK = ZERO
FNRMK = ZERO
RETURN
END IF
modified: SRC/dgecxx.f
modified: SRC/dgecxx.f
modified: SRC/dgecxx.f
cosmetic change modified: SRC/dgecxx.f
Also included sgecxx.f in to SRC/CMakeLists.txt SRC/Makefile and modified SRC/lapack_64.h to reflect the addition SRC/sgecxx.f modified: SRC/CMakeLists.txt modified: SRC/Makefile modified: SRC/lapack_64.h new file: SRC/sgecxx.f
modified: TESTING/LIN/dchkaa.F
also changed Definition sections in the top comments modified: TESTING/LIN/dchkcxx.f
modified: TESTING/LIN/dchkcxx.f
modified: TESTING/LIN/dchkcxx.f
from RESULT( 5 ) = 0D+0 to RESULT( 5 ) = ZERO modified: TESTING/LIN/dchkcxx.f
modified: TESTING/LIN/dchkaa.F
modified: LIN/dchkcxx.f
modified: TESTING/LIN/CMakeLists.txt modified: TESTING/LIN/Makefile modified: TESTING/LIN/schkaa.F new file: TESTING/LIN/schkcxx.f new file: TESTING/LIN/serrcxx.f modified: TESTING/LIN/slatb4.f modified: TESTING/stest.in
5ce5eeb to
9c3d06a
Compare
… and LIWORK modified: SRC/dgecxx.f modified: SRC/sgecxx.f
modified: SRC/dgecxx.f modified: SRC/sgecxx.f
modified: SRC/dgecxx.f modified: SRC/sgecxx.f
modified: SRC/CMakeLists.txt modified: SRC/Makefile modified: SRC/lapack_64.h new file: SRC/zgecxx.f
modified: TESTING/LIN/dchkcxx.f modified: TESTING/LIN/schkcxx.f
modified: TESTING/LIN/dchkcxx.f
modified: TESTING/LIN/schkcxx.f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This a draft for dgecxx.f. to REVIEW and COMMENT