Skip to content
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

Add GSVD with QR factorizations, 2-by-1 CS decomposition #406

Open
wants to merge 101 commits into
base: master
Choose a base branch
from

Commits on Apr 20, 2021

  1. Add GSVD solver based on QR, CS decompositions

    (double precision real only)
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    fd5e74e View commit details
    Browse the repository at this point in the history
  2. Make DGGQRCS compile

    - add file to CMakeLists.txt
    - fix syntax errors etc.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    63ce490 View commit details
    Browse the repository at this point in the history
  3. Fix DGGQRCS

    - workspace queries are signalled by LWORK=-1, not INFO=-1
    - fix undeclared, uninitialized variable errors
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    96dccdf View commit details
    Browse the repository at this point in the history
  4. Fix many DGGQRCS bugs

    - fix workspace queries
    - fix DORCSD2BY1 parameter containing the number of rows of X11
    - avoid scaling the matrix B if B is zero
    - handle the case where both matrices A, B are zero
    - check INFO after calling DORGQR
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    1e815ee View commit details
    Browse the repository at this point in the history
  5. Fix matrix computation in DGGQRCS

    Fix the computation of an n-by-n orthogonal matrix Q by DORGRQ by
    ensuring that the R elementary reflectors from DGERQF can be found in
    the last R rows of Q.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    ace0611 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4bb8054 View commit details
    Browse the repository at this point in the history
  7. DGGQRCS: ensure #columns <= #rows with DORCSD2BY1

    Ensure the number of columns indicated to DORCSD2BY1 is less than or
    equal to the number of rows during workspace queries.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    32622a6 View commit details
    Browse the repository at this point in the history
  8. Fix completely broken DGGQRCS matrix scaling

    The variable FACTOR was copy-pasted from xGEEQUB.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    1750e47 View commit details
    Browse the repository at this point in the history
  9. Fix DGGQRCS bugs

    - compute Q only when needed
    - fix argument order to DORCSD2BY1
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    fbf90a0 View commit details
    Browse the repository at this point in the history
  10. Use 1-based indexing in DGGQRCS

    DLANGE does not use WORK when computing the Frobenius norm.
    Nevertheless, this change may avoid future bugs.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    fd8c487 View commit details
    Browse the repository at this point in the history
  11. DGGQRCS: always return optimal workspace

    Return the optimal workspace size even if both matrices A, B are zero.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    7c89211 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    d58326f View commit details
    Browse the repository at this point in the history
  13. DGGQRCS: compute V^T R1( 1:RANK, : ) correctly

    The multiplication uses DGEMM so the lower triangular part of
    R1( 1:RANK, : ) must be set to zero.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    b35fd6c View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    2d8da3a View commit details
    Browse the repository at this point in the history
  15. DGGQRCS: overwrite unused memory with NaNs

    Ease debugging
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    2c83b37 View commit details
    Browse the repository at this point in the history
  16. DGGQRCS: fix argument to DLACPY

    This bug was introduced in commit 446ac9a2.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    436931e View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    094c302 View commit details
    Browse the repository at this point in the history
  18. DGGQRCS: fix triangular matrices copies again

    This bug was discovered by the random test from commit dcd04cd.
    Minimal triggering example with m=1, n=2, p=1 with non-random entries:
      A = [1, 1],
      B = [1, 0].
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    a25860a View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    1e7e677 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    81a282b View commit details
    Browse the repository at this point in the history
  21. DGGQRCS: fix typos

    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    957e217 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    f683c79 View commit details
    Browse the repository at this point in the history
  23. Fix harmless out-of-bounds accesses for ASAN

    Fix harmless out-of-bounds accesses to avoid spurious address sanitizer
    (ASAN) failures.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    8e30cd1 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    fffae5f View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    4f0080a View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    706d952 View commit details
    Browse the repository at this point in the history
  27. SGGQRCS: improve comments

    * fix typos
    * explain optimal workspace size computation
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    5110d92 View commit details
    Browse the repository at this point in the history
  28. CGGQRCS: multiple fixes

    * fix an argument type
    * fix name of called function
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    9944790 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    7caf824 View commit details
    Browse the repository at this point in the history
  30. xGGQRCS: remove integer variable R

    Remove integer variable `R` indicating the rank because
    * integer `L` was already introduced for this purpose
    * the purpose of `R` was never documented, and
    * it can be confused with the triangular matrices occuring throghout the
      computation.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    fe9ee05 View commit details
    Browse the repository at this point in the history
  31. CGGQRCS: fix LRWORK computation

    For CUNCSD2BY1, memory consumption is not at maximum with maximum matrix
    dimensions.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    c9e5167 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    2a55ab9 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    3bb2c51 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    087875f View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    5f307f6 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    5121631 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    846a97a View commit details
    Browse the repository at this point in the history
  38. SGGQRCS: fix generalized singular values

    In an attempt to avoid a large backward error, xGGQRCS scales on of the
    input matrices so that both input matrices have comparable norm. This
    changes (not perturb, changes!) the generalized singular values. The
    previously committed test focusing on the singular values computed by
    xGGQRCS highlighted the need to fix the singular values.
    
    With this commit, it became obvious that
    * the singular values can be computed to very high relative accuracy
      (small forward error),
    * the matrices computed by xGGQRCS change significantly with scaling
      (large backward error).
    
    Consequently, matrix scaling cannot be used and row sorting must be
    applied to the matrix `(A, B)` before the initial QR decomposition.
    christoph-conrads committed Apr 20, 2021
    Configuration menu
    Copy the full SHA
    bf66250 View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2021

  1. Configuration menu
    Copy the full SHA
    366de5e View commit details
    Browse the repository at this point in the history
  2. Add SLASRTI sorting indices based on numbers

    xLASRT sorts an array of real values. xLASRTI sorts an array of indices
    referencing real values in an array.
    
    SLASRTI is based on SLASRT.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    0f06a18 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    29d3e3b View commit details
    Browse the repository at this point in the history
  4. Add DLASRTI

    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    1e512db View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a238a65 View commit details
    Browse the repository at this point in the history
  6. xGGQRCS: fix typos

    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    7cc4495 View commit details
    Browse the repository at this point in the history
  7. xLASRTI: fix typos

    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    3bd430d View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ae68646 View commit details
    Browse the repository at this point in the history
  9. Add DLASRTR

    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    eb7f37e View commit details
    Browse the repository at this point in the history
  10. Add CLASRTR

    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    aaaf98c View commit details
    Browse the repository at this point in the history
  11. Add ZLASRTR

    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    bb2c0b9 View commit details
    Browse the repository at this point in the history
  12. xLASRTI: fix indexing error

    The indexing error could lead to an infinite loop.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    b954151 View commit details
    Browse the repository at this point in the history
  13. SGGQRCS: do not factor right-hand side GSVD matrix

    The GSVD decomposes a pair of matrices A, B into
    * `A = U1 D1 X`,
    * `B = U2 D2 X`,
    
    where `X` has full rank. Alternatively, one can compute the equivalent
    decomposition
    * `A = U1 D1 R Q^*`,
    * `B = U2 D2 R Q^*`,
    
    where `R` is upper triangular and `Q` orthogonal. The second form has
    several advantages from the point of view of _numerical_ linear algebra.
    None of these apply to the GSVD solvers based on QR and CS
    decomposition.  Consequently, xGGQRCS returns from now on only the
    product `X = RQ^*`.
    
    This change makes xGGQRCS
    * faster,
    * more flexible (`X` is computed or not),
    * easier to implement (no need to assemble `R Q^*` for tests), and
    * numerically stable!
    
    xGGQRCS becomes numerically stable because factoring `X` requires an
    explicit LQ decomposition but the result may not be backward stable
    unless `A` and `B` are similar in norm. Not computing the LQ
    decomposition obviously solves this problem.
    
    This commit is a proof-of-concept; {d,c,z}GGQRCS should be updated
    accordingly.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    eefd3a7 View commit details
    Browse the repository at this point in the history
  14. SGGQRCS: fix typo

    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    22735c9 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    3a6b92b View commit details
    Browse the repository at this point in the history
  16. SGGQRCS: replace matrix scaling with row sorting

    To achieve a backward stable solver, input matrices A, B were previously
    scaled to be similar norm but this changes the generalized singular
    values and I seem unable to compensate for the scaling effects by
    * recomputing the singular values and
    * rescaling the right-hand side GSVD matrix X.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    d7e01db View commit details
    Browse the repository at this point in the history
  17. Revert "SGGQRCS: replace matrix scaling with row sorting"

    Row sorting cannot replace matrix scaling, see the recently added tests.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    84cb49d View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    2678b0f View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    19a1e0b View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    b17648c View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    32ebe2b View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    357a5b9 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    69e0e6b View commit details
    Browse the repository at this point in the history
  24. SGGQRCS: fix row scaling with singular value zero

    The singular value will not change but the corresponding row in the
    right-hand side GSVD matrix X must be scaled.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    f3e4a2d View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    20c578d View commit details
    Browse the repository at this point in the history
  26. SGGQRCS: improve documentation

    * highlight conditional backward stability
    * recommend use of SGGSVD3 when necessary
    * emphasize accuracy of computed singular values
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    060d77c View commit details
    Browse the repository at this point in the history
  27. SGGQRCS: remove row sorting

    Row sorting has no discernible effect on forward or backward errors.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    dc2f5e0 View commit details
    Browse the repository at this point in the history
  28. SGGQRCS: ensure matrix scaling factors always >1

    The singular values must be corrected for matrix scaling. Let w be a
    power of two such that norm(wA) equals approximately norm(B). Then the
    radians representation of the singular values must corrected with
    
    x' = arctan(w * tan(x)),
    
    where x is the computed radians value with matrix scaling and x' is the
    computed radians value without matrix scaling. If w is less than one
    and if x is large (close to pi/2), then roughly speaking
    
    * tan(x) has a large derivative (i.e. it is badly conditioned),
    * w * tan(x) will be smaller than tan(x),
    * arctan(w * tan(x)) has derivative near one, because its argument
      is closer to zero.
    
    This commit modifies the GSVD computation such that w >= 1 by choosing
    to compute the GSVD of (A, B) or (B, A) depending on the relative norms.
    Then
    
    * tan(x) has a small derivative if x is sufficiently small,
    * arctan(w * tan(x)) has derivative near zero, and
    * if x is large (near pi/2), then x' will be near pi/2 as well.
    
    This commit fixes the large relative forward errors detected by
    xGGQRCS_test_singular_values<float>' when the singular values of the
    matrix pair (A,B) where drawn from [0, pi/2000).
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    676f894 View commit details
    Browse the repository at this point in the history
  29. SGGQRCS: return sine, cosine values

    Previously SGGQRCS returned angles instead of sine, cosine values but
    these computations (while numerically stable) may completely destroy the
    backward stability of the solver. Specifically, in one test* a computed
    angle x near π/2 was the best single-precision approximation to the true
    value but cosine(x) was nowhere near the true cosine value, thereby
    making it impossible to achieve a backward stable reassembly of the
    input matrices from the GSVD.
    
    For this reason, SGGQRCS returns sine and cosine values to the caller
    instead of angles.
    
    TODO: Documentation
    
    *Test name  xGGQRCS_test_singular_accuracy_vs_radians_accuracy
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    b5eb358 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    4202857 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    6e5c3a6 View commit details
    Browse the repository at this point in the history
  32. DGGQRCS: update implementation

    Port the most recent SGGQRCS code to double precision.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    29eff1b View commit details
    Browse the repository at this point in the history
  33. DGGQRCS: fix typo

    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    ea6b975 View commit details
    Browse the repository at this point in the history
  34. CGGQRCS: update implementation

    Port the most recent SGGQRCS code to single-precision complex.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    dbae805 View commit details
    Browse the repository at this point in the history
  35. ZGGQRCS: update implementation

    Port the most recent CGGQRCS code to double-precision complex.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    02cc14d View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    3b0f2ac View commit details
    Browse the repository at this point in the history
  37. SGGQRCS: try speeding up matrix multiplication

    For tall matrices, xGGSVD3 is faster than xGGQRCS. This commit tries to
    improve performance by speeding up the matrix-matrix multiplication
    `V^* R( 1:L, N )`, where `R` is upper triangular with, with `xTRMM()`.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    762ef54 View commit details
    Browse the repository at this point in the history
  38. Revert "SGGQRCS: try speeding up matrix multiplication"

    Revert because
    * the commit was incomplete and forgot to remove the superfluous SLASCL
      call zeroing the lower triangular matrix part; with this called
      removed...
    * there is hardly any difference for matrices with m, n, p <= 256,
    * if there is a difference, it may be in favor of xGEMM.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    1593ed7 View commit details
    Browse the repository at this point in the history
  39. xGGQRCS: fix out-of-bounds access

    Fix out-of-bounds access when computing only the singular values.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    baf0f41 View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    b9ca9b6 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    0a61fa4 View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    58f2a5b View commit details
    Browse the repository at this point in the history
  43. CGGQRCS: fix off-by-one bug

    The last element of the matrix X overlapped with the first element of
    the matrix V^* because WORK(1) cannot be used by X.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    dda1d0f View commit details
    Browse the repository at this point in the history
  44. ZGGQRCS: fix accidental memory allocation

    This commit is a port of recent changes mades to CGGQRCS.
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    702991a View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    4a6a0f8 View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    332b4e6 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    2652e1f View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    42f9910 View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    f1358ca View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    bd80228 View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    24fc861 View commit details
    Browse the repository at this point in the history
  52. Configuration menu
    Copy the full SHA
    3f267f1 View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    305afaf View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    224c527 View commit details
    Browse the repository at this point in the history
  55. xGGRCS: documentation improvements

    * fix typos
    * remove spurious direction value for an internal variable
    * fix formatting of internal variables section
    christoph-conrads committed Apr 21, 2021
    Configuration menu
    Copy the full SHA
    0298da0 View commit details
    Browse the repository at this point in the history
  56. Configuration menu
    Copy the full SHA
    3cb8736 View commit details
    Browse the repository at this point in the history
  57. Configuration menu
    Copy the full SHA
    5b48881 View commit details
    Browse the repository at this point in the history
  58. Configuration menu
    Copy the full SHA
    9f23fbd View commit details
    Browse the repository at this point in the history
  59. Configuration menu
    Copy the full SHA
    2a8c4dd View commit details
    Browse the repository at this point in the history

Commits on Apr 22, 2021

  1. Configuration menu
    Copy the full SHA
    48d8488 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6cb9a5f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e805767 View commit details
    Browse the repository at this point in the history
  4. xGGQRCS: ensure leading dimension is at least one

    Ensure the leading dimension of the assembled matrix `G = [A; B]` is
    always at least one.
    christoph-conrads committed Apr 22, 2021
    Configuration menu
    Copy the full SHA
    8a0bef1 View commit details
    Browse the repository at this point in the history