mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
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:

committed by
Christian Clauss

parent
07483139d1
commit
ec85cc8191
@ -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
|
||||
|
Reference in New Issue
Block a user