Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-652

Tridiagonal QR decomposition has a faulty test for zero...

Rank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1
    • 3.0
    • None
    • JAVA

    Description

      In the method getQT() of TriDiagonalTransformer we have:

      public RealMatrix getQT() {
      if (cachedQt == null) {
      final int m = householderVectors.length;
      cachedQt = MatrixUtils.createRealMatrix(m, m);

      // build up first part of the matrix by applying Householder transforms
      for (int k = m - 1; k >= 1; --k) {
      final double[] hK = householderVectors[k - 1];
      cachedQt.setEntry(k, k, 1);
      final double inv = 1.0 / (secondary[k - 1] * hK[k]);
      if (hK[k] != 0.0) {
      double beta = 1.0 / secondary[k - 1];

      The faulty line is : final double inv = 1.0 / (secondary[k - 1] * hK[k]);
      It should be put after the test for the zero, eg:

      public RealMatrix getQT() {
      if (cachedQt == null) {
      final int m = householderVectors.length;
      cachedQt = MatrixUtils.createRealMatrix(m, m);

      // build up first part of the matrix by applying Householder transforms
      for (int k = m - 1; k >= 1; --k) {
      final double[] hK = householderVectors[k - 1];
      cachedQt.setEntry(k, k, 1);
      if (hK[k] != 0.0) {
      final double inv = 1.0 / (secondary[k - 1] * hK[k]);
      double beta = 1.0 / secondary[k - 1];

      Attachments

        1. tridiagonal
          0.9 kB
          greg sterijevski

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            gsteri1 greg sterijevski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified

                Slack

                  Issue deployment