Defining real and complex variants of an abstract type for vector calculus

I like this and @hkvzjal’s FSPARSE approach: pre-processing is the most productive usage of your code right now. Unfortunately, the current Fortran standard does not allow any smart generics coding with number types, because the class(*) approach is really mainly useful for vertical inheritance, but not as much for horizontal polymorphism (plus, it is resolved at runtime hence slow, if repeated many times). Some including myself have been hoping to see number-centered generics features such as with real(*) or numeric(*) (sounds Fortrannic, does it?) being considered for an upcoming language proposal, but that’s not going to happen anytime soon.

1 Like