SciRuby/nmatrix

View on GitHub

Showing 130 of 196 total issues

Consider simplifying this complex logical expression.
Open

    if (right_v.is_a?(NMatrix) && self.stype == :dense && right_v.stype == :dense &&
        self.dim == 2 && right_v.dim == 2 && self.shape[1] == right_v.shape[0])

      result_dtype = NMatrix.upcast(self.dtype,right_v.dtype)
      left = self.dtype == result_dtype ? self : self.cast(dtype: result_dtype)
Severity: Major
Found in lib/nmatrix/lapack_ext_common.rb - About 40 mins to fix

    Method clapack_potrf has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def clapack_potrf(order, uplo, n, a, lda)
    Severity: Minor
    Found in lib/nmatrix/lapack_core.rb - About 35 mins to fix

      Method clapack_getri has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def clapack_getri(order, n, a, lda, ipiv)
      Severity: Minor
      Found in lib/nmatrix/lapack_core.rb - About 35 mins to fix

        Method dense_storage_coords has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def dense_storage_coords(s, slice_pos, coords_out, stride, offset)  #array, int, array
        Severity: Minor
        Found in lib/nmatrix/jruby/slice.rb - About 35 mins to fix

          Method load_array has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def load_array file, converter, dtype, entry_type, symmetry
          Severity: Minor
          Found in lib/nmatrix/io/market.rb - About 35 mins to fix

            Method clapack_potri has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def clapack_potri(order, uplo, n, a, lda)
            Severity: Minor
            Found in lib/nmatrix/lapack_core.rb - About 35 mins to fix

              Method load_coordinate has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def load_coordinate file, converter, dtype, entry_type, symmetry
              Severity: Minor
              Found in lib/nmatrix/io/market.rb - About 35 mins to fix

                Method ormqr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def ormqr(tau, side=:left, transpose=false, c=nil)
                    raise(StorageTypeError, "LAPACK functions only work on dense matrices") unless self.dense?
                    raise(TypeError, "Works only on floating point matrices, use unmqr for complex types") if self.complex_dtype?
                    raise(TypeError, "c must have the same dtype as the calling NMatrix") if c and c.dtype != self.dtype
                
                
                Severity: Minor
                Found in lib/nmatrix/lapacke.rb - About 35 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

                Method matrix_norm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def matrix_norm type = 2
                    raise(NotImplementedError, "norm can be calculated only for 2D matrices") unless self.dim == 2
                    raise(NotImplementedError, "norm only implemented for dense storage") unless self.stype == :dense
                    raise(ArgumentError, "norm not defined for byte dtype")if self.dtype == :byte
                    case type
                Severity: Minor
                Found in lib/nmatrix/math.rb - About 35 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

                Method / has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def /(other)
                    result = create_dummy_nmatrix
                    if (other.is_a?(NMatrix))
                      #check dimension
                      raise(ShapeError, "Cannot divide matrices with different dimension") if (@dim != other.dim)
                Severity: Minor
                Found in lib/nmatrix/jruby/operators.rb - About 35 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

                Method set_input has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def set_input ip
                        raise ArgumentError, "stype must be dense." if ip.stype != :dense
                        raise ArgumentError, "size of input (#{ip.size}) cannot be greater than planned input size #{@size}" if
                          ip.size != @size
                        
                Severity: Minor
                Found in lib/nmatrix/fftw.rb - About 35 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

                Method load_array has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def load_array file, converter, dtype, entry_type, symmetry
                      mat = nil
                
                      line = file.gets
                      line.chomp!
                Severity: Minor
                Found in lib/nmatrix/io/market.rb - About 35 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

                Method + has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def +(other)
                    result = create_dummy_nmatrix
                    if (other.is_a?(NMatrix))
                      #check dimension
                      raise(ShapeError, "Cannot add matrices with different dimension") if (@dim != other.dim)
                Severity: Minor
                Found in lib/nmatrix/jruby/operators.rb - About 35 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

                Method - has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def -(other)
                    result = create_dummy_nmatrix
                    if (other.is_a?(NMatrix))
                      #check dimension
                      raise(ShapeError, "Cannot subtract matrices with different dimension") if (@dim != other.dim)
                Severity: Minor
                Found in lib/nmatrix/jruby/operators.rb - About 35 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

                Method dot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def dot(other)
                    result = nil
                    if (other.is_a?(NMatrix))
                      #check dimension
                      if (@shape.length!=2 || other.shape.length!=2)
                Severity: Minor
                Found in lib/nmatrix/jruby/nmatrix_java.rb - About 35 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

                Method invert! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def invert!
                    raise(StorageTypeError, "invert only works on dense matrices currently") \
                     unless self.dense?
                
                    raise(ShapeError, "Cannot invert non-square matrix") \
                Severity: Minor
                Found in lib/nmatrix/atlas.rb - About 35 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

                Method * has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def *(other)
                    result = create_dummy_nmatrix
                    if (other.is_a?(NMatrix))
                      #check dimension
                      raise(ShapeError, "Cannot multiply matrices with different dimension") if (@dim != other.dim)
                Severity: Minor
                Found in lib/nmatrix/jruby/operators.rb - About 35 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

                Method __dense_each__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def __dense_each__
                    nmatrix = create_dummy_nmatrix
                    stride = get_stride(self)
                    offset = 0
                    #Create indices and initialize them to zero
                Severity: Minor
                Found in lib/nmatrix/jruby/nmatrix_java.rb - About 35 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

                Method asum has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def asum incx=1, n=nil
                    if self.shape == [1]
                      return self[0].abs unless self.complex_dtype?
                      return self[0].real.abs + self[0].imag.abs
                    end
                Severity: Minor
                Found in lib/nmatrix/jruby/math.rb - About 25 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

                Method new has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def new(*args)
                      stype = args[0].is_a?(Symbol) ? args.shift : :dense
                      shape = args[0].is_a?(Array) ? args.shift  : [1,args.shift]
                
                      if shape.size != 2 || !shape.include?(1) || shape == [1,1]
                Severity: Minor
                Found in lib/nmatrix/shortcuts.rb - About 25 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

                Severity
                Category
                Status
                Source
                Language