I have learnt that QR decomposition and RREF can be used to find linearly independent vectors, but now I am confronted with a question that is one step further: How do I find linearly dependent GROUPS among vectors?
For example, I have a matrix composed of column vectors.
>>> import numpy as np
>>> import sympy as sp
>>> A=np.array([[1,2,3,4,5,6],[6,5,4,3,2,1],[7,7,7,7,7,7],[1,1,2,2,3,3],[9,9,8,8,7,6],[9,9,8,8,7,6]]).T
>>> A
array([[1, 6, 7, 1, 9, 9],
[2, 5, 7, 1, 9, 9],
[3, 4, 7, 2, 8, 8],
[4, 3, 7, 2, 8, 8],
[5, 2, 7, 3, 7, 7],
[6, 1, 7, 3, 6, 6]])
>>> sp.Matrix(A).rref()[1]
(0, 1, 3, 4)
Sympy's RREF tells me that the only linearly independent vectors are the 0th, 1st, 3rd and 4th ones. But I want more knowledge, namely the groups of linearly dependent vectors. For this example, there are two groups. The first group is the first three columns: column 0 + column 1 = column 2; the second group is the last two columns: column 4 = column 5. So I expect some function to give the result:
>>> some_function(A)
[[0, 1, 2], [4, 5]] or [[0, 1, 2], [3], [4, 5]]
Is there any function that can do this? Thanks for any help!