Fixes in methods and tests in Linear Algebra (#1432)

* Fixes in methods and tests

* Renamed tests.py to test_linear_algebra.py

* removed force_test()

* Delete test_linear_algebra.py

* Format code with psf/black

* Rename tests.py to test_linear_algebra.py
This commit is contained in:
Alex Veltman
2019-10-24 12:39:51 +02:00
committed by Christian Clauss
parent 07483139d1
commit ec85cc8191
2 changed files with 4 additions and 11 deletions

View File

@ -119,7 +119,7 @@ class Vector(object):
size = len(self)
if size == len(other):
result = [self.__components[i] - other.component(i) for i in range(size)]
return result
return Vector(result)
else: # error case
raise Exception("must have the same size")
@ -130,7 +130,7 @@ class Vector(object):
"""
if isinstance(other, float) or isinstance(other, int):
ans = [c * other for c in self.__components]
return ans
return Vector(ans)
elif isinstance(other, Vector) and (len(self) == len(other)):
size = len(self)
summe = 0