{"id":17360836,"url":"https://github.com/14ngiestas/mfi","last_synced_at":"2026-02-17T13:03:49.258Z","repository":{"id":50250072,"uuid":"309228844","full_name":"14NGiestas/mfi","owner":"14NGiestas","description":"Modern Fortran Interfaces to BLAS and LAPACK","archived":false,"fork":false,"pushed_at":"2024-12-07T22:22:02.000Z","size":4451,"stargazers_count":38,"open_issues_count":3,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-27T16:37:44.660Z","etag":null,"topics":["blas","fortran","fortran-package-manager","interfaces-fortran","lapack","linear-algebra","modern-fortran"],"latest_commit_sha":null,"homepage":"","language":"Fortran","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/14NGiestas.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":"2020-11-02T01:42:07.000Z","updated_at":"2025-03-20T03:11:52.000Z","dependencies_parsed_at":"2025-03-27T16:36:05.044Z","dependency_job_id":"7d709cad-4182-4f65-9cea-df8c94e95ecd","html_url":"https://github.com/14NGiestas/mfi","commit_stats":{"total_commits":92,"total_committers":1,"mean_commits":92.0,"dds":0.0,"last_synced_commit":"40a78a216b37367b2048a437b1f8923b8df1f984"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/14NGiestas/mfi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/14NGiestas%2Fmfi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/14NGiestas%2Fmfi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/14NGiestas%2Fmfi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/14NGiestas%2Fmfi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/14NGiestas","download_url":"https://codeload.github.com/14NGiestas/mfi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/14NGiestas%2Fmfi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006247,"owners_count":26084060,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["blas","fortran","fortran-package-manager","interfaces-fortran","lapack","linear-algebra","modern-fortran"],"created_at":"2024-10-15T19:28:34.759Z","updated_at":"2025-10-11T04:17:38.550Z","avatar_url":"https://github.com/14NGiestas.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MFI\n\n## Modern Fortran interfaces to BLAS and LAPACK\n\nThis project aims to be a collection of modern fortran interfaces to commonly used procedure, for now BLAS and LAPACK.\nThe main goal is to reduce the pain of using such libraries, providing a generic interface to the intrinsic supported types and \nidentifying the optional or reconstructible arguments of a given procedure. The code uses [fypp](https://github.com/aradi/fypp),\nto generate the interfaces automatically to all supported types and kinds.\n\n### Example $C = AB$\n\n```fortran\nprogram main\nuse mfi_blas, only: mfi_gemm\nuse f77_blas, only: f77_gemm\nuse iso_fortran_env\nimplicit none\n! ... variables and other boilerplate code here ...\n! Original interface: type and precision dependent\ncall cgemm('N','N', N, N, N, alpha, A, N, B, N, beta, C, N)\n! Improved F77 interface: still a lot of arguments\ncall f77_gemm('N','N', N, N, N, alpha, A, N, B, N, beta, C, N)\n! Modern fortran interface: less arguments and more readable \ncall mfi_gemm(A,B,C)\nend program\n```\n\n## Getting Started\n\n### FPM\n\nThis project supports the [Fortran Package Manager](https://github.com/fortran-lang/fpm).\nFollow the directions on that page to install FPM if you haven't already.\n\n### Using as a dependency in FPM\n\nAdd a entry in the \"dependencies\" section of your project's fpm.toml\n\n```toml\n# fpm.toml\n[ dependencies ]\nmfi = { git=\"https://github.com/14NGiestas/mfi.git\", branch=\"mfi-fpm\" }\n```\n\n### Manual building\n\nFirst get the code, by cloning the repo:\n\n```sh\ngit clone https://github.com/14NGiestas/mfi.git\ncd mfi/\n```\n\n### Dependencies\n\nInstall the [fypp](https://github.com/aradi/fypp) using the command:\n\n```sh\nsudo pip install fypp\n```\n\nInstall lapack and blas (use the static versions).\nThis can be tricky, if you run into any problem, please open an issue.\n\n#### Arch Linux\n- [aur/openblas-lapack-static](https://aur.archlinux.org/packages/openblas-lapack-static)\n\n#### Ubuntu\n- [lapack-dev](https://packages.ubuntu.com/search?suite=default\u0026section=all\u0026arch=any\u0026keywords=lapack-dev\u0026searchon=names)\n\nUsually you can do the following:\n\n```sh\nmake\nfpm test\n```\n\nBy default, the `lapack-dev` package (which provides the reference blas) do not provide the `i?amin` implementation (among other extensions)\nin such cases you can use blas extensions with:\n\n```sh\nmake FYPPFLAGS=-DMFI_EXTENSIONS\nfpm test\n```\n\nOr if you have support to such extensions in your blas provider you can:\n\n```sh\nmake FYPPFLAGS=\"-DMFI_EXTENSIONS -DMFI_LINK_EXTERNAL\"\nfpm test\n```\n\nwhich will generate the code linking extensions to the external library\n\n\n## Support\n\nPlease note that this project is experimental, errors and mistakes are to be expected.\n\nThere four levels of interfaces that can be used:\n\n1. original f77: explicit declared original interface.\n```fortran\ncall cgemm('N','N', N, N, N, alpha, A, N, B, N, beta, C, N)\n```\n2. improved f77: original argument convention without need of a prefix.\n```fortran\ncall f77_gemm('N','N', N, N, N, alpha, A, N, B, N, beta, C, N)\n```\n3. modern interface with prefix:\n```fortran\ncall mfi_sgemm(A,B,C)\n```\n4. modern interface:\n```fortran\ncall mfi_gemm(A,B,C)\n```\n\nIf you are searching for a specific interface check the [API reference](https://14ngiestas.github.io/mfi/)\n\n\n\n### BLAS\n#### Level 1\nMost of BLAS level 1 routines can be replaced by intrinsincs and other features in modern fortran.\n\u003cdetails\u003e\n\n|done| name   | description                                             | modern alternative |\n|----| ------ | ------------------------------------------------------- | ------------------ |\n|:+1:| asum   | Sum of vector magnitudes                                | [sum](https://gcc.gnu.org/onlinedocs/gfortran/SUM.html) |\n|:+1:| axpy   | Scalar-vector product                                   | `a*x + b` |\n|:+1:| copy   | Copy vector                                             |  `x = b`  |\n|:+1:| dot    | Dot product                                             | [dot_product](https://gcc.gnu.org/onlinedocs/gfortran/DOT_005fPRODUCT.html)   |\n|:+1:| dotc   | Dot product conjugated                                  | |\n|:+1:| dotu   | Dot product unconjugated                                | |\n|og77| sdsdot | Compute the inner product of two vectors with extended precision accumulation.            | |\n|og77| dsdot  | Compute the inner product of two vectors with extended precision accumulation and result. | |\n|:+1:| nrm2   | Vector 2-norm (Euclidean norm)                          | [norm2](https://gcc.gnu.org/onlinedocs/gfortran/NORM2.html) |\n|:+1:| rot    | Plane rotation of points                                | |\n|:+1:| rotg   | Generate Givens rotation of points                      | |\n|:+1:| rotm   | Modified Givens plane rotation of points                | |\n|:+1:| rotmg  | Generate modified Givens plane rotation of points       | |\n|:+1:| scal   | Vector-scalar product                                   | `a*x + b` |\n|:+1:| swap   | Vector-vector swap                                      | |\n\u003c/details\u003e\n\n#### Level 1 - Utils / Extensions\n\u003cdetails\u003e\n\n| done? | name  | description                                              |  modern alternatives | obs |\n| ----- | ----- | -------------------------------------------------------- | ------------------- | --- |\n| :+1:  | iamax | Index of the maximum absolute value element of a vector  | [maxval](https://gcc.gnu.org/onlinedocs/gfortran/MAXVAL.html), [maxloc](https://gcc.gnu.org/onlinedocs/gfortran/MAXLOC.html) | |\n| :+1:  | iamin | Index of the minimum absolute value element of a vector  | [minval](https://gcc.gnu.org/onlinedocs/gfortran/MINVAL.html), [minloc](https://gcc.gnu.org/onlinedocs/gfortran/MINLOC.html) | |\n| :+1:  | lamch | Determines precision machine parameters.                 | [huge](https://gcc.gnu.org/onlinedocs/gfortran/intrinsic-procedures/huge.html), [tiny](https://gcc.gnu.org/onlinedocs/gfortran/intrinsic-procedures/tiny.html), [epsilon](https://gcc.gnu.org/onlinedocs/gfortran/intrinsic-procedures/epsilon.html) | Obs: had to add a parameter so fortran can distinguish between the single and double precision with the same interface. For values of cmach see: [lamch](https://www.netlib.org/lapack//explore-html/d4/d86/group__lamch.html)|\n\u003c/details\u003e\n\n#### Level 2\n\n\u003cdetails\u003e\n\n| done? | name | description                                                              |\n| ----- | ---- | ------------------------------------------------------------------------ |\n| :+1:  | gbmv | Matrix-vector product using a general band matrix                        |\n| :+1:  | gemv | Matrix-vector product using a general matrix                             |\n| :+1:  | ger  | Rank-1 update of a general matrix                                        |\n| :+1:  | gerc | Rank-1 update of a conjugated general matrix                             |\n| :+1:  | geru | Rank-1 update of a general matrix, unconjugated                          |\n| :+1:  | hbmv | Matrix-vector product using a Hermitian band matrix                      |\n| :+1:  | hemv | Matrix-vector product using a Hermitian matrix                           |\n| :+1:  | her  | Rank-1 update of a Hermitian matrix                                      |\n| :+1:  | her2 | Rank-2 update of a Hermitian matrix                                      |\n| :+1:  | hpmv | Matrix-vector product using a Hermitian packed matrix                    |\n| :+1:  | hpr  | Rank-1 update of a Hermitian packed matrix                               |\n| :+1:  | hpr2 | Rank-2 update of a Hermitian packed matrix                               |\n| :+1:  | sbmv | Matrix-vector product using symmetric band matrix                        |\n| :+1:  | spmv | Matrix-vector product using a symmetric packed matrix                    |\n| :+1:  | spr  | Rank-1 update of a symmetric packed matrix                               |\n| :+1:  | spr2 | Rank-2 update of a symmetric packed matrix                               |\n| :+1:  | symv | Matrix-vector product using a symmetric matrix                           |\n| :+1:  | syr  | Rank-1 update of a symmetric matrix                                      |\n| :+1:  | syr2 | Rank-2 update of a symmetric matrix                                      |\n| :+1:  | tbmv | Matrix-vector product using a triangular band matrix                     |\n| :+1:  | tbsv | Solution of a linear system of equations with a triangular band matrix   |\n| :+1:  | tpmv | Matrix-vector product using a triangular packed matrix                   |\n| :+1:  | tpsv | Solution of a linear system of equations with a triangular packed matrix |\n| :+1:  | trmv | Matrix-vector product using a triangular matrix                          |\n| :+1:  | trsv | Solution of a linear system of equations with a triangular matrix        |\n\u003c/details\u003e\n\n#### Level 3\n\n\u003cdetails\u003e\n\n| done? | name  | description                                                                                            |\n| ----- | ----- | ------------------------------------------------------------------------------------------------------ |\n| :+1:  | gemm  | Computes a matrix-matrix product with general matrices.                                                |\n| :+1:  | hemm  | Computes a matrix-matrix product where one input matrix is Hermitian and one is general.               |\n| :+1:  | herk  | Performs a Hermitian rank-k update.                                                                    |\n| :+1:  | her2k | Performs a Hermitian rank-2k update.                                                                   |\n| :+1:  | symm  | Computes a matrix-matrix product where one input matrix is symmetric and one matrix is general.        |\n| :+1:  | syrk  | Performs a symmetric rank-k update.                                                                    |\n| :+1:  | syr2k | Performs a symmetric rank-2k update.                                                                   |\n| :+1:  | trmm  | Computes a matrix-matrix product where one input matrix is triangular and one input matrix is general. |\n| :+1:  | trsm  | Solves a triangular matrix equation (forward or backward solve).                                       |\n\n\u003c/details\u003e\n\n### LAPACK :warning:\n\n- Lapack is really huge, so I'm going to focus on getting the improved f77 interfaces ready first.\n  Anything I end up using I'm going to implement.\n\n#### Linear solve, $AX = B$\n\u003cdetails\u003e\n\u003c!-- ##### LU: General matrix, driver --\u003e\n\n\u003c!-- ##### LU: computational routines (factor, cond, etc.) --\u003e\n \n\u003c!-- ##### Cholesky: Hermitian/symmetric positive definite matrix, driver --\u003e\n\n##### Cholesky: computational routines (factor, cond, etc.)\n| done?| name  | description               |\n| ---- | ----- | ------------------------- |\n| :+1: | pocon | condition number estimate |\n\n\u003c!-- ##### LDL: Hermitian/symmetric indefinite matrix, driver --\u003e\n \n\u003c!-- ##### LDL: computational routines (factor, cond, etc.) --\u003e\n \n\u003c!-- ##### Triangular computational routines (solve, cond, etc.) --\u003e\n \n\u003c!-- ##### Auxiliary routines --\u003e\n\u003c/details\u003e\n\n##### Orthogonal/unitary factors (QR, CS, etc.)\n\u003cdetails\u003e\n\n| done? | name  | description  |\n| ----- | ----- | ------------ |\n| :+1:  | geqrf | Computes the QR factorization of a general m-by-n matrix. |\n| :+1:  | gerqf | Computes the RQ factorization of a general m-by-n matrix. |\n| :+1:  | getrf | Computes the LU factorization of a general m-by-n matrix. |\n| :+1:  | getri | Computes the inverse of an LU-factored general matrix.    |\n| :+1:  | getrs | Solves a system of linear equations with an LU-factored square coefficient matrix, with multiple right-hand sides. |\n| :+1:  | hetrf | Computes the Bunch-Kaufman factorization of a complex Hermitian matrix. |\n| :+1:  | potrf | Computes the Cholesky factorization of a symmetric (Hermitian) positive-definite matrix.     |\n| :+1:  | potri | Computes the inverse of a Cholesky-factored symmetric (Hermitian) positive-definite matrix.  |\n| :+1:  | potrs | Solves a system of linear equations with a Cholesky-factored symmetric (Hermitian) positive-definite coefficient matrix, with multiple right-hand sides.  |\n|  f77  | orgqr | Generates the real orthogonal matrix Q of the QR factorization formed by geqrf. |\n|  f77  | orgrq | Generates the real orthogonal matrix Q of the RQ factorization formed by gerqf. |\n|  f77  | ormqr | Multiplies a real matrix by the orthogonal matrix Q of the QR factorization formed by geqrf. |\n|  f77  | ormrq | Multiplies a real matrix by the orthogonal matrix Q of the RQ factorization formed by gerqf. |\n|       | sytrf | Computes the Bunch-Kaufman factorization of a symmetric matrix.                        |\n|       | trtrs | Solves a system of linear equations with a triangular coefficient matrix, with multiple right-hand sides. |\n|  f77  | ungqr | Generates the complex unitary matrix Q of the QR factorization formed by geqrf.  |\n|  f77  | ungrq | Generates the complex unitary matrix Q of the RQ factorization formed by gerqf.  |\n|  f77  | unmqr | Multiplies a complex matrix by the unitary matrix Q of the QR factorization formed by geqrf. |\n|  f77  | unmrq | Multiplies a complex matrix by the unitary matrix Q of the RQ factorization formed by gerqf. |\n|  f77  | org2r | |\n|  f77  | orm2r | |\n|  f77  | ung2r | |\n|  f77  | unm2r | |\n|  f77  | orgr2 | |\n|  f77  | ormr2 | |\n|  f77  | ungr2 | |\n|  f77  | unmr2 | |\n\n#### Singular Value and Eigenvalue Problem Routines\n| done?| name  | description             |\n| ---- | ----- | ----------------------- |\n| :+1: | gesvd | Computes the singular value decomposition of a general rectangular matrix.  |\n| :+1: | heevd | Computes all eigenvalues and, optionally, all eigenvectors of a complex Hermitian matrix using divide and conquer algorithm. |\n| :+1: | hegvd | Computes all eigenvalues and, optionally, all eigenvectors of a complex generalized Hermitian definite eigenproblem using divide and conquer algorithm. |\n| f77  | heevr | Computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices. |\n| f77  | heevx | Computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices. |\n|      | gebrd | Reduces a general matrix to bidiagonal form.     |\n|      | hetrd | Reduces a complex Hermitian matrix to tridiagonal form. |\n|      | orgbr | Generates the real orthogonal matrix Q or PT determined by gebrd. |\n|      | orgtr | Generates the real orthogonal matrix Q determined by sytrd. |\n|      | ormtr | Multiplies a real matrix by the orthogonal matrix Q determined by sytrd. |\n|      | syevd | Computes all eigenvalues and, optionally, all eigenvectors of a real symmetric matrix using divide and conquer algorithm. |\n|      | sygvd | Computes all eigenvalues and, optionally, all eigenvectors of a real generalized symmetric definite eigenproblem using divide and conquer algorithm. |\n|      | sytrd | Reduces a real symmetric matrix to tridiagonal form. |\n|      | ungbr | Generates the complex unitary matrix Q or PT determined by gebrd. |\n|      | ungtr | Generates the complex unitary matrix Q determined by hetrd. |\n|      | unmtr | Multiplies a complex matrix by the unitary matrix Q determined by hetrd. |\n\n##### Least squares\n|done| name  | description                                    |\n|----| ----- | ---------------------------------------------- |\n|f77 | gels  | least squares using QR/LQ                      |\n|f77 | gelst | least squares using QR/LQ with T matrix        |\n|f77 | gelss | least squares using SVD, QR iteration          |\n|f77 | gelsd | least squares using SVD, divide and conquer    |\n|f77 | gelsy | least squares using complete orthogonal factor |\n|f77 | getsls| least squares using tall-skinny QR/LQ          |\n|f77 | gglse | equality-constrained least squares             |\n|f77 | ggglm | Gauss-Markov linear model                      |\n\n#### Other Auxiliary Routines\n\nThere are some other auxiliary lapack routines around, that may apear here:\n\n| name      | Data Types | Description |\n| --------- | ---------- | ------------|\n| mfi_lartg | s, d, c, z | Generates a plane rotation with real cosine and real/complex sine. |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F14ngiestas%2Fmfi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F14ngiestas%2Fmfi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F14ngiestas%2Fmfi/lists"}