Gareth Ma on Fri, 09 Feb 2024 17:35:37 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Best way to determine horizontal plane ℤ³ that contains most vectors of given vector of vectrs


Note your code depends on max(L) - min(L), which is probably not what you want?

You can replace your C with matreduce(L).

On 09/02/2024 16:26, hermann@stamm-wilbrandt.de wrote:
I have a vector of vectors in ℤ³ (result of qfminim()) and want to determine the z coordinate with maximal vectors in that plane.

The good thing with PARI/GP is, that I most times get what I want somehow, like here:

    L=[v[3]|v<-S];
    C=[[l,#[v|v<-S,v[3]==l]]|l<-[vecmin(L)..vecmax(L)]];
    mx=vecsort(C,2)[#C][1];
    P=[(Q*v)~|v<-S,v[3]==mx];

But sorting and iteration over all possible vecmin..vecmax values looks not nice.
Is there a more intuitive way to set P to all vectors in plane with maximal vectors?

Regards,

Hermann.