Skip to content

An implementation and generalization of Thurber's algorithm for orderable assembly spaces

Notifications You must be signed in to change notification settings

ELIFE-ASU/fastpathways

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastPathways

Building from Source

To build FastPathways, you will need to have https://cmake.org/[CMake] v2.8 or higher.

Linux, OS X, and Windows (Bash, MinGW and Cygwin)

Once CMake is installed, building, testing and installing the library is a snap

$ cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
$ make -C build

This will compile down to shared and static libraries, and generate the following executables:

  • build/intchains - compute the assembly indices of integers under addition
  • build/subsecond - determine the smallest integer for which it takes greater than 1s to compute the assembly index
  • build/test/fastpathways_unittests - test the library

You can run the unit tests explicitly

$ ./build/test/fastpathways_unittests

or via make

$ make -C build test

libfastpathways

The library, for the most part, exposes a single function thurber(int64_t n) -> int64_t. The argument is the integer for which you wish to compute the assembly index (minimal length of all addition chains terminating at n), and obviously the return value is that assembly index.

Usage

#include <fastpathways.h>
#include <iostream>

auto main(int argc, char **argv) -> int {
    std::cout << thurber(607) << std::endl;
}

Output:

13

Integer Addition Chains

$ ./build/intchains
usage: intchain [subcommand] n

Subcommands:
    <none>: compute and output the assembly index of `n`
    time:   compute and output the assembly index of `n` and run time.
    perf:   compute the assembly index of all integers from 1 to `n` (inclusive)
            and output the sum and run time.
Exception: ./build/intchains exited with 255
[tty 6], line 1: ./build/intchains
$ ./build/intchains 607
13
$ ./build/intchains time 607
13
0.04888121s
$ ./build/intchains perf 1000
10808
2.83965543s

About

An implementation and generalization of Thurber's algorithm for orderable assembly spaces

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published