Showing 130 of 196 total issues
Method clapack_potrs
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def clapack_potrs(order, uplo, n, nrhs, a, lda, b, ldb)
Method xslice_ref
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def xslice_ref(args)
result = nil
if self.dim < args.length
raise(ArgumentError,"wrong number of arguments (#{args} for #{effective_dim(self)})")
- 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 initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize shape, opts={}
verify_opts opts
opts = {
dim: 1,
flags: :estimate,
- 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 ==
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def ==(otherNmatrix)
result = false
if (otherNmatrix.is_a?(NMatrix))
#check dimension
if (@dim != otherNmatrix.dim)
- 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 translation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def translation *args
xyz = args.shift if args.first.is_a?(NMatrix) || args.first.is_a?(Array)
default_dtype = xyz.respond_to?(:dtype) ? xyz.dtype : NMatrix.guess_dtype(xyz)
opts = {dtype: default_dtype}
opts = opts.merge(args.pop) if args.size > 0 && args.last.is_a?(Hash)
- 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 rot
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def rot(x, y, c, s, incx = 1, incy = 1, n = nil, in_place=false)
raise(ArgumentError, 'Expected dense NMatrices as first two arguments.') \
unless x.is_a?(NMatrix) and y.is_a?(NMatrix) \
and x.stype == :dense and y.stype == :dense
- 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 xslice
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def xslice(args)
result = nil
if self.dim < args.length
raise(ArgumentError,"wrong number of arguments (#{args} for #{effective_dim(self)})")
- 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 rot!
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def rot!(x, y, c, s, incx = 1, incy = 1, n = nil)
Method slice_set
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def slice_set(dest, lengths, pdest, rank, v, v_size, v_offset)
Method each_stored_with_index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def each_stored_with_index(&block)
raise(NotImplementedError, "only works for dim 2 vectors") unless self.dim <= 2
return enum_for(:each_stored_with_index) unless block_given?
self.each_stored_with_indices do |v, i, j|
- 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
Avoid deeply nested control flow statements. Open
if args[1].is_a?(Symbol)
hash = args[1]
@dtype = hash[:dtype]
@stype = hash[:stype]
elements = Array.new(shape*shape) unless shape.is_a? Array
Method to_nm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_nm(dtype = nil)
# Hardest part is figuring out from_dtype, from_index_dtype, and dtype.
dtype ||= guess_dtype_from_mdtype
from_dtype = MatReader::MDTYPE_TO_DTYPE[self.real_part.tag.data_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
Method factorize_qr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def factorize_qr
raise(NotImplementedError, "only implemented for dense storage") unless self.stype == :dense
raise(ShapeError, "Input must be a 2-dimensional matrix to have a QR decomposition") unless self.dim == 2
rows, columns = self.shape
- 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 save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save(matrix, filename, options = {})
options = {:pattern => false,
:symmetry => :general}.merge(options)
mode = matrix.stype == :dense ? :array : :coordinate
- 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 svd_rank
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def svd_rank(tolerence="default")
raise(ShapeError, "rank calculated only for 2-D matrices") unless
self.dim == 2
sigmas = self.gesvd[1].to_a.flatten
- 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 slice_copy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def slice_copy(src, dest,lengths, pdest, psrc,n)
Method solve
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def solve(b, opts = {})
raise(ShapeError, "Must be called on square matrix") unless self.dim == 2 && self.shape[0] == self.shape[1]
raise(ShapeError, "number of rows of b must equal number of cols of self") if
self.shape[1] != b.shape[0]
raise(ArgumentError, "only works with dense matrices") if self.stype != :dense
- 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 unmqr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def unmqr(tau, side=:left, transpose=false, c=nil)
raise(StorageTypeError, "ATLAS functions only work on dense matrices") unless self.dense?
raise(TypeError, "Works only on complex matrices, use ormqr for normal floating point matrices") unless self.complex_dtype?
raise(TypeError, "c must have the same dtype as the calling NMatrix") if c and c.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 inv_hilbert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def inv_hilbert(shape, opts={})
opts = {:dtype => :float64}.merge(opts)
m = NMatrix.new([shape,shape],opts)
combination = NMatrix.new([2*shape,2*shape],opts)
#combinations refers to the combination of n things taken k at a time
- 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 binned_sorted_indices
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def binned_sorted_indices
return method_missing(:sorted_indices) unless vector?
ary = self.to_flat_array
ary2 = []
last_bin = ary.each_index.sort_by { |i| [ary[i]] }.inject([]) do |result, element|
- 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"