1Math::NumSeq::GolayRudiUnsSehrapCiornot(r3i)buted Perl DMoactuhm:e:nNtuamtSieoqn::GolayRudinShapiro(3)
2
3
4
6 Math::NumSeq::GolayRudinShapiro -- parity of adjacent 11 bit pairs
7
9 use Math::NumSeq::GolayRudinShapiro;
10 my $seq = Math::NumSeq::GolayRudinShapiro->new;
11 my ($i, $value) = $seq->next;
12
14 This is the Golay/Rudin/Shapiro sequence of +1 or -1 according to there
15 being an even or odd number of adjacent 11 bit pairs in i.
16
17 GRS(i) = (-1) ^ (count 11 bit pairs)
18
19 starting from i=0
20 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, ...
21
22 The first -1 is at i=3 which is binary 11 with a single 11 bit pair,
23 then i=6 binary 110 likewise -1. Later for example i=14 is binary 1110
24 which has two adjacent 11 pairs (overlapping pairs count), so value=1.
25
26 The value is also the parity of the number of even-length runs of
27 1-bits in i. An even length run has an odd number of 11 pairs, so each
28 of them is a -1 in the product. An odd-length run of 1-bits is an even
29 number of 11 pairs and so is +1 and has no effect on the result.
30
31 Such a parity of even-length 1-bit runs and hence the GRS sequence
32 arises as the "dX,dY" change for each segment of the alternate paper
33 folding curve. See "dX,dY" in Math::PlanePath::AlternatePaper.
34
35 Values Type
36 Parameter "values_type => '0,1'" gives values 0 and 1, being the count
37 of adjacent 11s taken modulo 2, so 0 if even, 1 if odd.
38
39 values_type => '0,1'
40 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, ...
41
43 See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence
44 classes.
45
46 "$seq = Math::NumSeq::GolayRudinShapiro->new ()"
47 "$seq = Math::NumSeq::GolayRudinShapiro->new (values_type => $str)"
48 Create and return a new sequence object. The "values_type"
49 parameter (a string) can be
50
51 "1,-1" 1=even, -1=odd
52 "0,1" 0=even, 1=odd
53
54 Random Access
55 "$value = $seq->ith($i)"
56 Return the $i'th value from the sequence, being +1 or -1 (or per
57 "values_type") according to the number of adjacent 11 bit pairs in
58 $i.
59
60 "$bool = $seq->pred($value)"
61 Return true if $value occurs in the sequence, which simply means
62 "$value == 1" or "$value == -1". Or if "values_type=>'0,1'" then 0
63 or 1.
64
66 Math::NumSeq, Math::NumSeq::GolayRudinShapiroCumulative,
67 Math::NumSeq::BaumSweet, Math::NumSeq::Fibbinary
68
69 Math::PlanePath::AlternatePaper
70
72 <http://user42.tuxfamily.org/math-numseq/index.html>
73
75 Copyright 2010, 2011, 2012, 2013, 2014 Kevin Ryde
76
77 Math-NumSeq is free software; you can redistribute it and/or modify it
78 under the terms of the GNU General Public License as published by the
79 Free Software Foundation; either version 3, or (at your option) any
80 later version.
81
82 Math-NumSeq is distributed in the hope that it will be useful, but
83 WITHOUT ANY WARRANTY; without even the implied warranty of
84 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85 General Public License for more details.
86
87 You should have received a copy of the GNU General Public License along
88 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
89
90
91
92perl v5.28.1 2014-06-29Math::NumSeq::GolayRudinShapiro(3)