Function simplify_sedumi_model
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def simplify_sedumi_model(A, b, c, K, allow_nonzero_b=False):
'''
Tries to eliminate variables using a few simple strategies:
1. If a constraint is expressing :math:`A_{ki}x_i = b_k` where variable
- 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 check_eliminatibility
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def check_eliminatibility(g, h, n_elig=None, allow_nonzero_b=False):
'''
Tests if constraint :math:`gx = h` fits either pattern :math:`ax_i = d`
or pattern :math:`ax_i + bx_j = d`, with the requirement that the
:math:`x_i` variable be one of the first n_elig variables.
- 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 simplify_sedumi_model
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def simplify_sedumi_model(A, b, c, K, allow_nonzero_b=False):
Function write_sedumi_to_mat
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def write_sedumi_to_mat(A, b, c, K, target):
Function clean_K_dims
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def clean_K_dims(K):
'''
Matlab requires the dimensions to be given in floating point numbers,
this checker ensures that they are.
'''
- 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 too many return
statements within this function. Open
return None, None
Function symmetrize_sedumi_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def symmetrize_sedumi_model(A, b, c, K):
'''
Symmetrize sedumi model.
'''
colstart = K['f'] + K['l'] + sum(K['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"