NAG Library for Python README document

Introduction

The nag4py package is a set of Python wrappers for the NAG C Library (Mark 26.0):

https://nag.co.uk/numeric/cl/nagdoc_cl26/html/frontmatter/manconts.html

The underlying calls to the NAG C Library use the Python ctypes module.

nag4py is compatible with Python 2.7 and Python 3.x. See the Applicability section below for more details.

A selection of example scripts are included in the nag4py distribution. These serve to demonstrate some important usage points and also can be used as short tests of the package.

The source distribution of the package contains a CHANGELOG file listing interesting enhancements and fixes introduced in each nag4py release.

By using this software you agree to the terms of the licence agreement found in the source distribution's license directory.

Dependencies

  • A licence for the underlying NAG C Library.
  • Python.
  • NumPy.
  • optionally, matplotlib (if you wish to run the graphical examples included in the nag4py distribution).

The package will raise RuntimeError if the target system is not supported, if the underlying NAG C Library could not be loaded, and also if the integer width used in the associated NAG C Library does not match that used in the target NumPy installation.

Installation

The supported installation framework is through Anaconda Python (https://www.continuum.io/).

We recommend installation to a virtual Python environment.

You will need to have permission to modify the directory tree of the Python you are installing nag4py for.

Installation is from the Python wheel in the nag4py dist directory in the source distribution

pip install nag4py-{nag4py version}-{python tag}-none-${platform tag}.whl

See the core Python documentation for additional ways that a wheel may be installed.

Note that in case of compatibility problems with matplotlib on Windows we recommend installing that package directly using pip rather than via conda.

The package may be uninstalled using

pip uninstall nag4py

Before Use

Following a successful deployment of the nag4py materials, it is recommended that you review the additional embedded documentation for the package before use. From a command prompt execute

python -m pydoc nag4py

See the accompanying README file in the source distribution's license directory for information on how to obtain a valid licence for the underlying C Library.

Example Scripts

All example scripts under the examples directory in the source distribution can be run as standard Python scripts from the command prompt, by executing for example

python c05auce.py

After the package has been installed each script will also be available as a Python module, invokable via for example

python -m nag4py.examples.c05auce

or

python -m nag4py.examples.graphical.minimize_rosenbrock

Running

python -m pydoc nag4py.examples.c05auce

will confirm the installation location of the given script.

All text-based examples may be executed sequentially by running

python -m nag4py.examples

and the non-interactive graphical examples likewise via

python -m nag4py.examples.graphical

Contents of these examples modules can be queried using

python -m pydoc nag4py.examples

and

python -m pydoc nag4py.examples.graphical

respectively.

Acknowledgements

We are indebted to Mike Croucher for his initial work while at the University of Manchester on wrapping the NAG C Library in Python. He is the original author for some of the examples included in the nag4py distribution.

Applicability

This package has been tested on the following systems:

  • 64-bit Windows (Windows 10):
    • Anaconda Python 2.7.13 (64-bit)
      • underlying C Library CLW6I26DEL
      • NumPy enabled with MKL 11.3.3;
    • Anaconda Python 3.5.2 (64-bit)
      • underlying C Library CLW6I26DEL
      • NumPy enabled with MKL 11.3.3.
  • 64-bit Linux (Fedora 25):
    • Anaconda Python 2.7.13 (64-bit)
      • underlying C Library CLL6I26DCL
      • NumPy enabled with MKL 11.3.3;
    • Anaconda Python 3.5.2 (64-bit)
      • underlying C Library CLL6I26DCL
      • NumPy enabled with MKL 11.3.3.
  • 64-bit Mac (macOS 10.11/El Capitan):
    • Anaconda Python 2.7.13 (64-bit)
      • underlying C Library CLMI626DDL
      • NumPy enabled with MKL 11.3.3;
    • Anaconda Python 3.5.2 (64-bit)
      • underlying C Library CLMI626DDL
      • NumPy enabled with MKL 11.3.3.

Further Support

Please direct any feedback or queries to one of the NAG Technical Support Service desks:

NAG Ltd (Oxford, UK): support@nag.co.uk

NAG Inc (Lisle, IL): support@nag.com

Nihon NAG KK (Tokyo, JP): naghelp@nag-j.co.jp