From 52ec964e63a2a76d4694e321f72997c074dea116 Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Mon, 24 Apr 2023 16:41:18 +0530
Subject: [PATCH 01/18] Added rank of matrix in linear algebra

---
 linear_algebra/src/Rank_of_Matrix.py | 51 ++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 linear_algebra/src/Rank_of_Matrix.py

diff --git a/linear_algebra/src/Rank_of_Matrix.py b/linear_algebra/src/Rank_of_Matrix.py
new file mode 100644
index 000000000000..07e0e61ece18
--- /dev/null
+++ b/linear_algebra/src/Rank_of_Matrix.py
@@ -0,0 +1,51 @@
+"""This is a python program that calculates the rank of a matrix"""
+""" BY - RUDRANSH BHARDWAJ"""
+def swapRows(a,row1,row2):
+	a[row2],a[row1]=a[row1],a[row2]
+	return a
+
+def Row_Transformation(a,x,row1,row2):
+	for i in range(len(a[row2])):
+                a[row2][i]+=a[row1][i]*x
+	return a
+
+def MatrixRank(a):
+
+	ncol=len(a[0])
+	nrow=len(a)
+	rank=min(ncol,nrow)
+
+	if nrow>ncol:
+		b=[]
+		for m in range(ncol):
+			l=[]
+			for n in range(nrow):
+				l.append(a[n][m])
+			b.append(l)
+		a=b
+		ncol,nrow=nrow,ncol
+
+	for r in range(rank):
+		if a[r][r]!=0:
+			for j in range(r+1,nrow):
+				a=Row_Transformation(a,-(a[j][r]//a[r][r]),r,j)
+		else:
+			count1=True
+			for k in range(r+1,nrow):
+				if a[k][r]!=0:
+					a=swapRows(a,r,k)
+					count1=False
+					break
+
+			if count1:
+				for i in range(nrow):
+					a[i][r],a[i][rank-1]=a[i][rank-1],a[i][r]
+			nrow-=1
+
+
+		count2=0
+		for i in a:
+			if i==[0]*ncol:
+				count2+=1
+
+		return (rank-count2)

From df86e10b9c5a50c79022ad83ffd21664b99a6602 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 24 Apr 2023 11:18:16 +0000
Subject: [PATCH 02/18] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 linear_algebra/src/Rank_of_Matrix.py | 94 ++++++++++++++--------------
 1 file changed, 48 insertions(+), 46 deletions(-)

diff --git a/linear_algebra/src/Rank_of_Matrix.py b/linear_algebra/src/Rank_of_Matrix.py
index 07e0e61ece18..f91758fc4488 100644
--- a/linear_algebra/src/Rank_of_Matrix.py
+++ b/linear_algebra/src/Rank_of_Matrix.py
@@ -1,51 +1,53 @@
 """This is a python program that calculates the rank of a matrix"""
 """ BY - RUDRANSH BHARDWAJ"""
-def swapRows(a,row1,row2):
-	a[row2],a[row1]=a[row1],a[row2]
-	return a
 
-def Row_Transformation(a,x,row1,row2):
-	for i in range(len(a[row2])):
-                a[row2][i]+=a[row1][i]*x
-	return a
 
-def MatrixRank(a):
+def swapRows(a, row1, row2):
+    a[row2], a[row1] = a[row1], a[row2]
+    return a
+
+
+def Row_Transformation(a, x, row1, row2):
+    for i in range(len(a[row2])):
+        a[row2][i] += a[row1][i] * x
+    return a
 
-	ncol=len(a[0])
-	nrow=len(a)
-	rank=min(ncol,nrow)
-
-	if nrow>ncol:
-		b=[]
-		for m in range(ncol):
-			l=[]
-			for n in range(nrow):
-				l.append(a[n][m])
-			b.append(l)
-		a=b
-		ncol,nrow=nrow,ncol
-
-	for r in range(rank):
-		if a[r][r]!=0:
-			for j in range(r+1,nrow):
-				a=Row_Transformation(a,-(a[j][r]//a[r][r]),r,j)
-		else:
-			count1=True
-			for k in range(r+1,nrow):
-				if a[k][r]!=0:
-					a=swapRows(a,r,k)
-					count1=False
-					break
-
-			if count1:
-				for i in range(nrow):
-					a[i][r],a[i][rank-1]=a[i][rank-1],a[i][r]
-			nrow-=1
-
-
-		count2=0
-		for i in a:
-			if i==[0]*ncol:
-				count2+=1
-
-		return (rank-count2)
+
+def MatrixRank(a):
+    ncol = len(a[0])
+    nrow = len(a)
+    rank = min(ncol, nrow)
+
+    if nrow > ncol:
+        b = []
+        for m in range(ncol):
+            l = []
+            for n in range(nrow):
+                l.append(a[n][m])
+            b.append(l)
+        a = b
+        ncol, nrow = nrow, ncol
+
+    for r in range(rank):
+        if a[r][r] != 0:
+            for j in range(r + 1, nrow):
+                a = Row_Transformation(a, -(a[j][r] // a[r][r]), r, j)
+        else:
+            count1 = True
+            for k in range(r + 1, nrow):
+                if a[k][r] != 0:
+                    a = swapRows(a, r, k)
+                    count1 = False
+                    break
+
+            if count1:
+                for i in range(nrow):
+                    a[i][r], a[i][rank - 1] = a[i][rank - 1], a[i][r]
+            nrow -= 1
+
+        count2 = 0
+        for i in a:
+            if i == [0] * ncol:
+                count2 += 1
+
+        return rank - count2

From a1e7bb7fe526ca8b34c0978ad732f096be375c9e Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Tue, 25 Apr 2023 15:05:11 +0530
Subject: [PATCH 03/18] Corrected name of function

---
 linear_algebra/src/Rank_of_Matrix.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linear_algebra/src/Rank_of_Matrix.py b/linear_algebra/src/Rank_of_Matrix.py
index f91758fc4488..79dd9a19fc93 100644
--- a/linear_algebra/src/Rank_of_Matrix.py
+++ b/linear_algebra/src/Rank_of_Matrix.py
@@ -2,7 +2,7 @@
 """ BY - RUDRANSH BHARDWAJ"""
 
 
-def swapRows(a, row1, row2):
+def swap_rows(a, row1, row2):
     a[row2], a[row1] = a[row1], a[row2]
     return a
 

From 6cca1cdd72d0d3e185ba77407d5e0eed37b906fb Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Tue, 25 Apr 2023 15:08:49 +0530
Subject: [PATCH 04/18] Corrected Rank_of_Matrix.py

---
 linear_algebra/src/Rank_of_Matrix.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linear_algebra/src/Rank_of_Matrix.py b/linear_algebra/src/Rank_of_Matrix.py
index 79dd9a19fc93..65a235311420 100644
--- a/linear_algebra/src/Rank_of_Matrix.py
+++ b/linear_algebra/src/Rank_of_Matrix.py
@@ -7,13 +7,13 @@ def swap_rows(a, row1, row2):
     return a
 
 
-def Row_Transformation(a, x, row1, row2):
+def row_transformation(a, x, row1, row2):
     for i in range(len(a[row2])):
         a[row2][i] += a[row1][i] * x
     return a
 
 
-def MatrixRank(a):
+def matrix_rank(a):
     ncol = len(a[0])
     nrow = len(a)
     rank = min(ncol, nrow)

From cb967004edfd0e68d72bce83ad01e1d708a17b46 Mon Sep 17 00:00:00 2001
From: ASR Logistics <aarti19830@gmail.com>
Date: Tue, 25 Apr 2023 16:05:27 +0530
Subject: [PATCH 05/18] Completed rank_of_matrix.py

---
 linear_algebra/src/Rank_of_Matrix.py | 91 ++++++++++++++++------------
 1 file changed, 51 insertions(+), 40 deletions(-)

diff --git a/linear_algebra/src/Rank_of_Matrix.py b/linear_algebra/src/Rank_of_Matrix.py
index 65a235311420..00c094753245 100644
--- a/linear_algebra/src/Rank_of_Matrix.py
+++ b/linear_algebra/src/Rank_of_Matrix.py
@@ -1,53 +1,64 @@
 """This is a python program that calculates the rank of a matrix"""
 """ BY - RUDRANSH BHARDWAJ"""
 
+def rank_of_matrix(matrix:list[list])->int:
+    """
+    Finds the rank of a matrix.
 
-def swap_rows(a, row1, row2):
-    a[row2], a[row1] = a[row1], a[row2]
-    return a
+    Args:
+        matrix (list of lists): The matrix as a list of lists.
 
+    Returns:
+        int: The rank of the matrix.
 
-def row_transformation(a, x, row1, row2):
-    for i in range(len(a[row2])):
-        a[row2][i] += a[row1][i] * x
-    return a
+    Example:
+    >>> matrix1 = [[1, 2, 3],
+    ...            [4, 5, 6],
+    ...            [7, 8, 9]]
+    >>> rank_of_matrix(matrix1)
+    2
+    >>> matrix2 = [[1, 0, 0],
+    ...            [0, 1, 0],
+    ...            [0, 0, 0]]
+    >>> rank_of_matrix(matrix2)
+    2
+    >>> matrix3 = [[1, 2, 3, 4],
+    ...            [5, 6, 7, 8],
+    ...            [9, 10, 11, 12]]
+    >>> rank_of_matrix(matrix3)
+    2
+    """
 
+    rows = len(matrix)
+    columns = len(matrix[0])
+    rank = min(rows, columns)
 
-def matrix_rank(a):
-    ncol = len(a[0])
-    nrow = len(a)
-    rank = min(ncol, nrow)
-
-    if nrow > ncol:
-        b = []
-        for m in range(ncol):
-            l = []
-            for n in range(nrow):
-                l.append(a[n][m])
-            b.append(l)
-        a = b
-        ncol, nrow = nrow, ncol
-
-    for r in range(rank):
-        if a[r][r] != 0:
-            for j in range(r + 1, nrow):
-                a = Row_Transformation(a, -(a[j][r] // a[r][r]), r, j)
+    for row in range(rank):
+        # Check if diagonal element is not zero
+        if matrix[row][row] != 0:
+            # Eliminate all the elements below the diagonal
+            for col in range(row + 1, rows):
+                multiplier = matrix[col][row] / matrix[row][row]
+                for i in range(row, columns):
+                    matrix[col][i] -= multiplier * matrix[row][i]
         else:
-            count1 = True
-            for k in range(r + 1, nrow):
-                if a[k][r] != 0:
-                    a = swapRows(a, r, k)
-                    count1 = False
+            # Find a non-zero diagonal element to swap rows
+            reduce = True
+            for i in range(row + 1, rows):
+                if matrix[i][row] != 0:
+                    matrix[row], matrix[i] = matrix[i], matrix[row]
+                    reduce = False
                     break
+            if reduce:
+                rank -= 1
+                for i in range(rows):
+                    matrix[i][row] = matrix[i][rank]
 
-            if count1:
-                for i in range(nrow):
-                    a[i][r], a[i][rank - 1] = a[i][rank - 1], a[i][r]
-            nrow -= 1
+            # Reduce the row pointer by one to stay on the same row
+            row -= 1
 
-        count2 = 0
-        for i in a:
-            if i == [0] * ncol:
-                count2 += 1
+    return rank
 
-        return rank - count2
+if __name__=='__main__':
+    import doctest
+    doctest.testmod()
\ No newline at end of file

From c027189a5067e2ff1286d670858234997e414790 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Tue, 25 Apr 2023 10:38:58 +0000
Subject: [PATCH 06/18] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 linear_algebra/src/Rank_of_Matrix.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/linear_algebra/src/Rank_of_Matrix.py b/linear_algebra/src/Rank_of_Matrix.py
index 00c094753245..b43d2830f58b 100644
--- a/linear_algebra/src/Rank_of_Matrix.py
+++ b/linear_algebra/src/Rank_of_Matrix.py
@@ -1,7 +1,8 @@
 """This is a python program that calculates the rank of a matrix"""
 """ BY - RUDRANSH BHARDWAJ"""
 
-def rank_of_matrix(matrix:list[list])->int:
+
+def rank_of_matrix(matrix: list[list]) -> int:
     """
     Finds the rank of a matrix.
 
@@ -59,6 +60,8 @@ def rank_of_matrix(matrix:list[list])->int:
 
     return rank
 
-if __name__=='__main__':
+
+if __name__ == "__main__":
     import doctest
-    doctest.testmod()
\ No newline at end of file
+
+    doctest.testmod()

From d157ec01fd1d52fd417f374d450d275e26060ad6 Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Wed, 26 Apr 2023 07:31:49 +0530
Subject: [PATCH 07/18] delete to rename Rank_of_Matrix.py

---
 linear_algebra/src/Rank_of_Matrix.py | 67 ----------------------------
 1 file changed, 67 deletions(-)
 delete mode 100644 linear_algebra/src/Rank_of_Matrix.py

diff --git a/linear_algebra/src/Rank_of_Matrix.py b/linear_algebra/src/Rank_of_Matrix.py
deleted file mode 100644
index b43d2830f58b..000000000000
--- a/linear_algebra/src/Rank_of_Matrix.py
+++ /dev/null
@@ -1,67 +0,0 @@
-"""This is a python program that calculates the rank of a matrix"""
-""" BY - RUDRANSH BHARDWAJ"""
-
-
-def rank_of_matrix(matrix: list[list]) -> int:
-    """
-    Finds the rank of a matrix.
-
-    Args:
-        matrix (list of lists): The matrix as a list of lists.
-
-    Returns:
-        int: The rank of the matrix.
-
-    Example:
-    >>> matrix1 = [[1, 2, 3],
-    ...            [4, 5, 6],
-    ...            [7, 8, 9]]
-    >>> rank_of_matrix(matrix1)
-    2
-    >>> matrix2 = [[1, 0, 0],
-    ...            [0, 1, 0],
-    ...            [0, 0, 0]]
-    >>> rank_of_matrix(matrix2)
-    2
-    >>> matrix3 = [[1, 2, 3, 4],
-    ...            [5, 6, 7, 8],
-    ...            [9, 10, 11, 12]]
-    >>> rank_of_matrix(matrix3)
-    2
-    """
-
-    rows = len(matrix)
-    columns = len(matrix[0])
-    rank = min(rows, columns)
-
-    for row in range(rank):
-        # Check if diagonal element is not zero
-        if matrix[row][row] != 0:
-            # Eliminate all the elements below the diagonal
-            for col in range(row + 1, rows):
-                multiplier = matrix[col][row] / matrix[row][row]
-                for i in range(row, columns):
-                    matrix[col][i] -= multiplier * matrix[row][i]
-        else:
-            # Find a non-zero diagonal element to swap rows
-            reduce = True
-            for i in range(row + 1, rows):
-                if matrix[i][row] != 0:
-                    matrix[row], matrix[i] = matrix[i], matrix[row]
-                    reduce = False
-                    break
-            if reduce:
-                rank -= 1
-                for i in range(rows):
-                    matrix[i][row] = matrix[i][rank]
-
-            # Reduce the row pointer by one to stay on the same row
-            row -= 1
-
-    return rank
-
-
-if __name__ == "__main__":
-    import doctest
-
-    doctest.testmod()

From 94519600262a5e86d1c7d4154263737487d019d4 Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Wed, 26 Apr 2023 07:32:40 +0530
Subject: [PATCH 08/18] created rank_of_matrix

---
 linear_algebra/src/rank_of_matrix.py | 64 ++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 linear_algebra/src/rank_of_matrix.py

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
new file mode 100644
index 000000000000..602638ab6213
--- /dev/null
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -0,0 +1,64 @@
+"""This is a python program that calculates the rank of a matrix"""
+""" BY - RUDRANSH BHARDWAJ"""
+
+
+def rank_of_matrix(matrix: list[list]) -> int:
+    """
+    Finds the rank of a matrix.
+    Args:
+        matrix (list of lists): The matrix as a list of lists.
+    Returns:
+        int: The rank of the matrix.
+    Example:
+    >>> matrix1 = [[1, 2, 3],
+    ...            [4, 5, 6],
+    ...            [7, 8, 9]]
+    >>> rank_of_matrix(matrix1)
+    2
+    >>> matrix2 = [[1, 0, 0],
+    ...            [0, 1, 0],
+    ...            [0, 0, 0]]
+    >>> rank_of_matrix(matrix2)
+    2
+    >>> matrix3 = [[1, 2, 3, 4],
+    ...            [5, 6, 7, 8],
+    ...            [9, 10, 11, 12]]
+    >>> rank_of_matrix(matrix3)
+    2
+    """
+
+    rows = len(matrix)
+    columns = len(matrix[0])
+    rank = min(rows, columns)
+
+    for row in range(rank):
+        # Check if diagonal element is not zero
+        if matrix[row][row] != 0:
+            # Eliminate all the elements below the diagonal
+            for col in range(row + 1, rows):
+                multiplier = matrix[col][row] / matrix[row][row]
+                for i in range(row, columns):
+                    matrix[col][i] -= multiplier * matrix[row][i]
+        else:
+            # Find a non-zero diagonal element to swap rows
+            reduce = True
+            for i in range(row + 1, rows):
+                if matrix[i][row] != 0:
+                    matrix[row], matrix[i] = matrix[i], matrix[row]
+                    reduce = False
+                    break
+            if reduce:
+                rank -= 1
+                for i in range(rows):
+                    matrix[i][row] = matrix[i][rank]
+
+            # Reduce the row pointer by one to stay on the same row
+            row -= 1
+
+    return rank
+
+
+if __name__ == "__main__":
+    import doctest
+
+    doctest.testmod()

From 1d026c9040347d78e822bda3e0b0651c4b866653 Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Thu, 27 Apr 2023 09:38:27 +0530
Subject: [PATCH 09/18] added more doctests in rank_of_matrix.py

---
 linear_algebra/src/rank_of_matrix.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index 602638ab6213..a6abb9b008ca 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -1,6 +1,4 @@
 """This is a python program that calculates the rank of a matrix"""
-""" BY - RUDRANSH BHARDWAJ"""
-
 
 def rank_of_matrix(matrix: list[list]) -> int:
     """
@@ -25,6 +23,22 @@ def rank_of_matrix(matrix: list[list]) -> int:
     ...            [9, 10, 11, 12]]
     >>> rank_of_matrix(matrix3)
     2
+    >>>rank_of_matrix([[2,3,-1,-1],
+    ...                [1,-1,-2,4],
+    ...                [3,1,3,-2],
+    ...                [6,3,0,-7]])
+    3
+    >>>rank_of_matrix([[2,1,-3,-6],
+    ...                [3,-3,1,2],
+    ...                [1,1,1,2]])
+    2
+    >>>rank_of_matrix([[2,-1,0],
+    ...                [1,3,4],
+    ...                [4,1,-3]])
+    3
+    >>>rank_of_matrix([[3,2,1],
+    ...                [-6,-4,-2]])
+    1
     """
 
     rows = len(matrix)

From b37b262ad342132a3d6ef100f7e62f3c171af54d Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Thu, 27 Apr 2023 04:10:01 +0000
Subject: [PATCH 10/18] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 linear_algebra/src/rank_of_matrix.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index a6abb9b008ca..d1ef6daf912f 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -1,5 +1,6 @@
 """This is a python program that calculates the rank of a matrix"""
 
+
 def rank_of_matrix(matrix: list[list]) -> int:
     """
     Finds the rank of a matrix.

From c8af526b5a00325751d3239aec7d866ad8777d8c Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Thu, 27 Apr 2023 09:59:38 +0530
Subject: [PATCH 11/18] fixed some issues in rank_of_matrix.py

---
 linear_algebra/src/rank_of_matrix.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index d1ef6daf912f..e723beb38659 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -1,6 +1,5 @@
 """This is a python program that calculates the rank of a matrix"""
 
-
 def rank_of_matrix(matrix: list[list]) -> int:
     """
     Finds the rank of a matrix.
@@ -24,20 +23,20 @@ def rank_of_matrix(matrix: list[list]) -> int:
     ...            [9, 10, 11, 12]]
     >>> rank_of_matrix(matrix3)
     2
-    >>>rank_of_matrix([[2,3,-1,-1],
+    >>> rank_of_matrix([[2,3,-1,-1],
     ...                [1,-1,-2,4],
     ...                [3,1,3,-2],
     ...                [6,3,0,-7]])
-    3
-    >>>rank_of_matrix([[2,1,-3,-6],
+    4
+    >>> rank_of_matrix([[2,1,-3,-6],
     ...                [3,-3,1,2],
     ...                [1,1,1,2]])
-    2
-    >>>rank_of_matrix([[2,-1,0],
+    3
+    >>> rank_of_matrix([[2,-1,0],
     ...                [1,3,4],
     ...                [4,1,-3]])
     3
-    >>>rank_of_matrix([[3,2,1],
+    >>> rank_of_matrix([[3,2,1],
     ...                [-6,-4,-2]])
     1
     """

From 1b5a31abff5296b53e3c46be4a52a0e6bf580cf9 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Thu, 27 Apr 2023 04:30:10 +0000
Subject: [PATCH 12/18] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 linear_algebra/src/rank_of_matrix.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index e723beb38659..518c049d3512 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -1,5 +1,6 @@
 """This is a python program that calculates the rank of a matrix"""
 
+
 def rank_of_matrix(matrix: list[list]) -> int:
     """
     Finds the rank of a matrix.

From 80de4d37d2c439ff084b760431fa0e3509c013e4 Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Thu, 27 Apr 2023 13:55:38 +0530
Subject: [PATCH 13/18] added moreeee doctestsss in rank_of_mtrix.py and fixed
 some bugss

---
 linear_algebra/src/rank_of_matrix.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index 518c049d3512..77d879ec4d85 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -40,6 +40,10 @@ def rank_of_matrix(matrix: list[list]) -> int:
     >>> rank_of_matrix([[3,2,1],
     ...                [-6,-4,-2]])
     1
+    >>> rank_of_matrix([[],[]])
+    0
+    >>> rank_of_matrix([[1]])
+    1
     """
 
     rows = len(matrix)

From afb5191580a976f6fee203b6e4b5e08ce2add2d4 Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Sun, 30 Apr 2023 14:30:25 +0530
Subject: [PATCH 14/18] Update linear_algebra/src/rank_of_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>
---
 linear_algebra/src/rank_of_matrix.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index 77d879ec4d85..8726826515a3 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -1,4 +1,8 @@
-"""This is a python program that calculates the rank of a matrix"""
+"""
+Calculate the rank of a matrix.
+
+See: https://en.wikipedia.org/wiki/Rank_(linear_algebra)
+"""
 
 
 def rank_of_matrix(matrix: list[list]) -> int:

From 301726af647538d91b182c5d65411d1347f36306 Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Sun, 30 Apr 2023 14:31:01 +0530
Subject: [PATCH 15/18] Update linear_algebra/src/rank_of_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>
---
 linear_algebra/src/rank_of_matrix.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index 8726826515a3..9673ca201b8f 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -9,9 +9,9 @@ def rank_of_matrix(matrix: list[list]) -> int:
     """
     Finds the rank of a matrix.
     Args:
-        matrix (list of lists): The matrix as a list of lists.
+        matrix: The matrix as a list of lists.
     Returns:
-        int: The rank of the matrix.
+        The rank of the matrix.
     Example:
     >>> matrix1 = [[1, 2, 3],
     ...            [4, 5, 6],

From e683139a18c0feae03067e1a4c2386ab05912510 Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Sun, 30 Apr 2023 14:31:24 +0530
Subject: [PATCH 16/18] Update linear_algebra/src/rank_of_matrix.py

Co-authored-by: Christian Clauss <cclauss@me.com>
---
 linear_algebra/src/rank_of_matrix.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index 9673ca201b8f..de3617d97c8c 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -5,7 +5,7 @@
 """
 
 
-def rank_of_matrix(matrix: list[list]) -> int:
+def rank_of_matrix(matrix: list[list[int]]) -> int:
     """
     Finds the rank of a matrix.
     Args:

From cd8d2094f2a46e346eead62163fb71cc3f0248dd Mon Sep 17 00:00:00 2001
From: Rudransh Bhardwaj <115872354+rudransh61@users.noreply.github.com>
Date: Sun, 30 Apr 2023 14:33:14 +0530
Subject: [PATCH 17/18] Update rank_of_matrix.py

---
 linear_algebra/src/rank_of_matrix.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index de3617d97c8c..6cb02b14c2a9 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -48,6 +48,8 @@ def rank_of_matrix(matrix: list[list[int]]) -> int:
     0
     >>> rank_of_matrix([[1]])
     1
+    >>> rank_of_matrix([[]])
+    0
     """
 
     rows = len(matrix)

From 8d6caaf8a524ce45cd8aad633c45e5980ae572b1 Mon Sep 17 00:00:00 2001
From: Christian Clauss <cclauss@me.com>
Date: Tue, 30 May 2023 15:06:31 +0200
Subject: [PATCH 18/18] Update linear_algebra/src/rank_of_matrix.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
---
 linear_algebra/src/rank_of_matrix.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linear_algebra/src/rank_of_matrix.py b/linear_algebra/src/rank_of_matrix.py
index 6cb02b14c2a9..7ff3c1699a69 100644
--- a/linear_algebra/src/rank_of_matrix.py
+++ b/linear_algebra/src/rank_of_matrix.py
@@ -5,7 +5,7 @@
 """
 
 
-def rank_of_matrix(matrix: list[list[int]]) -> int:
+def rank_of_matrix(matrix: list[list[int | float]]) -> int:
     """
     Finds the rank of a matrix.
     Args: