This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/33197] Fortran 2008: math functions



------- Comment #16 from burnus at gcc dot gnu dot org  2008-03-06 13:50 -------
(In reply to comment #15)
> > - Implementation of NORM2
> There are quite a few other new F2008 intrinsics, including other
> transformational intrinsics, so I think it's better to focus this PR on math
> intrinsics.

I would regard the L2 norm as mathematical
(http://mathworld.wolfram.com/L2-Norm.html)
y = NORM2(x) is for rank one arrays simply:

y = 0
do i=lbound(x,dim=1),ubound(x,dim=1)
   y = y + x(i)**2
enddo
y = sqrt(y).

For a rank-one, size-two array it is the same as hypot(x(1),x(2)). Actually,
using hypot is an optimization one should do for size-2 arrays.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33197


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]