File: vector.gp

package info (click to toggle)
gp2c 0.0.14pl1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,180 kB
  • sloc: ansic: 8,608; sh: 1,630; lex: 347; yacc: 227; makefile: 107
file content (20 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
dacmul(V)=/*Divide-and-conquer multiplication*/
{
	local(l:small);
	while(length(V)>1,
		l=length(V);
		print1(l," ");
		V=vector((l+1)\2,i,
			if(2*i<=l,
				V[2*i]*V[2*i-1],
				V[2*i-1])));
	print();
	V[1]
}
f(a:small)=\\Multiply some cyclotomic polynomials
{
	local(p:small=100,V);
	V=vector(a,i,p=nextprime(p+1):small;polcyclo(p));
	dacmul(V);
}/*parse some matrices*/
g()=print([1,2]*[1,2,3;4,5,6]*[1,2,3]~,[],[;],[]~)