Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

A (one dimensional) cellular automaton is a function1 F : Σ → Σ with the property that there is a K > 0 such that F (x)i depends only on the 2K + 1 coordinates xi−K , xi−K+1, . . . , xi−1, xi, xi+1, . . . , xi+K . A periodic point of σ is any x such that σ^p (x) = x for some p ∈ N, and a periodic point of F is any x such that F^q (x) = x for some q ∈ N. Given a cellular automaton F, a point x ∈ Σ is jointly periodic if there are p, q ∈ N such that σ^p (x) = F^q (x) = x, that is, it is a periodic point under both functions.

This project aims to explore the nature of one-dimensional Cellular Automata, in the hope of finding the structure of cellular automata through its periodic points.

2034 views
License: MIT
ubuntu2004
1
/*
2
* Copyright (C) 2004 Bryant Lee
3
*
4
* This file is part of FPeriod.
5
*
6
* FPeriod is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* FPeriod is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with FPeriod; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
/**
22
* Represents a polynomial function in terms x[-s,t] mod N
23
*
24
* Written by: Bryant Lee
25
* Date: 10/31/04
26
**/
27
28
#ifndef FUNC_H
29
#define FUNC_H
30
31
#include "FuncNode.h"
32
33
#include <fstream> //for printing
34
35
#include <string>
36
#include <list>
37
#include <vector>
38
#include <map> //actually used only for opt polynomials
39
40
#include "StorageKey.h" //used only for opt polynomials lookup map
41
42
class Func {
43
private:
44
string str;
45
list<FuncNode*> fList; //list representation of function (poly repres.)
46
int* fTable; //lookup representation of function (table repres.)
47
int shiftSize; //#symbols in shift
48
int type; //0 = table, 1 = polynomial, 2= optimized polynomial
49
unsigned int span; //span (table repres. only)
50
unsigned int tablesize; //(table repres. only)
51
52
//-- member vars used for OPT functions ONLY
53
vector<int> optTerms;
54
map<StorageKey, byte> optLookupMap; //takes a vector of term values, returns answer
55
map<int, int> optFindTerm; //key = term #, val = coord in "compact" array
56
//--
57
58
//generates the index-th term of the image of x
59
byte timage(byte *word, int wordLength, int index);
60
unsigned int timage(unsigned int * word, int wordLength, int index);
61
62
// (used in opt polynomial functions only: for precomputing to lookup table)
63
// generates value of function based on inputs
64
byte timage_by_inputs(byte *inTerms, int numTerms,
65
const map<int,int> &optFindTerm);
66
67
public:
68
//constructor
69
Func(const string & iStr, int iShiftSize, bool opt);
70
71
//destructor
72
~Func();
73
74
//print
75
void print(ofstream & fout);
76
77
//return image of word x
78
void image(byte *word, int wordLength, byte *output);
79
80
//return image of word x
81
void image(unsigned int * word, int wordLength, unsigned int *output,
82
unsigned int blocks);
83
84
//return true if this is an opt polynomial function
85
bool isOpt();
86
};
87
88
#endif
89
90
91
92
93
94