blib/lib/Math/Polynomial/Cyclotomic.pm

filter: Statementstmt 100% 226 / 226 Branchbran 100% 92 / 92 Conditioncond 90.5% 48 / 53 MC/DCmcdc 77.4% 24 / 31 Subroutinesub 100% 29 / 29 Podpod 50.0% 8 / 16 totaltotal 95.5% 427 / 447 CC 70 SCAR 20.2
CC
70
Cov
99%
_cyclo_poly
12.0
_lucas_cd
12.0
cyclo_int_factors
11.0
CRAP 7.5
↑ Summary
1 # Copyright (c) 2019-2021 by Martin Becker. This package is free software,
2 # licensed under The Artistic License 2.0 (GPL compatible).
3  
4 package Math::Polynomial::Cyclotomic;
5  
6 3 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Math::BigInt try => 'GMP';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use Math::Polynomial 1.019;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use Math::Prime::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
13 divisors factor factor_exp euler_phi gcd is_square_free is_power
14 moebius kronecker vecprod
15 3 );
16 3 require Exporter;
17  
18 3 our @ISA = qw(Exporter);
19 3 our @EXPORT_OK = qw(
20 cyclo_poly cyclo_factors cyclo_plusfactors cyclo_poly_iterate
21 cyclo_lucas_cd cyclo_schinzel_cd cyclo_int_factors cyclo_int_plusfactors
22 );
23 3 our %EXPORT_TAGS = (all => \@EXPORT_OK);
24 3 our $VERSION = '0.004';
25  
26 # some polynomial with coefficient type Math::BigInt
27 3 my $default = Math::Polynomial->new(Math::BigInt->new('1'));
28 3 $default->string_config({fold_sign => 1, times => '*'});
29  
30 # ----- private subroutines -----
31  
32 118 ▶sub _cyclo_poly {
Subroutine _cyclo_poly: called CC=12 SCAR=24.8
33 118 my ($poly, $table, $n, $divisors) = @_;
34 118 ▶ return $table->{$n} if exists $table->{$n};
Branch: 1 branch
BranchTrueFalseTotal
if exists $table->{$n} 56 62 118
35 62 my $m = vecprod(map { $_->[0] } factor_exp($n)); # $m = radix($n)
36 62 my $o = $m & 1;
37 62 ▶ $m >>= 1 if !$o;
Branch: 1 branch
BranchTrueFalseTotal
unless $o 29 33 62
38 62 my $p;
39 62 ▶ if (exists $table->{$m}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $table->{$m}) { } 26 36 62
40 26 $p = $table->{$m};
41 }
42 else {
43 36 my $one = $poly->coeff_one;
44 36 ▶ my @d = $divisors? (grep { not $m % $_ } @{$divisors}): divisors($m);
Branch: 1 branch
BranchTrueFalseTotal
$divisors ? : 23 13 36
45 36 $p = $poly->monomial(pop @d)->sub_const($one);
46 36 ▶ if (@d) {
Branch: 1 branch
BranchTrueFalseTotal
if (@d) 26 10 36
47 26 my $b = $d[-1];
48 26 $p /= $poly->monomial($b)->sub_const($one);
49 26 ▶ for (my $i = 1; $i < $#d; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $#d) 11 26 37
50 11 my $r = $d[$i];
51 11 ▶ if ($b % $r) {
Branch: 1 branch
BranchTrueFalseTotal
if ($b % $r) 9 2 11
52 9 ▶ $p /= $table->{$r} || _cyclo_poly($poly, $table, $r, \@d);
Condition66%2/3
$table->{$r} || _cyclo_poly($poly, $table, $r, \@d)
l!l&&r!l&&!r
540
MC/DC0%0/2
$table->{$r} || _cyclo_poly($poly, $table, $r, \@d)
$table->{$r} _cyclo_poly($poly, $table, $r, \@d)
Truth table66%2/3
A || B
A= $table->{$r}B= _cyclo_poly($poly, $table, $r, \@d)
ABresult
1X1
011
000
53 }
54 }
55 }
56 36 $table->{$m} = $p;
57 }
58 62 ▶ if (!$o) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($o) 29 33 62
59 29 ▶ $p = -$p if $m == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $m == 1 12 17 29
60 29 $m <<= 1;
61 29 $p = $p->mirror;
62 29 $table->{$m} = $p;
63 }
64 62 ▶ if ($m != $n) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m != $n) 21 41 62
65 21 $p = $p->inflate($n/$m);
66 21 $table->{$n} = $p;
67 }
68 62 return $p;
69 }
70  
71 # for a positive integer n, return r,s so that r is square-free and n=rs^2
72 16 ▶sub _square_free_square {
Subroutine _square_free_square: called CC=6 SCAR=17.9
73 16 my ($n) = @_;
74 16 my ($r, $s) = (1, 1);
75 16 foreach my $be (factor_exp($n)) {
76 27 my ($b, $e) = @{$be};
77 27 ▶ $r *= $b if $e & 1;
Branch: 1 branch
BranchTrueFalseTotal
if $e & 1 22 5 27
78 27 $e >>= 1;
79 27 ▶ while ($e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e) 7 27 34
80 7 ▶ $s *= $b if $e & 1;
Branch: 1 branch
BranchTrueFalseTotal
if $e & 1 6 1 7
81 7 ▶ $e >>= 1 and $b *= $b;
Branch: 1 branch
BranchTrueFalseTotal
$e >>= 1 and $b *= $b 1 6 7
82 }
83 }
84 16 return ($r, $s);
85 }
86  
87 # generate polynomials C, D, satisfying the identity of Aurifeuille,
88 # Le Lasseur and Lucas: for n > 1, square-free,
89 # n === 1 (mod 4): Phi_n(x) = C^2 - n*x*D^2
90 # else: Phi_2n(x) = C^2 - n*x*D^2
91 10 ▶sub _lucas_cd {
Subroutine _lucas_cd: called CC=12 SCAR=24.8
92 10 my ($poly, $table, $n) = @_;
93 10 my $c1 = 1 == ($n & 3);
94 10 ▶ my $n1 = $c1? $n: $n + $n;
Branch: 1 branch
BranchTrueFalseTotal
$c1 ? : 3 7 10
95 10 ▶ if (exists $table->{"$n1 $n"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$table{"$n1 $n"}) 3 7 10
96 3 return (@{$table->{"$n1 $n"}})
97 }
98 7 my $c2 = !($n & 1);
99 7 my $ee = euler_phi($n1);
100 7 my $e = $ee >> 1;
101 7 my $one = $poly->coeff_one;
102 7 my $nul = $poly->coeff_zero;
103  
104 7 my $E = $e | 1;
105 7 my @q = ($one);
106 7 my $cos = $one;
107 7 my %MP = ();
108 7 ▶ for (my $k = 2; $k <= $E; ++$k) {
Branch: 1 branch
BranchTrueFalseTotal
if ($k <= $E) 30 7 37
109 30 ▶ if ($k & 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($k & 1) 15 15 30
110 15 push @q, $nul + kronecker($n, $k);
111 15 next;
112 }
113 15 ▶ if ($c2 && $k & 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 and $k & 2) 2 13 15
Condition100%3/3
$c2 and $k & 2
!ll&&!rl&&r
1212
MC/DC100%2/2
$c2 and $k & 2
$c2 $k & 2
Truth table100%3/3
A and B
A= $c2B= $k & 2
ABresult
0X0
100
111
114 2 push @q, $nul;
115 2 next;
116 }
117 13 ▶ $cos = -$cos if !$c1; # $cos is cos((n-1)*k*pi/4)
Branch: 1 branch
BranchTrueFalseTotal
unless $c1 9 4 13
118 13 my $gk = gcd($n1, $k);
119 13 ▶ my $mp = $MP{$gk} ||= moebius($n1 / $gk) * euler_phi($gk);
Condition66%2/3
$MP{$gk} ||= &moebius($n1 / $gk) * &euler_phi($gk)
l!l&&r!l&&!r
760
MC/DC0%0/2
$MP{$gk} ||= &moebius($n1 / $gk) * &euler_phi($gk)
$MP{$gk} &moebius($n1 / $gk) * &euler_phi($gk)
Truth table66%2/3
A ||= B
A= $MP{$gk}B= &moebius($n1 / $gk) * &euler_phi($gk)
ABresult
1X1
011
000
120 13 push @q, $cos * $mp;
121 }
122  
123 7 my @cs = ($one);
124 7 my @ds = ($one);
125 7 $cs[$e] = $ds[$e-1] = $one;
126 7 ▶ for(my $k = 1, my $kk = $e - 1; $k <= $kk; ++$k, --$kk) {
Branch: 1 branch
BranchTrueFalseTotal
if ($k <= $kk) 15 7 22
127 15 my ($c, $d) = ($nul, $nul);
128 15 ▶ for (my $i = 0, my $j = $k-1; $j >= 0; $i += 2, --$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j >= 0) 37 15 52
129 37 my $cc = $cs[$j];
130 37 my $dd = $ds[$j];
131 37 my ($q1, $q2) = @q[$i, $i+1];
132 37 $c += $q1 * $n * $dd - $q2 * $cc;
133 37 $d += $q[$i+2] * $cc - $q2 * $dd;
134 }
135 15 $c /= ($k + $k);
136 15 $cs[$k] = $cs[$kk] = $c;
137 15 ▶ $ds[$k] = $ds[$kk-1] = ($d + $c) / ($k + $k + 1) if $k < $kk;
Branch: 1 branch
BranchTrueFalseTotal
if $k < $kk 10 5 15
138 }
139  
140 7 my $cp = $poly->new(@cs);
141 7 my $dp = $poly->new(@ds);
142 7 $table->{"$n1 $n"} = [$cp, $dp];
143 7 return ($cp, $dp);
144 }
145  
146 # generate polynomials C, D, satisfying the identity of Beeger and Schinzel:
147 # for k > 1, square-free, k1 = k (if k === 1 (mod 4)), k1 = 2*k (else),
148 # n = odd multiple of k1: Phi_n(x) = C^2 - k*x*D^2
149 25 ▶sub _schinzel_cd {
Subroutine _schinzel_cd: called CC=10 SCAR=23.0
150 25 my ($poly, $table, $n, $k) = @_;
151 25 ▶ my $K = ($k & 3) == 1? $k: $k << 1;
Branch: 1 branch
BranchTrueFalseTotal
($k & 3) == 1 ? : 8 17 25
152 25 my $f = $n / $K;
153 25 ▶ return () if not $f & 1;
Branch: 1 branch
BranchTrueFalseTotal
unless $f & 1 2 23 25
154 23 my $r = vecprod(map { $_->[0] } factor_exp($f));
155 23 my $m = $f / $r * gcd($f, $k);
156 23 ▶ if ($m > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m > 1) 3 20 23
157 3 $n /= $m;
158 3 $f /= $m;
159 }
160 23 my ($C, $D) = ();
161 23 ▶ if (exists $table->{"$n $k"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$table{"$n $k"}) { } 17 6 23
162 17 ($C, $D) = @{$table->{"$n $k"}};
163 }
164 else {
165 6 ($C, $D) = _lucas_cd($poly, $table, $k);
166 6 my ($L, $M, $Q) = ();
167 6 foreach my $p (factor($f)) {
168 6 my $p2 = $p >> 1;
169 6 my $kp2 = Math::BigInt->new($k)->bpow($p2);
170 6 ▶ if (!defined $M) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $M) 5 1 6
171 5 $Q = $poly->monomial(2, $k);
172 5 my $CC = $C->nest($Q);
173 5 my $DD = $D->nest($Q)->shift_up(1)->mul_const($k);
174 5 $L = $CC - $DD;
175 5 $M = $CC + $DD;
176 }
177 6 ▶ if (kronecker($k, $p) < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (<custom op kronecker> < 0) { } 5 1 6
178 5 ($L, $M) = (
179 $L->nest($poly->monomial($p, $kp2)) / $M,
180 $M->nest($poly->monomial($p, $kp2)) / $L,
181 );
182 }
183 else {
184 1 ($L, $M) = (
185 $M->nest($poly->monomial($p, $kp2)) / $M,
186 $L->nest($poly->monomial($p, $kp2)) / $L,
187 );
188 }
189 }
190 6 ▶ if (defined $M) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $M) 5 1 6
191 5 $C = ($M + $L)->div_const(2)->unnest($Q);
192 5 $D = (($M - $L) / $poly->monomial(1, $k << 1))->unnest($Q);
193 5 $table->{"$n $k"} = [$C, $D];
194 }
195 }
196 23 ▶ if ($m > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m > 1) 3 20 23
197 3 $C = $C->inflate($m);
198 3 $D = $D->inflate($m)->shift_up($m >> 1);
199 }
200 23 return ($C, $D);
201 }
202  
203 # for r > 1, integer, square-free, s > 0, integer, x = r*s^2,
204 # r1 = r (if r === 1 (mod 4)), r1 = 2*r (else), n = odd multiple of r1,
205 # generate integer factors l < m such that l * m = Phi_n(x).
206 # if l = 1, return (m) else (l, m).
207 16 ▶sub _schinzel_lm {
Subroutine _schinzel_lm: called CC=2 SCAR=6.9
208 16 my ($poly, $table, $n, $r, $s, $x) = @_;
209 16 my ($c, $d) = _schinzel_cd($poly, $table, $n, $r);
210 16 my $cx = $c->evaluate($x);
211 16 my $dx = $d->evaluate($x) * $r * $s;
212 16 my ($l, $m) = ($cx - $dx, $cx + $dx);
213 16 ▶ return $m if $l == $poly->coeff_one;
Branch: 1 branch
BranchTrueFalseTotal
if $l == $poly->coeff_one 2 14 16
214 14 return ($l, $m);
215 }
216  
217 # ----- Math::Polynomial extension -----
218  
219 12 ▶sub Math::Polynomial::cyclotomic {
Subroutine cyclotomic: called CC=2 SCAR=6.9
Pod undocumented
220 12 my ($this, $n, $table) = @_;
221 12 ▶ return _cyclo_poly($this, $table || {}, $n);
Condition100%2/2
$table || {}
l!l
66
MC/DC100%1/1
$table || {}
$table
Truth table100%2/2
A
A= $table
Aresult
11
00
222 }
223  
224 6 ▶sub Math::Polynomial::cyclo_factors {
Subroutine cyclo_factors: called CC=2 SCAR=6.9
Pod undocumented
225 6 my ($this, $n, $table) = @_;
226 6 my @d = divisors($n);
227 6 ▶ $table ||= {};
Condition100%2/2
$table ||= {}
l!l
33
MC/DC100%1/1
$table ||= {}
$table
Truth table100%2/2
A
A= $table
Aresult
11
00
228 6 return map { _cyclo_poly($this, $table, $_, \@d) } @d;
229 }
230  
231 13 ▶sub Math::Polynomial::cyclo_int_factors {
Subroutine cyclo_int_factors: called CC=11 SCAR=24.0
Pod undocumented
232 13 my ($this, $x, $n, $table) = @_;
233 13 ▶ return ($this->coeff_zero) if !$n || $x == $this->coeff_one;
Branch: 1 branch
BranchTrueFalseTotal
if not $n or $x == $this->coeff_one 2 11 13
Condition100%3/3
not $n or $x == $this->coeff_one
l!l&&r!l&&!r
1111
MC/DC100%2/2
not $n or $x == $this->coeff_one
not $n $x == $this->coeff_one
Truth table100%3/3
not(A) or B
A= not $nB= $x == $this->coeff_one
ABresult
1X1
011
000
234 11 ▶ return ($x - $this->coeff_one) if $n == 1 || !$x;
Branch: 1 branch
BranchTrueFalseTotal
if $n == 1 or not $x 2 9 11
Condition100%3/3
$n == 1 or not $x
l!l&&r!l&&!r
119
MC/DC100%2/2
$n == 1 or not $x
$n == 1 not $x
Truth table100%3/3
A or not(B)
A= $n == 1B= not $x
ABresult
1X1
011
000
235 9 ▶ $table ||= {};
Condition50%1/2
$table ||= {}
l!l
90
MC/DC0%0/1
$table ||= {}
$table
Truth table50%1/2
A
A= $table
Aresult
11
00
236 9 ▶ if (my $exp = is_power($x, 0, \my $root)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $exp = &is_power($x, 0, \my $root)) 2 7 9
237 2 $x = $root;
238 2 $n *= $exp;
239 }
240 9 my ($r, $s) = _square_free_square($x);
241 9 ▶ my $r1 = (1 == ($r & 3))? $r: $r+$r;
Branch: 1 branch
BranchTrueFalseTotal
1 == ($r & 3) ? : 3 6 9
242 9 my @d = divisors($n);
243 9 ▶ my $i = $x == 2 || 0;
Condition100%2/2
$x == 2 || 0
l!l
18
MC/DC100%1/1
$x == 2 || 0
$x == 2
Truth table100%2/2
A
A= $x == 2
Aresult
11
00
244 return
245 map {
246 9 ▶ !($_ % $r1) && ($_ / $r1) & 1?
Branch: 1 branch
BranchTrueFalseTotal
!($_ % $r1) && $_ / $r1 & 1 ? : 12 33 45
Condition100%3/3
not $_ % $r1 and $_ / $r1 & 1
!ll&&!rl&&r
32112
MC/DC100%2/2
not $_ % $r1 and $_ / $r1 & 1
not $_ % $r1 $_ / $r1 & 1
Truth table100%3/3
not(A) and B
A= not $_ % $r1B= $_ / $r1 & 1
ABresult
0X0
100
111
247 _schinzel_lm($this, $table, $_, $r, $s, $x):
248 (_cyclo_poly($this, $table, $_, \@d))->evaluate($x)
249 } @d[$i .. $#d];
250 }
251  
252 4 ▶sub Math::Polynomial::cyclo_plusfactors {
Subroutine cyclo_plusfactors: called CC=2 SCAR=6.9
Pod undocumented
253 4 my ($this, $n, $table) = @_;
254 4 my @d = divisors($n << 1);
255 4 my $m = $n ^ ($n - 1);
256 4 ▶ $table ||= {};
Condition100%2/2
$table ||= {}
l!l
13
MC/DC100%1/1
$table ||= {}
$table
Truth table100%2/2
A
A= $table
Aresult
11
00
257 return
258 8 map { _cyclo_poly($this, $table, $_, \@d) }
259 4 grep { !($_ & $m) } @d;
260 }
261  
262 11 ▶sub Math::Polynomial::cyclo_int_plusfactors {
Subroutine cyclo_int_plusfactors: called CC=10 SCAR=23.0
Pod undocumented
263 11 my ($this, $x, $n, $table) = @_;
264 11 my $u = $this->coeff_one;
265 11 ▶ return ($u + $u) if !$n;
Branch: 1 branch
BranchTrueFalseTotal
unless $n 1 10 11
266 10 ▶ return ($x + $u) if $n == 1 || !$x || $x == $u;
Branch: 1 branch
BranchTrueFalseTotal
if $n == 1 or not $x or $x == $u 3 7 10
Condition100%6/6
$n == 1 or not $x or $x == $u
l!l&&r!l&&!r
217
$n == 1 or not $x
l!l&&r!l&&!r
118
MC/DC100%3/3
$n == 1 or not $x or $x == $u
$n == 1 not $x $x == $u
Truth table100%4/4
A or not(B) or C
A= $n == 1B= not $xC= $x == $u
ABCresult
1XX1
01X1
0011
0000
267 7 ▶ if (my $exp = is_power($x, 0, \my $root)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $exp = &is_power($x, 0, \my $root)) 2 5 7
268 2 $x = $root;
269 2 $n *= $exp;
270 }
271 7 my ($r, $s) = _square_free_square($x);
272 7 ▶ my $r1 = (1 == ($r & 3))? $r: $r+$r;
Branch: 1 branch
BranchTrueFalseTotal
1 == ($r & 3) ? : 1 6 7
273 7 my @d = divisors($n << 1);
274 7 my $m = $n ^ ($n - 1);
275 7 ▶ $table ||= {};
Condition50%1/2
$table ||= {}
l!l
70
MC/DC0%0/1
$table ||= {}
$table
Truth table50%1/2
A
A= $table
Aresult
11
00
276 return
277 map {
278 23 ▶ !($_ % $r1) && ($_ / $r1) & 1?
Branch: 1 branch
BranchTrueFalseTotal
!($_ % $r1) && $_ / $r1 & 1 ? : 4 19 23
Condition100%3/3
not $_ % $r1 and $_ / $r1 & 1
!ll&&!rl&&r
1544
MC/DC100%2/2
not $_ % $r1 and $_ / $r1 & 1
not $_ % $r1 $_ / $r1 & 1
Truth table100%3/3
not(A) and B
A= not $_ % $r1B= $_ / $r1 & 1
ABresult
0X0
100
111
279 _schinzel_lm($this, $table, $_, $r, $s, $x):
280 (_cyclo_poly($this, $table, $_, \@d))->evaluate($x)
281 7 } grep { !($_ & $m) } @d;
282 }
283  
284 6 ▶sub Math::Polynomial::cyclo_lucas_cd {
Subroutine cyclo_lucas_cd: called CC=4 SCAR=13.9
Pod undocumented
285 6 my ($this, $n, $table) = @_;
286 6 ▶ if ($n <= 1 || !is_square_free($n)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n <= 1 or not &is_square_free($n)) 2 4 6
Condition100%3/3
$n <= 1 or not &is_square_free($n)
l!l&&r!l&&!r
114
MC/DC100%2/2
$n <= 1 or not &is_square_free($n)
$n <= 1 not &is_square_free($n)
Truth table100%3/3
A or not(B)
A= $n <= 1B= not &is_square_free($n)
ABresult
1X1
011
000
287 2 croak "$n: not a square-free integer greater than one";
288 }
289 4 ▶ return _lucas_cd($this, $table || {}, $n);
Condition50%1/2
$table || {}
l!l
40
MC/DC0%0/1
$table || {}
$table
Truth table50%1/2
A
A= $table
Aresult
11
00
290 }
291  
292 11 ▶sub Math::Polynomial::cyclo_schinzel_cd {
Subroutine cyclo_schinzel_cd: called CC=6 SCAR=17.9
Pod undocumented
293 11 my ($this, $n, $k, $table) = @_;
294 11 ▶ if ($k <= 1 || !is_square_free($k)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($k <= 1 or not &is_square_free($k)) 2 9 11
Condition100%3/3
$k <= 1 or not &is_square_free($k)
l!l&&r!l&&!r
119
MC/DC100%2/2
$k <= 1 or not &is_square_free($k)
$k <= 1 not &is_square_free($k)
Truth table100%3/3
A or not(B)
A= $k <= 1B= not &is_square_free($k)
ABresult
1X1
011
000
295 2 croak "$k: not a square-free integer greater than one";
296 }
297 9 ▶ my @cd = _schinzel_cd($this, $table || {}, $n, $k);
Condition100%2/2
$table || {}
l!l
72
MC/DC100%1/1
$table || {}
$table
Truth table100%2/2
A
A= $table
Aresult
11
00
298 9 ▶ if (!@cd) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@cd) 2 7 9
299 2 ▶ my $k1 = ($k & 3) == 1? 'k': '2*k';
Branch: 1 branch
BranchTrueFalseTotal
($k & 3) == 1 ? : 1 1 2
300 2 croak "$n: n is not an odd multiple of $k1";
301 }
302 7 return @cd;
303 }
304  
305 4 ▶sub Math::Polynomial::cyclo_poly_iterate {
Subroutine cyclo_poly_iterate: called CC=3 SCAR=11.0
Pod undocumented
306 4 my ($this, $n, $table) = @_;
307 4 ▶ $n ||= 1;
Condition100%2/2
$n ||= 1
l!l
22
MC/DC100%1/1
$n ||= 1
$n
Truth table100%2/2
A
A= $n
Aresult
11
00
308 4 --$n;
309 4 ▶ $table ||= {};
Condition100%2/2
$table ||= {}
l!l
22
MC/DC100%1/1
$table ||= {}
$table
Truth table100%2/2
A
A= $table
Aresult
11
00
310 return
311 14 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
312 14 ++$n;
313 14 _cyclo_poly($this, $table, $n);
314 4 };
315 }
316  
317 # ----- public subroutines -----
318  
319 9 ▶sub cyclo_poly { $default->cyclotomic(@_) }
Subroutine cyclo_poly: called CC=1 SCAR=0.0
Pod documented
320 2 ▶sub cyclo_factors { $default->cyclo_factors(@_) }
Subroutine cyclo_factors: called CC=1 SCAR=0.0
Pod documented
321 3 ▶sub cyclo_plusfactors { $default->cyclo_plusfactors(@_) }
Subroutine cyclo_plusfactors: called CC=1 SCAR=0.0
Pod documented
322 2 ▶sub cyclo_poly_iterate { $default->cyclo_poly_iterate(@_) }
Subroutine cyclo_poly_iterate: called CC=1 SCAR=0.0
Pod documented
323 6 ▶sub cyclo_lucas_cd { $default->cyclo_lucas_cd(@_) }
Subroutine cyclo_lucas_cd: called CC=1 SCAR=0.0
Pod documented
324 11 ▶sub cyclo_schinzel_cd { $default->cyclo_schinzel_cd(@_) }
Subroutine cyclo_schinzel_cd: called CC=1 SCAR=0.0
Pod documented
325 13 ▶sub cyclo_int_factors { $default->cyclo_int_factors(@_) }
Subroutine cyclo_int_factors: called CC=1 SCAR=0.0
Pod documented
326 11 ▶sub cyclo_int_plusfactors { $default->cyclo_int_plusfactors(@_) }
Subroutine cyclo_int_plusfactors: called CC=1 SCAR=0.0
Pod documented
327  
328 3 1;
329  
330 __END__
↑ Summary