Showing 34 of 64 total issues
Function minimize_algorithm_1dim_brent
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def minimize_algorithm_1dim_brent(fct, _a, _b, _c, tolerance=DOUBLE_TOL):
'''
Finds the minimum of the given function f. The arguments are the given function f, and given a bracketing triplet of abscissas A, B, C
(such that B is between A and C, and f(B) is less than both f(A) and f(C)) and the Tolerance.
This routine isolates the minimum to a fractional precision of about tol using
- 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 gauss_kronrod_integrator.py
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# mathtoolspy
# -----------
# A fast, efficient Python library for mathematically operations, like
Consider simplifying this complex logical expression. Open
if ix > 0 and ix < self.nx and iy > 0 and iy < self.ny:
# x between, y between
x1 = self.xaxis[ix - 1]
x2 = self.xaxis[ix]
y1 = self.yaxis[iy - 1]
Function integrate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def integrate(self, function, lower_bound, upper_bound):
if upper_bound - lower_bound > GaussKronrodIntegrator._MAX_INTEGRAL_LENGTH:
bounds = self._get_bounds(lower_bound, upper_bound)
return sum([self.integrate(function, a, b) for a, b in bounds])
- 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
Function mn_brak_
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def mn_brak_(a, b, fct):
ax = a
bx = b
ulim = u = r = q = fu = dum = 0.0
fa = fct(a)
- 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
Function mn_brak
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def mn_brak(a, b, fct):
ax = a
bx = b
ulim = u = r = q = fu = 0.0
fa = fct(a)
- 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
Function integrate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def integrate(self, function, lower_bound, upper_bound):
if lower_bound == upper_bound:
return 0
if lower_bound > upper_bound:
return -self.integrate(function, upper_bound, lower_bound)
Function _set_interpolation_coefficients
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _set_interpolation_coefficients(self):
"""
computes the coefficients for the single polynomials of the spline.
"""
- 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
Function interpolation_bilinear
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def interpolation_bilinear(x, y, x1, x2, y1, y2, z11, z21, z22, z12):
Function get_value
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_value(self, x, y):
ix = bisect.bisect_left(self.xaxis, x) # x <= self.xaxis[ix]
iy = bisect.bisect_left(self.yaxis, y)
if ix > 0 and ix < self.nx and iy > 0 and iy < self.ny:
- 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
Function minimize_algorithm_1dim_golden
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def minimize_algorithm_1dim_golden(function, a, b, c, tolerance=DOUBLE_TOL):
'''
Given a function f, and given a bracketing triplet of abscissas ax, bx, cx
(such that bx is between ax and cx, and f(bx) is less than both f(ax) and f(cx)),
this routine performs a golden section search for the minimum, isolating it to
- 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
Function invert_matrix
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def invert_matrix(A, tol=None):
"""
Returns the inverse of the passed in matrix.
:param A: The matrix to be inversed
- 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
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, max_number_of_iterations=255, initial_order=3, min_number_of_iterations=7,
Function add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add(self, x, value):
for i in range(self.n):
v = self.values[i][1]
k = self._compare(v, value) if v != None else 1
if k == 1:
- 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
Function _checkDimension
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _checkDimension(self, constraint, initialValues):
c = len(constraint) if constraint else -1
n = len(initialValues) if initialValues else -1
if n > -1 and c > -1:
if n != c:
- 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
Function interpolation_linear
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def interpolation_linear(x, x1, x2, y1, y2):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, function, alpha, beta, Is, max_number_of_iterations):
Function minimize_algorithm_1dim_golden
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def minimize_algorithm_1dim_golden(function, a, b, c, tolerance=DOUBLE_TOL):
Function powell
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def powell(self, initial_xvalues, initial_fvalues, ndim, tol, fct):
Function minimize_algorithm_1dim_brent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def minimize_algorithm_1dim_brent(fct, _a, _b, _c, tolerance=DOUBLE_TOL):