{"id":25715338,"url":"https://github.com/mrcdr/lambda-lanczos","last_synced_at":"2025-07-11T15:40:22.988Z","repository":{"id":51113129,"uuid":"150957568","full_name":"mrcdr/lambda-lanczos","owner":"mrcdr","description":"C++ adaptive and header-only Lanczos algorithm library","archived":false,"fork":false,"pushed_at":"2023-11-23T08:43:30.000Z","size":423,"stargazers_count":28,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T16:56:18.119Z","etag":null,"topics":["c-plus-plus","eigenvector-calculation","header-only","lanczos","lanczos-algorithm","matrix"],"latest_commit_sha":null,"homepage":"","language":"C++","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-30T10:33:07.000Z","updated_at":"2025-04-26T18:28:50.000Z","dependencies_parsed_at":"2025-02-25T13:52:54.762Z","dependency_job_id":"bfcf705e-f4b4-44b4-8ef5-7ff8b81c7fca","html_url":"https://github.com/mrcdr/lambda-lanczos","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrcdr/lambda-lanczos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Flambda-lanczos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Flambda-lanczos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Flambda-lanczos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Flambda-lanczos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrcdr","download_url":"https://codeload.github.com/mrcdr/lambda-lanczos/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcdr%2Flambda-lanczos/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264842148,"owners_count":23671943,"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":["c-plus-plus","eigenvector-calculation","header-only","lanczos","lanczos-algorithm","matrix"],"created_at":"2025-02-25T13:52:45.786Z","updated_at":"2025-07-11T15:40:22.950Z","avatar_url":"https://github.com/mrcdr.png","language":"C++","readme":"![CI](https://github.com/mrcdr/lambda-lanczos/workflows/CI/badge.svg)\n[![codecov](https://codecov.io/gh/mrcdr/lambda-lanczos/branch/master/graph/badge.svg)](https://codecov.io/gh/mrcdr/lambda-lanczos)\n[![License](https://img.shields.io/badge/License-MIT-green.svg)]()\n[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/mrcdr/lambda-lanczos)]()\n\nLambda Lanczos\n===========\n\nC++ adaptive and header-only Lanczos algorithm library\n\n## Overview\n\n**Lambda Lanczos** calculates the smallest or largest eigenvalue and\nthe corresponding eigenvector of a symmetric (Hermitian) matrix.\n\nThe characteristic feature is the matrix-vector multiplication routine used in\nthe Lanczos algorithm is adaptable:\n\n```c++\n#include \u003clambda_lanczos/lambda_lanczos.hpp\u003e\nusing lambda_lanczos::LambdaLanczos;\n/* Some include and using declarations are omitted */\n\nvoid sample() {\n  const int n = 3;\n  double matrix[n][n] = { {2.0, 1.0, 1.0},\n                          {1.0, 2.0, 1.0},\n                          {1.0, 1.0, 2.0} };\n  // Its eigenvalues are {4, 1, 1}\n\n  /* Prepare matrix-vector multiplication routine used in Lanczos algorithm */\n  auto mv_mul = [\u0026](const vector\u003cdouble\u003e\u0026 in, vector\u003cdouble\u003e\u0026 out) {\n    for(int i = 0;i \u003c n;i++) {\n      for(int j = 0;j \u003c n;j++) {\n        out[i] += matrix[i][j]*in[j];\n      }\n    }\n  };\n\n\n  /* Execute Lanczos algorithm */\n  LambdaLanczos\u003cdouble\u003e engine(mv_mul, n, true, 1); // Find 1 maximum eigenvalue\n  vector\u003cdouble\u003e eigenvalues;\n  vector\u003cvector\u003cdouble\u003e\u003e eigenvectors;\n  engine.run(eigenvalues, eigenvectors);\n  //// If C++17 is available, the following notation does the same thing:\n  // auto [eigenvalues, eigenvectors] = engine.run()\n\n\n  /* Print result */\n  cout \u003c\u003c \"Eigenvalue: \" \u003c\u003c setprecision(16) \u003c\u003c eigenvalues[0] \u003c\u003c endl;\n  cout \u003c\u003c \"Eigenvector:\";\n  for(int i = 0; i \u003c n; i++) {\n    cout \u003c\u003c eigenvectors[0][i] \u003c\u003c \" \";\n  }\n  cout \u003c\u003c endl;\n}\n```\n\nThis feature allows you to\n- easily combine **Lambda Lanczos** with existing matrix libraries\n(e.g. [Eigen](http://eigen.tuxfamily.org/index.php);\nsee a [sample code](https://github.com/mrcdr/lambda-lanczos/blob/master/src/samples/sample4_use_Eigen_library.cpp)).\n- use a matrix whose elements are partially given,\n  e.g. a sparse matrix whose non-zero elements are stored\n  as a list of {row-index, column-index, value} tuples.\n\n## Interfaces\nLambda Lanczos provides the following two interfaces:\n### 1. Eigenvalue problem\n`LambdaLanczos` class computes maximum (minimum) eigenvalues and\ncorresponding eigenvectors. Degenerate eigenvalues are taken into account.\nThis class aims problems that require one or a few eigenpairs\n(e.g. low-energy excitation of a quantum system).\n\n### 2. Exponentiation\n`Exponentiator` class computes the following type of matrix-vector multiplication:\n\n$$\\boldsymbol{v}'=e^{\\delta A} \\boldsymbol{v},$$\n\nwhere $A$ is a symmetric (Hermitian) matrix and $\\delta$ is a scalar parameter.\nThis class is based on the same theory of the Lanczos algorithm (Krylov subspace method).\n\nAs an application, this class may be used for\ntime evolution of a quantum many-body system:\n\n$$ \\ket{\\psi(t+\\Delta t)} = e^{-iH\\Delta t} \\ket{\\psi(t)},$$\n\nand more sophisticated algorithms, such as [TDVP](https://arxiv.org/abs/1408.5056) and other tensor networks.\n\n\n\n## Sample programs\nSee [here](https://github.com/mrcdr/lambda-lanczos/tree/master/src/samples).\n\n## API reference\n[API reference](https://mrcdr.github.io/lib-docs/lambda-lanczos/)\n\n## Requirement\n\nC++11 compatible environment\n\n## Dependencies\n**Lambda Lanczos** itself does not depend on any libraries.\n\nIn order to run tests, [Google Test](https://github.com/google/googletest) is required.\n\n## Installation\n\n**Lambda Lanczos** is a header-only library.\nSo the installation step is as follows:\n\n1. Clone or download the latest version from [Github](https://github.com/mrcdr/lambda-lanczos/).\n2. Place the `include/lambda_lanczos` directory anywhere your project can find.\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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcdr%2Flambda-lanczos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrcdr%2Flambda-lanczos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcdr%2Flambda-lanczos/lists"}