I am writing some code which involves numerical integration of a function on a 3D grid of points. I am defining the type vector to refer to these points, and I am also trying to extend the intrinsic operator * to include scalar and vector multiplication. However, I cannot compile and I don't know how to fix it.(adsbygoogle = window.adsbygoogle || []).push({});

I am having trouble with and without the module, but I think it would be better to make it work as a module. I am not sure how to go about getting this to work, though. This one includes just scalar multiplication:

module modvec

type vector

real, dimension(3) :: x

end type vector

interface operator(*)

module procedure distributive

end interface

contains

function distributive(a,v) result (w)

real, intent(in) :: a

type(vector), intent(in) :: v

type(vector), intent(out) :: w

do i=1,3

w(i) = a*v(i)

enddo

end function distributive

end module modvec

This does not compile in the main or as a module. What am I doing wrong?

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# I am stuck with an f90 module with user-defined operations

Loading...

Similar Threads for stuck module user |
---|

Voice modulator (the Bowtie of Detective Conan) |

Hacking: Legal and Ethical Problems |

**Physics Forums | Science Articles, Homework Help, Discussion**