stdlib/matrix/eigenvalue_decomposition.rb

Summary

Maintainability
F
1 wk
Test Coverage

Method hessenberg_to_real_schur has a Cognitive Complexity of 184 (exceeds 5 allowed). Consider refactoring.
Open

    def hessenberg_to_real_schur

      #  This is derived from the Algol procedure hqr2,
      #  by Martin and Wilkinson, Handbook for Auto. Comp.,
      #  Vol.ii-Linear Algebra, and the corresponding
Severity: Minor
Found in stdlib/matrix/eigenvalue_decomposition.rb - About 3 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method hessenberg_to_real_schur has 332 lines of code (exceeds 30 allowed). Consider refactoring.
Open

    def hessenberg_to_real_schur

      #  This is derived from the Algol procedure hqr2,
      #  by Martin and Wilkinson, Handbook for Auto. Comp.,
      #  Vol.ii-Linear Algebra, and the corresponding
Severity: Major
Found in stdlib/matrix/eigenvalue_decomposition.rb - About 1 day to fix

    Method tridiagonalize has 91 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

        def tridiagonalize
    
          #  This is derived from the Algol procedures tred2 by
          #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
          #  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
    Severity: Major
    Found in stdlib/matrix/eigenvalue_decomposition.rb - About 3 hrs to fix

      Method diagonalize has 86 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

          def diagonalize
            #  This is derived from the Algol procedures tql2, by
            #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
            #  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
            #  Fortran subroutine in EISPACK.
      Severity: Major
      Found in stdlib/matrix/eigenvalue_decomposition.rb - About 3 hrs to fix

        Method reduce_to_hessenberg has 65 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

            def reduce_to_hessenberg
              #  This is derived from the Algol procedures orthes and ortran,
              #  by Martin and Wilkinson, Handbook for Auto. Comp.,
              #  Vol.ii-Linear Algebra, and the corresponding
              #  Fortran subroutines in EISPACK.
        Severity: Major
        Found in stdlib/matrix/eigenvalue_decomposition.rb - About 2 hrs to fix

          Method diagonalize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              def diagonalize
                #  This is derived from the Algol procedures tql2, by
                #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
                #  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
                #  Fortran subroutine in EISPACK.
          Severity: Minor
          Found in stdlib/matrix/eigenvalue_decomposition.rb - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method reduce_to_hessenberg has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def reduce_to_hessenberg
                #  This is derived from the Algol procedures orthes and ortran,
                #  by Martin and Wilkinson, Handbook for Auto. Comp.,
                #  Vol.ii-Linear Algebra, and the corresponding
                #  Fortran subroutines in EISPACK.
          Severity: Minor
          Found in stdlib/matrix/eigenvalue_decomposition.rb - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid deeply nested control flow statements.
          Open

                          if (vr == 0.0 && vi == 0.0)
                            vr = eps * norm * (w.abs + q.abs +
                            x.abs + y.abs + z.abs)
                          end
          Severity: Major
          Found in stdlib/matrix/eigenvalue_decomposition.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if (y < x)
                              s = -s
                            end
            Severity: Major
            Found in stdlib/matrix/eigenvalue_decomposition.rb - About 45 mins to fix

              Method tridiagonalize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def tridiagonalize
              
                    #  This is derived from the Algol procedures tred2 by
                    #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
                    #  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
              Severity: Minor
              Found in stdlib/matrix/eigenvalue_decomposition.rb - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Avoid deeply nested control flow statements.
              Open

                              if (x.abs > (z.abs + q.abs))
                                @h[i+1][n-1] = (-ra - w * @h[i][n-1] + q * @h[i][n]) / x
                                @h[i+1][n] = (-sa - w * @h[i][n] - q * @h[i][n-1]) / x
                              else
                                cdivr, cdivi = cdiv(-r-y*@h[i][n-1], -s-y*@h[i][n], z, q)
              Severity: Major
              Found in stdlib/matrix/eigenvalue_decomposition.rb - About 45 mins to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                p = x * @h[i][k] + y * @h[i][k+1]
                                if (notlast)
                                  p += z * @h[i][k+2]
                                  @h[i][k+2] = @h[i][k+2] - p * r
                                end
                Severity: Major
                Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 2 hrs to fix
                stdlib/matrix/eigenvalue_decomposition.rb on lines 712..718

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 82.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                p = x * @v[i][k] + y * @v[i][k+1]
                                if (notlast)
                                  p += z * @v[i][k+2]
                                  @v[i][k+2] = @v[i][k+2] - p * r
                                end
                Severity: Major
                Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 2 hrs to fix
                stdlib/matrix/eigenvalue_decomposition.rb on lines 700..706

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 82.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                              z = @h[i][n-1]
                              @h[i][n-1] = q * z + p * @h[i][n]
                              @h[i][n] = q * @h[i][n] - p * z
                Severity: Minor
                Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 50 mins to fix
                stdlib/matrix/eigenvalue_decomposition.rb on lines 559..561

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 43.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                              z = @v[i][n-1]
                              @v[i][n-1] = q * z + p * @v[i][n]
                              @v[i][n] = q * @v[i][n] - p * z
                Severity: Minor
                Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 50 mins to fix
                stdlib/matrix/eigenvalue_decomposition.rb on lines 551..553

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 43.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            f = 0.0
                            high.downto(m) do |j|
                              f += @ort[j]*@h[i][j]
                            end
                            f = f/h
                Severity: Minor
                Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 45 mins to fix
                stdlib/matrix/eigenvalue_decomposition.rb on lines 390..397

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 40.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            f = 0.0
                            high.downto(m) do |i|
                              f += @ort[i]*@h[i][j]
                            end
                            f = f/h
                Severity: Minor
                Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 45 mins to fix
                stdlib/matrix/eigenvalue_decomposition.rb on lines 401..408

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 40.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                          @size.times do |j|
                            p = @v[j][i]
                            @v[j][i] = @v[j][k]
                            @v[j][k] = p
                Severity: Minor
                Found in stdlib/matrix/eigenvalue_decomposition.rb and 1 other location - About 20 mins to fix
                stdlib/matrix/lup_decomposition.rb on lines 202..203

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 27.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status