James Giles wrote:
...
>>Ok, why not Dot_Prod, this name has 8 characters and it has very clear
>>meaning. In C you can use other names through the command #define, but
>>in fortran it is not so easy, some times you need to use some functions
>>many times and if it is has very long name and also you have to repeat
>>useless information like in the case of Dot_Product(x,x) your code could
>>have a lot of characters that could be avoided.
>Sum(X*X)
If what you ultimately want is sqrt(dot_product(x,x)) or sqrt(sum(x*x)), then
you probably don't want to compute it either of those two ways. The L2
norm can be computed without intermediate underflows, and without intermediate
overflows if the final result doesn't overflow. It's better to get BLAS
routines for single, double and complex L2 norm, and put them together with a
generic interface block. One could argue that an L2 norm intrinsic would
be useful, but it ought not to be spelled in either of the ways above, or
as sqrt(dot_product(x)). The first two trust the optimizer too much, and
the latter has a cryptic spelling that probably would confuse readers who
don't have the standard at hand.
...
>Well, that's why the committee should have selected Ken Kennedy's
>subscript transformation proposal back in 1982 instead of IDENTIFY,
>or the more complex and less flexible POINTER-to-array-slice mechanism
>we have now. Using Kennedy's subscript transformations, you give a name
>to the transformation you're interested in and can then apply that same
>transformation to as many different arrays as you like. So, your example:
> ... Dot_Product(x(n1+n2+n3:n4+n5,n6),x(n1+n2+n3:n4+n5,n6)) ...
>This could perhaps be written as:
> @slice = (n1+n2+n3:n4+n5,n6)
> ... SUM(x@slice*y@slice) ...
...
I noticed that an array slice descriptor is a weird kind of beast for which
Fortran has a constructor, but neither type nor variables of the type.
Proposals I made to create an intrinsic SLICE or SECTION or SEQUENCE type
had to hack their way around the elided lower or upper bound, e.g. "n:"
means "from n to the end of the array." A text substitution wouldn't have
this problem.
>I have a copy of Ken Kennedy's 1982 paper if the members of the
>committee no longer retain the information.
Maybe you could mention it during the next requirements processing phase.
It begins after the current standard is promulgated, which is scheduled
for late (November I think) 2002. If it's electronic, I'd like a copy.
Maybe even if it's only on paper.
Van Snyder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|