Showing 130 of 196 total issues
Method to_nm
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_nm(shape = nil, dtype = nil, stype = :dense)
elements = self.dup
guess_dtype = ->(type) {
case type
Method pretty_print
has 37 lines of code (exceeds 25 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)
Method read_packed
has 37 lines of code (exceeds 25 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]
Method transpose
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transpose(permute = nil)
if permute.nil?
if self.dim == 1
return self.clone
elsif self.dim == 2
Method solve
has a Cognitive Complexity of 12 (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 dense_storage_set
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def dense_storage_set(slice, right)
stride = get_stride(self)
v_size = 1
if right.is_a?(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 transpose
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def transpose(permute = nil)
if permute.nil?
if self.dim == 1
return self.clone
elsif self.dim == 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
Method doubly_even_magic
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def doubly_even_magic(nm, shape)
mini_square_num = shape / 4
count = 1
inv_count = shape * shape
shape.times do |row|
- 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 pow
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def pow n
raise ShapeError, "Only works with 2D square matrices." if
shape[0] != shape[1] or shape.size != 2
raise TypeError, "Only works with integer powers" unless n.is_a?(Integer)
- 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 solve
has a Cognitive Complexity of 12 (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 singly_even_magic
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def singly_even_magic(nm, shape)
half_shape = shape / 2
complementary_pair = (shape - 2) / 4
swap_col = NMatrix.new([shape])
index = 0
Method cblas_herk
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def cblas_herk(order, uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
Method gemv
has 11 arguments (exceeds 4 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)
Method cblas_syrk
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def cblas_syrk(order, uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
Method lapack_gesdd
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def lapack_gesdd(jobz, m, n, a, lda, s, u, ldu, vt, ldvt, lwork)
Method solve
has 34 lines of code (exceeds 25 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
Method dense_storage_set
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dense_storage_set(slice, right)
stride = get_stride(self)
v_size = 1
if right.is_a?(NMatrix)
Method gemm
has 33 lines of code (exceeds 25 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.') \
Method solve
has 33 lines of code (exceeds 25 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
Method load_coordinate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_coordinate file, converter, dtype, entry_type, symmetry
mat = nil
# Read until we get the dimensions and nonzeros