diags=Take[ds,All];
mat = {};
EWRules ={};
Do[
Print[{i,diags[[i]], MaxMemoryUsed[], TimeUsed[]}];
vect = U[4, diags[[i]]] /. EWRules;
Print["Length[vect] is ", Length[vect]];
EWs=Union[Cases[vect, _EW, Infinity]];
If[EWRules === {}, l=0, l=Length[EWRules[[1]]]];
Print["l is ", l];
If[EWRules === {}, 
EWRules=Dispatch[Thread[
EWs -> Table[v[j+l], {j, Length[EWs]}]
]],
EWRules=Dispatch[Join[EWRules[[1]], Thread[
EWs -> Table[v[j+l], {j, Length[EWs]}]
]]]
];
l=Length[EWRules[[1]]];
Print["l is ", l];
AppendTo[mat, 
Replace[#, c_.*v[j_] :> ({i,j} -> c)]& /@ (List @@ vect /. EWRules)
],
{i, Length[diags]}
];
mat = SparseArray[Flatten[mat], {Length[diags], l}];
Print["Computing Rank..."];
MatrixRank[mat]
NullSpace[Transpose[mat]]