# Fortran自由函数集合
**Repository Path**: ship-motions/fffc
## Basic Information
- **Project Name**: Fortran自由函数集合
- **Description**: Fortran自由函数集合(fortran free function collection)(不含GPL/LGPL代码)
- **Primary Language**: FORTRAN
- **License**: BSD-3-Clause
- **Default Branch**: master
- **Homepage**: https://fffc.netlify.app/
- **GVP Project**: No
## Statistics
- **Stars**: 3
- **Forks**: 0
- **Created**: 2023-03-30
- **Last Updated**: 2023-12-24
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Fortran 自由函数集合


[](LICENSE)
本仓库主要收集一些基础的通用函数,如线性代数求解,便于编程。
## 依赖
* BLAS (GFortran: OpenBLAS)。
## 使用 Meson 构建链接库
```sh
meson setup _build -Dprefix=/mingw64
meson install --destdir 'C:\msys64\' -C _build
meson test -C _build func_api -v # 单元测试
```
理论上,Meson 支持 Windows/macOS/Linux 下的 gfortran, macOS/Linux 下的 ifort。
若需要支持 Windows 下的 ifort, 可搭配 VS2022 进行编译。
## 使用 fpm 构建链接库
```sh
fpm build
```
## 示例
```fortran
program main
use fffc_module
real :: a(2, 2) = reshape([1., 2., 3., 4.], shape(a)), b(2, 2)
b = a
call inv(b)
110 format(f8.3, ", ", f8.3, "; ")
111 format(a, t12, ' =')
print 111, 'inv(a)'
print 110, b(1, :)
print 110, b(2, :)
print 111, 'a * inv(a)'
b = gemm(a, b)
print 110, b(1, :)
print 110, b(2, :)
end program main
!inv(a) =
! -2.000, 1.500;
! 1.000, -0.500;
!a * inv(a) =
! 1.000, 0.000;
! 0.000, 1.000;
```
## 使用 [FORD][7] 构建文档
```sh
ford FORD-doc.md
start build/ford/index.html # Windows 打开网页
```
[7]: https://github.com/Fortran-FOSS-Programmers/ford