Showing 130 of 196 total issues
File nmatrix_java.rb
has 625 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'java'
require_relative '../../../ext/nmatrix_java/vendor/commons-math3-3.6.1.jar'
require_relative '../../../ext/nmatrix_java/target/nmatrix.jar'
java_import 'org.apache.commons.math3.linear.ArrayRealVector'
Method initialize
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args)
if args[-1] == :copy
@shape = [2,2]
@s = [0,0,0,0]
@dim = shape.is_a?(Array) ? shape.length : 2
- Read upRead up
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
File nmatrix.rb
has 547 lines of code (exceeds 250 allowed). Consider refactoring. Open
def jruby?
/java/ === RUBY_PLATFORM
end
if jruby?
Class NMatrix
has 58 methods (exceeds 20 allowed). Consider refactoring. Open
class NMatrix
include_package 'org.apache.commons.math3.analysis.function'
attr_accessor :shape, :dim, :dtype, :stype, :s
def initialize(*args)
Class NMatrix
has 56 methods (exceeds 20 allowed). Consider refactoring. Open
class NMatrix
# Read and write extensions for NMatrix.
module IO
extend AutoloadPatch
File math.rb
has 500 lines of code (exceeds 250 allowed). Consider refactoring. Open
class NMatrix
module NMMath #:nodoc:
METHODS_ARITY_2 = [:atan2, :ldexp, :hypot]
METHODS_ARITY_1 = [:cos, :sin, :tan, :acos, :asin, :atan, :cosh, :sinh, :tanh, :acosh,
Method geev
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def geev(matrix, which=:both)
raise(StorageTypeError, "LAPACK functions only work on dense matrices") \
unless matrix.dense?
raise(ShapeError, "eigenvalues can only be computed for square matrices") \
- Read upRead up
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 geev
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def geev(matrix, which=:both)
raise(StorageTypeError, "LAPACK functions only work on dense matrices") unless matrix.dense?
raise(ShapeError, "eigenvalues can only be computed for square matrices") unless matrix.dim == 2 && matrix.shape[0] == matrix.shape[1]
jobvl = (which == :both || which == :left) ? :t : false
- Read upRead up
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
Class NMatrix
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class NMatrix
module NMMath #:nodoc:
METHODS_ARITY_2 = [:atan2, :ldexp, :hypot]
METHODS_ARITY_1 = [:cos, :sin, :tan, :acos, :asin, :atan, :cosh, :sinh, :tanh, :acosh,
Method get_slice
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def get_slice(dim, args, shape_array)
slice = {}
slice[:coords]=[]
slice[:lengths]=[]
slice[:single] = true
- Read upRead up
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 gemm
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def gemm(a, b, c = nil, alpha = 1.0, beta = 0.0,
transpose_a = false, transpose_b = false, m = nil,
n = nil, k = nil, lda = nil, ldb = nil, ldc = nil)
raise(ArgumentError, 'Expected dense NMatrices as first two arguments.') \
- Read upRead up
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
File mat5_reader.rb
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative './mat_reader.rb'
module NMatrix::IO::Matlab
# Reader (and eventual writer) for a version 5 .mat file.
Class NMatrix
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class NMatrix
# A dummy matrix is a matrix without the elements atrribute.
# NMatrix#create_dummy_matrix prevents creating copies as @s is set explicitly.
def +(other)
Method quaternion
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def quaternion
raise(ShapeError, "Expected square matrix") if self.shape[0] != self.shape[1]
raise(ShapeError, "Expected 3x3 rotation (or 4x4 homogeneous) matrix") if self.shape[0] > 4 || self.shape[0] < 3
q = NMatrix.new([4], dtype: self.dtype == :float32 ? :float32: :float64)
- Read upRead up
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 gemv
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def gemv(a, x, y = nil, alpha = 1.0, beta = 0.0,
transpose_a = false, m = nil, n = nil, lda = nil,
incx = nil, incy = nil)
raise(ArgumentError, 'Expected dense NMatrices as first two arguments.') \
unless a.is_a?(NMatrix) and x.is_a?(NMatrix) and \
- Read upRead up
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
File shortcuts.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
class NMatrix
# Methods for generating magic matrix.
module MagicHelpers
class << self
Method to_nm
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def to_nm(shape = nil, dtype = nil, stype = :dense)
elements = self.dup
guess_dtype = ->(type) {
case type
- Read upRead up
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
Class NMatrix
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class NMatrix
#
# call-seq:
# getrf! -> Array
Method initialize
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(*args)
if args[-1] == :copy
@shape = [2,2]
@s = [0,0,0,0]
@dim = shape.is_a?(Array) ? shape.length : 2
Method meshgrid
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def meshgrid(vectors, options = {})
raise(ArgumentError, 'Expected at least 2 arrays.') if vectors.size < 2
options[:indexing] ||= :xy
raise(ArgumentError, 'Indexing must be :xy of :ij') unless [:ij, :xy].include? options[:indexing]
mats = vectors.map { |arr| arr.respond_to?(:flatten) ? arr.flatten : arr.to_flat_array }
- Read upRead up
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"