-
Notifications
You must be signed in to change notification settings - Fork 448
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
xUNCSD2BY1 does not handle submatrices with empty rows properly #549
Comments
FixFor simultaneous bidiagonalization of the input matrices, xORCSD2BY1 calls xORBDB2 and xORBDB3 and the out-of-bounds array accesses occur within these bidiagonalization subroutines. According the xORBDB{2,3} documentation, the input causing the misbehavior is allowed. Consequently, a fix must modify xORBDB{2,3}. I see two possibilities for fixing this issue:
I am in favor of the latter approach because to the best of my knowledge, all LAPACK routines can handle input of dimension zero (whether this is along one axis or several axes). Hence making xORBDB{2,3} reject certain inputs of dimension zero would violate the principle of least astonishment. |
Consider the constraints on the input dimensions, see
( Have a look at the loop with the out-of-bounds access: Lines 317 to 322 in 2dafa3d
If CALL SLARFGP( 1, X21(M, M), X21(M+1, M), 1, TAUP2(M) )
Lines 144 to 164 in 2dafa3d
@weslleyspereira Like I wrote #406, this is another |
Hi @christoph-conrads. Thanks for the complete description! This is very helpful! I understood this is a false positive, and that I propose the following change. Lines 317 to 322 in 2dafa3d
by: DO I = P + 1, MIN( Q, M - P - 1 )
CALL SLARFGP( M-P-I+1, X21(I,I), X21(I+1,I), 1, TAUP2(I) )
X21(I,I) = ONE
CALL SLARF( 'L', M-P-I+1, Q-I, X21(I,I), 1, TAUP2(I),
$ X21(I,I+1), LDX21, WORK(ILARF) )
END DO
*
DO I = M - P, Q
TAUP2(I) = ZERO
X21(I,I) = ONE
END DO With this change, all tests pass with I can submit a PR with the fix if everything is ok. |
|
Lines 279 to 313 in 2dafa3d
|
Thanks, @christoph-conrads! I agree with (1). I will prepare a PR including your correction for negative |
Description
The 2x1 CS decomposition decomposes a matrix
Q = [Q1; Q2]
, whereQ^* Q = I
. There are two possibilities for the CS decompositionUΣV = Q1
in the special case whereQ2
has no rows:U = Q1
,Σ = I
,V = I
,U = I
,Σ = I
,V = Q1
.That is, the only thing to do by the algorithm is copying the input matrix into U or V and set the other matrix to the identity matrix.
If
Q1
orQ2
has no rows andthen SORCSD2BY1 performs out-of-bounds array accesses. I assume the same behavior occurs also for DORCSD2BY1, CUNCSD2BY1, and ZUNCSD2BY1. My expectation is that xORCSD2BY1 does not perform out-of-bounds accesses and returns one of the two possible decompositions shown above.
Output:
Checklist
The text was updated successfully, but these errors were encountered: