mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 13:03:05 +02:00
hotfix: replaced vector norm calculations wiith cmath squrt function
This commit is contained in:
parent
d3a210f09e
commit
4fa4f306c7
@ -1,3 +1,4 @@
|
||||
import cmath
|
||||
import math
|
||||
import itertools
|
||||
import operator
|
||||
@ -72,7 +73,9 @@ class SequentialLinearAlgebraUtils(ABC):
|
||||
|
||||
@staticmethod
|
||||
def vector_norm(v):
|
||||
return math.sqrt(sum(x*x for x in v))
|
||||
x_values = (x*x for x in v)
|
||||
x_values_sum = sum(x_values)
|
||||
return cmath.sqrt(x_values_sum).real
|
||||
|
||||
@staticmethod
|
||||
def vector_scalar_divide(x, scalar):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user