Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming the hafnian library to The Walrus #34

Merged
merged 7 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
- run:
name: Build unit tests
command: |
cd src/tests
cd tests
GOOGLETEST_DIR=/root/googletest make cpptests
- run:
name: Run unit tests
command: |
cd src/tests && ./cpptests
cd tests && ./cpptests

pythoncoverage:
docker:
Expand Down Expand Up @@ -75,9 +75,9 @@ jobs:
- image: circleci/python:3.6.8-stretch
environment:
CIBW_SKIP: "cp27-* cp34-* *i686"
CIBW_BEFORE_BUILD_LINUX: curl -OsL https://bitbucket.org/eigen/eigen/get/3.3.7.tar.gz && tar xzf 3.3.7.tar.gz eigen-eigen-323c052e1731/Eigen --strip-components 1 && cp -rf Eigen {project}/src && pip install numpy scipy cython
CIBW_BEFORE_BUILD_LINUX: curl -OsL https://bitbucket.org/eigen/eigen/get/3.3.7.tar.gz && tar xzf 3.3.7.tar.gz eigen-eigen-323c052e1731/Eigen --strip-components 1 && cp -rf Eigen {project}/include && pip install numpy scipy cython
CIBW_TEST_REQUIRES: numpy scipy pytest pytest-cov
CIBW_TEST_COMMAND: python -m pytest {project}/hafnian
CIBW_TEST_COMMAND: python -m pytest {project}/thewalrus
steps:
- checkout
- setup_remote_docker
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
CIBW_SKIP: "cp27-* cp34-* *i686"
CIBW_BEFORE_BUILD_MACOS: brew cask uninstall --force oclint && brew install gcc eigen libomp || true; brew install gcc eigen libomp && pip install numpy scipy cython
CIBW_TEST_REQUIRES: numpy scipy pytest pytest-cov
CIBW_TEST_COMMAND: python -m pytest {project}/hafnian
CIBW_TEST_COMMAND: python -m pytest {project}/thewalrus
steps:
- checkout
- run:
Expand Down
10 changes: 5 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# .coveragerc to control coverage.py
[run]
source = hafnian
omit = hafnian/tests/*
source = thewalrus
omit = thewalrus/tests/*

[report]
# Regexes for lines to exclude from consideration
Expand Down Expand Up @@ -30,9 +30,9 @@ exclude_lines =
raise IndexError
raise FileNotFoundError
raise NotADirectoryError
return __version__
if len(lst) != self._num_modes:
elif max(lst) >= self._trunc:
return __version__
if len(lst) != self._num_modes:
elif max(lst) >= self._trunc:
except NotImplementedError as err

# Don't complain if non-runnable code isn't run:
Expand Down
15 changes: 7 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
docs/_build
build
dist
hafnian.egg-info
thewalrus.egg-info
.idea
examples/*ipynp*
.eggs/*
*.egg-info*
hafnian/__pycache__/*
thewalrus/__pycache__/*
thewalrus/*.so
tests/__pycache__/*
.coverage
coverage_html_report
hafnian/lib
src/*.o
src/timing
src/tests/*.o
src/tests/cpptests
include/*.o
tests/*.o
tests/cpptests
docs/doxyoutput/*
docs/hafnian_cpp_api/*
docs/libwalrus_cpp_api/*
docs/.ipynb_checkpoints/*
coverage.xml
6 changes: 3 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=numpy,hafnian.lib,hafnian.lib.libhaf,hafnian.lib.libperm,hafnian.lib.libtor,hafnian.lib.libhafapprox
extension-pkg-whitelist=numpy,thewalrus.libwalrus

[TYPECHECK]

# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=numpy,ctypes,hafnian.lib.libhaf,hafnian.lib.libperm,hafnian.lib,hafnian.lib.libtor,hafnian.lib.libhafapprox
ignored-modules=numpy,ctypes,thewalrus.libwalrus

# List of classes names for which member attributes should not be checked
# (useful for classes with attributes dynamically set). This supports can work
# with qualified names.
ignored-classes=numpy,ctypes,hafnian.lib,hafnian.lib.libhaf,hafnian.lib.libperm,hafnian.lib.libtor,hafnian.lib.libhafapprox
ignored-classes=numpy,ctypes,thewalrus.libwalrus

[MESSAGES CONTROL]

Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ include README.rst
include docs/*
include LICENSE
include examples/*
include src/*/*
include include/*
include tests/*
include octave/*
27 changes: 12 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ PYTHON3 := $(shell which python3 2>/dev/null)
COVERAGE3 := $(shell which coverage3 2>/dev/null)

PYTHON := python3
COVERAGE := --cov=hafnian --cov-report term-missing --cov-report=html:coverage_html_report --cov-report=xml:coverage.xml
TESTRUNNER := -m pytest hafnian
COVERAGE := --cov=thewalrus --cov-report term-missing --cov-report=html:coverage_html_report --cov-report=xml:coverage.xml
TESTRUNNER := -m pytest thewalrus

.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " install to install Hafnian"
@echo " install to install The Walrus"
@echo " libperm to compile the Fortran permanent library"
@echo " wheel to build the Hafnian wheel"
@echo " wheel to build the The Walrus wheel"
@echo " dist to package the source distribution"
@echo " clean to delete all temporary, cache, and build files"
@echo " clean-docs to delete all built documentation"
Expand All @@ -21,7 +21,7 @@ help:
.PHONY: install
install:
ifndef PYTHON3
@echo "To install Hafnian you need to have Python 3 installed"
@echo "To install The Walrus you need to have Python 3 installed"
endif
$(PYTHON) setup.py install

Expand All @@ -35,9 +35,9 @@ dist:

.PHONY : clean
clean:
make -C src clean
rm -rf hafnian/__pycache__
rm -rf hafnian/tests/__pycache__
make -C include clean
rm -rf thewalrus/__pycache__
rm -rf thewalrus/tests/__pycache__
rm -rf dist
rm -rf build

Expand All @@ -46,21 +46,18 @@ doc:

.PHONY : clean-docs
clean-docs:
rm -rf docs/hafnian_cpp_api
rm -rf docs/libwalrus_cpp_api
make -C docs clean

test-cpp:
make -C src/tests clean
make -C tests clean
echo "Going to compile C++ tests"
make -C src/tests
make -C tests cpptests
echo "Compilation done for C++ tests"
make -C src/tests runtest
make -C tests

test:
$(PYTHON) $(TESTRUNNER)

coverage:
$(PYTHON) $(TESTRUNNER) $(COVERAGE)

libperm:
make libperm -C src
64 changes: 33 additions & 31 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
Hafnian
#######
.. image:: https://circleci.com/gh/XanaduAI/hafnian/tree/master.svg?style=svg&circle-token=209b57390082a2b2fe2cdc9ee49a301ddc29ca5b
The Walrus
##########

.. image:: https://circleci.com/gh/XanaduAI/thewalrus/tree/master.svg?style=svg&circle-token=209b57390082a2b2fe2cdc9ee49a301ddc29ca5b
:alt: CircleCI
:target: https://circleci.com/gh/XanaduAI/hafnian/tree/master
:target: https://circleci.com/gh/XanaduAI/thewalrus/tree/master

.. image:: https://ci.appveyor.com/api/projects/status/9udscqldo1xd25yk/branch/master?svg=true
:alt: Appveyor
:target: https://ci.appveyor.com/project/josh146/hafnian/branch/master
:target: https://ci.appveyor.com/project/josh146/thewalrus/branch/master

.. image:: https://img.shields.io/codecov/c/github/xanaduai/hafnian/master.svg?style=flat
.. image:: https://img.shields.io/codecov/c/github/xanaduai/thewalrus/master.svg?style=flat
:alt: Codecov coverage
:target: https://codecov.io/gh/XanaduAI/hafnian
:target: https://codecov.io/gh/XanaduAI/thewalrus

.. image:: https://img.shields.io/codacy/grade/df94d22534cf4c05b1bddcf697011a82.svg?style=flat
:alt: Codacy grade
:target: https://app.codacy.com/app/XanaduAI/hafnian?utm_source=github.com&utm_medium=referral&utm_content=XanaduAI/hafnian&utm_campaign=badger
:target: https://app.codacy.com/app/XanaduAI/thewalrus?utm_source=github.com&utm_medium=referral&utm_content=XanaduAI/thewalrus&utm_campaign=badger

.. image:: https://img.shields.io/readthedocs/hafnian.svg?style=flat
.. image:: https://img.shields.io/readthedocs/thewalrus.svg?style=flat
:alt: Read the Docs
:target: https://hafnian.readthedocs.io
:target: https://thewalrus.readthedocs.io

.. image:: https://img.shields.io/pypi/pyversions/hafnian.svg?style=flat
.. image:: https://img.shields.io/pypi/pyversions/thewalrus.svg?style=flat
:alt: PyPI - Python Version
:target: https://pypi.org/project/hafnian
:target: https://pypi.org/project/thewalrus

The fastest exact hafnian library. For more information, please see the `documentation <https://hafnian.readthedocs.io>`_.
The fastest exact hafnian library. For more information, please see the `documentation <https://thewalrus.readthedocs.io>`_.

Features
========
Expand Down Expand Up @@ -57,13 +57,13 @@ To install, simply run

.. code-block:: bash

pip install hafnian
pip install thewalrus


Compiling from source
=====================

Hafnian depends on the following Python packages:
The Walrus depends on the following Python packages:

* `Python <http://python.org/>`_ >=3.5
* `NumPy <http://numpy.org/>`_ >=1.13.3
Expand Down Expand Up @@ -94,47 +94,47 @@ Alternatively, you can download the Eigen headers manually:
$ tar xzf eigen3.tar.gz eigen-eigen-323c052e1731/Eigen --strip-components 1
$ export EIGEN_INCLUDE_DIR=$HOME/.local/eigen3

Note that we export the environment variable ``EIGEN_INCLUDE_DIR`` so that Hafnian can find the Eigen3 header files (if not provided, Hafnian will by default look in ``/use/include/eigen3`` and ``/usr/local/include/eigen3``).
Note that we export the environment variable ``EIGEN_INCLUDE_DIR`` so that The Walrus can find the Eigen3 header files (if not provided, The Walrus will by default look in ``/use/include/eigen3`` and ``/usr/local/include/eigen3``).

Once all dependencies are installed, you can compile the latest stable version of the Hafnian library as follows:
Once all dependencies are installed, you can compile the latest stable version of the The Walrus library as follows:

.. code-block:: console

$ python -m pip install hafnian --no-binary :all:
$ python -m pip install thewalrus --no-binary :all:

Alternatively, you can compile the latest development version by cloning the git repository, and installing using pip in development mode.

.. code-block:: console

$ git clone https://github.com/XanaduAI/hafnian.git
$ cd hafnian && python -m pip install -e .
$ git clone https://github.com/XanaduAI/thewalrus.git
$ cd thewalrus && python -m pip install -e .


OpenMP
------

The Hafnian library uses OpenMP to parallelize both the permanent and the hafnian calculation. **At the moment, this is only supported on Linux using the GNU g++ compiler, due to insufficient support using Windows/MSCV and MacOS/Clang.**
``libwalrus`` uses OpenMP to parallelize both the permanent and the hafnian calculation. **At the moment, this is only supported on Linux using the GNU g++ compiler, due to insufficient support using Windows/MSCV and MacOS/Clang.**



Using LAPACK, OpenBLAS, or MKL
------------------------------

If you would like to take advantage of the highly optimized matrix routines of LAPACK, OpenBLAS, or MKL, you can optionally compile the Hafnian library such that Eigen uses these frameworks as backends. As a result, all calls in the Hafnian library to Eigen functions are silently substituted with calls to LAPACK/OpenBLAS/MKL.
If you would like to take advantage of the highly optimized matrix routines of LAPACK, OpenBLAS, or MKL, you can optionally compile the ``libwalrus`` such that Eigen uses these frameworks as backends. As a result, all calls in the ``libwalrus`` library to Eigen functions are silently substituted with calls to LAPACK/OpenBLAS/MKL.

For example, for LAPACK integration, make sure you have the ``lapacke`` C++ LAPACK bindings installed (``sudo apt install liblapacke-dev`` in Ubuntu-based Linux distributions), and then compile with the environment variable ``USE_LAPACK=1``:

.. code-block:: console

$ USE_LAPACK=1 python -m pip install hafnian --no-binary :all:
$ USE_LAPACK=1 python -m pip install thewalrus --no-binary :all:

Alternatively, you may pass ``USE_OPENBLAS=1`` to use the OpenBLAS library.


Software tests
==============

To ensure that the Hafnian library is working correctly after installation, the test suite can be run by navigating to the source code folder and running
To ensure that The Walrus library is working correctly after installation, the test suite can be run by navigating to the source code folder and running

.. code-block:: console

Expand Down Expand Up @@ -169,7 +169,9 @@ libraries are available on your include/library paths.
Documentation
=============

The Hafnian+ documentation is currently not hosted online. To build it locally, you need to have the following packages installed:
The Walrus documentation is available online on `Read the Docs <https://thewalrus.readthedocs.io>`_.

To build it locally, you need to have the following packages installed:

* `Sphinx <http://sphinx-doc.org/>`_ >=1.5
* `sphinxcontrib-bibtex <https://sphinxcontrib-bibtex.readthedocs.io/en/latest/>`_ >=0.3.6
Expand Down Expand Up @@ -200,23 +202,23 @@ Authors

Nicolás Quesada, Brajesh Gupt, and Josh Izaac.

All contributions are acknowledged in the `acknowledgments page <https://github.com/XanaduAI/hafnian/blob/master/.github/ACKNOWLEDGMENTS.md>`_.
All contributions are acknowledged in the `acknowledgments page <https://github.com/XanaduAI/thewalrus/blob/master/.github/ACKNOWLEDGMENTS.md>`_.

If you are doing research using Hafnian, please cite `our paper <https://dl.acm.org/citation.cfm?id=3325111>`_:
If you are doing research using The Walrus, please cite `our paper <https://dl.acm.org/citation.cfm?id=3325111>`_:

Andreas Björklund, Brajesh Gupt, and Nicolás Quesada. A faster hafnian formula for complex matrices and its benchmarking on a supercomputer, Journal of Experimental Algorithmics (JEA) 24 (1), 11 (2019)


Support
=======

- **Source Code:** https://github.com/XanaduAI/hafnian
- **Issue Tracker:** https://github.com/XanaduAI/hafnian/issues
- **Source Code:** https://github.com/XanaduAI/thewalrus
- **Issue Tracker:** https://github.com/XanaduAI/thewalrus/issues

If you are having issues, please let us know by posting the issue on our Github issue tracker.


License
=======

Hafnian is **free** and **open source**, released under the Apache License, Version 2.0.
The Walrus is **free** and **open source**, released under the Apache License, Version 2.0.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
CIBW_BEFORE_BUILD: pip install numpy scipy cython
CIBW_SKIP: "cp27-* cp33-* cp34-* *win32"
CIBW_TEST_REQUIRES: "numpy scipy pytest pytest-cov"
CIBW_TEST_COMMAND: "python -m pytest {project}/hafnian"
CIBW_TEST_COMMAND: "python -m pytest {project}/thewalrus"
CIBW_BUILD_VERBOSITY: 3
WHEELHOUSE_UPLOADER_USERNAME: AKIAJOU6ECM5Q7T6UUQQ
WHEELHOUSE_UPLOADER_SECRET:
Expand Down
4 changes: 2 additions & 2 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "Hafnian C++"
PROJECT_NAME = "libwalrus C++"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down Expand Up @@ -873,7 +873,7 @@ RECURSIVE = NO
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE =
EXCLUDE =

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
Loading