2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
14
Task/Matrix-arithmetic/PARI-GP/matrix-arithmetic-3.pari
Normal file
14
Task/Matrix-arithmetic/PARI-GP/matrix-arithmetic-3.pari
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
matperm(M)=
|
||||
{
|
||||
my(n=matsize(M)[1],innerSums=vectorv(n));
|
||||
if(n==0, return(1));
|
||||
sum(x=1,2^n-1,
|
||||
my(k=valuation(x,2),s=M[,k+1],gray=bitxor(x, x>>1));
|
||||
if(bittest(gray,k),
|
||||
innerSums += s;
|
||||
,
|
||||
innerSums -= s;
|
||||
);
|
||||
(-1)^hammingweight(gray)*factorback(innerSums)
|
||||
)*(-1)^n;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue