5
5
6
6
7
7
class MatrixOperations :
8
- class IncompatibleDimensionsError (Exception ):
8
+ class __IncompatibleDimensionsError (Exception ):
9
9
def __str__ (self ) -> str :
10
10
return "Matrices are not compatible.\n " \
11
11
"No. of Columns in Matrix 1 have to be the same as No. of Rows in Matrix 2."
@@ -35,7 +35,7 @@ def addition(matrix_1: matrix, matrix_2: matrix) -> matrix:
35
35
compatible_dim : bool
36
36
dim_1 , dim_2 , same_dim , compatible_dim = MatrixOperations .__get_dimensions (matrix_1 , matrix_2 )
37
37
if not same_dim :
38
- raise MatrixOperations .IncompatibleDimensionsError
38
+ raise MatrixOperations .__IncompatibleDimensionsError
39
39
sum_m : matrix = [[0 for cols in range (dim_1 [1 ])] for rows in range (dim_1 [0 ])]
40
40
for i in range (0 , dim_1 [0 ]):
41
41
for j in range (0 , dim_1 [1 ]):
@@ -51,7 +51,7 @@ def subtraction(matrix_1: matrix, matrix_2: matrix) -> matrix:
51
51
compatible_dim : bool
52
52
dim_1 , dim_2 , same_dim , compatible_dim = MatrixOperations .__get_dimensions (matrix_1 , matrix_2 )
53
53
if not same_dim :
54
- raise MatrixOperations .IncompatibleDimensionsError
54
+ raise MatrixOperations .__IncompatibleDimensionsError
55
55
difference_m : matrix = [[0 for cols in range (dim_1 [1 ])] for rows in range (dim_1 [0 ])]
56
56
for i in range (0 , dim_1 [0 ]):
57
57
for j in range (0 , dim_1 [1 ]):
@@ -67,7 +67,7 @@ def multiplication(matrix_1: matrix, matrix_2: matrix) -> matrix:
67
67
compatible_dim : bool
68
68
dim_1 , dim_2 , same_dim , compatible_dim = MatrixOperations .__get_dimensions (matrix_1 , matrix_2 )
69
69
if not compatible_dim :
70
- raise MatrixOperations .IncompatibleDimensionsError
70
+ raise MatrixOperations .__IncompatibleDimensionsError
71
71
product_m : matrix = [[0 for cols in range (dim_2 [1 ])] for rows in range (dim_1 [0 ])]
72
72
for i in range (0 , dim_1 [0 ]):
73
73
for j in range (0 , dim_2 [1 ]):
0 commit comments