Bill Allombert on Sun, 10 Mar 2024 16:10:42 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: Vecsize?
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Sun, 10 Mar 2024 16:10:38 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1710083440; c=relaxed/relaxed; bh=QaNT/exJGxWh1FBcSJffECRt4Q5RlWUWBzMD3Uz/63k=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=RQMEWUnGswMLGx8uHlNP05RqpZGjjy8D4M7giP4L4HWCth6Zrh7tHCfpxfZfr8d+t+Blb61cUPCsZiNO71kTDvb5n2n5xPxz1c4WPnL5IXCvL5LXdLaWQ3uEfUxqm25H9AJyufPd9/ZLV3xEVvCtN2lU4xS0BR8CQJ8AzTL5UhWHxlrzH29m6XSVIHRaEGJsl/EZhCvyHEHyFPsmkNkFSkYJU2m064jikkA5+TQqBywDrB5mxZEQjqbKgquHvshCqmWwVrAXVVZljmm0gAoMRRcRA2xtTqENNkAjbcB+cnM9Zlisaw5QIiWyEZx8XLkqSFnzGkpSCnYzzy7Fje+lnReqPD6icnW9018ImIyOhElPk01ZohTjwcmzJKsS27z9aUWeCpH/XmzDTlNCXGWJwIZ7JMQKYuNYT3uiEd5GYn93vbykFvlIirzHyc2gnFOufaXH8izPK5mMjgafEdiwA+J76j33ViCMvAYQTrlrrwWShqOpu7AofdaA8MXyaWFl2B3Gh/Ny+pvkfy3ISeWEqvp4cYpYffbnUZ9cRMxnQsyVvNvx+sF68OaWFeBgygkD9hooanY+pdk8bMHfMy/Q8uW9iVG3OIiSTHc9Y+AsOw8Jt1e+YxkxLR67/feYogFUN+6FJ+0FLb17TEFWHgtYlWAhGESk0vKG6F3uIaDpizM=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1710083440; cv=none; b=B7UOK/lUG88XnAt1+JBXcDXw/M41Md/ik9xAYEmuS4RiLM7q6rxh2NFetHaOQoOwTRCXrrFnvFCgbFa422BWkXrwQMJ1ia8qDodSWFr141TVcKFscJIzzDRwendG6SQk1tLAQpYMofA7i8S7orH+tp9P6C3O98pNdwexI35EfSbUPUEdzvY0f6gvFjMCgxUPNxdCTN3/Rgpi+ZCvyFfbsTR2sgy3eha1N1Qt3BDLjQJAFsOxixoONwisWOt9dd0+Wua94TGyjFn3rcd6iLKtjotnqfqeRB3x19INP+7pookjKfIMmndi/2JIZWkKa6HJjpV8bM+O7Y6S4h0oYWIemQi0iOHNbPAlfStY+8hfHg1P00Qp3TovT/V22O8yNqtM2TyYGjue8Y7XQf7IrzazU+RzFXC3uamXhmw4ciFsQ5wioW7m/lTzh2q0aR4BI3fMwhXcoPlkykd/WeVGxSVN+MLssUdi+lqhZylyONiI0+MfWFZBjybuS2xQgSpEtBBbCfSffkANuq9di7FpcGduTVLNqlkSqd6MdHQIX4DRyVapOOK7sDRZ7GiyI1iyI2Oe7avc63SNwdGC2dJX1/JkyN2t4DysygCfF6pfb5SsS1raEvpVQyz2Zd2G+IpRjSPQr1wtn06+7v9aYS276RsnbquQgjxqd/x0RQ0hOrlLmWE=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Sun, 10 Mar 2024 16:10:42 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1710083440; bh=QaNT/exJGxWh1FBcSJffECRt4Q5RlWUWBzMD3Uz/63k=; h=Date:From:To:Subject:References:In-Reply-To:From; b=LLB057GZRAuMPSGqPpE99JDQi6SWud62+wiHXsIKEXexaCUES/Cv3MvIXT17kBpGG MEtnfZsMuRTEzpeBiqYHbUiWa93PIjC6OSn0hBxm7o+D1vlQvw4BXn1EAyTJzsJnus qOoprdtNoiNFC9o+P0bOY5n8ZSs6UePQClIcIPkcfLQoexuj71JK+9w1VWYNZFuiMH 9+4ztzdsZ+5gzrF33Waya4bWc9CbbUgr0mNiAiggqz5PrjF0BWmD+Z1OMzHSYSUho9 cd/cgkhEyfMEZ1iYkqkTWwTRRO1cP+tnMuVi7QaIIbFWOehoRNzAT83bK3EYt1ZHBY qQR2IC4YMWk6Nq47V0AuvepDi8JFWNsq7q0w1sKfeZ5+HvHk0tDxYaNUj/xit7D04+ BCFHliLGq0/aNCih5tS82al40F3ARoq0sI4WUW+MeNzQAk1Qdt8of+BXaBaUKkkufE X/iDzxO0ciMfn3oGYlsmL8Mfx+6I3tusd4jCZH91mWtoB/QscGDF2pFFtGfj4t/2Kf v+pmZiFv+qkV6xppx2eJ6asEsI0EMQsch95D+XtM+y+yU+lVbJ2LdV9+hB00jRurzf 9NbfvW8R77wW8v5/g6m17urxprE7qEYGFpASPZokDfLcXZpEi/l1SHVXR6o4gNLT6u r9fMQecdKB75QI9ytQhtone0=
- In-reply-to: <CAD0p0K7kV6XDuRKnF1pFDsD-FGy6u-pzVFSmfwhK0Mmh0bhuUg@mail.gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <CAD0p0K7kV6XDuRKnF1pFDsD-FGy6u-pzVFSmfwhK0Mmh0bhuUg@mail.gmail.com>
On Sun, Mar 10, 2024 at 12:03:33PM +0000, John Cremona wrote:
> Libpari has a function matsize which gives the pair [nrows,ncols] of a
> matrix but I could not find a similar vecsize for vectors. This is for use
> in a C program, I know that you can use # in GP. My solution is to use
> matsize anyway and ignore one of the numbers it gives (which is 1).
You can use length (and lg(x)-1) in C:
This is the kind of question you can solve with gp2c:
echo 'f(x)=#x'|./gp2c
...
long
f(GEN x)
{
return glength(x);
}
echo 'f(x:vec)=#x'|./gp2c
long
f(GEN x)
{
if (!is_matvec_t(typ(x)))
pari_err_TYPE("f",x);
return lg(x)-1;
}
> I also could not find a function which would create an nxn matrix of
> integers, ready to be filled with C ints in a double loop,
Yes, I do not think this exists. we usualy do
M = cgetg(n+1,t_MAT);
for(i=1;i<=n; i++)
{
GEN v = cgetg(n+1, t_COL) (or t_VECSMALL);
for(j=1;j<=n; j++)
gel(v,j) = (or v[j] = ...);
gel(M,i) = v;
}
> but creating a
> zero matrix of the right size works ok.
Yes you can use zero_Flm_copy
> To end on a positive note, your matsnf works a whole lot better and faster
> than the equivalent function in flint!
Cheers,
Bill
- References:
- Vecsize?
- From: John Cremona <john.cremona@gmail.com>