Skip to content

Commit 1a5c729

Browse files
committed
fixed external blas with gfortran
updated readme
1 parent 2460718 commit 1a5c729

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ The library also contains routines for computing definite integrals of bsplines.
8484

8585
Note that extrapolation is not currently supported for these.
8686

87+
## Least squares fitting
88+
89+
The BSpline-Fortran library also exports the `defc` subroutine, which can be used to fit B-spline polynomials to 1D data using a weighted least squares method.
90+
8791
## Examples
8892

8993
See the [examples](https://github.com/jacobwilliams/bspline-fortran/tree/master/src/tests) for more details. Note that, to compile and run some of the test programs, the [pyplot_module.f90](https://github.com/jacobwilliams/pyplot-fortran) file (which is used to generate plots) must be copied into the `src/tests` directory.
@@ -160,6 +164,16 @@ For a debug build:
160164
cmake -DCMAKE_BUILD_TYPE=DEBUG ..
161165
```
162166

167+
## Dependencies
168+
169+
The library requires some [BLAS](https://netlib.org/blas/) routines, which are included. However, the user may also choose to link to an external BLAS library. This can be done by using the `HAS_BLAS` compiler directive. For example:
170+
171+
```
172+
fpm build --compiler gfortran --flag "-DHAS_BLAS -lblas"
173+
```
174+
175+
However, note that an external BLAS can only be used if the library is compiled with double precision (`real64`) reals.
176+
163177
## Documentation
164178

165179
The latest API documentation can be found [here](https://jacobwilliams.github.io/bspline-fortran/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford) (i.e. by running `ford bspline-fortran.md`).

src/bspline_blas_module.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
! * [BLAS Sourcecode](https://github.com/Reference-LAPACK/lapack/tree/master/BLAS/SRC)
1717

1818
module bspline_blas_module
19+
1920
#ifndef HAS_BLAS
2021

2122
use bspline_kinds_module, only: wp, ip
2223

2324
implicit none
24-
2525
private
2626

2727
public :: daxpy,dcopy,dscal,dswap,ddot
2828

2929
contains
3030

31-
subroutine daxpy(n, da, dx, incx, dy, incy)
31+
subroutine daxpy(n, da, dx, incx, dy, incy)
3232
!! DAXPY constant times a vector plus a vector.
3333
!! uses unrolled loops for increments equal to one.
3434

src/bspline_defc_module.f90 renamed to src/bspline_defc_module.F90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88
module bspline_defc_module
99

1010
use bspline_kinds_module, only: wp !, ip
11+
#ifndef HAS_BLAS
1112
use bspline_blas_module
13+
#endif
1214

1315
implicit none
1416

1517
private
1618

19+
#ifdef HAS_BLAS
20+
double precision,external :: ddot
21+
external :: daxpy,dcopy,dscal,dswap
22+
#endif
23+
1724
public :: defc
1825

1926
contains

0 commit comments

Comments
 (0)