...
 
Commits (9)
......@@ -6,3 +6,6 @@ dd0e0p
tempdir
cygwin
compiletime.txt
logicsynth/abc
logicsynth/abc.rc
logicsynth/aigtoaig
#ifndef LIFELIB_VERSION /*
__version__=[x.replace('"', '') for x in '''
*/
#define LIFELIB_VERSION "ll2.2.8"
#define LIFELIB_VERSION "ll2.2.11"
// '''.split() if ('ll' in x)][0][2:]
#endif
......@@ -8,31 +8,25 @@
}
void assemble_lut18() {
std::cerr << "Computing 2^18-entry lookup table...";
lut18 = (uint8_t*) std::malloc(0x40000); // don't bother freeing; the OS will do that.
for (uint64_t i = 0; i < 0x40000; i++) {
lut18[i] = xfl9(i) | (xfl9(i >> 1) << 1) | (xfl9(i >> 2) << 2) | (xfl9(i >> 3) << 3);
}
std::cerr << "done!" << std::endl;
}
void assemble_lut24() {
if (lut18 == 0) { assemble_lut18(); }
std::cerr << "Computing 2^24-entry lookup table...";
lut24 = (uint8_t*) std::malloc(0x1000000); // don't bother freeing; the OS will do that.
for (uint64_t i = 0; i < 0x1000000; i++) {
lut24[i] = lut18[i & 0x3ffff] | (lut18[i >> 6] << 4);
}
std::cerr << "done!" << std::endl;
}
void assemble_mix18() {
std::cerr << "Computing 2^18-entry mixing table...";
mix18 = (uint32_t*) std::malloc(0x100000); // see above.
for (uint64_t i = 0; i < 0x40000; i++) {
mix18[i] = (i & 0x3f) | (((i >> 4) & 0x3f) << 8) | (((i >> 8) & 0x3f) << 16) | (((i >> 12) & 0x3f) << 24);
}
std::cerr << "done!" << std::endl;
}
bool iterate_var_leaf(uint64_t *inleaves, uint64_t *outleafx) {
......
......@@ -183,12 +183,8 @@ def isotrope(rulestring):
lord2 = str2tab(rulestring)
print(('Compressing 512-bit lookup table for rule %s...' % rulestring))
lut9 = [sum([(lord2[8*i+j] << j) for j in range(8)]) for i in range(64)]
print(('Creating magic sauce for rule %s...' % rulestring))
def oi(i0, i1, i2, i4, i5, i6):
thisbyte = 0
for i3 in range(2):
......@@ -238,7 +234,3 @@ def isotrope(rulestring):
for j in range(i*18+4, i*18+22):
currstring += ((' %3d};' if (j == 111) else ' %3d,') % lut9[j])
f.write(currstring + '\n')
print('...completed.')
......@@ -15,11 +15,8 @@ rules_dir = os.path.join(lifelib_dir, 'rules')
def table_to_tree(lines):
print('Reading rule table...')
n_states, nhood, transitions = ReadRuleTable(lines)
print('Assembling tree...')
lines = TransitionsToTree(n_states, nhood, transitions)
print('...done!')
return lines
def minkowski_symmetrise(nhood):
......@@ -30,10 +27,8 @@ def analyse_tree(segments):
lines = segments['@TREE']
print('Reading rule tree...')
n_states, nhood, list_of_nodes = ReadRuleTree(lines)
syms = get_symmetries(n_states, nhood, list_of_nodes)
print('Symmetries: %s' % syms)
if len(syms) == 12:
symstring = "HEXAGONAL"
......@@ -44,10 +39,8 @@ def analyse_tree(segments):
is16bit = (n_states > 256)
print('Flattening tree...')
flattened_tree = FlattenRuleTree(n_states, nhood, list_of_nodes)
segments['@FLATTREE'] = MakeStaticTable(flattened_tree)
print('...done!')
# Determine zone of influence for rule:
mink = minkowski_symmetrise(nhood)
......
......@@ -67,11 +67,6 @@ extern "C"
void SavePatternRLE(void *ptr, const char *filename, const char *header, const char *footer) {
std::cerr << "filename: '" << filename << "'\n";
std::cerr << "header: '" << header << "'\n";
std::cerr << "footer: '" << footer << "'\n";
std::cerr << "--------" << std::endl;
std::ofstream out(filename);
auto ppat = reinterpret_cast<apg::pattern*>(ptr);
out << header;
......@@ -81,11 +76,6 @@ extern "C"
void SavePatternMC(void *ptr, const char *filename, const char *header, const char *footer) {
std::cerr << "filename: '" << filename << "'\n";
std::cerr << "header: '" << header << "'\n";
std::cerr << "footer: '" << footer << "'\n";
std::cerr << "--------" << std::endl;
std::ofstream out(filename);
auto ppat = reinterpret_cast<apg::pattern*>(ptr);
auto lab = ppat->getlab();
......@@ -205,6 +195,11 @@ extern "C"
return new(std::nothrow) apg::pattern(ppat->match(*ppat1));
}
void* CopyPattern(void* pat) {
auto ppat = reinterpret_cast<apg::pattern*>(pat);
return new(std::nothrow) apg::pattern(*ppat);
}
void* MatchLiveAndDead(void* pat, void* pat1, void* pat0) {
auto ppat = reinterpret_cast<apg::pattern*>(pat);
auto ppat1 = reinterpret_cast<apg::pattern*>(pat1);
......@@ -240,6 +235,12 @@ extern "C"
s.copy(buffer, 2048);
}
void GetWechslerOfPattern(void* pat, char* buffer) {
auto ppat = reinterpret_cast<apg::pattern*>(pat);
std::string s = ppat->phase_wechsler();
s.copy(buffer, 2048);
}
void GetApgcodeOfPattern(void* pat, char* buffer) {
auto ppat = reinterpret_cast<apg::pattern*>(pat);
std::string s = ppat->apgcode();
......
......@@ -441,14 +441,14 @@ namespace apg {
if (posrule != std::string::npos) {
rule = sanirule(line.substr(posrule + 4));
delete grm; grm = getMapper(rule);
std::cerr << line << " interpreted as " << rule << std::endl;
// std::cerr << line << " interpreted as " << rule << std::endl;
}
} else if (line[0] == '#') {
if (line.length() >= 2 && (line[1] == 'R' || line[1] == 'G')) {
if (line[1] == 'R') {
rule = sanirule(line.substr(3));
delete grm; grm = getMapper(rule);
std::cerr << line << " interpreted as " << rule << std::endl;
// std::cerr << line << " interpreted as " << rule << std::endl;
}
} else if ((line.length() > 4) && (line.substr(0, 4) == "#CLL")) {
// Lifelib-specific meta-information
......
......@@ -501,7 +501,7 @@ namespace apg {
}
hypernode<I> pattern_match(hypernode<I> u, hypernode<I> c0, hypernode<I> c1) {
hypernode<I> v = pyramid_up(pyramid_up(pyramid_up(u, c0.depth), c1.depth));
hypernode<I> v = pyramid_up(pyramid_up(pyramid_up(pyramid_up(u, c0.depth), c1.depth)));
hypernode<I> sol = solid(v.depth);
hypernode<I> sol2 = solid(v.depth-1);
hypernode<I> rc0 = pyramid_up(transform_recurse(c0, 27), v.depth);
......
This file describes the license and copyright for the AIGER source code.
Almost all of the source code of AIGER has so far been developed from
scratch at the Johannes Kepler University. But contributions by authors of
other institutions are very much welcome. The default license is an MIT
style license, acknowledging the copyright of all its authors, and we would
like to keep this license the default. Currently the only exception is
'bliftoaig.c' which contains parts of the CUDD library. Therefore
license of 'bliftoaig.c' has to fall back to the slightly more restrictive
BSD style license used in CUDD and discussed further down.
More specifically, all source code of the AIGER library with the exception
of the 'bliftoaig.c' utility falls under the following LICENSE.
---------------------------------------------------------------------------
-- START OF DEFAULT LICENSE FOR AIGER SOURCE CODE -------------------------
---------------------------------------------------------------------------
Copyright (c) 2006-2013, Armin Biere, Johannes Kepler University, Austria.
Copyright (c) 2006, Marc Herbstritt, University of Freiburg, Germany.
Copyright (c) 2006, Daniel Le Berre, Universite d'Artois, France.
Copyright (c) 2011, Siert Wieringa, Alto University, Finland.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
---------------------------------------------------------------------------
-- END OF DEFAULT LICENSE FOR AIGER SOURCE CODE ---------------------------
---------------------------------------------------------------------------
The list of authors and copyright holders listed in the default license
contains all the authors and copyright holders of AIGER, individual source
code files may only list the authors and copyright holders of the individual
file. The LICENSE is the same and thus should allow to cover all the
source except 'bliftoaig.c' by the above default license which lists all
authors.
The License for 'bliftoaig.c' is a BSD style license since it includes
part of utilities derived from the CUDD library which uses a BSD style
license. The full license for 'bliftoaig.c' is as follows:
---------------------------------------------------------------------------
-- START OF LICENSE FOR 'bliftoaig.c' -------------------------------------
---------------------------------------------------------------------------
Copyright (c) 2006 Armin Biere, Johannes Kepler University, Austria.
Copyright (c) 2006 Marc Herbstritt, University of Freiburg, Germany.
Copyright (c) 1995-2004, Regents of the University of Colorado, USA.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the authors, nor the names of contributors, nor the name
of the copyright holders, including the name of the Johannes Kepler
University, the name of the University of Freiburg, or the name of the
University of Colorado may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------
-- END OF LICENSE FOR 'bliftoaig.c' --------------------------------------
--------------------------------------------------------------------------
This diff is collapsed.
This diff is collapsed.
/***************************************************************************
Copyright (c) 2006-2007, Armin Biere, Johannes Kepler University.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
***************************************************************************/
#include "aiger.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdarg.h>
#define PERCENT(a,b) ((b) ? (100.0 * (a))/ (double)(b) : 0.0)
typedef struct stream stream;
typedef struct memory memory;
struct stream
{
double bytes;
FILE *file;
};
struct memory
{
double bytes;
double max;
};
static void *
aigtoaig_malloc (memory * m, size_t bytes)
{
m->bytes += bytes;
assert (m->bytes);
if (m->bytes > m->max)
m->max = m->bytes;
return malloc (bytes);
}
static void
aigtoaig_free (memory * m, void *ptr, size_t bytes)
{
assert (m->bytes >= bytes);
m->bytes -= bytes;
free (ptr);
}
static int
aigtoaig_put (char ch, stream * stream)
{
int res;
res = putc ((unsigned char) ch, stream->file);
if (res != EOF)
stream->bytes++;
return res;
}
static int
aigtoaig_get (stream * stream)
{
int res;
res = getc (stream->file);
if (res != EOF)
stream->bytes++;
return res;
}
static double
size_of_file (const char *file_name)
{
struct stat buf;
buf.st_size = 0;
stat (file_name, &buf);
return buf.st_size;
}
static void
die (const char *fmt, ...)
{
va_list ap;
fputs ("*** [aigtoaig] ", stderr);
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
fputc ('\n', stderr);
exit (1);
}
#define USAGE \
"usage: aigtoaig [-h][-v][-s][-a][src [dst]]\n" \
"\n" \
"This is an utility to translate files in AIGER format.\n" \
"\n" \
" -h print this command line option summary\n" \
" -v verbose output on 'stderr'\n" \
" -a output in ASCII AIGER '.aag' format\n" \
" -s strip symbols and comments of the output file\n" \
" src input file or '-' for 'stdin'\n" \
" dst output file or '-' for 'stdout'\n" \
"\n" \
"The input format is given by the header in the input file, while\n" \
"the output format is determined by the name of the output file.\n" \
"If the name of the output file has a '.aag' or '.aag.gz' suffix or '-a'\n" \
"is used then the output is written in ASCII format, otherwise in\n" \
"in binary format. Input files and output files can be compressed\n" \
"by GZIP if they are not 'stdin' or 'stdout' respectively. The name of\n" \
"a compressed file needs to have a '.gz' suffix.\n"
int
main (int argc, char **argv)
{
const char *src, *dst, *src_name, *dst_name, *error;
int verbose, ascii, strip, res;
stream reader, writer;
aiger_mode mode;
memory memory;
aiger *aiger;
unsigned i;
res = verbose = ascii = strip = 0;
src_name = dst_name = src = dst = 0;
for (i = 1; i < argc; i++)
{
if (!strcmp (argv[i], "-h"))
{
fprintf (stderr, USAGE);
exit (0);
}
else if (!strcmp (argv[i], "-v"))
verbose = 1;
else if (!strcmp (argv[i], "-s"))
strip = 1;
else if (!strcmp (argv[i], "-a"))
ascii = 1;
else if (argv[i][0] == '-' && argv[i][1])
die ("invalid command line option '%s'", argv[i]);
else if (!src_name)
{
if (!strcmp (argv[i], "-"))
{
src = 0;
src_name = "<stdin>";
}
else
src = src_name = argv[i];
}
else if (!dst_name)
{
if (!strcmp (argv[i], "-"))
{
dst = 0;
dst_name = "<stdout>";
}
else
dst = dst_name = argv[i];
}
else
die ("more than two files specified");
}
if (dst && ascii)
die ("'dst' file and '-a' specified");
if (!dst && !ascii && isatty (1))
ascii = 1;
if (src && dst && !strcmp (src, dst))
die ("identical 'src' and 'dst' file");
memory.max = memory.bytes = 0;
aiger = aiger_init_mem (&memory,
(aiger_malloc) aigtoaig_malloc,
(aiger_free) aigtoaig_free);
if (src)
{
error = aiger_open_and_read_from_file (aiger, src);
if (error)
{
READ_ERROR:
fprintf (stderr, "*** [aigtoaig] %s\n", error);
res = 1;
}
else
{
reader.bytes = size_of_file (src);
if (verbose)
{
fprintf (stderr,
"[aigtoaig] read from '%s' (%.0f bytes)\n",
src, (double) reader.bytes);
fflush (stderr);
}
}
}
else
{
reader.file = stdin;
reader.bytes = 0;
error = aiger_read_generic (aiger, &reader, (aiger_get) aigtoaig_get);
if (error)
goto READ_ERROR;
if (verbose)
{
fprintf (stderr,
"[aigtoaig] read from '<stdin>' (%.0f bytes)\n",
(double) reader.bytes);
fflush (stderr);
}
}
if (!res)
{
if (strip)
{
i = aiger_strip_symbols_and_comments (aiger);
if (verbose)
{
fprintf (stderr, "[aigtoaig] stripped %u symbols\n", i);
fflush (stderr);
}
}
if (dst)
{
if (aiger_open_and_write_to_file (aiger, dst))
{
writer.bytes = size_of_file (dst);
if (verbose)
{
fprintf (stderr,
"[aigtoaig] wrote to '%s' (%.0f bytes)\n",
dst, (double) writer.bytes);
fflush (stderr);
}
}
else
{
unlink (dst);
WRITE_ERROR:
fprintf (stderr, "*** [aigtoai]: write error\n");
res = 1;
}
}
else
{
writer.file = stdout;
writer.bytes = 0;
if (ascii)
mode = aiger_ascii_mode;
else
mode = aiger_binary_mode;
if (!aiger_write_generic (aiger, mode,
&writer, (aiger_put) aigtoaig_put))
goto WRITE_ERROR;
if (verbose)
{
fprintf (stderr,
"[aigtoaig] wrote to '<stdout>' (%.0f bytes)\n",
(double) writer.bytes);
fflush (stderr);
}
}
}
aiger_reset (aiger);
if (!res && verbose)
{
if (reader.bytes > writer.bytes)
fprintf (stderr, "[aigtoaig] deflated to %.1f%%\n",
PERCENT (writer.bytes, reader.bytes));
else
fprintf (stderr, "[aigtoaig] inflated to %.1f%%\n",
PERCENT (writer.bytes, reader.bytes));
fprintf (stderr,
"[aigtoaig] allocated %.0f bytes maximum\n", memory.max);
fflush (stderr);
}
return res;
}
#!/bin/bash
cd `dirname "${BASH_SOURCE[0]}"`
set -e
echo "Building AIGER..."
gcc -O3 aigtoaig.c aiger.c -o aigtoaig
echo "Downloading ABC..."
rm -rf "berkeley-abc"
git clone "https://github.com/berkeley-abc/abc.git" "berkeley-abc"
echo "Building ABC..."
cd "berkeley-abc"
make ABC_USE_NO_READLINE=1 ABC_USE_NO_PTHREADS=1
cd ".."
mv "berkeley-abc/abc" "abc"
mv "berkeley-abc/abc.rc" "abc.rc"
rm -rf "berkeley-abc"
#!/bin/bash
INPUT_FILE="$( readlink -m "$1" )"
OUTPUT_FILE="$( readlink -m "$2" )"
cd `dirname "${BASH_SOURCE[0]}"`
set -e
rm -f "unopt.aig" "opt.aig" | true
./aigtoaig "$INPUT_FILE" "unopt.aig"
./abc -c "r unopt.aig; ps; resyn2; ps; choice; fraig; ps; resyn2; ps; choice; fraig; ps; resyn2; ps; cec; w opt.aig"
./aigtoaig "opt.aig" "$OUTPUT_FILE"
rm -f "unopt.aig" "opt.aig" | true
......@@ -581,6 +581,10 @@ namespace apg {
}
}
std::string phase_wechsler() {
return phase_wechsler(rule_symmetries());
}
std::string apgcode() {
/*
* Returns the apgcode of a still-life, oscillator or spaceship:
......
......@@ -76,7 +76,7 @@ restypes = {'DeletePattern': None, 'GetBeszelIndex': c_uint64, 'GetUlqomaIndex':
'GetSolidForPattern': c_void_p, 'GetOriginState': c_uint64, 'GetCells': None, 'SetCells': None,
'CreatePatternFromFile': c_void_p, 'MakeSpaceshipStream': c_void_p, 'GetCompiledVersion': None,
'GetCoords': None, 'GetPatternBound': c_uint64, 'GetSubpops': None, 'Hashsoup': c_void_p,
'FindConnectedComponent': c_void_p, 'GetOneCell': c_void_p}
'FindConnectedComponent': c_void_p, 'GetOneCell': c_void_p, 'CopyPattern': c_void_p, 'GetWechslerOfPattern': None}
def call_underlying(lifelib, fname_and_args):
......@@ -228,8 +228,6 @@ class WrappedLibrary(object):
if x is None:
import warnings
warnings.warn("Could not ensure stack size, probably due to running on Windows. Expect segfaults soon.")
else:
print("Stack size limit increased to (%d, %d)" % x)
self.last_power = powerof2
def __del__(self):
......
......@@ -204,6 +204,11 @@ class Pattern(object):
newptr = self.lifelib('TransformPattern', self.ptr, tfm)
return Pattern(self.session, newptr, self.owner)
def __copy__(self):
newptr = self.lifelib('CopyPattern', self.ptr)
return Pattern(self.session, newptr, self.owner)
def shift(self, x, y, exponent=0):
if not isinstance(x, Integral):
......@@ -337,11 +342,11 @@ class Pattern(object):
def __call__(self, *args):
temp = self
if (len(args) > 3):
raise TypeError("Usage: pattern(8, -5) or pattern('rccw') or pattern('rot90', 7, 3)")
temp = self.__copy__()
if ((len(args) % 2) == 1):
temp = temp.transform(args[0])
......@@ -366,6 +371,10 @@ class Pattern(object):
return self.lifelib('GetRuleOfPattern', self.ptr, [2048])
def phase_wechsler(self):
return self.lifelib('GetWechslerOfPattern', self.ptr, [2048])
def oscar(self, maxexp=24, eventual_oscillator=True, verbose=True, return_apgcode=False):
logdiam = self.lifelib('GetDiameterOfPattern', self.ptr)
......@@ -375,7 +384,7 @@ class Pattern(object):
x = self
for exponent in range(8, maxexp+2, 2):
if (verbose):
if (verbose) and (exponent > 8):
print("Checking periodicity with exponent %d..." % exponent)
y = x.pdetect_or_advance(exponent)
if isinstance(y, dict):
......@@ -664,6 +673,11 @@ class Pattern(object):
populations = [self.lifelib('GetPopulationOfPattern', self.ptr, p) for p in relprimes]
return chinese_remainder(relprimes, populations)
@property
def wechsler(self):
return self.phase_wechsler()
@property
def apgcode(self):
......
......@@ -20,6 +20,14 @@ class TestGoL(unittest.TestCase):
self.sess.lifelib.ensure_limit(20000, 1)
self.sess.lifelib.ensure_limit(10000, 1)
def test_freywa_bug(self):
a = self.lt.pattern("bo$2bo$3o5$5bobo$6b2o$6bo")
b = self.lt.pattern("bo$2bo$3o")
self.assertEqual(a(-10, -16).match(b).nonempty(), True)
self.assertEqual(a(-20, -32).match(b).nonempty(), True)
self.assertEqual(a(-40, -64).match(b).nonempty(), True)
def test_components(self):
pat = self.lt.pattern('''7b3o5b3o16b3o5b3o$6bo2bo5bo2bo15bo2bo3bo2bo$6bo3bo3bo3bo15bo9bo$7b4o3b
......@@ -36,6 +44,17 @@ $3b3o3b2o3b2o3bo2bo7bo2bo12b3o$3bo2bo2b2o3b2o2bo3bo7bob2o12bo2bo$3bo
ncomps = len(pat.components())
self.assertEqual(ncomps, 41)
def test_copy(self):
pat = self.lt.pattern('xp40_33zxs48g69gvzx3021zy833')
pat2 = pat.__copy__()
self.assertEqual(pat, pat2)
pat += pat(1093, 3511)
self.assertNotEqual(pat, pat2)
pat2 += pat2(1093, 3511)
self.assertEqual(pat, pat2)
def test_samples(self):
pat = self.lt.pattern('xp40_33zxs48g69gvzx3021zy833')
......@@ -120,6 +139,8 @@ $.4B$4B$3B$2B!'''
osc = coe.oscar()
self.assertEqual(osc['period'], 16)
self.assertEqual(coe.wechsler, 'gcbgzvgg826frc')
def test_io(self):
try:
......
......@@ -124,9 +124,6 @@ bbbbooobobobbboo!''', 'g3b3s23')
p54soup[coords] = values
values2 = p54soup[coords]
print(values)
print(values2)
self.assertEqual(np.all(values == values2), True)
def test_isogeny(self):
......