Repository: fedorpashin/linalg

Issue:
Add __repr__ for Solution

Discussion:

Patch:
diff --git a/linalg/solution.py b/linalg/solution.py
index 314c165..6ea2dbe 100644
--- a/linalg/solution.py
+++ b/linalg/solution.py
@@ -3,6 +3,7 @@ from linalg.base.any_system import AnySystem
 from linalg.base.any_algorithm import AnyAlgorithm
 from linalg.factories.default_algorithm import DefaultAlgorithm
 
+from dataclasses import dataclass
 from typing import TypeVar
 from final_class import final
 from overrides import overrides
@@ -15,6 +16,7 @@ T = TypeVar('T', bound=AnySystem)
 
 
 @final
+@dataclass
 class Solution(AnyVector):
     __system: T  # type: ignore
     __algorithm: AnyAlgorithm[T]
@@ -35,3 +37,6 @@ class Solution(AnyVector):
     @property
     def algorithm(self):
         return self.__algorithm
+
+    def __repr__(self):
+        return self.value.__repr__()
diff --git a/linalg/systems/tridiagonal_matrix/thomas_algorithm.py b/linalg/systems/tridiagonal_matrix/thomas_algorithm.py
index e674a4e..2892cf0 100644
--- a/linalg/systems/tridiagonal_matrix/thomas_algorithm.py
+++ b/linalg/systems/tridiagonal_matrix/thomas_algorithm.py
@@ -30,7 +30,6 @@ class ThomasAlgorithm(TridiagonalMatrixSystemAlgorithm):
         x[n-1] = (g[n-1] - a[n-2] * β[n-2]) / (a[n-2] * α[n-2] + c[n-1])
 
         for i in range(n - 2, -1, -1):
-            print(i)
             x[i] = α[i] * x[i+1] + β[i]
 
         return Vector(x)


Test patch:
diff --git a/tests/test_solution.py b/tests/test_solution.py
index 05628ee..bf5093f 100644
--- a/tests/test_solution.py
+++ b/tests/test_solution.py
@@ -27,3 +27,10 @@ class TestSolution(unittest.TestCase):
             ).value,
             ThomasAlgorithm().solution(self.system).value
         )
+
+    def test_repr(self):
+        solution = Solution(self.system)
+        self.assertEqual(
+            solution.__repr__(),
+            solution.value.__repr__()
+        )