I am writing a vector type in Fortran and am getting very confused.
Suppose I have the following derived type
Type (Vector)
Real :: x, y
Contains
Procedure :: vector_smul
End Type
Function vector_smul &
( &
va, vb &
) &
Result (c)
Real :: c
Class (Vector), Intent (In) :: va, vb
c = (va%x + vb%x) + (va%y * vb%y)
End Function vector_smul
However when I use
Type (Vectors)
Real :: x, y
Contains
Procedure :: smul => vector_smul
End Type
I get an error when I use
Program Test
Use Vector
Implicit None
Real :: c
Type (Vector) :: va, vb
c = smul (va, vb)
End Program