{"id":13413017,"url":"https://github.com/Konstantin8105/f4go","last_synced_at":"2025-03-14T19:31:23.489Z","repository":{"id":45876888,"uuid":"140186941","full_name":"Konstantin8105/f4go","owner":"Konstantin8105","description":"Transpiling fortran code to golang code","archived":false,"fork":false,"pushed_at":"2023-08-17T07:29:34.000Z","size":10915,"stargazers_count":43,"open_issues_count":7,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-07-31T20:51:51.097Z","etag":null,"topics":["convert","f4go","f77","fortran","go","golang","transpile"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/Konstantin8105.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":"2018-07-08T17:05:43.000Z","updated_at":"2024-06-26T12:54:47.000Z","dependencies_parsed_at":"2022-07-22T20:22:10.070Z","dependency_job_id":null,"html_url":"https://github.com/Konstantin8105/f4go","commit_stats":{"total_commits":603,"total_committers":3,"mean_commits":201.0,"dds":"0.0033167495854062867","last_synced_commit":"568775fd7b9b26ab28e653c9ccc8cc2fb7e1548c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konstantin8105%2Ff4go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konstantin8105%2Ff4go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konstantin8105%2Ff4go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Konstantin8105%2Ff4go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Konstantin8105","download_url":"https://codeload.github.com/Konstantin8105/f4go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221498712,"owners_count":16833053,"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":["convert","f4go","f77","fortran","go","golang","transpile"],"created_at":"2024-07-30T20:01:32.370Z","updated_at":"2024-10-26T05:30:16.742Z","avatar_url":"https://github.com/Konstantin8105.png","language":"Go","funding_links":[],"categories":["Go Compilers","Go 编译器","Golang","Compilers","位置信息与地理GEO处理库","Relational Databases","Go"],"sub_categories":["Search and Analytic Databases","Advanced Console UIs","检索及分析资料库","Translators","SQL 查询语句构建库"],"readme":"# f4go\n\n\n[![Build Status](https://travis-ci.org/Konstantin8105/f4go.svg?branch=master)](https://travis-ci.org/Konstantin8105/f4go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/Konstantin8105/f4go)](https://goreportcard.com/report/github.com/Konstantin8105/f4go)\n[![codecov](https://codecov.io/gh/Konstantin8105/f4go/branch/master/graph/badge.svg)](https://codecov.io/gh/Konstantin8105/f4go)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/Konstantin8105/f4go/master/LICENSE)\n[![GoDoc](https://godoc.org/github.com/Konstantin8105/f4go/fortran?status.svg)](https://godoc.org/github.com/Konstantin8105/f4go/fortran)\n[![Maintainability](https://api.codeclimate.com/v1/badges/b8d0bb5533207cce5ed3/maintainability)](https://codeclimate.com/github/Konstantin8105/f4go/maintainability)\n\n# Example of use\n\n```cmd\n\u003e # Install golang\n\u003e # Compile f4go\n\u003e go get -u github.com/Konstantin8105/f4go\n\u003e cd $GOPATH/src/github.com/Konstantin8105/f4go\n\u003e go build\n\u003e ./f4go ./testdata/blas/caxpy.f\n\u003e # Look on Go result source\n\u003e less ./testdata/blas/caxpy.go\n```\n\n# Transpiling fortran code to golang code\n\nPresent result:\n```fortran\n*\u003e \\brief \\b CAXPY\n*\n*  =========== DOCUMENTATION ===========\n*\n* Online html documentation available at\n*            http://www.netlib.org/lapack/explore-html/\n*\n*  Definition:\n*  ===========\n*\n*       SUBROUTINE CAXPY(N,CA,CX,INCX,CY,INCY)\n*\n*       .. Scalar Arguments ..\n*       COMPLEX CA\n*       INTEGER INCX,INCY,N\n*       ..\n*       .. Array Arguments ..\n*       COMPLEX CX(*),CY(*)\n*       ..\n*\n*\n*\u003e \\par Purpose:\n*  =============\n*\u003e\n*\u003e \\verbatim\n*\u003e\n*\u003e    CAXPY constant times a vector plus a vector.\n*\u003e \\endverbatim\n*\n*  Arguments:\n*  ==========\n*\n*\u003e \\param[in] N\n*\u003e \\verbatim\n*\u003e          N is INTEGER\n*\u003e         number of elements in input vector(s)\n*\u003e \\endverbatim\n*\u003e\n*\u003e \\param[in] CA\n*\u003e \\verbatim\n*\u003e          CA is COMPLEX\n*\u003e           On entry, CA specifies the scalar alpha.\n*\u003e \\endverbatim\n*\u003e\n*\u003e \\param[in] CX\n*\u003e \\verbatim\n*\u003e          CX is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCX ) )\n*\u003e \\endverbatim\n*\u003e\n*\u003e \\param[in] INCX\n*\u003e \\verbatim\n*\u003e          INCX is INTEGER\n*\u003e         storage spacing between elements of CX\n*\u003e \\endverbatim\n*\u003e\n*\u003e \\param[in,out] CY\n*\u003e \\verbatim\n*\u003e          CY is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCY ) )\n*\u003e \\endverbatim\n*\u003e\n*\u003e \\param[in] INCY\n*\u003e \\verbatim\n*\u003e          INCY is INTEGER\n*\u003e         storage spacing between elements of CY\n*\u003e \\endverbatim\n*\n*  Authors:\n*  ========\n*\n*\u003e \\author Univ. of Tennessee\n*\u003e \\author Univ. of California Berkeley\n*\u003e \\author Univ. of Colorado Denver\n*\u003e \\author NAG Ltd.\n*\n*\u003e \\date November 2017\n*\n*\u003e \\ingroup complex_blas_level1\n*\n*\u003e \\par Further Details:\n*  =====================\n*\u003e\n*\u003e \\verbatim\n*\u003e\n*\u003e     jack dongarra, linpack, 3/11/78.\n*\u003e     modified 12/3/93, array(1) declarations changed to array(*)\n*\u003e \\endverbatim\n*\u003e\n*  =====================================================================\n      SUBROUTINE CAXPY(N,CA,CX,INCX,CY,INCY)\n*\n*  -- Reference BLAS level1 routine (version 3.8.0) --\n*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --\n*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--\n*     November 2017\n*\n*     .. Scalar Arguments ..\n      COMPLEX CA\n      INTEGER INCX,INCY,N\n*     ..\n*     .. Array Arguments ..\n      COMPLEX CX(*),CY(*)\n*     ..\n*\n*  =====================================================================\n*\n*     .. Local Scalars ..\n      INTEGER I,IX,IY\n*     ..\n*     .. External Functions ..\n      REAL SCABS1\n      EXTERNAL SCABS1\n*     ..\n      IF (N.LE.0) RETURN\n      IF (SCABS1(CA).EQ.0.0E+0) RETURN\n      IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN\n*\n*        code for both increments equal to 1\n*\n         DO I = 1,N\n            CY(I) = CY(I) + CA*CX(I)\n         END DO\n      ELSE\n*\n*        code for unequal increments or equal increments\n*          not equal to 1\n*\n         IX = 1\n         IY = 1\n         IF (INCX.LT.0) IX = (-N+1)*INCX + 1\n         IF (INCY.LT.0) IY = (-N+1)*INCY + 1\n         DO I = 1,N\n            CY(IY) = CY(IY) + CA*CX(IX)\n            IX = IX + INCX\n            IY = IY + INCY\n         END DO\n      END IF\n*\n      RETURN\n      END\n```\n\nGo code:\n\n```golang\npackage main\n\n//*\u003e \\brief \\b CAXPY\n//*\n//*  =========== DOCUMENTATION ===========\n//*\n//* Online html documentation available at\n//*            http://www.netlib.org/lapack/explore-html/\n//*\n//*  Definition:\n//*  ===========\n//*\n//*       SUBROUTINE CAXPY(N,CA,CX,INCX,CY,INCY)\n//*\n//*       .. Scalar Arguments ..\n//*       COMPLEX CA\n//*       INTEGER INCX,INCY,N\n//*       ..\n//*       .. Array Arguments ..\n//*       COMPLEX CX(*),CY(*)\n//*       ..\n//*\n//*\n//*\u003e \\par Purpose:\n//*  =============\n//*\u003e\n//*\u003e \\verbatim\n//*\u003e\n//*\u003e    CAXPY constant times a vector plus a vector.\n//*\u003e \\endverbatim\n//*\n//*  Arguments:\n//*  ==========\n//*\n//*\u003e \\param[in] N\n//*\u003e \\verbatim\n//*\u003e          N is INTEGER\n//*\u003e         number of elements in input vector(s)\n//*\u003e \\endverbatim\n//*\u003e\n//*\u003e \\param[in] CA\n//*\u003e \\verbatim\n//*\u003e          CA is COMPLEX\n//*\u003e           On entry, CA specifies the scalar alpha.\n//*\u003e \\endverbatim\n//*\u003e\n//*\u003e \\param[in] CX\n//*\u003e \\verbatim\n//*\u003e          CX is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCX ) )\n//*\u003e \\endverbatim\n//*\u003e\n//*\u003e \\param[in] INCX\n//*\u003e \\verbatim\n//*\u003e          INCX is INTEGER\n//*\u003e         storage spacing between elements of CX\n//*\u003e \\endverbatim\n//*\u003e\n//*\u003e \\param[in,out] CY\n//*\u003e \\verbatim\n//*\u003e          CY is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCY ) )\n//*\u003e \\endverbatim\n//*\u003e\n//*\u003e \\param[in] INCY\n//*\u003e \\verbatim\n//*\u003e          INCY is INTEGER\n//*\u003e         storage spacing between elements of CY\n//*\u003e \\endverbatim\n//*\n//*  Authors:\n//*  ========\n//*\n//*\u003e \\author Univ. of Tennessee\n//*\u003e \\author Univ. of California Berkeley\n//*\u003e \\author Univ. of Colorado Denver\n//*\u003e \\author NAG Ltd.\n//*\n//*\u003e \\date November 2017\n//*\n//*\u003e \\ingroup complex_blas_level1\n//*\n//*\u003e \\par Further Details:\n//*  =====================\n//*\u003e\n//*\u003e \\verbatim\n//*\u003e\n//*\u003e     jack dongarra, linpack, 3/11/78.\n//*\u003e     modified 12/3/93, array(1) declarations changed to array(*)\n//*\u003e \\endverbatim\n//*\u003e\n//*  =====================================================================\nfunc CAXPY(N *int, CA *complex128, CX *[]complex128, INCX *int, CY *[]complex128, INCY *int) {\n\tI := new(int)\n\tIX := new(int)\n\tIY := new(int)\n\t//*\n\t//*  -- Reference BLAS level1 routine (version 3.8.0) --\n\t//*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --\n\t//*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--\n\t//*     November 2017\n\t//*\n\t//*     .. Scalar Arguments ..\n\t//*     ..\n\t//*     .. Array Arguments ..\n\t//*     ..\n\t//*\n\t//*  =====================================================================\n\t//*\n\t//*     .. Local Scalars ..\n\t//*     ..\n\t//*     .. External Functions ..\n\t//*     ..\n\tif (*(N)) \u003c= 0 {\n\t\treturn\n\t}\n\tif (*SCABS1((CA))) == 0.0e+0 {\n\t\treturn\n\t}\n\tif (*(INCX)) == 1 \u0026\u0026 (*(INCY)) == 1 {\n\t\t//*\n\t\t//*        code for both increments equal to 1\n\t\t//*\n\t\tfor (*I) = 1; (*I) \u003c= (*(N)); (*I)++ {\n\t\t\t(*(CY))[(*I)-(1)] = (*(CY))[(*I)-(1)] + (*(CA))*(*(CX))[(*I)-(1)]\n\t\t}\n\t} else {\n\t\t//*\n\t\t//*        code for unequal increments or equal increments\n\t\t//*          not equal to 1\n\t\t//*\n\t\t(*IX) = 1\n\t\t(*IY) = 1\n\t\tif (*(INCX)) \u003c 0 {\n\t\t\t(*IX) = (-(*(N))+1)*(*(INCX)) + 1\n\t\t}\n\t\tif (*(INCY)) \u003c 0 {\n\t\t\t(*IY) = (-(*(N))+1)*(*(INCY)) + 1\n\t\t}\n\t\tfor (*I) = 1; (*I) \u003c= (*(N)); (*I)++ {\n\t\t\t(*(CY))[(*IY)-(1)] = (*(CY))[(*IY)-(1)] + (*(CA))*(*(CX))[(*IX)-(1)]\n\t\t\t(*IX) = (*IX) + (*(INCX))\n\t\t\t(*IY) = (*IY) + (*(INCY))\n\t\t}\n\t}\n\t//*\n\treturn\n}\n```\n\n\nExample of simplification Go code(comments removed for short view):\n\n```go\npackage main\n\nfunc CAXPY(N int, CA *complex128, CX []complex128, INCX int, CY []complex128, INCY int) {\n\tvar I int\n\tvar IX int\n\tvar IY int\n\n\tif N \u003c= 0 {\n\t\treturn\n\t}\n\tif (*SCABS1((CA))) == 0.0e+0 {\n\t\treturn\n\t}\n\tif INCX == 1 \u0026\u0026 INCY == 1 {\n\n\t\tfor I = 1; I \u003c= N; I++ {\n\t\t\tCY[I-1] = CY[I-1] + CA*CX[I-1]\n\t\t}\n\t} else {\n\n\t\tIX = 1\n\t\tIY = 1\n\t\tif INCX \u003c 0 {\n\t\t\tIX = (-N+1)*INCX + 1\n\t\t}\n\t\tif INCY \u003c 0 {\n\t\t\tIY = (-N+1)*INCY + 1\n\t\t}\n\t\tfor I = 1; I \u003c= N; I++ {\n\t\t\tCY[IY-1] = CY[IY-1] + CA*CX[IX-1]\n\t\t\tIX = IX + INCX\n\t\t\tIY = IY + INCY\n\t\t}\n\t}\n\n\treturn\n}\n```\n\n### Notes\n\nFortran 77 | Golang\n---------- | ------------\nall arguments of function are pointers | ?\nall arguments of intrisic function are pointers | ?\nall internal function variables are pointers | ?\n\n\n**IDENT**:\n* constants\n* arrays, matrixes\n\nOperations:\n* assign\n* initialization\n* boolean\n\n### Fortran test sources\n\n* [**LAPACK from lapack3.8.0**](http://netlib.org/lapack/index.html)\n* [**BOSOR5**](http://shellbuckling.com/BOSOR5.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKonstantin8105%2Ff4go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKonstantin8105%2Ff4go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKonstantin8105%2Ff4go/lists"}