slycot


Nameslycot JSON
Version 0.5.4 PyPI version JSON
download
home_page
SummaryA wrapper for the SLICOT control and systems library
upload_time2023-04-27 19:49:52
maintainer
docs_urlNone
authorEnrico Avventi et al.
requires_python>=3.8
licenseGPL-2.0 AND BSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Slycot
======

.. image:: https://img.shields.io/pypi/v/slycot.svg
   :target: https://pypi.org/project/slycot/

.. image:: https://anaconda.org/conda-forge/slycot/badges/version.svg
   :target: https://anaconda.org/conda-forge/slycot

.. image:: https://github.com/python-control/Slycot/workflows/Build%20and%20Test%20Slycot/badge.svg
   :target: https://github.com/python-control/Slycot/actions

.. image:: https://coveralls.io/repos/github/python-control/Slycot/badge.svg?branch=master
   :target: https://coveralls.io/github/python-control/Slycot?branch=master

Python wrapper for selected SLICOT routines, notably including solvers for
Riccati, Lyapunov, and Sylvester equations.

Dependencies
------------

Slycot supports Python versions 3.8 or later.

To run the compiled Slycot package, the following must be installed as
dependencies:

- Python 3.8+
- NumPy

If you are compiling and installing Slycot from source, you will need the
following dependencies:

- Python 3.8+
- NumPy
- scikit-build
- CMake
- C compiler (e.g. gcc, MS Visual C++, clang)
- FORTRAN compiler (e.g. gfortran, ifort, flang)
- BLAS/LAPACK (e.g. OpenBLAS, ATLAS, MKL)

To run the Slycot unit tests and examples, you'll also need SciPy and
pytest.

There are a variety of ways to install these dependencies on different
operating systems. See the individual packages' documentation for options.

Installing
----------

The easiest way to get started with Slycot is to install pre-compiled
binaries from conda-forge (see below); these are available for Linux,
OSX, and Windows.

Compiling the Slycot source is unfortunately a bit tricky, especially
on Windows, but we give some pointers further below for doing this.

Using conda and conda-forge
~~~~~~~~~~~~~~~~~~~~~~~~~~~

First install Miniconda or Anaconda.  Slycot can then be installed
from the conda-forge channel with the following command::

    conda install -c conda-forge slycot


Compiling from source
---------------------

The hardest part about installing from source is getting a working
version of FORTRAN and LAPACK (provided by OpenBLAS, MKL, etc.)
installed on your system. Depending on where you get your NumPy and SciPy
from, you will need to use a compatible LAPACK implementation. Make sure that
the correct header files are installed, and specify the CMake variable
`BLA_VENDOR`_, if necessary. We recommend to use `BLA_VENDOR=Generic` in order
to produce a Slycot module, which is binary compatible with all implementations.

.. _BLA_VENDOR: https://cmake.org/cmake/help/latest/module/FindBLAS.html#input-variables

Compiling the PyPI source with pip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We publish Slycot to the Python package index, but only as a source
package, so to install using pip you'll first need to install the
build prerequisites (compilers, libraries, etc.)

If you have these build prerequisites, the command::

    pip install slycot

will download the latest release of the source code from `PyPI`_, compile, and
install Slycot into the currently configured location (virtual environment or
user site-packages).

Getting the full source code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Get it from PyPI
^^^^^^^^^^^^^^^^

Get the source code of the latest release is available from `PyPI`_. It
contains both the Python to Fortran wrappers as well as the SLICOT-Reference
Fortran sources.

.. _PyPI: https://pypi.org/project/slycot

Get it from GitHub archives
^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you decide to download a source code archive from GitHub (tagged release or
a specific branch), you also have to get the correct version of our
SLICOT-Reference fork and place it into ``slycot/src/SLICOT-Reference``:
 
1. Download and unpack https://github.com/python-control/Slycot/archive/master.zip
2. Go to https://github.com/python-control/Slycot/master/slycot/src
3. Follow the link of ``SLICOT-Reference @ <commit-id>``
4. Download the archive of SLICOT-Reference from the Code download button
   (``https://github.com/python-control/SLICOT-Reference/archive/<commit-id>.zip``)
5. Unpack the contents of the SLICOT-Reference archive into
   ``slycot/src/SLICOT-Reference``

Replace ``master`` with the release tag or branch name, which you want to build.

Clone the git repository
^^^^^^^^^^^^^^^^^^^^^^^^

Directly checkout the submodule, when cloning the git repository::

    git clone --recurse-submodules https://github.com/python-control/Slycot.git

or if you forked the repository::

    git clone --recurse-submodules https://github.com/<your-username>/Slycot.git

If you already have a local checkout, but still need to init the submodule::

    git submodule init
    git submodule update

Compiling the source (Linux, macOS, Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you need to specify a specific compiler, set the environment variable FC
before running the install::

    # Linux/OSX:
    export FC=/path/to/my/fortran

    # Windows:
    set FC=D:\path\to\my\fortran.exe

To build and install, execute::

    cd /path/to/slycot_src/
    pip install -v .

Using the conda recipe
~~~~~~~~~~~~~~~~~~~~~~

You can use conda to compile and install Slycot from source. The recipe is
located in the folder ``conda-recipe`` and is intended to work for all
platforms.

The ``conda-forge`` channel provides almost all requirements to compile
Slycot with `conda-build`_, except:

- On macOS, you need the macOS SDK. See the
  `conda-build documentation for macOS`_ how to get it.
- On Windows, you need to install `Microsoft Visual C++ 14.x`_ provided e.g.
  by `Microsoft Visual Studio`_.  To build, you'll need a command shell setup
  for both conda and the Visual Studio build tools.  See `conda activation`_
  and `Microsoft Visual Studio setup`_ for information on this.

.. _conda-build: https://docs.conda.io/projects/conda-build/en/latest/resources/commands/conda-build.html
.. _conda-build documentation for macOS: https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html#macos-sdk
.. _Microsoft Visual C++ 14.x: https://wiki.python.org/moin/WindowsCompilers
.. _Microsoft Visual Studio: https://visualstudio.microsoft.com/de/vs/
.. _conda activation: https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#windows-environment-has-not-been-activated
.. _Microsoft Visual Studio setup: https://docs.microsoft.com/en-us/cpp/build/setting-the-path-and-environment-variables-for-command-line-builds

To build and install::

    conda build -c conda-forge conda-recipe
    conda install -c conda-forge --use-local slycot

Building from source manually in a conda environment (Windows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A similar method can be used for Linux and macOS, but is detailed here
for Windows.  This method uses conda and conda-forge to get most build
dependencies, *except* for the C compiler.

This procedure has been tested on Python 3.8.

1. Install `Microsoft Visual Studio`_.
2. Unpack the source code to a directory of your choice,
3. Create a command shell setup that can run the conda commands and the Visual
   Studio build tools (see above)
4. In such a command shell, within the Slycot source code directory, run the
   following commands to build and install Slycot (this example creates a
   Python 3.8 environment)::

        conda create --channel conda-forge --name build-slycot python=3.8 numpy scipy libblas=*=*netlib liblapack=*=*netlib scikit-build flang pytest
        conda activate build-slycot

        pip install -v .

Additional hints
~~~~~~~~~~~~~~~~

Additional hints for how to install Slycot from source can be found in the
`.github`_ directory , (commands used to build and test in the GitHub Actions
CI), the `logs from the GitHub Actions`_, and the ``conda-recipe`` directory
(conda pre-requisites, install and test commands) which is included
in the source code repository.

.. _.github: https://github.com/python-control/Slycot/tree/master/.github
.. _`logs from the GitHub Actions`: https://github.com/python-control/Slycot/actions

Testing
-------
To test if the installation was successful, you can run the slycot unit tests::

    pytest --pyargs slycot

You may also run the tests by calling ``slycot.test()`` from within the python
interpreter::

    import slycot
    slycot.test()

Importing ``slycot`` or running ``pytest`` without ``--pyargs slycot`` from
inside the source directory will fail, unless the compiled wrapper library has
been installed into that directory. Note that the ``[tool:pytest]`` section
in ``setup.cfg`` enforces the ``--pyargs slycot`` argument by default.

License
-------
Up until version 0.4, Slycot used a version of SLICOT that was released under
the GPLv2 license. This requires Slycot to be released under the same license. In
December 2020, SLICOT 5.7 was released under BSD-3-Clause. However, as the
existing Slycot wrappers have been submitted by many contributors, we cannot
move away from GPLv2 unless we get the permission to do so by all authors.
Thus, Slycot remains licensed under GPLv2 until further notice.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "slycot",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Slycot developers <python-control-discuss@lists.sourceforge.net>",
    "keywords": "",
    "author": "Enrico Avventi et al.",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/56/db/4f0341828faa7e2751722cd2aae12f7cb976f428c0252cbd4679bbd4e45f/slycot-0.5.4.tar.gz",
    "platform": null,
    "description": "Slycot\n======\n\n.. image:: https://img.shields.io/pypi/v/slycot.svg\n   :target: https://pypi.org/project/slycot/\n\n.. image:: https://anaconda.org/conda-forge/slycot/badges/version.svg\n   :target: https://anaconda.org/conda-forge/slycot\n\n.. image:: https://github.com/python-control/Slycot/workflows/Build%20and%20Test%20Slycot/badge.svg\n   :target: https://github.com/python-control/Slycot/actions\n\n.. image:: https://coveralls.io/repos/github/python-control/Slycot/badge.svg?branch=master\n   :target: https://coveralls.io/github/python-control/Slycot?branch=master\n\nPython wrapper for selected SLICOT routines, notably including solvers for\nRiccati, Lyapunov, and Sylvester equations.\n\nDependencies\n------------\n\nSlycot supports Python versions 3.8 or later.\n\nTo run the compiled Slycot package, the following must be installed as\ndependencies:\n\n- Python 3.8+\n- NumPy\n\nIf you are compiling and installing Slycot from source, you will need the\nfollowing dependencies:\n\n- Python 3.8+\n- NumPy\n- scikit-build\n- CMake\n- C compiler (e.g. gcc, MS Visual C++, clang)\n- FORTRAN compiler (e.g. gfortran, ifort, flang)\n- BLAS/LAPACK (e.g. OpenBLAS, ATLAS, MKL)\n\nTo run the Slycot unit tests and examples, you'll also need SciPy and\npytest.\n\nThere are a variety of ways to install these dependencies on different\noperating systems. See the individual packages' documentation for options.\n\nInstalling\n----------\n\nThe easiest way to get started with Slycot is to install pre-compiled\nbinaries from conda-forge (see below); these are available for Linux,\nOSX, and Windows.\n\nCompiling the Slycot source is unfortunately a bit tricky, especially\non Windows, but we give some pointers further below for doing this.\n\nUsing conda and conda-forge\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFirst install Miniconda or Anaconda.  Slycot can then be installed\nfrom the conda-forge channel with the following command::\n\n    conda install -c conda-forge slycot\n\n\nCompiling from source\n---------------------\n\nThe hardest part about installing from source is getting a working\nversion of FORTRAN and LAPACK (provided by OpenBLAS, MKL, etc.)\ninstalled on your system. Depending on where you get your NumPy and SciPy\nfrom, you will need to use a compatible LAPACK implementation. Make sure that\nthe correct header files are installed, and specify the CMake variable\n`BLA_VENDOR`_, if necessary. We recommend to use `BLA_VENDOR=Generic` in order\nto produce a Slycot module, which is binary compatible with all implementations.\n\n.. _BLA_VENDOR: https://cmake.org/cmake/help/latest/module/FindBLAS.html#input-variables\n\nCompiling the PyPI source with pip\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nWe publish Slycot to the Python package index, but only as a source\npackage, so to install using pip you'll first need to install the\nbuild prerequisites (compilers, libraries, etc.)\n\nIf you have these build prerequisites, the command::\n\n    pip install slycot\n\nwill download the latest release of the source code from `PyPI`_, compile, and\ninstall Slycot into the currently configured location (virtual environment or\nuser site-packages).\n\nGetting the full source code\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nGet it from PyPI\n^^^^^^^^^^^^^^^^\n\nGet the source code of the latest release is available from `PyPI`_. It\ncontains both the Python to Fortran wrappers as well as the SLICOT-Reference\nFortran sources.\n\n.. _PyPI: https://pypi.org/project/slycot\n\nGet it from GitHub archives\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf you decide to download a source code archive from GitHub (tagged release or\na specific branch), you also have to get the correct version of our\nSLICOT-Reference fork and place it into ``slycot/src/SLICOT-Reference``:\n \n1. Download and unpack https://github.com/python-control/Slycot/archive/master.zip\n2. Go to https://github.com/python-control/Slycot/master/slycot/src\n3. Follow the link of ``SLICOT-Reference @ <commit-id>``\n4. Download the archive of SLICOT-Reference from the Code download button\n   (``https://github.com/python-control/SLICOT-Reference/archive/<commit-id>.zip``)\n5. Unpack the contents of the SLICOT-Reference archive into\n   ``slycot/src/SLICOT-Reference``\n\nReplace ``master`` with the release tag or branch name, which you want to build.\n\nClone the git repository\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nDirectly checkout the submodule, when cloning the git repository::\n\n    git clone --recurse-submodules https://github.com/python-control/Slycot.git\n\nor if you forked the repository::\n\n    git clone --recurse-submodules https://github.com/<your-username>/Slycot.git\n\nIf you already have a local checkout, but still need to init the submodule::\n\n    git submodule init\n    git submodule update\n\nCompiling the source (Linux, macOS, Windows)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you need to specify a specific compiler, set the environment variable FC\nbefore running the install::\n\n    # Linux/OSX:\n    export FC=/path/to/my/fortran\n\n    # Windows:\n    set FC=D:\\path\\to\\my\\fortran.exe\n\nTo build and install, execute::\n\n    cd /path/to/slycot_src/\n    pip install -v .\n\nUsing the conda recipe\n~~~~~~~~~~~~~~~~~~~~~~\n\nYou can use conda to compile and install Slycot from source. The recipe is\nlocated in the folder ``conda-recipe`` and is intended to work for all\nplatforms.\n\nThe ``conda-forge`` channel provides almost all requirements to compile\nSlycot with `conda-build`_, except:\n\n- On macOS, you need the macOS SDK. See the\n  `conda-build documentation for macOS`_ how to get it.\n- On Windows, you need to install `Microsoft Visual C++ 14.x`_ provided e.g.\n  by `Microsoft Visual Studio`_.  To build, you'll need a command shell setup\n  for both conda and the Visual Studio build tools.  See `conda activation`_\n  and `Microsoft Visual Studio setup`_ for information on this.\n\n.. _conda-build: https://docs.conda.io/projects/conda-build/en/latest/resources/commands/conda-build.html\n.. _conda-build documentation for macOS: https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html#macos-sdk\n.. _Microsoft Visual C++ 14.x: https://wiki.python.org/moin/WindowsCompilers\n.. _Microsoft Visual Studio: https://visualstudio.microsoft.com/de/vs/\n.. _conda activation: https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#windows-environment-has-not-been-activated\n.. _Microsoft Visual Studio setup: https://docs.microsoft.com/en-us/cpp/build/setting-the-path-and-environment-variables-for-command-line-builds\n\nTo build and install::\n\n    conda build -c conda-forge conda-recipe\n    conda install -c conda-forge --use-local slycot\n\nBuilding from source manually in a conda environment (Windows)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA similar method can be used for Linux and macOS, but is detailed here\nfor Windows.  This method uses conda and conda-forge to get most build\ndependencies, *except* for the C compiler.\n\nThis procedure has been tested on Python 3.8.\n\n1. Install `Microsoft Visual Studio`_.\n2. Unpack the source code to a directory of your choice,\n3. Create a command shell setup that can run the conda commands and the Visual\n   Studio build tools (see above)\n4. In such a command shell, within the Slycot source code directory, run the\n   following commands to build and install Slycot (this example creates a\n   Python 3.8 environment)::\n\n        conda create --channel conda-forge --name build-slycot python=3.8 numpy scipy libblas=*=*netlib liblapack=*=*netlib scikit-build flang pytest\n        conda activate build-slycot\n\n        pip install -v .\n\nAdditional hints\n~~~~~~~~~~~~~~~~\n\nAdditional hints for how to install Slycot from source can be found in the\n`.github`_ directory , (commands used to build and test in the GitHub Actions\nCI), the `logs from the GitHub Actions`_, and the ``conda-recipe`` directory\n(conda pre-requisites, install and test commands) which is included\nin the source code repository.\n\n.. _.github: https://github.com/python-control/Slycot/tree/master/.github\n.. _`logs from the GitHub Actions`: https://github.com/python-control/Slycot/actions\n\nTesting\n-------\nTo test if the installation was successful, you can run the slycot unit tests::\n\n    pytest --pyargs slycot\n\nYou may also run the tests by calling ``slycot.test()`` from within the python\ninterpreter::\n\n    import slycot\n    slycot.test()\n\nImporting ``slycot`` or running ``pytest`` without ``--pyargs slycot`` from\ninside the source directory will fail, unless the compiled wrapper library has\nbeen installed into that directory. Note that the ``[tool:pytest]`` section\nin ``setup.cfg`` enforces the ``--pyargs slycot`` argument by default.\n\nLicense\n-------\nUp until version 0.4, Slycot used a version of SLICOT that was released under\nthe GPLv2 license. This requires Slycot to be released under the same license. In\nDecember 2020, SLICOT 5.7 was released under BSD-3-Clause. However, as the\nexisting Slycot wrappers have been submitted by many contributors, we cannot\nmove away from GPLv2 unless we get the permission to do so by all authors.\nThus, Slycot remains licensed under GPLv2 until further notice.\n",
    "bugtrack_url": null,
    "license": "GPL-2.0 AND BSD-3-Clause",
    "summary": "A wrapper for the SLICOT control and systems library",
    "version": "0.5.4",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "56db4f0341828faa7e2751722cd2aae12f7cb976f428c0252cbd4679bbd4e45f",
                "md5": "a8e9bdfcd17d7847316bca0d2dcc7fe3",
                "sha256": "0bcb6e6322d955bfe696a549cb09c1f16272cbbdd09453cb82ea7193ed3d01c6"
            },
            "downloads": -1,
            "filename": "slycot-0.5.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a8e9bdfcd17d7847316bca0d2dcc7fe3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3006370,
            "upload_time": "2023-04-27T19:49:52",
            "upload_time_iso_8601": "2023-04-27T19:49:52.595460Z",
            "url": "https://files.pythonhosted.org/packages/56/db/4f0341828faa7e2751722cd2aae12f7cb976f428c0252cbd4679bbd4e45f/slycot-0.5.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-27 19:49:52",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "slycot"
}
        
Elapsed time: 0.24696s