{"id":14989182,"url":"https://github.com/althonos/rlinalg","last_synced_at":"2026-03-02T19:01:38.514Z","repository":{"id":247148961,"uuid":"823764451","full_name":"althonos/rlinalg","owner":"althonos","description":"Linear Algebra routines for Python as implemented in the R language.","archived":false,"fork":false,"pushed_at":"2024-07-07T13:33:36.000Z","size":139,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T11:17:38.140Z","etag":null,"topics":["linear-algebra","python-library","scientific-computing","scipy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/althonos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","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":"2024-07-03T17:02:02.000Z","updated_at":"2024-07-07T13:33:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"1eaff6f5-2287-406b-a60c-163ab99f8737","html_url":"https://github.com/althonos/rlinalg","commit_stats":{"total_commits":101,"total_committers":1,"mean_commits":101.0,"dds":0.0,"last_synced_commit":"7be8df2917b07a55f214cd685266a599bcda8adb"},"previous_names":["althonos/rlinalg"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Frlinalg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Frlinalg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Frlinalg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Frlinalg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/althonos","download_url":"https://codeload.github.com/althonos/rlinalg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240390701,"owners_count":19793782,"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":["linear-algebra","python-library","scientific-computing","scipy"],"created_at":"2024-09-24T14:17:49.131Z","updated_at":"2025-11-14T19:02:03.983Z","avatar_url":"https://github.com/althonos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ®️ `rlinalg` [![Stars](https://img.shields.io/github/stars/althonos/rlinalg.svg?style=social\u0026maxAge=3600\u0026label=Star)](https://github.com/althonos/rlinalg/stargazers)\n\n*Linear Algebra routines for Python as implemented in the [R language](https://www.r-project.org/).*\n\n[![Actions](https://img.shields.io/github/actions/workflow/status/althonos/rlinalg/test.yml?branch=main\u0026logo=github\u0026style=flat-square\u0026maxAge=300)](https://github.com/althonos/rlinalg/actions)\n[![Coverage](https://img.shields.io/codecov/c/gh/althonos/rlinalg?style=flat-square\u0026maxAge=3600)](https://codecov.io/gh/althonos/rlinalg/)\n[![License](https://img.shields.io/badge/license-GPLv3+-blue.svg?style=flat-square\u0026maxAge=2678400)](https://choosealicense.com/licenses/gpl-3.0/)\n[![PyPI](https://img.shields.io/pypi/v/rlinalg.svg?style=flat-square\u0026maxAge=3600)](https://pypi.org/project/rlinalg)\n[![AUR](https://img.shields.io/aur/version/python-rlinalg?logo=archlinux\u0026style=flat-square\u0026maxAge=3600)](https://aur.archlinux.org/packages/python-rlinalg)\n[![Wheel](https://img.shields.io/pypi/wheel/rlinalg.svg?style=flat-square\u0026maxAge=3600)](https://pypi.org/project/rlinalg/#files)\n[![Python Versions](https://img.shields.io/pypi/pyversions/rlinalg.svg?style=flat-square\u0026maxAge=3600)](https://pypi.org/project/rlinalg/#files)\n[![Python Implementations](https://img.shields.io/pypi/implementation/rlinalg?style=flat-square\u0026maxAge=3600\u0026label=impl)](https://pypi.org/project/rlinalg/#files)\n[![Source](https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=2678400\u0026style=flat-square)](https://github.com/althonos/rlinalg/)\n[![Mirror](https://img.shields.io/badge/mirror-LUMC-darkblue?style=flat-square\u0026maxAge=2678400)](https://git.lumc.nl/mflarralde/rlinalg)\n[![GitHub issues](https://img.shields.io/github/issues/althonos/rlinalg.svg?style=flat-square\u0026maxAge=600)](https://github.com/althonos/rlinalg/issues)\n[![Docs](https://img.shields.io/readthedocs/rlinalg/latest?style=flat-square\u0026maxAge=600)](https://rlinalg.readthedocs.io)\n[![Changelog](https://img.shields.io/badge/keep%20a-changelog-8A0707.svg?maxAge=2678400\u0026style=flat-square)](https://github.com/althonos/rlinalg/blob/master/CHANGELOG.md)\n[![Downloads](https://img.shields.io/pypi/dm/rlinalg?style=flat-square\u0026color=303f9f\u0026maxAge=86400\u0026label=downloads)](https://pepy.tech/project/rlinalg)\n\n## 🗺️ Overview\n\n[The R Project for Statistical Computing](https://www.r-project.org/) provides\nan environment for using and developing statistical methods. Most of the array\nmanipulation and linear algebra routines are implemented using\n[LAPACK], which can be accessed in Python using [SciPy] and [NumPy].\n\nHowever, when trying to port and reproduce code from R in Python, one can\nnotice differences in the implementation of several routines, in particular\nin the [QR decomposition](https://en.wikipedia.org/wiki/QR_decomposition)\nwith pivoting enabled:\n\n```r\n\u003e mat \u003c- t(matrix(seq_len(9), nrow=3))\n\u003e qr.Q(mat)\n           [,1]       [,2]       [,3]\n[1,] -0.1230915  0.9045340  0.4082483\n[2,] -0.4923660  0.3015113 -0.8164966\n[3,] -0.8616404 -0.3015113  0.4082483\n```\n\n```python\n\u003e\u003e\u003e mat = numpy.arange(1, 10).reshape(3, 3)\n\u003e\u003e\u003e scipy.linalg.qr(mat, pivoting = True)[0]\narray([[-0.2672612  0.8728716  0.4082483]\n       [-0.5345225  0.2182179 -0.8164966]\n       [-0.8017837 -0.4364358  0.4082483]])\n```\n\nThe culprit here is the [`qr`] function from R not using [LAPACK] [`dgeqp3`]\nby default, but a modified R-specific version of the [LINPACK] [`dqrdc`]\nroutine (`dqrdc2`) that optimizes the pivoting strategy. This means that code\nusing [`qr`] in R will behave differently than an equivalent Python using\n[LAPACK], and there was (until now) no way to reproduce the R behaviour.\n\nThe `rlinalg` library provides linear algebra routines from R using the\nFortran sources to allow reproducibility. It exposes an API similar to\nthe `scipy` interface for similar functions (`qr`, `cond`, `lstsq`), \nwhich can be used to get the same results as R:\n\n```python\n\u003e\u003e\u003e mat = numpy.arange(1, 10).reshape(3, 3)\n\u003e\u003e\u003e rlinalg.qr(mat).Q.round(7)\narray([[-0.1230915  0.904534   0.4082483]\n       [-0.492366   0.3015113 -0.8164966]\n       [-0.8616404 -0.3015113  0.4082483]])\n```\n\nThis library depends on [NumPy], and on the [BLAS] libraries available\non the system. It is available for all modern Python versions (3.7+).\nBuilding is done with [Meson] and requires a Fortran compiler when compiling\nfrom source.\n\n[`qr`]: https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/qr\n[LAPACK]: https://www.netlib.org/lapack/\n[BLAS]: https://www.netlib.org/blas/\n[LINPACK]: https://netlib.org/linpack/\n[NumPy]: https://numpy.org/\n[SciPy]: https://scipy.org/\n[`dgeqp3`]: https://www.netlib.org/lapack/explore-html-3.6.1/dd/d9a/group__double_g_ecomputational_ga1b0500f49e03d2771b797c6e88adabbb.html\n[`dqrdc`]: https://netlib.org/linpack/dqrdc.f\n[Meson]: https://mesonbuild.com/\n\n\u003c!-- ### 📋 Features --\u003e\n\n\n## 🔧 Installing\n\nInstall the `rlinalg` package directly from [PyPi](https://pypi.org/project/rlinalg)\nwhich hosts universal wheels that can be installed with `pip`:\n```console\n$ pip install rlinalg\n```\n\n## 📖 Documentation\n\nA complete [API reference](https://rlinalg.readthedocs.io/en/stable/api.html)\ncan be found in the [online documentation](https://rlinalg.readthedocs.io/),\nor directly from the command line using\n[`pydoc`](https://docs.python.org/3/library/pydoc.html):\n```console\n$ pydoc rlinalg\n```\n\n\u003c!-- ## 💡 Example --\u003e\n\n## 💭 Feedback\n\n### ⚠️ Issue Tracker\n\nFound a bug? Have an enhancement request? Head over to the [GitHub issue\ntracker](https://github.com/althonos/rlinalg/issues) if you need to report\nor ask something. If you are filing in on a bug, please include as much\ninformation as you can about the issue, and try to recreate the same bug\nin a simple, easily reproducible situation.\n\n### 🏗️ Contributing\n\nContributions are more than welcome! See\n[`CONTRIBUTING.md`](https://github.com/althonos/rlinalg/blob/main/CONTRIBUTING.md)\nfor more details.\n\n## 📋 Changelog\n\nThis project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)\nand provides a [changelog](https://github.com/althonos/rlinalg/blob/master/CHANGELOG.md)\nin the [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) format.\n\n## ⚖️ License\n\nThis library is provided under the\n[GNU General Public License v3.0](https://choosealicense.com/licenses/gpl-3.0/) or later.\nIt includes some code redistributed from the R language, which is licensed under the\n[GNU General Public License v2.0](https://choosealicense.com/licenses/gpl-2.0/)\nor later. Some tests were adapted from SciPy, which is developed under the \n[BSD-3-clause](https://choosealicense.com/licenses/bsd-3-clause/) license.\nSee full [copyright notice](https://rlinalg.readthedocs.io/en/stable/copyright.html)\non the [online documentation](https://rlinalg.readthedocs.io/).\n\n*This project is in no way not affiliated, sponsored, or otherwise endorsed\nby the [`R` project](https://www.r-project.org/).\nIt was developed by [Martin Larralde](https://github.com/althonos/) during his\nPhD project at the [Leiden University Medical Center](https://www.lumc.nl/en/)\nin the [Zeller lab](https://zellerlab.org/).*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falthonos%2Frlinalg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falthonos%2Frlinalg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falthonos%2Frlinalg/lists"}