Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
scr2016 wants to merge7 commits intoReference-LAPACK:master
base:master
Choose a base branch
Loading
fromscr2016:scr2016-dgecx-draft

Conversation

@scr2016
Copy link
Contributor

@scr2016scr2016 commentedOct 15, 2025
edited by mgates3
Loading

This a draft for dgecx.f. to REVIEW and COMMENT

@scr2016scr2016 marked this pull request as draftOctober 15, 2025 07:09
Copy link
Collaborator

@mgates3mgates3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Some initial comments.

SRC/dgecx.f Outdated
*> Specifies how the factors of CX factorization
*> are returned.
*>
*> = 'P' or 'p' : return only the column permutaion matrix P
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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 )
Copy link
Collaborator

@mgates3mgates3Oct 15, 2025
edited
Loading

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 )
Copy link
Collaborator

@mgates3mgates3Oct 15, 2025
edited
Loading

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 )
Copy link
Collaborator

@mgates3mgates3Oct 15, 2025
edited
Loading

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
Copy link
ContributorAuthor

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
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
Copy link
Contributor

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,
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
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 extrax, such asgesvx,gesvxx,posvx,posvxx. Should we rename this onegecxx and create the simplified interface asgecx?

SRC/dgecxx.f Outdated
* http://www.netlib.org/lapack/explore-html/
*
*> \htmlonly
*> Download DGEQP3RK + dependencies
Copy link
Collaborator

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
Copy link
Collaborator

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 decomposition

We may need a new category. CX doesn't seem to fit inexisting categories.

Copy link
Collaborator

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
Copy link
Collaborator

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 )
Copy link
Collaborator

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

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mgates3mgates3mgates3 requested changes

+1 more reviewer

@ilaynilaynilayn left review comments

Reviewers whose approvals may not affect merge requirements

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@scr2016@mgates3@ilayn

[8]ページ先頭

©2009-2025 Movatter.jp