VecFor is a pure Fortran library for 3D vector algebra: one vector type, written as you write the maths (a + b, 2 * a, a .dot. b, a .cross. b), in single, double or quadruple precision, on whole arrays at once, and inside OpenACC kernels.
- Docs: VecFor (cookbook, geometry guide, GPU guide)
- Source: GitHub - szaghi/VecFor: Vector algebra class for Fortran poor people · GitHub
New in v1.10.0
-
Accurate products:
crossproduct_accurateanddotproduct_accuratestay exact when their terms nearly cancel (FMA-based, Kahan’s algorithm). -
Cell measures:
triangle_area,tetrahedron_volume,polygon_vector_area. -
Point location: barycentric coordinates in a triangle or a tetrahedron, and the closest point of a triangle together with the vertex, edge or face it lies on.
-
Checked normalize:
normalized_checkedreports a degenerate length instead of dividing by zero. -
Every new procedure also has a device-callable
_devform for!$acc routine seqkernels. -
Docs: five new cookbook recipes, a reviewed tutorial, and a new logo.
k = 2._R8P**27 ! a and b nearly parallel a = (k + 1) * ex + k * ey b = k * ex + (k + 1) * ey c = a .cross. b ! c%z = 268435456 (wrong in the last digit) c = crossproduct_accurate(a, b) ! c%z = 268435457 (exact: 2k + 1)
Builds with FoBiS or fpm; tested with gfortran and nvfortran (OpenACC on device).
FOSS licensed.
Feedback welcome!
Stefano


