Skip to content

VecForVector algebra for Fortran

A pure Fortran 2003+ OOP library for 3D Cartesian vector calculus.

Quick start โ€‹

Import VecFor, define some vectors using the built-in Cartesian versors, and perform vectorial algebra:

fortran
use vecfor
implicit none
type(vector) :: point1, point2, distance

point1 = 1 * ex                  ! ex is the x-direction versor [1, 0, 0]
point2 = 1 * ex + 2 * ey         ! ey is the y-direction versor [0, 1, 0]

distance = point2 - point1       ! [0, 2, 0]

call distance%print              ! Component x  0.000...
                                 ! Component y +2.000...
                                 ! Component z  0.000...
print *, distance%normL2()       ! +2.000...

Authors โ€‹

Contributions are welcome โ€” see the Contributing page.

Copyrights โ€‹

VecFor is distributed under a multi-licensing system:

Use caseLicense
FOSS projectsGPL v3
Closed source / commercialBSD 2-Clause
Closed source / commercialBSD 3-Clause
Closed source / commercialMIT

Anyone interested in using, developing, or contributing to VecFor is welcome โ€” pick the license that best fits your needs.