Passed
Push — master ( 90fac4...b39ade )
by Grega
51s
created

Sphere   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
dl 0
loc 11
rs 10
c 2
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A evaluate() 0 5 2
A function() 0 9 3
1
"""Implementation of Sphere function."""
2
3
__all__ = ['Sphere']
4
5
6
class Sphere(object):
7
8
    @classmethod
9
    def function(cls):
10
        def evaluate(D, sol):
11
            val = 0.0
12
            for i in range(D):
13
                val = val + sol[i] * sol[i]
14
            return val
15
16
        return evaluate
17