Showing 130 of 196 total issues
Method read_packed
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def read_packed(packedio, options)
flags_class, self.nonzero_max = packedio.read([Element, options]).data
self.matlab_class = MatReader::MCLASSES[flags_class % 16]
- 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 23 methods (exceeds 20 allowed). Consider refactoring. Open
class NMatrix
# Methods for generating magic matrix.
module MagicHelpers
class << self
Method geev
has 61 lines of code (exceeds 25 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") \
Method pretty_print
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def pretty_print(q) #:nodoc:
if self.shape.size > 1 and self.shape[1] > 100
self.inspect.pretty_print(q)
elsif self.dim > 3 || self.dim == 1
self.to_a.pretty_print(q)
- 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 load_coordinate
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def load_coordinate file, converter, dtype, entry_type, symmetry
mat = nil
# Read until we get the dimensions and nonzeros
- 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 dot
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def dot(right_v)
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)
- 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 cast
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def cast(*params)
if (params.size > 0 && params[0].is_a?(Hash))
opts = {
:stype => self.stype,
:dtype => self.dtype,
- 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 read_packed
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def read_packed(packedio, options)
raise(ArgumentError, 'Missing mandatory option :endian.') \
unless options.has_key?(:endian)
tag = packedio.read([Tag, {:endian => options[:endian]}])
- 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 50 lines of code (exceeds 25 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
Method inject_rank
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def inject_rank(dimen=0, initial=nil, dtype=nil)
raise(RangeError, "requested dimension (#{dimen}) does not exist (shape: #{shape})") if dimen > self.dim
return enum_for(:inject_rank, dimen, initial, dtype) unless block_given?
- 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 block_diagonal
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def block_diagonal(*params)
options = params.last.is_a?(Hash) ? params.pop : {}
params.each_index do |i|
params[i] = params[i].to_nm if params[i].is_a?(Array) # Convert Array to NMatrix
- 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 quaternion
has 45 lines of code (exceeds 25 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)
Method get_slice
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_slice(dim, args, shape_array)
slice = {}
slice[:coords]=[]
slice[:lengths]=[]
slice[:single] = true
Method dense_storage_get
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dense_storage_get(slice,stride)
if slice[:single]
return dense_storage_pos(slice[:coords],stride)
else
shape = @shape.dup
Method save_coordinate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def save_coordinate matrix, file, symmetry, pattern
# Convert to a hash in order to store
rows = matrix.to_h
# Count non-zeros
- 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 13 arguments (exceeds 4 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)
Method to_hash
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def to_hash
if stype == :yale
h = {}
each_stored_with_indices do |val,i,j|
next if val == 0 # Don't bother storing the diagonal zero values -- only non-zeros.
- 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 lapack_geev
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def lapack_geev(jobvl, jobvr, n, a, lda, w, wi, vl, ldvl, vr, ldvr, lwork)
Method lapack_gesvd
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def lapack_gesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, lwork)
Method cblas_trmm
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def cblas_trmm(order, side, uplo, trans_a, diag, m, n, alpha, a, lda, b, ldb)