- Notifications
You must be signed in to change notification settings - Fork483
This a draft for dgecx.f.#1161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
mgates3 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Some initial comments.
Uh oh!
There was an error while loading.Please reload this page.
SRC/dgecx.f Outdated
| *> Specifies how the factors of CX factorization | ||
| *> are returned. | ||
| *> | ||
| *> = 'P' or 'p' : return only the column permutaion matrix P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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`SRC/dgecx.f Outdated
| *> matrix in the blocked step auxiliary subroutine DLAQP3RK ). | ||
| *> \endverbatim | ||
| *> | ||
| *> \param[out] LIWORK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Input, right?\param[in]
SRC/dgecx.f Outdated
| *> 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Typo:IWORK array.
SRC/dgecx.f Outdated
| * | ||
| * DGECX | ||
| * | ||
| END No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Files should end with a newline. Notice ⊖ on Github.
SRC/dgecx.f Outdated
| NBOPT = ILAENV( INB, 'DGEQRF', ' ', M, N, -1, -1 ) | ||
| LWKOPT = 1000 | ||
| END IF | ||
| WORK( 1 ) = DBLE( LWKOPT ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Add:IWORK( 1 ) = N
or whatever the formula is. Also elsewhere.
[Fixed LWORK => IWORK in comment.]
SRC/dgecx.f Outdated
| * | ||
| END IF | ||
| * | ||
| WORK( 1 ) = DBLE( LWKOPT ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Add:IWORK( 1 ) = N
as above.
SRC/dgecx.f Outdated
| * MSUB. | ||
| * | ||
| INFO = -6 | ||
| WORK( 1 ) = DBLE( LWKOPT ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Add:IWORK( 1 ) = N
or whatever the formula is. Also elsewhere.
scr2016 commentedOct 16, 2025 via email
by mistake 2 branches (one with dgecx.f and one with DGECX.f ) were joinedin 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
Uh oh!
There was an error while loading.Please reload this page.
SRC/dgecx.f Outdated
| *> | ||
| *> DGECX computes a CX factorization of a real M-by-N matrix A: | ||
| *> | ||
| *> A * P(K) = C*X + A_resid, where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I thinkP(K) notation is confusing here. It's not a function ofK but depends onK parameter.
SRC/dgecx.f Outdated
| *> from the original matrix A, | ||
| *> | ||
| *> X is a K-by-N matrix that minimizes the Frobenius norm of the | ||
| *> residual matrix A_resid, X = pseudoinv(C) * A, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You can just say "minimizes "|A - C*X|" in the Frobenius norm".
SRC/dgecx.f Outdated
| *> Column selection stage 1. | ||
| *> ========================= | ||
| *> | ||
| *> The user can select N_sel columns and deselect N_desel columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why can't I just supply a list of columns that I want and leave this deselect business out? Then it will be two options, "A" is all columns, "S" selected columns. If "A" thencols array is not referenced otherwise it is read fromcols array.
I'm afraid this is getting a bit too complicated with explicit deselection. Same goes for the rows
mgates3 commentedNov 5, 2025
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 |
SRC/dgecxx.f Outdated
| * http://www.netlib.org/lapack/explore-html/ | ||
| * | ||
| *> \htmlonly | ||
| *> Download DGEQP3RK + dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
GECXX instead ofGEQP3RK.
| *> \author Univ. of Colorado Denver | ||
| *> \author NAG Ltd. | ||
| * | ||
| *> \ingroup gecxx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Need to add to DOCS/groups-usr.dox:
@defgroup gecxx gecxx: CX decompositionWe may need a new category. CX doesn't seem to fit inexisting categories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Jim suggests a category "Low rank factorizations". Given that, I suggest adding this, or a subset of this, to groups-user.dox betweenunitary_top @{ ... @} andgeev_top @{ ... @} top-level groups (line 456):
@defgroup low_rank_top Low-rank factors (CX, CUR, etc.) @{ @defgroup cx_grp CX @{ @defgroup gecx gecx: CX factor @defgroup gecxx gecxx: CX factor, expert interface @} @defgroup cur_grp CUR @{ @defgroup gecur gecur: CUR factor @defgroup gecurx gecurx: CUR factor, expert interface @} @}SRC/dgecxx.f Outdated
| *> On exit, if INFO >= 0, WORK(1) returns the optimal LIWORK. | ||
| *> \endverbatim | ||
| *> | ||
| *> \param[out] LIWORK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
\param[in]
| NFREE = NSUB | ||
| * | ||
| LQUERY = ( LWORK.EQ.-1 ) | ||
| LIQUERY = ( LIWORK.EQ.-1 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It would be simpler to have just one LQUERY variable. Cf.zheevd.f
Uh oh!
There was an error while loading.Please reload this page.
This a draft for dgecx.f. to REVIEW and COMMENT