smallexpimv


Namesmallexpimv JSON
Version 0.0.1 PyPI version JSON
download
home_page
SummaryA package to apply the imaginary exponential of a small-dimensional matrix to a vector.
upload_time2023-01-09 10:32:12
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords matrix-exponential
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # smallexpimv
This repository provides some Fortran routines and python wrappers to apply the imaginary exponential of a matrix (real tridiagonal or complex) to a vector. More precisely,

$$
\beta\mathrm{e}^{\pm\mathrm{i} t X} u \in\mathbb{C}^n,
$$

for a matrix $X\in\mathbb{C}^{n\times n}$, a time-step $t\in\mathbb{R}$, a scaling factor $\beta\in\mathbb{R}$, a vector $u\in\mathbb{C}^n$ and the imaginary number $\mathrm{i}^2 = -1 $. Our first routine computes this vector by an adaptive and restarted Taylor approximation. We also provide a second routine for a tridiagonal case, namely

$$
\beta\mathrm{e}^{\pm\mathrm{i} t T} e_1 \in\mathbb{C}^n,
$$

where $T\in\mathbb{R}^{n\times n}$ refers to a tridiagonal symmetric matrix and $e_1$ denotes the first unit vector, i.e., $e_1 = (1,0,\ldots,0)^\ast \in\mathbb{R}^{n}$. For the tridiagonal case, the action of the matrix exponential is computed using an eigendecomposition of $T$ via the lapack $\texttt{dstevr}$ routine.

The matrix exponentials above have some relevance for the Lanczos or Arnoldi approximations to the action of large-dimensional matrix exponentials, e.g., for time-dependent Schrödinger-type problems. In this context, $X$ or $T$ correspond to small dimensional Krylov representations of a large problem.

The main code is written in Fortran, and can be used in Python using f2py.

To generate the main python module smallexpimv.so run
> python3 -m numpy.f2py -c src/F_smallexpimv.F90 -m smallexpimv -lblas

optional, generate f2py header files:
> python3 -m numpy.f2py -h smexp.pyf -m smallexpimv src/F_smallexpimv.F90

For more user-friendly Python code which also handles working memory (most relevant when applying the matrix exponential multiple times)
we also provide the module smallexpimv_pyclass.py. Keep in mind that this module requires still the smallexpimv.so module.

makefile: run
> make test

to run the python and fortran tests, and
> make libs

to generate smallexpimv.so and smallexpimv_pyclass.pyc. To use the Makefile, first check that (in the makefile) the compiler commands and the f2py filename extension are defined correctly for your system!


python3.7 -m build --sdist
python3.7 -m twine upload --repository testpypi dist/*
python3.7 -m pip install --index-url https://test.pypi.org/simple/ --no-deps mypackagetjx

python3.7 -m pip install mypackagetjx==0.0.14 --extra-index-url=https://test.pypi.org/simple/

from mypackagetjx import onef

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "smallexpimv",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Tobias Jawecki <tobias.jawecki@gmail.com>",
    "keywords": "matrix-exponential",
    "author": "",
    "author_email": "Tobias Jawecki <tobias.jawecki@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/59/cc/71252d337184a06fa7b89a76da619e5a08121fd1d0b84f0fc86fa429e0da/smallexpimv-0.0.1.tar.gz",
    "platform": null,
    "description": "# smallexpimv\nThis repository provides some Fortran routines and python wrappers to apply the imaginary exponential of a matrix (real tridiagonal or complex) to a vector. More precisely,\n\n$$\n\\beta\\mathrm{e}^{\\pm\\mathrm{i} t X} u \\in\\mathbb{C}^n,\n$$\n\nfor a matrix $X\\in\\mathbb{C}^{n\\times n}$, a time-step $t\\in\\mathbb{R}$, a scaling factor $\\beta\\in\\mathbb{R}$, a vector $u\\in\\mathbb{C}^n$ and the imaginary number $\\mathrm{i}^2 = -1 $. Our first routine computes this vector by an adaptive and restarted Taylor approximation. We also provide a second routine for a tridiagonal case, namely\n\n$$\n\\beta\\mathrm{e}^{\\pm\\mathrm{i} t T} e_1 \\in\\mathbb{C}^n,\n$$\n\nwhere $T\\in\\mathbb{R}^{n\\times n}$ refers to a tridiagonal symmetric matrix and $e_1$ denotes the first unit vector, i.e., $e_1 = (1,0,\\ldots,0)^\\ast \\in\\mathbb{R}^{n}$. For the tridiagonal case, the action of the matrix exponential is computed using an eigendecomposition of $T$ via the lapack $\\texttt{dstevr}$ routine.\n\nThe matrix exponentials above have some relevance for the Lanczos or Arnoldi approximations to the action of large-dimensional matrix exponentials, e.g., for time-dependent Schr\u00f6dinger-type problems. In this context, $X$ or $T$ correspond to small dimensional Krylov representations of a large problem.\n\nThe main code is written in Fortran, and can be used in Python using f2py.\n\nTo generate the main python module smallexpimv.so run\n> python3 -m numpy.f2py -c src/F_smallexpimv.F90 -m smallexpimv -lblas\n\noptional, generate f2py header files:\n> python3 -m numpy.f2py -h smexp.pyf -m smallexpimv src/F_smallexpimv.F90\n\nFor more user-friendly Python code which also handles working memory (most relevant when applying the matrix exponential multiple times)\nwe also provide the module smallexpimv_pyclass.py. Keep in mind that this module requires still the smallexpimv.so module.\n\nmakefile: run\n> make test\n\nto run the python and fortran tests, and\n> make libs\n\nto generate smallexpimv.so and smallexpimv_pyclass.pyc. To use the Makefile, first check that (in the makefile) the compiler commands and the f2py filename extension are defined correctly for your system!\n\n\npython3.7 -m build --sdist\npython3.7 -m twine upload --repository testpypi dist/*\npython3.7 -m pip install --index-url https://test.pypi.org/simple/ --no-deps mypackagetjx\n\npython3.7 -m pip install mypackagetjx==0.0.14 --extra-index-url=https://test.pypi.org/simple/\n\nfrom mypackagetjx import onef\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A package to apply the imaginary exponential of a small-dimensional matrix to a vector.",
    "version": "0.0.1",
    "split_keywords": [
        "matrix-exponential"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "59cc71252d337184a06fa7b89a76da619e5a08121fd1d0b84f0fc86fa429e0da",
                "md5": "c83a4896352e5d0509b4e882a7898dfa",
                "sha256": "43e2050322e25cd3314a8c207a2185a6e84326bee5cb9afbe4d5875ad0e04e46"
            },
            "downloads": -1,
            "filename": "smallexpimv-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c83a4896352e5d0509b4e882a7898dfa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5805,
            "upload_time": "2023-01-09T10:32:12",
            "upload_time_iso_8601": "2023-01-09T10:32:12.429303Z",
            "url": "https://files.pythonhosted.org/packages/59/cc/71252d337184a06fa7b89a76da619e5a08121fd1d0b84f0fc86fa429e0da/smallexpimv-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-09 10:32:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "smallexpimv"
}
        
Elapsed time: 0.05821s