{"id":25431935,"url":"https://github.com/mrcdr/pylanczos","last_synced_at":"2025-10-18T14:01:38.452Z","repository":{"id":45793794,"uuid":"246119928","full_name":"mrcdr/pylanczos","owner":"mrcdr","description":"Python wrapper for Lambda Lanczos","archived":false,"fork":false,"pushed_at":"2023-12-02T08:15:15.000Z","size":66,"stargazers_count":17,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-15T22:23:27.866Z","etag":null,"topics":["eigenvector-calculation","lanczos-algorithm","matrix","numpy","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrcdr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-03-09T19:07:15.000Z","updated_at":"2024-09-25T08:17:17.000Z","dependencies_parsed_at":"2023-11-23T15:49:09.169Z","dependency_job_id":null,"html_url":"https://github.com/mrcdr/pylanczos","commit_stats":{"total_commits":48,"total_committers":1,"mean_commits":48.0,"dds":0.0,"last_synced_commit":"0377c0c93595352802def41a3c1f16765f479db7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Fpylanczos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Fpylanczos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Fpylanczos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Fpylanczos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrcdr","download_url":"https://codeload.github.com/mrcdr/pylanczos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239236393,"owners_count":19604901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eigenvector-calculation","lanczos-algorithm","matrix","numpy","python"],"created_at":"2025-02-17T04:30:30.697Z","updated_at":"2025-10-18T14:01:38.356Z","avatar_url":"https://github.com/mrcdr.png","language":"Python","readme":"![CI](https://github.com/mrcdr/pylanczos/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/mrcdr/pylanczos/branch/master/graph/badge.svg?token=CLVRQ8PN1J)]()\n[![License](https://img.shields.io/badge/License-MIT-green.svg)]()\n\n\n# PyLanczos\n## Overview\n**PyLanczos** is a Lanczos diagonalization library.\nIts core part is written in C++ as [LambdaLanczos](https://github.com/mrcdr/lambda-lanczos).\n\n## Usage\nAll samples are available [here](https://github.com/mrcdr/pylanczos/tree/master/sample).\n\n### NumPy and SciPy matrix\n``` python\nmatrix = np.array([[2.0, 1.0, 1.0],\n                   [1.0, 2.0, 1.0],\n                   [1.0, 1.0, 2.0]])\n\nengine = PyLanczos(matrix, True, 2)  # Find 2 maximum eigenpairs\neigenvalues, eigenvectors = engine.run()\nprint(\"Eigenvalue: {}\".format(eigenvalues))\nprint(\"Eigenvector:\")\nprint(eigenvectors)\n```\nNote: Use of SciPy sparse matrix is recommended to take full advantage of Lanczos algorithm.\n\n### Customized operation\nYou can also attach your customized function:\n```python\ntensor = np.zeros((2, 2, 2, 2), dtype='float64')\ntensor[0, 0, 0, 0] = 1\n# and so on...\n\n## Matrix-vector (or tensor-matrix) multiplication function\ndef mv_mul(v_in, v_out):\n    v_in.shape = (2, 2)\n    v_out.shape = (2, 2)\n\n    np.einsum(\"ijkl, kl -\u003e ij\", tensor, v_in, out=v_out, optimize=\"optimal\")\n\n## Calculate an \"eigenmatrix\" for the 4th-order tensor.\nengine = PyLanczos.create_custom(mv_mul, n, 'float64', False, 1) # Find 1 minimum eigenpair\neigenvalues, eigenmatrices = engine.run()\neigenmatrices.shape = (2, 2)\nprint(\"Eigenvalue: {}\".format(eigenvalues))\nprint(\"Eigenmatrix:\")\nprint(eigenmatrices)\n```\nThere is [a full sample](https://github.com/mrcdr/pylanczos/tree/master/sample/sample3_custom.py) with detailed description.\n\n## Installation\n```sh\npip install pylanczos\n```\n\n## Requirements\n\nC++11 compatible environment\n\n## License\n\n[MIT](https://github.com/mrcdr/lambda-lanczos/blob/master/LICENSE)\n\n## Author\n\n[mrcdr](https://github.com/mrcdr)\n\n## PyPI repository\n\n[pylanczos](https://pypi.org/project/pylanczos/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcdr%2Fpylanczos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrcdr%2Fpylanczos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcdr%2Fpylanczos/lists"}