-
Notifications
You must be signed in to change notification settings - Fork 502
Fix xGESVDQ's jobu and jobv support in LAPACKE
#1146
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,11 +51,16 @@ lapack_int API_SUFFIX(LAPACKE_cgesvdq_work)( int matrix_layout, char joba, char | |
| } | ||
| } else if( matrix_layout == LAPACK_ROW_MAJOR ) { | ||
| lapack_int nrows_u = ( API_SUFFIX(LAPACKE_lsame)( jobu, 'a' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'u' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'r' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'f' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) ) ? m : 1; | ||
| lapack_int ncols_u = API_SUFFIX(LAPACKE_lsame)( jobu, 'a' ) ? m : | ||
| (API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) ? MIN(m,n) : 1); | ||
| lapack_int nrows_v = API_SUFFIX(LAPACKE_lsame)( jobv, 'a' ) ? n : | ||
| ( API_SUFFIX(LAPACKE_lsame)( jobv, 's' ) ? MIN(m,n) : 1); | ||
| ( (API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'u' ) ) ? MIN(m,n) : 1); | ||
| lapack_int nrows_v = ( API_SUFFIX(LAPACKE_lsame)( jobv, 'a' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobv, 'v' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobv, 'r' )) ? n : 1; | ||
| lapack_int lda_t = MAX(1,m); | ||
| lapack_int ldu_t = MAX(1,nrows_u); | ||
| lapack_int ldv_t = MAX(1,nrows_v); | ||
|
|
@@ -91,15 +96,19 @@ lapack_int API_SUFFIX(LAPACKE_cgesvdq_work)( int matrix_layout, char joba, char | |
| info = LAPACK_TRANSPOSE_MEMORY_ERROR; | ||
| goto exit_level_0; | ||
| } | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobu, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) ) { | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobu, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) || | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the |
||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'u' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'r' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'f' ) ) { | ||
| u_t = (lapack_complex_float*) | ||
| LAPACKE_malloc( sizeof(lapack_complex_float) * ldu_t * MAX(1,ncols_u) ); | ||
| if( u_t == NULL ) { | ||
| info = LAPACK_TRANSPOSE_MEMORY_ERROR; | ||
| goto exit_level_1; | ||
| } | ||
| } | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobv, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobv, 's' ) ) { | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobv, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobv, 'v' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobv, 'r' ) ) { | ||
| v_t = (lapack_complex_float*) | ||
| LAPACKE_malloc( sizeof(lapack_complex_float) * ldv_t * MAX(1,n) ); | ||
| if( v_t == NULL ) { | ||
|
|
@@ -118,20 +127,28 @@ lapack_int API_SUFFIX(LAPACKE_cgesvdq_work)( int matrix_layout, char joba, char | |
| } | ||
| /* Transpose output matrices */ | ||
| API_SUFFIX(LAPACKE_cge_trans)( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda ); | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobu, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) ) { | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobu, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'u' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'r' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'f' ) ) { | ||
| API_SUFFIX(LAPACKE_cge_trans)( LAPACK_COL_MAJOR, nrows_u, ncols_u, u_t, ldu_t, | ||
| u, ldu ); | ||
| } | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobv, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobv, 's' ) ) { | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobv, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobv, 'v' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobv, 'r' )) { | ||
| API_SUFFIX(LAPACKE_cge_trans)( LAPACK_COL_MAJOR, nrows_v, n, v_t, ldv_t, v, | ||
| ldv ); | ||
| } | ||
| /* Release memory and exit */ | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobv, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobv, 's' ) ) { | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobv, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobv, 'v' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobv, 'r' ) ) { | ||
| LAPACKE_free( v_t ); | ||
| } | ||
| exit_level_2: | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobu, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) ) { | ||
| if( API_SUFFIX(LAPACKE_lsame)( jobu, 'a' ) || API_SUFFIX(LAPACKE_lsame)( jobu, 's' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'u' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'r' ) || | ||
| API_SUFFIX(LAPACKE_lsame)( jobu, 'f' ) ) { | ||
| LAPACKE_free( u_t ); | ||
| } | ||
| exit_level_1: | ||
|
|
||
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
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
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
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.
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.
Shouldn't
jobu = 'f'andjobu = 'r'be included here too?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.
Yes. I got it hard to understand the shape of U with jobu = 'f' and jobu = 'r', so these was remained for later implementation. For jobu = 'r', how many cols should be included(as numrank is determined inside lapack), or using the maxium(MIN(m,n)) is OK?