I have a list of rules, the whole set is bigger, this is just a small part

`rule1=MapIndexed[Subscript[A, First@#2]->#&,{0.017840140244041125`,0.03701275157916095`,0.051660116184981536`,0.08951663681268851`,0.11158027392659164`,0.11199090055895211`,0.11722479640123873`,0.12880796041375156`,0.13998629375261973`,0.14799408926444602`,0.1603406353916348`,0.1691630967698906`,0.17603820358593392`,0.17625123467649714`,0.19645343424258566`,0.21551707277352605`,0.2181102569613515`,0.23391774392335418`,0.2550771120859639`,0.268556465535236`,0.3048461639996855`,0.31092372219882125`,0.3127938111713915`,0.31392896827464023`,0.3409781586745735`,0.34596915956848695`,0.3529110816686192`,0.3616255919094322`,0.367472697175696`,0.3934402946502719`,0.4047693032887368`,0.4311153156718978`,0.4683757162129396`,0.46952099223657906`,0.5072262199843859`,0.5221019133548683`,0.5343944162249954`,0.547890105814087`,0.5599232760856494`,0.5668852126411741`,0.5798751142315612`,0.5934466012255624`,0.5974131205016744`,0.6095346242098095`,0.6435968663448772`,0.6590218413254265`,0.6941771182743655`,0.7420644764943874`,0.7438917323215621`,0.7969894568033051`,0.8000537128029253`,0.8374749504134635`,0.8407436273863764`,0.8616085956899902`,0.9112275732642781`,0.9275783068606626`,0.9389371022951489`,0.9437334963687791`,0.9593199516799973`,1}]; `

a, b, c, d are the four numbers in the set, and at most two are equal, satisfy the following relationship:

$ \frac{a}{b}=k \frac{c}{d}$

$ k$ is a rational number.

when $ k=1$ , The GroupBy based approach is fast

`GroupBy[#/#2 -> (#/#2 /. rule1) & @@@ Subsets[Keys@rule1, {2}], Round[Last@#, 10^-10.] & -> First, Equal @@ # &] // DeleteCases[True] // AbsoluteTiming `

when $ k\neq 1$ , assume that $ k = 1/3$

It’s not easy to do with GroupBy, I thought of a way to use Gather, It’s much slower than the previous one

`Gather[#/#2 -> (#/#2 /. rule1) & @@@ Subsets[Keys@rule1, {2}], Abs[#[[2]] #2[[2]] - 1/3] < 10^-10. &] // Select[Length@# > 1 &] // AbsoluteTiming `

I want to know if $ k\neq 1$ , is there a way to use Groupby instead of Gather, or other more efficient methods?

Thank you in advance.