fermat-test.test 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. #
  3. # fermat-test.test - shell wrapper for performing fermat test
  4. #
  5. # Written in 2016-2017 by Alex Vong <alexvong1995@gmail.com>
  6. #
  7. # To the extent possible under law, the author(s) have dedicated all copyright
  8. # and related and neighboring rights to this software to the public domain
  9. # worldwide. This software is distributed without any warranty.
  10. #
  11. # You should have received a copy of the CC0 Public Domain Dedication along
  12. # with this software.
  13. # If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
  14. # Use error
  15. set -e
  16. # Obtain MLUCAS_PATH by tranforming `foo/bar' to `foo/'
  17. # Otherwise, assume it is the current working directory
  18. case "$0" in
  19. */*)
  20. MLUCAS_PATH=`printf '%s' "$0" | sed -e 's/\/[^\/]*$/\//g'`
  21. ;;
  22. *)
  23. MLUCAS_PATH='./'
  24. ;;
  25. esac
  26. # Export MLUCAS_PATH so that mlucas.cfg stays in the build directory
  27. export MLUCAS_PATH
  28. # Do fermat-test
  29. "$MLUCAS_PATH"mlucas -fftlen 1024 -f 24 -iters 100 \
  30. && "$MLUCAS_PATH"mlucas -fftlen 1024 -radset 4 -f 24 -iters 1000