My good friend and colleague Christian Ikenmeyer and I <a href="http://arxiv.org/abs/1410.8202" target="_blank">wrote this cute preprint</a> about polynomials and how they can be written as the determinant of a matrix with entries equal to zero, one and indeterminantes. Go ahead and read it if you know even just a little math, it's quite straightforward. The algorithm described in section 3 has been implemented and you can download the code <a href="http://page.math.tu-berlin.de/~jesko/code/ptest.zip" target="_blank">from my website at the TU Berlin</a>. Compilation instructions are in `ptest.c`, but you will need to get <a href="http://cs.anu.edu.au/~bdm/nauty/" target="_blank">nauty</a> to perform the entire computerized proof.
Just a checklist for programming the microncontroller Ralf gave me yesterday ((Also check out <a href="http://www.mikrocontroller.net/articles/AVR_Eclipse">this useful article</a>))
* you need a functional eclipse installation
* Install WinAVR and be sure that it is in the `PATH` by executing `avr-gcc` from a command prompt
* Install the AVR-Interface into eclipse via `Help` → `Install New Software` → `Add`. Then paste the following link in the URL Box:
```text
http://avr-eclipse.sourceforge.net/updatesite/
```
* When I create a new project, I need to adjust the following settings in the project properties:
* `AVR` → `AVRDude` `Programmer` click on `New`, Name: `USBASP`, Programmer Hardware (`-c`) `USBasp, http://www.fischl.de/usbasp/`
* `AVR` → `AVRDude`, `Advance` be sure the check `Disable device signature check`
* `AVR` → Target Hardware `MCU Type` select `ATmega168` and set the `MCU Clock Frequency` to `12000000` (that's $12\cdot10^6$)
* `C/C++-Build` → Settings unter `Tool Settings` check `Generate HEX file for Flash memory`
* `C/C++-Build` → Settings unter `Tool Settings`, `AVR Compiler` → `Optimization` set the `Optimization Level` to `Size Optimizations (-Os)`.
After a couple of tests, it turns out that the very simple
```C
#include <limits.h>
inline void memzap(void *dest, unsigned long count) {
asm( "cld"
# if ULONG_MAX == 0xffffffff
"\n" "andl $3, %%ecx"
"\n" "rep stosb"
"\n" "movl %%ebx, %%ecx"
"\n" "shrl $2, %%ecx"
"\n" "rep stosl"
# else
"\n" "andq $7, %%rcx"
"\n" "rep stosb"
"\n" "movq %%rbx, %%rcx"
"\n" "shrq $3, %%rcx"
"\n" "rep stosq"
# endif
: "=c" (count), "=D" (dest), "=b" (count)
: "c" (count), "D" (dest), "b" (count), "a" (0)
);
}
```
is the fastest way to zero out a large block of memory, which is not very surprising. It is about 4 to 5 times faster than `memset` and about as fast as `new []`, if I can trust @tobi on that matter. I tried using MMX registers, but anything that involves `actually` looping over the memory region will be about as fast as `memset`. The only way to get a bit of speed is using the `rep` opcode.
<b>Tiny Edit:</b> The above code is much more safe to compile on both 64 and 32 bit computers.