{"id":17520471,"url":"https://github.com/iraikov/chicken-lapack","last_synced_at":"2026-01-05T09:40:12.435Z","repository":{"id":26899836,"uuid":"30361472","full_name":"iraikov/chicken-lapack","owner":"iraikov","description":"Chicken Scheme bindings for ATLAS and LAPACK","archived":false,"fork":false,"pushed_at":"2016-01-20T02:04:03.000Z","size":219,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-28T01:02:26.383Z","etag":null,"topics":["chicken-scheme","chicken-scheme-eggs","lapack","scheme-language"],"latest_commit_sha":null,"homepage":null,"language":"Scheme","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/iraikov.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}},"created_at":"2015-02-05T15:11:08.000Z","updated_at":"2022-06-06T04:19:19.000Z","dependencies_parsed_at":"2022-07-27T08:52:37.111Z","dependency_job_id":null,"html_url":"https://github.com/iraikov/chicken-lapack","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fchicken-lapack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fchicken-lapack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fchicken-lapack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iraikov%2Fchicken-lapack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iraikov","download_url":"https://codeload.github.com/iraikov/chicken-lapack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245525863,"owners_count":20629832,"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":["chicken-scheme","chicken-scheme-eggs","lapack","scheme-language"],"created_at":"2024-10-20T11:08:57.155Z","updated_at":"2026-01-05T09:40:12.391Z","avatar_url":"https://github.com/iraikov.png","language":"Scheme","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chicken-lapack\n\nChicken Scheme bindings for the LAPACK and ATLAS libraries.\n\nATLAS (http://math-atlas.sourceforge.net) stands for Automatically\nTuned Linear Algebra Software. Its purpose is to provide portably\noptimal linear algebra routines. The current version provides a\ncomplete BLAS (http://www.netlib.org/blas) API (for both C and\nFortran77), and a small subset of the LAPACK\n(http://www.netlib.org/lapack) API. \n\n## Naming conventions for routines\n\nEvery routine in the LAPACK library comes in four flavors, each\nprefixed by the letters S, D, C, and Z, respectively. Each letter\nindicates the format of input data:\n\n* S stands for single-precision (32-bit IEEE floating point numbers), \n* D stands for double-precision (64-bit IEEE floating point numbers), \n* C stands for complex numbers (represented by pairs of 32-bit IEEE floating point numbers), \n* Z stands for double complex numbers (represented by pairs of 64-bit IEEE floating point numbers)\n\n\nIn addition, each ATLAS-LAPACK routine in this egg comes in three flavors: \n* Safe, pure: safe routines check the sizes of their input arguments. For example, if a routine is supplied arguments that indicate that an input matrix is of dimensions M-by-N, then the argument corresponding to that matrix is checked that it is of size M * N.  ''Pure'' routines do not alter their arguments in any way. A new matrix or vector is allocated for the return value of the routine. \n* Safe, destructive (suffix: !): safe routines check the sizes of their input arguments. For example, if a routine is supplied arguments that indicate that an input matrix is of dimensions M-by-N, then the argument corresponding to that matrix is checked that it is of size M * N. Destructive routines can modify some or all of their arguments. They  are given names ending in exclamation mark. The matrix factorization routines in LAPACK overwrite the input matrix argument with the result of the factorization, and the linear system solvers overwrite the right-hand side vector with the system solution. Please consult the LAPACK documentation to determine which functions modify their input arguments. \n* Unsafe, destructive (prefix: unsafe-:, suffix: !). Unsafe routines do not check the sizes of their input arguments. They invoke the corresponding ATLAS-LAPACK routines directly. Unsafe routines do not have pure variants. \n\n\nFor example, function xGESV (N-by-N linear system solver) comes in the following variants: \n\n\u003ctable\u003e\u003ctr\u003e\u003cth\u003eLAPACK name\u003c/th\u003e\u003cth\u003eSafe, pure\u003c/th\u003e\u003cth\u003eSafe, destructive\u003c/th\u003e\u003cth\u003eUnsafe, destructive\u003c/th\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eSGESV\u003c/td\u003e\u003ctd\u003esgesv\u003c/td\u003e\u003ctd\u003esgesv!\u003c/td\u003e\u003ctd\u003eunsafe-sgesv!\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eDGESV\u003c/td\u003e\u003ctd\u003edgesv\u003c/td\u003e\u003ctd\u003edgesv!\u003c/td\u003e\u003ctd\u003eunsafe-dgesv!\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eCGESV\u003c/td\u003e\u003ctd\u003ecgesv\u003c/td\u003e\u003ctd\u003ecgesv!\u003c/td\u003e\u003ctd\u003eunsafe-cgesv!\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eZGESV\u003c/td\u003e\u003ctd\u003ezgesv\u003c/td\u003e\u003ctd\u003ezgesv!\u003c/td\u003e\u003ctd\u003eunsafe-zgesv!\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n\n## LAPACK datatype conventions\n\nThe datatype constructors described below are defined in the\n[blas](http://wiki.call-cc.org/eggref/4/blas) library.  The `blas`\nlibrary must be loaded before using any of the routines in this\nlibrary.\n\nArgument `ORDER` is one of `RowMajor` or `ColMajor` to\nindicate that the input and output matrices are in row-major or\ncolumn-major form, respectively.\n\nWhere present, argument `TRANS` can be one of `NoTrans` or `Trans` to\nindicate whether the input matrix is to be transposed or not.\n\nWhere present, argument `UPLO` can be one of `Upper` or\n`Lower` to indicate whether the upper or lower triangular part\nof an input symmetric matrix is to referenced,or to specify the type\nof an input triangular matrix.\n\nWhere present, argument `DIAG` can be one of `NonUnit` or\n`Unit` to indicate whether an input triangular matrix is unit\ntriangular or not.\n\n\n## LAPACK driver routines\n\n\n### General linear system solving\n\n\n* sgesv:: ORDER * N * NRHS * A * B * [LDA] * [LDB] -\u003e F32VECTOR * F32VECTOR * S32VECTOR\n* dgesv:: ORDER * N * NRHS * A * B * [LDA] * [LDB] -\u003e F64VECTOR * F64VECTOR * S32VECTOR\n+ cgesv:: ORDER * N * NRHS * A * B * [LDA] * [LDB] -\u003e F32VECTOR * F32VECTOR * S32VECTOR\n* zgesv:: ORDER * N * NRHS * A * B * [LDA] * [LDB] -\u003e F64VECTOR * F64VECTOR * S32VECTOR\n\nThe routines compute the solution to a system of linear equations A\n* X = B, where A is an N-by-N matrix and X and B are\nN-by-NRHS matrices. Optional arguments LDA and LDB are the\nleading dimensions of arrays A and B, respectively. LU\ndecomposition with partial pivoting and row interchanges is used to\nfactor A as A = P * L * U, where P is a permutation\nmatrix, L is unit lower triangular, and U is upper\ntriangular. The factored form of A is then used to solve the\nsystem. The return values are:\n\n* a matrix containing the factors L and U from the factorization A = P*L*U; \n* the N-by-NRHS solution matrix X\n*  a vector with pivot indices:  for 1 \u003c= i \u003c= min(M,N), row i of the matrix A was interchanged with row pivot(i)\n\n\n### Symmetric positive definite linear system solving\n\n\n\u003cprocedure\u003esposv:: ORDER * UPLO * N * NRHS * A * B * [LDA] * [LDB] -\u003e F32VECTOR * F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edposv:: ORDER * UPLO * N * NRHS * A * B * [LDA] * [LDB] -\u003e F64VECTOR * F64VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ecposv:: ORDER * UPLO * N * NRHS * A * B * [LDA] * [LDB] -\u003e F32VECTOR * F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ezposv:: ORDER * UPLO * N * NRHS * A * B * [LDA] * [LDB] -\u003e F64VECTOR * F64VECTOR\u003c/procedure\u003e\n\n\n\nThe routines compute the solution to a system of linear equations A * X = B, where A is an N-by-N symmetric positive definite matrix\nand X and B are N-by-NRHS matrices. Optional arguments LDA and LDB are the leading dimensions of arrays A and B,\nrespectively. Cholesky decomposition is used to factor A as * A = U**T * U     if UPLO = 'Upper'\n* A = L  * L**T     if UPLO = 'Lower' where U is an upper triangular, and L is a lower triangular matrix. \nThe factored form of A is then used to solve the system. The return values are: \n# the factor U or Lfrom the Cholesky factorization, depending on the value of argument UPLO.\n# the N-by-NRHS solution matrix X\n\n\n## LAPACK computational routines\n\n\n### General matrix factorization\n\n\n\u003cprocedure\u003esgetrf:: ORDER * M * N * A * [LDA] -\u003e F32VECTOR * S32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edgetrf:: ORDER * M * N * A * [LDA] -\u003e F64VECTOR * S32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ecgetrf:: ORDER * M * N * A * [LDA] -\u003e F32VECTOR * S32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ezgetrf:: ORDER * M * N * A * [LDA] -\u003e F64VECTOR * S32VECTOR\u003c/procedure\u003e\n\n\n\nThese routines compute an LU factorization of a general M-by-N matrix\nA using partial pivoting with row interchanges. Optional argument\nLDA is the leading dimension of array A. The return values\nare:\n\n* a matrix containing the factors L and U from the factorization A = P*L*U; \n* a vector with pivot indices:  for 1 \u003c= i \u003c= min(M,N), row i of the matrix was interchanged with row pivot(i)\n\n\n### General linear system solving using factorization\n\n\n\u003cprocedure\u003esgetrs:: ORDER * TRANSPOSE * N * NRHS * A * B * [LDA] * [LDB] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edgetrs:: ORDER * TRANSPOSE * N * NRHS * A * B * [LDA] * [LDB] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ecgetrs:: ORDER * TRANSPOSE * N * NRHS * A * B * [LDA] * [LDB] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ezgetrs:: ORDER * TRANSPOSE * N * NRHS * A * B * [LDA] * [LDB] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\n\nThese routines solve a system of linear equations A * X = B or\nA' * X = B with a general N-by-N matrix A using the LU\nfactorization computed by the xGETRF routines. Argument NRHS is\nthe number of right-hand sides (i.e. number of columns in\nB). Optional arguments LDA and LDB are the leading\ndimensions of arrays A and B, respectively. The return value\nis the solution matrix X.\n\n\n\n### General matrix invert using factorization\n\n\n\u003cprocedure\u003esgetri:: ORDER * N * A * PIVOT * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edgetri:: ORDER * N * A * PIVOT * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ecgetri:: ORDER * N * A * PIVOT * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ezgetri:: ORDER * N * A * PIVOT * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\n\nThese routines compute the inverse of a matrix using the LU\nfactorization computed by the xGETRF routines. Argument A must\ncontain the factors L and U from the LU factorization computed by\nxGETRF. Argument PIVOT must be the pivot vector returned by the\nfactorization routine. Optional argument LDA is the leading\ndimension of array A. The return value is the inverse of the\noriginal matrix A.\n\n\n\n### Symmetric positive definite matrix factorization\n\n\n\u003cprocedure\u003espotrf:: ORDER * UPLO * N * A * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edpotrf:: ORDER * UPLO * N * A * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ecpotrf:: ORDER * UPLO * N * A * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ezpotrf:: ORDER * UPLO * N * A * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\n\nThese routines compute the Cholesky factorization of a symmetric positive definite matrix A. The factorization has the form: \n\n* A = U**T * U     if UPLO = 'Upper'\n* A = L  * L**T     if UPLO = 'Lower'\n\nwhere U is an upper triangular, and L is a lower triangular\nmatrix. Optional argument LDA is the leading dimension of array\nA. The return value is the factor U or Lfrom the Cholesky\nfactorization, depending on the value of argument UPLO.\n\n\n\n### Symmetric positive definite matrix solving using factorization\n\n\n\u003cprocedure\u003espotrs:: ORDER * UPLO * N * NRHS * A * B * [LDA] * [LDB] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edpotrs:: ORDER * UPLO * N * NRHS * A * B * [LDA] * [LDB] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ecpotrs:: ORDER * UPLO * N * NRHS * A * B * [LDA] * [LDB] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ezpotrs:: ORDER * UPLO * N * NRHS * A * B * [LDA] * [LDB] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\n\nThese routines solve a system of linear equations A * X = B with a\nsymmetric positive definite matrix A using the Cholesky\nfactorization computed by the xPOTRF routines. Argument A is the\ntriangular factor U or L as computed by xPOTRF. Argument\nNRHS is the number of right-hand sides (i.e. number of columns in\nB). Argument UPLO indicates whether upper or lower triangle of A\nis stored ('Upper' or 'Lower'). Optional arguments LDA and\nLDB are the leading dimensions of arrays A and B,\nrespectively. The return value is the solution matrix X.\n\n\n\n### Symmetric positive definite matrix invert using factorization\n\n\n\u003cprocedure\u003espotri:: ORDER * UPLO * N * A * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edpotri:: ORDER * UPLO * N * A * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ecpotri:: ORDER * UPLO * N * A * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ezpotri:: ORDER * UPLO * N * A * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\n\nThese routines compute the inverse of a symmetric positive definite\nmatrix A using the Cholesky factorization A = U**T*U or A =\nL*L**T computed by xPOTRF. Argument A is the triangular factor\nU or L as computed by xPOTRF. Argument UPLO indicates whether\nupper or lower triangle of A is stored ('Upper' or\n'Lower'). Optional argument LDA is the leading dimension of\narray A. The return value is the upper or lower triangle of the\ninverse of A.\n\n\n\n### Triangular matrix invert\n\n\n\u003cprocedure\u003estrtri:: ORDER * UPLO * DIAG * N * A * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edtrtri:: ORDER * UPLO * DIAG * N * A * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ectrtri:: ORDER * UPLO * DIAG * N * A * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003eztrtri:: ORDER * UPLO * DIAG * N * A * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\n\nThese routines compute the inverse of a triangular matrix\nA. Argument A is the triangular factor U or L as\ncomputed by xPOTRF. Argument UPLO indicates whether upper or lower\ntriangle of A is stored ('Upper' or 'Lower'). Argument DIAG\nindicates whether A is non-unit triangular or unit triangular\n('NonUnit' or 'Unit'). Optional argument LDA is the\nleading dimension of array A. The return value is the triangular\ninverse of the input matrix, in the same storage format.\n\n\n\n### Auxilliary routines\n\n\n\u003cprocedure\u003eslauum:: ORDER * UPLO * DIAG * N * A * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003edlauum:: ORDER * UPLO * DIAG * N * A * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003eclauum:: ORDER * UPLO * DIAG * N * A * [LDA] -\u003e F32VECTOR\u003c/procedure\u003e\n\n\u003cprocedure\u003ezlauum:: ORDER * UPLO * DIAG * N * A * [LDA] -\u003e F64VECTOR\u003c/procedure\u003e\n\n\n\nThese routines compute the product U * U' or L' * L, where the\ntriangular factor U or L is stored in the upper or lower\ntriangular part of the array A. Argument UPLO indicates whether\nupper or lower triangle of A is stored ('Upper' or\nLower'). Optional argument LDA is the leading dimension of\narray A. The return value is the lower triangle of the lower\ntriangular product, or the upper triangle of upper triangular product,\nin the respective storage format.\n\n\n\n## Examples\n \n```scheme\n (use srfi-4 blas atlas-lapack)\n \n (define order ColMajor)\n (define n 4)\n (define nrhs 1)\n \n ;; Solve the equations\n ;;\n ;; Ax = b,\n ;;\n ;; where A is the general matrix\n \n ;; column-major order\n (define A (f64vector 1.8   5.25   1.58 -1.11  \n \t\t     2.88  -2.95 -2.69 -0.66 \n \t\t     2.05  -0.95 -2.90 -0.59 \n \t\t     -0.89 -3.80 -1.04  0.80))\n ;;\n ;; and b is\n ;;\n (define b (f64vector 9.52 24.35 0.77 -6.22))\n \n ;; A and b are not modified\n (define-values (LU x piv) (dgesv order n nrhs A b))\n \n ;; A is overwritten with its LU decomposition, and \n ;; b is overwritten with the solution of the system\n (dgesv! order n nrhs A b)\n``` \n\n## Version history\n\n3.0 : Using bind instead of easyffi\n2.1 : Ensure that unit test script exists with a non-zero exit status on error (thanks to mario)\n2.0 : Eliminated reduntant atlas-lapack: prefix from names of exported symbols\n\n## Requirements\n\n* [blas](http://wiki.call-cc.org/eggref/4/blas)\n\n## License\n\n\u003e\n\u003e Copyright 2007-2015 Ivan Raikov, Jeremy Steward\n\u003e \n\u003e This program is free software: you can redistribute it and/or modify\n\u003e it under the terms of the GNU General Public License as published by\n\u003e the Free Software Foundation, either version 3 of the License, or (at\n\u003e your option) any later version.\n\u003e \n\u003e This program is distributed in the hope that it will be useful, but\n\u003e WITHOUT ANY WARRANTY; without even the implied warranty of\n\u003e MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n\u003e General Public License for more details.\n\u003e \n\u003e A full copy of the GPL license can be found at\n\u003e \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firaikov%2Fchicken-lapack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firaikov%2Fchicken-lapack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firaikov%2Fchicken-lapack/lists"}